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.
@@ -3212,16 +3212,18 @@ function createCursorTooltip(deps) {
3212
3212
  const renderBody = () => {
3213
3213
  body.replaceChildren();
3214
3214
  if (typeof currentContent === "string") {
3215
- applyColor(DEFAULT_TOOLTIP_COLOR);
3215
+ applyColor("#a1a1aa");
3216
+ el2.style.opacity = "0.6";
3216
3217
  body.append(document.createTextNode(currentContent));
3217
3218
  return;
3218
3219
  }
3219
3220
  if (!currentContent) return;
3221
+ el2.style.opacity = "1";
3220
3222
  const { entity, node } = currentContent;
3221
3223
  const style = KIND_STYLE[entity.kind];
3222
3224
  const demoted = entity.kind === "primitive";
3223
3225
  applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
3224
- el2.style.opacity = demoted ? "0.55" : "1";
3226
+ if (demoted) el2.style.opacity = "0.55";
3225
3227
  if (style) {
3226
3228
  const svg = createLucideElement(style.icon);
3227
3229
  svg.setAttribute("aria-hidden", "true");
@@ -3329,7 +3331,8 @@ function createInspector(options) {
3329
3331
  resolveAll = (target) => defaultResolveAllMatches(target, registry),
3330
3332
  onHover,
3331
3333
  onSelect,
3332
- onCycle
3334
+ onCycle,
3335
+ onObscured
3333
3336
  } = options;
3334
3337
  let mounted = false;
3335
3338
  let currentEl = null;
@@ -3338,6 +3341,13 @@ function createInspector(options) {
3338
3341
  let layerIndex = 0;
3339
3342
  let lastCursor = { x: 0, y: 0 };
3340
3343
  const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
3344
+ const onDocumentLeave = () => {
3345
+ currentEl = null;
3346
+ stack = [];
3347
+ layerIndex = 0;
3348
+ session.highlight.unhover();
3349
+ onObscured?.(lastCursor);
3350
+ };
3341
3351
  const onMouseMove = (e) => {
3342
3352
  if (!(e.target instanceof Element)) return;
3343
3353
  const matches = resolveAll(e.target);
@@ -3390,6 +3400,7 @@ function createInspector(options) {
3390
3400
  document.head.appendChild(cursorStyleEl);
3391
3401
  }
3392
3402
  document.addEventListener("mousemove", onMouseMove);
3403
+ document.addEventListener("mouseleave", onDocumentLeave);
3393
3404
  document.addEventListener("click", onClick, true);
3394
3405
  document.addEventListener("contextmenu", onContextMenu, true);
3395
3406
  },
@@ -3404,6 +3415,7 @@ function createInspector(options) {
3404
3415
  cursorStyleEl = null;
3405
3416
  }
3406
3417
  document.removeEventListener("mousemove", onMouseMove);
3418
+ document.removeEventListener("mouseleave", onDocumentLeave);
3407
3419
  document.removeEventListener("click", onClick, true);
3408
3420
  document.removeEventListener("contextmenu", onContextMenu, true);
3409
3421
  session.highlight.unhover();
@@ -4189,6 +4201,10 @@ function createSurfaceShell(options) {
4189
4201
  },
4190
4202
  onCycle: (stack, cursor) => {
4191
4203
  showStack(stack, cursor);
4204
+ },
4205
+ onObscured: (cursor) => {
4206
+ overlay.hide();
4207
+ tooltip.update("iframe", cursor);
4192
4208
  }
4193
4209
  });
4194
4210
  cleanup.add(inspector);