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.
@@ -3229,16 +3229,18 @@ function createCursorTooltip(deps) {
3229
3229
  const renderBody = () => {
3230
3230
  body.replaceChildren();
3231
3231
  if (typeof currentContent === "string") {
3232
- applyColor(DEFAULT_TOOLTIP_COLOR);
3232
+ applyColor("#a1a1aa");
3233
+ el2.style.opacity = "0.6";
3233
3234
  body.append(document.createTextNode(currentContent));
3234
3235
  return;
3235
3236
  }
3236
3237
  if (!currentContent) return;
3238
+ el2.style.opacity = "1";
3237
3239
  const { entity, node } = currentContent;
3238
3240
  const style = KIND_STYLE[entity.kind];
3239
3241
  const demoted = entity.kind === "primitive";
3240
3242
  applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
3241
- el2.style.opacity = demoted ? "0.55" : "1";
3243
+ if (demoted) el2.style.opacity = "0.55";
3242
3244
  if (style) {
3243
3245
  const svg = (0, import_lucide2.createElement)(style.icon);
3244
3246
  svg.setAttribute("aria-hidden", "true");
@@ -3346,7 +3348,8 @@ function createInspector(options) {
3346
3348
  resolveAll = (target) => defaultResolveAllMatches(target, registry),
3347
3349
  onHover,
3348
3350
  onSelect,
3349
- onCycle
3351
+ onCycle,
3352
+ onObscured
3350
3353
  } = options;
3351
3354
  let mounted = false;
3352
3355
  let currentEl = null;
@@ -3355,6 +3358,13 @@ function createInspector(options) {
3355
3358
  let layerIndex = 0;
3356
3359
  let lastCursor = { x: 0, y: 0 };
3357
3360
  const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
3361
+ const onDocumentLeave = () => {
3362
+ currentEl = null;
3363
+ stack = [];
3364
+ layerIndex = 0;
3365
+ session.highlight.unhover();
3366
+ onObscured?.(lastCursor);
3367
+ };
3358
3368
  const onMouseMove = (e) => {
3359
3369
  if (!(e.target instanceof Element)) return;
3360
3370
  const matches = resolveAll(e.target);
@@ -3407,6 +3417,7 @@ function createInspector(options) {
3407
3417
  document.head.appendChild(cursorStyleEl);
3408
3418
  }
3409
3419
  document.addEventListener("mousemove", onMouseMove);
3420
+ document.addEventListener("mouseleave", onDocumentLeave);
3410
3421
  document.addEventListener("click", onClick, true);
3411
3422
  document.addEventListener("contextmenu", onContextMenu, true);
3412
3423
  },
@@ -3421,6 +3432,7 @@ function createInspector(options) {
3421
3432
  cursorStyleEl = null;
3422
3433
  }
3423
3434
  document.removeEventListener("mousemove", onMouseMove);
3435
+ document.removeEventListener("mouseleave", onDocumentLeave);
3424
3436
  document.removeEventListener("click", onClick, true);
3425
3437
  document.removeEventListener("contextmenu", onContextMenu, true);
3426
3438
  session.highlight.unhover();
@@ -4197,6 +4209,10 @@ function createSurfaceShell(options) {
4197
4209
  },
4198
4210
  onCycle: (stack, cursor) => {
4199
4211
  showStack(stack, cursor);
4212
+ },
4213
+ onObscured: (cursor) => {
4214
+ overlay.hide();
4215
+ tooltip.update("iframe", cursor);
4200
4216
  }
4201
4217
  });
4202
4218
  cleanup.add(inspector);