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/headless/index.cjs +19 -3
- package/dist/headless/index.cjs.map +1 -1
- package/dist/headless/index.js +19 -3
- package/dist/headless/index.js.map +1 -1
- package/dist/index.cjs +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +19 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +19 -3
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -434,6 +434,11 @@ interface InspectorOptions {
|
|
|
434
434
|
x: number;
|
|
435
435
|
y: number;
|
|
436
436
|
}) => void;
|
|
437
|
+
/** Fired when the cursor enters an iframe or otherwise leaves the inspectable document. */
|
|
438
|
+
onObscured?: (cursor: {
|
|
439
|
+
x: number;
|
|
440
|
+
y: number;
|
|
441
|
+
}) => void;
|
|
437
442
|
}
|
|
438
443
|
interface Inspector {
|
|
439
444
|
mount(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -434,6 +434,11 @@ interface InspectorOptions {
|
|
|
434
434
|
x: number;
|
|
435
435
|
y: number;
|
|
436
436
|
}) => void;
|
|
437
|
+
/** Fired when the cursor enters an iframe or otherwise leaves the inspectable document. */
|
|
438
|
+
onObscured?: (cursor: {
|
|
439
|
+
x: number;
|
|
440
|
+
y: number;
|
|
441
|
+
}) => void;
|
|
437
442
|
}
|
|
438
443
|
interface Inspector {
|
|
439
444
|
mount(): void;
|
package/dist/index.js
CHANGED
|
@@ -3484,16 +3484,18 @@ function createCursorTooltip(deps) {
|
|
|
3484
3484
|
const renderBody = () => {
|
|
3485
3485
|
body.replaceChildren();
|
|
3486
3486
|
if (typeof currentContent === "string") {
|
|
3487
|
-
applyColor(
|
|
3487
|
+
applyColor("#a1a1aa");
|
|
3488
|
+
el2.style.opacity = "0.6";
|
|
3488
3489
|
body.append(document.createTextNode(currentContent));
|
|
3489
3490
|
return;
|
|
3490
3491
|
}
|
|
3491
3492
|
if (!currentContent) return;
|
|
3493
|
+
el2.style.opacity = "1";
|
|
3492
3494
|
const { entity, node } = currentContent;
|
|
3493
3495
|
const style = KIND_STYLE[entity.kind];
|
|
3494
3496
|
const demoted = entity.kind === "primitive";
|
|
3495
3497
|
applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
|
|
3496
|
-
el2.style.opacity =
|
|
3498
|
+
if (demoted) el2.style.opacity = "0.55";
|
|
3497
3499
|
if (style) {
|
|
3498
3500
|
const svg2 = createLucideElement(style.icon);
|
|
3499
3501
|
svg2.setAttribute("aria-hidden", "true");
|
|
@@ -3654,7 +3656,8 @@ function createInspector(options) {
|
|
|
3654
3656
|
resolveAll = (target) => defaultResolveAllMatches(target, registry),
|
|
3655
3657
|
onHover,
|
|
3656
3658
|
onSelect,
|
|
3657
|
-
onCycle
|
|
3659
|
+
onCycle,
|
|
3660
|
+
onObscured
|
|
3658
3661
|
} = options;
|
|
3659
3662
|
let mounted = false;
|
|
3660
3663
|
let currentEl = null;
|
|
@@ -3663,6 +3666,13 @@ function createInspector(options) {
|
|
|
3663
3666
|
let layerIndex = 0;
|
|
3664
3667
|
let lastCursor = { x: 0, y: 0 };
|
|
3665
3668
|
const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
|
|
3669
|
+
const onDocumentLeave = () => {
|
|
3670
|
+
currentEl = null;
|
|
3671
|
+
stack = [];
|
|
3672
|
+
layerIndex = 0;
|
|
3673
|
+
session.highlight.unhover();
|
|
3674
|
+
onObscured?.(lastCursor);
|
|
3675
|
+
};
|
|
3666
3676
|
const onMouseMove = (e) => {
|
|
3667
3677
|
if (!(e.target instanceof Element)) return;
|
|
3668
3678
|
const matches = resolveAll(e.target);
|
|
@@ -3715,6 +3725,7 @@ function createInspector(options) {
|
|
|
3715
3725
|
document.head.appendChild(cursorStyleEl);
|
|
3716
3726
|
}
|
|
3717
3727
|
document.addEventListener("mousemove", onMouseMove);
|
|
3728
|
+
document.addEventListener("mouseleave", onDocumentLeave);
|
|
3718
3729
|
document.addEventListener("click", onClick, true);
|
|
3719
3730
|
document.addEventListener("contextmenu", onContextMenu, true);
|
|
3720
3731
|
},
|
|
@@ -3729,6 +3740,7 @@ function createInspector(options) {
|
|
|
3729
3740
|
cursorStyleEl = null;
|
|
3730
3741
|
}
|
|
3731
3742
|
document.removeEventListener("mousemove", onMouseMove);
|
|
3743
|
+
document.removeEventListener("mouseleave", onDocumentLeave);
|
|
3732
3744
|
document.removeEventListener("click", onClick, true);
|
|
3733
3745
|
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
3734
3746
|
session.highlight.unhover();
|
|
@@ -4636,6 +4648,10 @@ function createSurfaceShell(options) {
|
|
|
4636
4648
|
},
|
|
4637
4649
|
onCycle: (stack, cursor) => {
|
|
4638
4650
|
showStack(stack, cursor);
|
|
4651
|
+
},
|
|
4652
|
+
onObscured: (cursor) => {
|
|
4653
|
+
overlay.hide();
|
|
4654
|
+
tooltip.update("iframe", cursor);
|
|
4639
4655
|
}
|
|
4640
4656
|
});
|
|
4641
4657
|
cleanup.add(inspector);
|