@antone-io/render-picker 0.3.2 → 0.3.3
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/README.md +38 -14
- package/dist/{chunk-WUA7VWEU.js → chunk-FM3HLV7V.js} +2 -2
- package/dist/{chunk-ZZUJJL22.js → chunk-RT6TNNKG.js} +2593 -1772
- package/dist/chunk-RT6TNNKG.js.map +1 -0
- package/dist/{chunk-2N6FOIM5.js → chunk-XUPSSH7J.js} +156 -67
- package/dist/chunk-XUPSSH7J.js.map +1 -0
- package/dist/client.cjs +58 -56
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +2 -2
- package/dist/index.cjs +2323 -1516
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/react.cjs +2470 -1665
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +2 -2
- package/package.json +3 -1
- package/dist/chunk-2N6FOIM5.js.map +0 -1
- package/dist/chunk-ZZUJJL22.js.map +0 -1
- /package/dist/{chunk-WUA7VWEU.js.map → chunk-FM3HLV7V.js.map} +0 -0
package/dist/client.cjs
CHANGED
|
@@ -311,6 +311,51 @@ var PICKER_ARMED = {
|
|
|
311
311
|
var hasPointer = typeof window !== "undefined" && "PointerEvent" in window;
|
|
312
312
|
var DOWN_TYPE = hasPointer ? "pointerdown" : "mousedown";
|
|
313
313
|
|
|
314
|
+
// src/core/inspector/hit-test.ts
|
|
315
|
+
function shouldIgnore(el) {
|
|
316
|
+
return !!el?.closest?.(`[${IGNORE_ATTR}]`);
|
|
317
|
+
}
|
|
318
|
+
function containsPoint(el, x, y) {
|
|
319
|
+
const rects = el.getClientRects?.();
|
|
320
|
+
const list = rects && rects.length ? Array.from(rects) : [el.getBoundingClientRect()];
|
|
321
|
+
return list.some(
|
|
322
|
+
(r) => r.width > 0 && r.height > 0 && x >= r.left && x <= r.right && y >= r.top && y <= r.bottom
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
function skippedChildAt(el, x, y) {
|
|
326
|
+
const children = Array.from(el.children);
|
|
327
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
328
|
+
const child = children[i];
|
|
329
|
+
if (shouldIgnore(child)) continue;
|
|
330
|
+
if (!containsPoint(child, x, y)) continue;
|
|
331
|
+
const cs = getComputedStyle(child);
|
|
332
|
+
if (cs.pointerEvents !== "none") continue;
|
|
333
|
+
if (cs.visibility === "hidden" || cs.opacity === "0") continue;
|
|
334
|
+
return child;
|
|
335
|
+
}
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
function isDisabled(el) {
|
|
339
|
+
try {
|
|
340
|
+
return el.matches(':disabled,[disabled],[aria-disabled="true"]');
|
|
341
|
+
} catch {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function resolveTarget(x, y) {
|
|
346
|
+
if (typeof document.elementFromPoint !== "function") return null;
|
|
347
|
+
const hit = document.elementFromPoint(x, y);
|
|
348
|
+
if (!hit || shouldIgnore(hit)) return null;
|
|
349
|
+
let current = hit;
|
|
350
|
+
for (let i = 0; i < MAX_DESCEND; i++) {
|
|
351
|
+
if (isDisabled(current)) break;
|
|
352
|
+
const child = skippedChildAt(current, x, y);
|
|
353
|
+
if (!child) break;
|
|
354
|
+
current = child;
|
|
355
|
+
}
|
|
356
|
+
return current;
|
|
357
|
+
}
|
|
358
|
+
|
|
314
359
|
// src/core/dev/editors.ts
|
|
315
360
|
var EDITORS = [
|
|
316
361
|
{ id: "vscode", label: "VS Code", scheme: "vscode", family: "vscode" },
|
|
@@ -628,8 +673,9 @@ function initClickToSource(root, getCommands = () => loadSettings().commands, us
|
|
|
628
673
|
return null;
|
|
629
674
|
}
|
|
630
675
|
function open(e, action) {
|
|
631
|
-
const
|
|
632
|
-
const
|
|
676
|
+
const hit = PICKER_ARMED.value ? resolveTarget(e.clientX, e.clientY) : null;
|
|
677
|
+
const target = hit ?? e.target;
|
|
678
|
+
const el = target?.closest?.("[data-source]");
|
|
633
679
|
if (!el) return;
|
|
634
680
|
openEl(el, action);
|
|
635
681
|
e.preventDefault();
|
|
@@ -686,6 +732,7 @@ function initClickToSource(root, getCommands = () => loadSettings().commands, us
|
|
|
686
732
|
window.removeEventListener(type, swallow, { capture: true });
|
|
687
733
|
}
|
|
688
734
|
if (suppressTimer) clearTimeout(suppressTimer);
|
|
735
|
+
if (vscodeOpenRef === openEl) vscodeOpenRef = null;
|
|
689
736
|
};
|
|
690
737
|
}
|
|
691
738
|
|
|
@@ -1523,56 +1570,13 @@ function createKeyCommandMatcher() {
|
|
|
1523
1570
|
// src/core/inspector/constants/picker.ts
|
|
1524
1571
|
var ACCENT = "#3b82f6";
|
|
1525
1572
|
var OVERLAY_Z = 2147482e3;
|
|
1573
|
+
var HIGHLIGHT_Z = OVERLAY_Z - 1;
|
|
1526
1574
|
var SELECTED_BG = "rgba(59,130,246,0.24)";
|
|
1527
1575
|
var HIGHLIGHT_BORDER = `2px solid ${ACCENT}`;
|
|
1528
1576
|
var OVERLAY_RADIUS = "3px";
|
|
1529
1577
|
var OVERLAY_GLIDE = "top .2s cubic-bezier(.25,.1,.25,1), left .2s cubic-bezier(.25,.1,.25,1), width .2s cubic-bezier(.25,.1,.25,1), height .2s cubic-bezier(.25,.1,.25,1), opacity .12s ease-out";
|
|
1530
1578
|
var PICKING_CSS = ':disabled,[disabled],[aria-disabled="true"]{pointer-events:none!important}';
|
|
1531
1579
|
|
|
1532
|
-
// src/core/inspector/hit-test.ts
|
|
1533
|
-
function shouldIgnore(el) {
|
|
1534
|
-
return !!el?.closest?.(`[${IGNORE_ATTR}]`);
|
|
1535
|
-
}
|
|
1536
|
-
function containsPoint(el, x, y) {
|
|
1537
|
-
const rects = el.getClientRects?.();
|
|
1538
|
-
const list = rects && rects.length ? Array.from(rects) : [el.getBoundingClientRect()];
|
|
1539
|
-
return list.some(
|
|
1540
|
-
(r) => r.width > 0 && r.height > 0 && x >= r.left && x <= r.right && y >= r.top && y <= r.bottom
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
function skippedChildAt(el, x, y) {
|
|
1544
|
-
const children = Array.from(el.children);
|
|
1545
|
-
for (let i = children.length - 1; i >= 0; i--) {
|
|
1546
|
-
const child = children[i];
|
|
1547
|
-
if (shouldIgnore(child)) continue;
|
|
1548
|
-
if (!containsPoint(child, x, y)) continue;
|
|
1549
|
-
const cs = getComputedStyle(child);
|
|
1550
|
-
if (cs.pointerEvents !== "none") continue;
|
|
1551
|
-
if (cs.visibility === "hidden" || cs.opacity === "0") continue;
|
|
1552
|
-
return child;
|
|
1553
|
-
}
|
|
1554
|
-
return null;
|
|
1555
|
-
}
|
|
1556
|
-
function isDisabled(el) {
|
|
1557
|
-
try {
|
|
1558
|
-
return el.matches(':disabled,[disabled],[aria-disabled="true"]');
|
|
1559
|
-
} catch {
|
|
1560
|
-
return false;
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
function resolveTarget(x, y) {
|
|
1564
|
-
const hit = document.elementFromPoint(x, y);
|
|
1565
|
-
if (!hit || shouldIgnore(hit)) return null;
|
|
1566
|
-
let current = hit;
|
|
1567
|
-
for (let i = 0; i < MAX_DESCEND; i++) {
|
|
1568
|
-
if (isDisabled(current)) break;
|
|
1569
|
-
const child = skippedChildAt(current, x, y);
|
|
1570
|
-
if (!child) break;
|
|
1571
|
-
current = child;
|
|
1572
|
-
}
|
|
1573
|
-
return current;
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
1580
|
// src/core/inspector/constants/theme.ts
|
|
1577
1581
|
var SOLID_BG = "#18181b";
|
|
1578
1582
|
var TOOLTIP_SHADOW = "inset 0 1px 0 rgba(255,255,255,0.12), inset 0 0 0 1px rgba(255,255,255,0.08), 0 6px 20px rgba(0,0,0,0.45)";
|
|
@@ -1580,6 +1584,7 @@ var PANEL_BORDER = "1px solid rgba(255,255,255,0.1)";
|
|
|
1580
1584
|
var SECONDARY_SURFACE = "linear-gradient(rgba(255,255,255,0.04), rgba(255,255,255,0.04)), #18181b";
|
|
1581
1585
|
var SECONDARY_BORDER = "1px solid rgba(255,255,255,0.08)";
|
|
1582
1586
|
var BTN_SHADOW = "0px -1px 0px 0px rgba(255,255,255,.06), 0px 0px 0px 1px rgba(255,255,255,.06), 0px 0px 0px 1px rgba(39,39,42,1), 0px 0px 1px 1.5px rgba(0,0,0,.24), 0px 2px 2px 0px rgba(0,0,0,.24)";
|
|
1587
|
+
var FOCUS_RING = `0 0 0 1px ${SOLID_BG}, 0 0 0 3px rgba(96,165,250,0.8)`;
|
|
1583
1588
|
|
|
1584
1589
|
// src/core/inspector/surfaces/dom.ts
|
|
1585
1590
|
function assign(el, style) {
|
|
@@ -2010,7 +2015,10 @@ var Inspector = class {
|
|
|
2010
2015
|
this.moveFrame = 0;
|
|
2011
2016
|
/** Dernière position mousemove reçue, traitée une fois par frame. */
|
|
2012
2017
|
this.pendingMove = null;
|
|
2013
|
-
/**
|
|
2018
|
+
/**
|
|
2019
|
+
* Mode recherche actif : le survol continue (il montre ce que le clic visera), mais les
|
|
2020
|
+
* gestes de picking passent la main à la recherche (`core/search/page-click.ts`).
|
|
2021
|
+
*/
|
|
2014
2022
|
this.searchMode = false;
|
|
2015
2023
|
/** Matcher de la commande clavier « inspect » (modificateur + touche, simple/double-tap). */
|
|
2016
2024
|
this.inspectMatcher = createKeyCommandMatcher();
|
|
@@ -2093,7 +2101,7 @@ var Inspector = class {
|
|
|
2093
2101
|
this.finishMulti();
|
|
2094
2102
|
return;
|
|
2095
2103
|
}
|
|
2096
|
-
if (keyMatches(cmds.cancel, e.key)) {
|
|
2104
|
+
if (keyMatches(cmds.cancel, e.key) && !CONTEXT_MENU_OPEN.value) {
|
|
2097
2105
|
e.preventDefault();
|
|
2098
2106
|
e.stopPropagation();
|
|
2099
2107
|
this.deactivate();
|
|
@@ -2305,20 +2313,14 @@ var Inspector = class {
|
|
|
2305
2313
|
setTimeout(cleanup, SWALLOW_MS);
|
|
2306
2314
|
}
|
|
2307
2315
|
// --- Handlers (arrow = identité stable pour add/remove) -------------------
|
|
2308
|
-
/** Active/désactive le mode recherche :
|
|
2316
|
+
/** Active/désactive le mode recherche : survol inchangé, picking désactivé. */
|
|
2309
2317
|
setSearchMode(on) {
|
|
2310
2318
|
this.searchMode = on;
|
|
2311
|
-
if (on) this.hideHover();
|
|
2312
2319
|
}
|
|
2313
2320
|
processMouseMove() {
|
|
2314
2321
|
const pending = this.pendingMove;
|
|
2315
2322
|
if (!pending) return;
|
|
2316
2323
|
const { x, y } = pending;
|
|
2317
|
-
if (this.searchMode) {
|
|
2318
|
-
this.lastTarget = null;
|
|
2319
|
-
this.hideHover();
|
|
2320
|
-
return;
|
|
2321
|
-
}
|
|
2322
2324
|
if (CONTEXT_MENU_OPEN.value) return;
|
|
2323
2325
|
const target = this.lastTarget && this.lastTarget.isConnected && document.elementFromPoint(x, y) === this.lastTarget ? this.lastTarget : resolveTarget(x, y);
|
|
2324
2326
|
if (!target || shouldIgnore(target)) {
|
|
@@ -2365,7 +2367,7 @@ var Inspector = class {
|
|
|
2365
2367
|
}
|
|
2366
2368
|
/** Repositionne instantanément (sans glisse) le survol sur `lastTarget`. */
|
|
2367
2369
|
refreshHover() {
|
|
2368
|
-
if (!this.active || !this.hovering ||
|
|
2370
|
+
if (!this.active || !this.hovering || !this.lastTarget) return;
|
|
2369
2371
|
if (!this.lastTarget.isConnected) {
|
|
2370
2372
|
this.lastTarget = null;
|
|
2371
2373
|
this.hideHover();
|