@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/index.cjs
CHANGED
|
@@ -278,10 +278,6 @@ function clearLogs() {
|
|
|
278
278
|
logs.length = 0;
|
|
279
279
|
emit();
|
|
280
280
|
}
|
|
281
|
-
function clearRequests() {
|
|
282
|
-
requests.length = 0;
|
|
283
|
-
emit();
|
|
284
|
-
}
|
|
285
281
|
function subscribe(fn) {
|
|
286
282
|
listeners.add(fn);
|
|
287
283
|
return () => listeners.delete(fn);
|
|
@@ -331,6 +327,58 @@ var PICKER_ARMED = {
|
|
|
331
327
|
};
|
|
332
328
|
var hasPointer = typeof window !== "undefined" && "PointerEvent" in window;
|
|
333
329
|
var DOWN_TYPE = hasPointer ? "pointerdown" : "mousedown";
|
|
330
|
+
var MOVE_THRESHOLD_PX = 4;
|
|
331
|
+
var MOVE_VIEWPORT_MARGIN = 4;
|
|
332
|
+
var MOVE_HOME_TOLERANCE = 12;
|
|
333
|
+
var MOVE_HOME_OVERLAP = 0.6;
|
|
334
|
+
var MOVE_RETURN_MS = 250;
|
|
335
|
+
var MOVE_STORAGE_PREFIX = "renderPicker.pos.";
|
|
336
|
+
var CONTROL_TRANSITION_MS = 150;
|
|
337
|
+
|
|
338
|
+
// src/core/inspector/hit-test.ts
|
|
339
|
+
function shouldIgnore(el) {
|
|
340
|
+
return !!el?.closest?.(`[${IGNORE_ATTR}]`);
|
|
341
|
+
}
|
|
342
|
+
function containsPoint(el, x, y) {
|
|
343
|
+
const rects = el.getClientRects?.();
|
|
344
|
+
const list = rects && rects.length ? Array.from(rects) : [el.getBoundingClientRect()];
|
|
345
|
+
return list.some(
|
|
346
|
+
(r) => r.width > 0 && r.height > 0 && x >= r.left && x <= r.right && y >= r.top && y <= r.bottom
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function skippedChildAt(el, x, y) {
|
|
350
|
+
const children = Array.from(el.children);
|
|
351
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
352
|
+
const child = children[i];
|
|
353
|
+
if (shouldIgnore(child)) continue;
|
|
354
|
+
if (!containsPoint(child, x, y)) continue;
|
|
355
|
+
const cs = getComputedStyle(child);
|
|
356
|
+
if (cs.pointerEvents !== "none") continue;
|
|
357
|
+
if (cs.visibility === "hidden" || cs.opacity === "0") continue;
|
|
358
|
+
return child;
|
|
359
|
+
}
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
function isDisabled(el) {
|
|
363
|
+
try {
|
|
364
|
+
return el.matches(':disabled,[disabled],[aria-disabled="true"]');
|
|
365
|
+
} catch {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function resolveTarget(x, y) {
|
|
370
|
+
if (typeof document.elementFromPoint !== "function") return null;
|
|
371
|
+
const hit = document.elementFromPoint(x, y);
|
|
372
|
+
if (!hit || shouldIgnore(hit)) return null;
|
|
373
|
+
let current2 = hit;
|
|
374
|
+
for (let i = 0; i < MAX_DESCEND; i++) {
|
|
375
|
+
if (isDisabled(current2)) break;
|
|
376
|
+
const child = skippedChildAt(current2, x, y);
|
|
377
|
+
if (!child) break;
|
|
378
|
+
current2 = child;
|
|
379
|
+
}
|
|
380
|
+
return current2;
|
|
381
|
+
}
|
|
334
382
|
|
|
335
383
|
// src/core/dev/editors.ts
|
|
336
384
|
var EDITORS = [
|
|
@@ -628,6 +676,9 @@ function vscodeActionFor(e, kind = "click") {
|
|
|
628
676
|
if (source.trigger === kind && modifierMatches(source.modifier, e)) return "source";
|
|
629
677
|
return null;
|
|
630
678
|
}
|
|
679
|
+
function canOpenInEditor() {
|
|
680
|
+
return vscodeOpenRef !== null;
|
|
681
|
+
}
|
|
631
682
|
function vscodeOpenFor(el, action) {
|
|
632
683
|
if (!vscodeOpenRef) return false;
|
|
633
684
|
vscodeOpenRef(el, action);
|
|
@@ -660,8 +711,9 @@ function initClickToSource(root, getCommands = () => loadSettings().commands, us
|
|
|
660
711
|
return null;
|
|
661
712
|
}
|
|
662
713
|
function open(e, action) {
|
|
663
|
-
const
|
|
664
|
-
const
|
|
714
|
+
const hit = PICKER_ARMED.value ? resolveTarget(e.clientX, e.clientY) : null;
|
|
715
|
+
const target = hit ?? e.target;
|
|
716
|
+
const el = target?.closest?.("[data-source]");
|
|
665
717
|
if (!el) return;
|
|
666
718
|
openEl(el, action);
|
|
667
719
|
e.preventDefault();
|
|
@@ -718,6 +770,7 @@ function initClickToSource(root, getCommands = () => loadSettings().commands, us
|
|
|
718
770
|
window.removeEventListener(type, swallow, { capture: true });
|
|
719
771
|
}
|
|
720
772
|
if (suppressTimer) clearTimeout(suppressTimer);
|
|
773
|
+
if (vscodeOpenRef === openEl) vscodeOpenRef = null;
|
|
721
774
|
};
|
|
722
775
|
}
|
|
723
776
|
|
|
@@ -1461,9 +1514,9 @@ function printNode(node, depth, indent) {
|
|
|
1461
1514
|
}
|
|
1462
1515
|
function formatHtml(html, indent = " ") {
|
|
1463
1516
|
if (typeof document === "undefined") return html;
|
|
1464
|
-
const container = document.createElement("
|
|
1517
|
+
const container = document.createElement("template");
|
|
1465
1518
|
container.innerHTML = html.trim();
|
|
1466
|
-
return Array.from(container.childNodes).map((n) => printNode(n, 0, indent)).filter(Boolean).join("\n");
|
|
1519
|
+
return Array.from(container.content.childNodes).map((n) => printNode(n, 0, indent)).filter(Boolean).join("\n");
|
|
1467
1520
|
}
|
|
1468
1521
|
function formatResults(results) {
|
|
1469
1522
|
if (results.length <= 1) {
|
|
@@ -1598,6 +1651,20 @@ function groupResults(elements, prefix = "") {
|
|
|
1598
1651
|
});
|
|
1599
1652
|
return Array.from(byKey.values()).sort((a, b) => a.cls.length - b.cls.length);
|
|
1600
1653
|
}
|
|
1654
|
+
function wrapIndex(i, n) {
|
|
1655
|
+
return n > 0 ? (i % n + n) % n : 0;
|
|
1656
|
+
}
|
|
1657
|
+
function searchCounter(query, group, member) {
|
|
1658
|
+
if (query.trim() === "") return "";
|
|
1659
|
+
if (!group || group.count === 0) return "0";
|
|
1660
|
+
return `${wrapIndex(member, group.count) + 1}/${group.count}`;
|
|
1661
|
+
}
|
|
1662
|
+
function classQueryOf(el) {
|
|
1663
|
+
const raw = el.getAttribute("class");
|
|
1664
|
+
const tokens = raw && raw.trim() ? raw.trim().split(/\s+/) : [];
|
|
1665
|
+
if (tokens.length === 0) return el.tagName.toLowerCase();
|
|
1666
|
+
return tokens.map((t) => `.${escapeClassToken(t)}`).join("");
|
|
1667
|
+
}
|
|
1601
1668
|
|
|
1602
1669
|
// src/core/source/enrich.ts
|
|
1603
1670
|
function findPickedElement(result, doc = document) {
|
|
@@ -1706,6 +1773,7 @@ function createKeyCommandMatcher() {
|
|
|
1706
1773
|
// src/core/inspector/constants/picker.ts
|
|
1707
1774
|
var ACCENT = "#3b82f6";
|
|
1708
1775
|
var OVERLAY_Z = 2147482e3;
|
|
1776
|
+
var HIGHLIGHT_Z = OVERLAY_Z - 1;
|
|
1709
1777
|
var UI_Z = 2147483e3;
|
|
1710
1778
|
var HIGHLIGHT_BG = "rgba(59,130,246,0.15)";
|
|
1711
1779
|
var SELECTED_BG = "rgba(59,130,246,0.24)";
|
|
@@ -1714,50 +1782,6 @@ var OVERLAY_RADIUS = "3px";
|
|
|
1714
1782
|
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";
|
|
1715
1783
|
var PICKING_CSS = ':disabled,[disabled],[aria-disabled="true"]{pointer-events:none!important}';
|
|
1716
1784
|
|
|
1717
|
-
// src/core/inspector/hit-test.ts
|
|
1718
|
-
function shouldIgnore(el) {
|
|
1719
|
-
return !!el?.closest?.(`[${IGNORE_ATTR}]`);
|
|
1720
|
-
}
|
|
1721
|
-
function containsPoint(el, x, y) {
|
|
1722
|
-
const rects = el.getClientRects?.();
|
|
1723
|
-
const list = rects && rects.length ? Array.from(rects) : [el.getBoundingClientRect()];
|
|
1724
|
-
return list.some(
|
|
1725
|
-
(r) => r.width > 0 && r.height > 0 && x >= r.left && x <= r.right && y >= r.top && y <= r.bottom
|
|
1726
|
-
);
|
|
1727
|
-
}
|
|
1728
|
-
function skippedChildAt(el, x, y) {
|
|
1729
|
-
const children = Array.from(el.children);
|
|
1730
|
-
for (let i = children.length - 1; i >= 0; i--) {
|
|
1731
|
-
const child = children[i];
|
|
1732
|
-
if (shouldIgnore(child)) continue;
|
|
1733
|
-
if (!containsPoint(child, x, y)) continue;
|
|
1734
|
-
const cs = getComputedStyle(child);
|
|
1735
|
-
if (cs.pointerEvents !== "none") continue;
|
|
1736
|
-
if (cs.visibility === "hidden" || cs.opacity === "0") continue;
|
|
1737
|
-
return child;
|
|
1738
|
-
}
|
|
1739
|
-
return null;
|
|
1740
|
-
}
|
|
1741
|
-
function isDisabled(el) {
|
|
1742
|
-
try {
|
|
1743
|
-
return el.matches(':disabled,[disabled],[aria-disabled="true"]');
|
|
1744
|
-
} catch {
|
|
1745
|
-
return false;
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
function resolveTarget(x, y) {
|
|
1749
|
-
const hit = document.elementFromPoint(x, y);
|
|
1750
|
-
if (!hit || shouldIgnore(hit)) return null;
|
|
1751
|
-
let current2 = hit;
|
|
1752
|
-
for (let i = 0; i < MAX_DESCEND; i++) {
|
|
1753
|
-
if (isDisabled(current2)) break;
|
|
1754
|
-
const child = skippedChildAt(current2, x, y);
|
|
1755
|
-
if (!child) break;
|
|
1756
|
-
current2 = child;
|
|
1757
|
-
}
|
|
1758
|
-
return current2;
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
1785
|
// src/core/inspector/constants/theme.ts
|
|
1762
1786
|
var SOLID_BG = "#18181b";
|
|
1763
1787
|
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)";
|
|
@@ -1766,11 +1790,23 @@ var ELEVATED_BG = "#272729";
|
|
|
1766
1790
|
var HOVER_BG = "#2e2e31";
|
|
1767
1791
|
var MUTED = "#c4c4c8";
|
|
1768
1792
|
var PRIMARY = "#60a5fa";
|
|
1769
|
-
var SECONDARY_BG_HOVER = "rgba(255,255,255,0.08)";
|
|
1770
1793
|
var SECONDARY_SURFACE = "linear-gradient(rgba(255,255,255,0.04), rgba(255,255,255,0.04)), #18181b";
|
|
1771
1794
|
var SECONDARY_BORDER = "1px solid rgba(255,255,255,0.08)";
|
|
1772
1795
|
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)";
|
|
1773
1796
|
var CARD_SHADOW = "0px 0px 0px 1px rgba(0,0,0,.08), 0px 1px 2px -1px rgba(0,0,0,.08), 0px 2px 4px 0px rgba(0,0,0,.04)";
|
|
1797
|
+
var CONTROL_BORDER = "1px solid #3a3a3d";
|
|
1798
|
+
var CONTROL_DIVIDER = "rgba(255,255,255,0.08)";
|
|
1799
|
+
var SUBTLE_FG = "#a1a1aa";
|
|
1800
|
+
var SUBTLE_FG_HOVER = "#ffffff";
|
|
1801
|
+
var FOCUS_RING = `0 0 0 1px ${SOLID_BG}, 0 0 0 3px rgba(96,165,250,0.8)`;
|
|
1802
|
+
var MOVE_HOME_BORDER = "1px dashed rgba(43,127,255,0.3)";
|
|
1803
|
+
var MOVE_HOME_BORDER_OVER = "1px dashed rgba(43,127,255,0.5)";
|
|
1804
|
+
var MOVE_HOME_BG = "rgba(59,130,246,0.1)";
|
|
1805
|
+
var MOVE_HOME_BG_OVER = "rgba(59,130,246,0.2)";
|
|
1806
|
+
var FAINT_FG = "#71717a";
|
|
1807
|
+
var DISABLED_OPACITY = 0.4;
|
|
1808
|
+
var UI_FONT = "system-ui, sans-serif";
|
|
1809
|
+
var MONO_FONT = "ui-monospace, SFMono-Regular, Menlo, monospace";
|
|
1774
1810
|
|
|
1775
1811
|
// src/core/inspector/surfaces/dom.ts
|
|
1776
1812
|
function assign(el, style) {
|
|
@@ -1882,6 +1918,22 @@ var MODULE_OVERLAY_LABEL_BG = "rgba(217,119,6,0.95)";
|
|
|
1882
1918
|
var CMS_OVERLAY_BORDER = "1px solid rgba(13,148,136,0.9)";
|
|
1883
1919
|
var CMS_OVERLAY_BG = "rgba(13,148,136,0.08)";
|
|
1884
1920
|
var CMS_OVERLAY_LABEL_BG = "rgba(13,148,136,0.95)";
|
|
1921
|
+
var CONTROL_HEIGHT = 36;
|
|
1922
|
+
var CONTROL_PADDING = 4;
|
|
1923
|
+
var CONTROL_GAP = 4;
|
|
1924
|
+
var CONTROL_RADIUS = 8;
|
|
1925
|
+
var CONTROL_INSET = 8;
|
|
1926
|
+
var CONTROL_DIVIDER_HEIGHT = 16;
|
|
1927
|
+
var ICON_BUTTON_SIZE = 24;
|
|
1928
|
+
var ICON_BUTTON_RADIUS = 4;
|
|
1929
|
+
var ICON_BUTTON_ICON_SIZE = 14;
|
|
1930
|
+
var ICON_BUTTON_PRESSED_SCALE = 0.9;
|
|
1931
|
+
var SEARCH_WIDTH = 360;
|
|
1932
|
+
var SEARCH_BOTTOM = 70;
|
|
1933
|
+
var SEARCH_LIST_MAX_HEIGHT = 224;
|
|
1934
|
+
var SEARCH_ROW_HEIGHT = 28;
|
|
1935
|
+
var SEARCH_INPUT_FONT_SIZE = 13;
|
|
1936
|
+
var SEARCH_META_FONT_SIZE = 11;
|
|
1885
1937
|
|
|
1886
1938
|
// src/core/inspector/surfaces/decorations.ts
|
|
1887
1939
|
function clearDecorations(layer) {
|
|
@@ -2207,7 +2259,10 @@ var Inspector = class {
|
|
|
2207
2259
|
this.moveFrame = 0;
|
|
2208
2260
|
/** Dernière position mousemove reçue, traitée une fois par frame. */
|
|
2209
2261
|
this.pendingMove = null;
|
|
2210
|
-
/**
|
|
2262
|
+
/**
|
|
2263
|
+
* Mode recherche actif : le survol continue (il montre ce que le clic visera), mais les
|
|
2264
|
+
* gestes de picking passent la main à la recherche (`core/search/page-click.ts`).
|
|
2265
|
+
*/
|
|
2211
2266
|
this.searchMode = false;
|
|
2212
2267
|
/** Matcher de la commande clavier « inspect » (modificateur + touche, simple/double-tap). */
|
|
2213
2268
|
this.inspectMatcher = createKeyCommandMatcher();
|
|
@@ -2290,7 +2345,7 @@ var Inspector = class {
|
|
|
2290
2345
|
this.finishMulti();
|
|
2291
2346
|
return;
|
|
2292
2347
|
}
|
|
2293
|
-
if (keyMatches(cmds.cancel, e.key)) {
|
|
2348
|
+
if (keyMatches(cmds.cancel, e.key) && !CONTEXT_MENU_OPEN.value) {
|
|
2294
2349
|
e.preventDefault();
|
|
2295
2350
|
e.stopPropagation();
|
|
2296
2351
|
this.deactivate();
|
|
@@ -2502,20 +2557,14 @@ var Inspector = class {
|
|
|
2502
2557
|
setTimeout(cleanup, SWALLOW_MS);
|
|
2503
2558
|
}
|
|
2504
2559
|
// --- Handlers (arrow = identité stable pour add/remove) -------------------
|
|
2505
|
-
/** Active/désactive le mode recherche :
|
|
2560
|
+
/** Active/désactive le mode recherche : survol inchangé, picking désactivé. */
|
|
2506
2561
|
setSearchMode(on) {
|
|
2507
2562
|
this.searchMode = on;
|
|
2508
|
-
if (on) this.hideHover();
|
|
2509
2563
|
}
|
|
2510
2564
|
processMouseMove() {
|
|
2511
2565
|
const pending = this.pendingMove;
|
|
2512
2566
|
if (!pending) return;
|
|
2513
2567
|
const { x, y } = pending;
|
|
2514
|
-
if (this.searchMode) {
|
|
2515
|
-
this.lastTarget = null;
|
|
2516
|
-
this.hideHover();
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
2568
|
if (CONTEXT_MENU_OPEN.value) return;
|
|
2520
2569
|
const target = this.lastTarget && this.lastTarget.isConnected && document.elementFromPoint(x, y) === this.lastTarget ? this.lastTarget : resolveTarget(x, y);
|
|
2521
2570
|
if (!target || shouldIgnore(target)) {
|
|
@@ -2562,7 +2611,7 @@ var Inspector = class {
|
|
|
2562
2611
|
}
|
|
2563
2612
|
/** Repositionne instantanément (sans glisse) le survol sur `lastTarget`. */
|
|
2564
2613
|
refreshHover() {
|
|
2565
|
-
if (!this.active || !this.hovering ||
|
|
2614
|
+
if (!this.active || !this.hovering || !this.lastTarget) return;
|
|
2566
2615
|
if (!this.lastTarget.isConnected) {
|
|
2567
2616
|
this.lastTarget = null;
|
|
2568
2617
|
this.hideHover();
|
|
@@ -2654,7 +2703,7 @@ function initRenderPicker(options = {}) {
|
|
|
2654
2703
|
}
|
|
2655
2704
|
|
|
2656
2705
|
// src/react.tsx
|
|
2657
|
-
var
|
|
2706
|
+
var import_react19 = require("react");
|
|
2658
2707
|
|
|
2659
2708
|
// src/core/route.ts
|
|
2660
2709
|
function resolveRoute(pathname, location2) {
|
|
@@ -2663,6 +2712,20 @@ function resolveRoute(pathname, location2) {
|
|
|
2663
2712
|
return base + location2.search;
|
|
2664
2713
|
}
|
|
2665
2714
|
|
|
2715
|
+
// src/core/source/prestashop.ts
|
|
2716
|
+
function detectPrestaShop(win, doc) {
|
|
2717
|
+
const globals = win;
|
|
2718
|
+
if (globals.prestashop && typeof globals.prestashop === "object") return true;
|
|
2719
|
+
if (typeof globals.renderPickerAdminDir === "string") return true;
|
|
2720
|
+
if (!doc.body) return false;
|
|
2721
|
+
const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_COMMENT);
|
|
2722
|
+
for (let n = walker.nextNode(); n; n = walker.nextNode()) {
|
|
2723
|
+
const text = (n.nodeValue ?? "").trim();
|
|
2724
|
+
if (text.startsWith("rp-module:") || text.startsWith("rp@")) return true;
|
|
2725
|
+
}
|
|
2726
|
+
return false;
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2666
2729
|
// src/core/source/site-plan.ts
|
|
2667
2730
|
var CONCURRENCY = 4;
|
|
2668
2731
|
var MODULE_MARKER_RE = /<!--\s*rp-module:([^:]+):/g;
|
|
@@ -2878,15 +2941,37 @@ function pageTreeText(plan) {
|
|
|
2878
2941
|
return lines.join("\n");
|
|
2879
2942
|
}
|
|
2880
2943
|
|
|
2944
|
+
// src/core/devpanel/console-eval.ts
|
|
2945
|
+
function runConsoleExpression(src) {
|
|
2946
|
+
const code = src.trim();
|
|
2947
|
+
if (!code) return;
|
|
2948
|
+
if (typeof window === "undefined" || typeof console === "undefined") return;
|
|
2949
|
+
console.log(`\u203A ${code}`);
|
|
2950
|
+
try {
|
|
2951
|
+
const result = (0, eval)(code);
|
|
2952
|
+
if (isThenable(result)) {
|
|
2953
|
+
result.then(
|
|
2954
|
+
(v) => console.log("\u27F5", v),
|
|
2955
|
+
(e) => console.error("\u27F5", e)
|
|
2956
|
+
);
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
2959
|
+
console.log(result);
|
|
2960
|
+
} catch (e) {
|
|
2961
|
+
console.error(e);
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
function isThenable(v) {
|
|
2965
|
+
return (typeof v === "object" || typeof v === "function") && v !== null && typeof v.then === "function";
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2881
2968
|
// src/core/devpanel/panel-state.ts
|
|
2882
2969
|
var KEY = "render-picker:devpanel";
|
|
2883
2970
|
var DEFAULT = {
|
|
2884
2971
|
open: false,
|
|
2885
2972
|
tab: "console",
|
|
2886
|
-
width:
|
|
2887
|
-
height:
|
|
2888
|
-
x: 80,
|
|
2889
|
-
y: 80
|
|
2973
|
+
width: 640,
|
|
2974
|
+
height: 480
|
|
2890
2975
|
};
|
|
2891
2976
|
function loadPanelState() {
|
|
2892
2977
|
if (typeof window === "undefined") return DEFAULT;
|
|
@@ -2905,362 +2990,33 @@ function savePanelState(patch) {
|
|
|
2905
2990
|
}
|
|
2906
2991
|
}
|
|
2907
2992
|
|
|
2908
|
-
// src/core/
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
"cursor",
|
|
2913
|
-
"font-family",
|
|
2914
|
-
"font-size",
|
|
2915
|
-
"font-weight",
|
|
2916
|
-
"font-style",
|
|
2917
|
-
"font-variant",
|
|
2918
|
-
"font-stretch",
|
|
2919
|
-
"line-height",
|
|
2920
|
-
"letter-spacing",
|
|
2921
|
-
"word-spacing",
|
|
2922
|
-
"text-align",
|
|
2923
|
-
"text-indent",
|
|
2924
|
-
"text-transform",
|
|
2925
|
-
"text-shadow",
|
|
2926
|
-
"white-space",
|
|
2927
|
-
"word-break",
|
|
2928
|
-
"overflow-wrap",
|
|
2929
|
-
"visibility",
|
|
2930
|
-
"caret-color",
|
|
2931
|
-
"list-style",
|
|
2932
|
-
"list-style-type",
|
|
2933
|
-
"list-style-position",
|
|
2934
|
-
"direction",
|
|
2935
|
-
"-webkit-font-smoothing",
|
|
2936
|
-
"-webkit-text-fill-color",
|
|
2937
|
-
"-webkit-locale"
|
|
2938
|
-
]);
|
|
2939
|
-
function createDefaultsReader() {
|
|
2940
|
-
const iframe = document.createElement("iframe");
|
|
2941
|
-
iframe.setAttribute(IGNORE_ATTR, "");
|
|
2942
|
-
iframe.style.cssText = "position:fixed;width:0;height:0;border:0;visibility:hidden;left:-9999px";
|
|
2943
|
-
iframe.srcdoc = "<!doctype html><html><head></head><body></body></html>";
|
|
2944
|
-
document.body.appendChild(iframe);
|
|
2945
|
-
const doc = iframe.contentDocument;
|
|
2946
|
-
const body = doc?.body;
|
|
2947
|
-
const view = iframe.contentWindow;
|
|
2948
|
-
if (!doc || !body || !view) {
|
|
2949
|
-
iframe.remove();
|
|
2950
|
-
return null;
|
|
2951
|
-
}
|
|
2952
|
-
const cache = /* @__PURE__ */ new Map();
|
|
2953
|
-
return {
|
|
2954
|
-
defaultsFor(tag) {
|
|
2955
|
-
const cached = cache.get(tag);
|
|
2956
|
-
if (cached) return cached;
|
|
2957
|
-
const map = /* @__PURE__ */ new Map();
|
|
2958
|
-
try {
|
|
2959
|
-
const el = doc.createElement(tag);
|
|
2960
|
-
body.appendChild(el);
|
|
2961
|
-
const cs = view.getComputedStyle(el);
|
|
2962
|
-
for (let i = 0; i < cs.length; i++) {
|
|
2963
|
-
const p = cs[i];
|
|
2964
|
-
map.set(p, cs.getPropertyValue(p));
|
|
2965
|
-
}
|
|
2966
|
-
body.removeChild(el);
|
|
2967
|
-
} catch {
|
|
2968
|
-
}
|
|
2969
|
-
cache.set(tag, map);
|
|
2970
|
-
return map;
|
|
2971
|
-
},
|
|
2972
|
-
destroy() {
|
|
2973
|
-
iframe.remove();
|
|
2974
|
-
}
|
|
2975
|
-
};
|
|
2993
|
+
// src/core/dev/admin-config.ts
|
|
2994
|
+
function resolveAdminDir(win) {
|
|
2995
|
+
const v = win.renderPickerAdminDir;
|
|
2996
|
+
return v || void 0;
|
|
2976
2997
|
}
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
const v = cs.getPropertyValue(p);
|
|
2986
|
-
if (!v || v === def2.get(p)) continue;
|
|
2987
|
-
if (INHERITED.has(p) && parentCs && parentCs.getPropertyValue(p) === v) continue;
|
|
2988
|
-
decls.push(`${p}: ${v}`);
|
|
2998
|
+
|
|
2999
|
+
// src/core/dev/project-root.ts
|
|
3000
|
+
var ROOT_LS_KEY = "renderPickerRoot";
|
|
3001
|
+
function resolveProjectRoot(win, doc) {
|
|
3002
|
+
try {
|
|
3003
|
+
const ls = win.localStorage.getItem(ROOT_LS_KEY);
|
|
3004
|
+
if (ls) return { root: ls, source: "localStorage" };
|
|
3005
|
+
} catch {
|
|
2989
3006
|
}
|
|
2990
|
-
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
const addClasses = (el) => {
|
|
2996
|
-
const raw = el.getAttribute("class");
|
|
2997
|
-
if (raw) {
|
|
2998
|
-
for (const c of raw.trim().split(/\s+/)) {
|
|
2999
|
-
if (c && !seen.has(c)) {
|
|
3000
|
-
seen.add(c);
|
|
3001
|
-
classes.push(c);
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
for (const kid of el.children) addClasses(kid);
|
|
3006
|
-
};
|
|
3007
|
-
addClasses(root);
|
|
3008
|
-
return classes;
|
|
3007
|
+
const fromGlobal = win.renderPickerRoot;
|
|
3008
|
+
if (fromGlobal) return { root: fromGlobal, source: "jsDef" };
|
|
3009
|
+
const content = doc.querySelector('meta[name="render-picker-root"]')?.getAttribute("content");
|
|
3010
|
+
if (content) return { root: content, source: "meta" };
|
|
3011
|
+
return { root: void 0, source: "none" };
|
|
3009
3012
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
function
|
|
3014
|
-
const
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
const wanted = /* @__PURE__ */ new Map();
|
|
3018
|
-
for (const c of classes) wanted.set(`.${escClass(c)}`, c);
|
|
3019
|
-
const scan = (rules) => {
|
|
3020
|
-
for (const rule of Array.from(rules)) {
|
|
3021
|
-
const r = rule;
|
|
3022
|
-
if (typeof r.selectorText === "string" && r.style) {
|
|
3023
|
-
const cls = wanted.get(r.selectorText);
|
|
3024
|
-
if (cls) {
|
|
3025
|
-
const decl = r.style.cssText.trim().replace(/;\s*$/, "");
|
|
3026
|
-
if (decl) {
|
|
3027
|
-
const prev = out.get(cls);
|
|
3028
|
-
out.set(cls, prev ? `${prev} ${decl}` : decl);
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
} else if (r.cssRules) {
|
|
3032
|
-
scan(r.cssRules);
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
};
|
|
3036
|
-
for (const sheet of Array.from(document.styleSheets)) {
|
|
3037
|
-
try {
|
|
3038
|
-
scan(sheet.cssRules);
|
|
3039
|
-
} catch {
|
|
3040
|
-
continue;
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
const ordered = /* @__PURE__ */ new Map();
|
|
3044
|
-
for (const c of classes) {
|
|
3045
|
-
const d = out.get(c);
|
|
3046
|
-
if (d) ordered.set(c, d);
|
|
3047
|
-
}
|
|
3048
|
-
return ordered;
|
|
3049
|
-
}
|
|
3050
|
-
function collectStateRules(root) {
|
|
3051
|
-
const out = /* @__PURE__ */ new Map();
|
|
3052
|
-
const classes = subtreeClasses(root);
|
|
3053
|
-
if (classes.length === 0 || typeof document === "undefined") return out;
|
|
3054
|
-
const bases = classes.map((c, i) => ({
|
|
3055
|
-
base: `.${escClass(c)}`,
|
|
3056
|
-
order: i
|
|
3057
|
-
}));
|
|
3058
|
-
const hits = /* @__PURE__ */ new Map();
|
|
3059
|
-
const consider = (selector, decl) => {
|
|
3060
|
-
for (const { base, order } of bases) {
|
|
3061
|
-
if (!selector.startsWith(base)) continue;
|
|
3062
|
-
const rest = selector.slice(base.length);
|
|
3063
|
-
if (rest.startsWith("::") || !/^(:[^\s>+~,:]+(\([^)]*\))?)+$/.test(rest)) continue;
|
|
3064
|
-
const prev = hits.get(selector);
|
|
3065
|
-
if (prev) prev.decl = prev.decl ? `${prev.decl}; ${decl}` : decl;
|
|
3066
|
-
else hits.set(selector, { decl, order });
|
|
3067
|
-
return;
|
|
3068
|
-
}
|
|
3069
|
-
};
|
|
3070
|
-
const scan = (rules) => {
|
|
3071
|
-
for (const rule of Array.from(rules)) {
|
|
3072
|
-
const r = rule;
|
|
3073
|
-
if (typeof r.selectorText === "string" && r.style) {
|
|
3074
|
-
if (!r.selectorText.includes(":")) continue;
|
|
3075
|
-
const decl = r.style.cssText.trim().replace(/;\s*$/, "");
|
|
3076
|
-
if (!decl) continue;
|
|
3077
|
-
for (const part of r.selectorText.split(",")) consider(part.trim(), decl);
|
|
3078
|
-
} else if (r.cssRules) {
|
|
3079
|
-
scan(r.cssRules);
|
|
3080
|
-
}
|
|
3081
|
-
}
|
|
3082
|
-
};
|
|
3083
|
-
for (const sheet of Array.from(document.styleSheets)) {
|
|
3084
|
-
try {
|
|
3085
|
-
scan(sheet.cssRules);
|
|
3086
|
-
} catch {
|
|
3087
|
-
continue;
|
|
3088
|
-
}
|
|
3089
|
-
}
|
|
3090
|
-
for (const [selector] of [...hits].sort((a, b) => a[1].order - b[1].order)) {
|
|
3091
|
-
out.set(selector, hits.get(selector).decl);
|
|
3092
|
-
}
|
|
3093
|
-
return out;
|
|
3094
|
-
}
|
|
3095
|
-
function resolveVarsIn(text, root) {
|
|
3096
|
-
if (typeof getComputedStyle === "undefined" || !text.includes("var(")) return text;
|
|
3097
|
-
const rootCs = getComputedStyle(root);
|
|
3098
|
-
const re = /var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,([^()]*(?:\([^()]*\)[^()]*)*))?\)/;
|
|
3099
|
-
let out = text;
|
|
3100
|
-
for (let i = 0; i < 20 && out.includes("var("); i++) {
|
|
3101
|
-
const next = out.replace(re, (_m, name, fallback) => {
|
|
3102
|
-
const val = rootCs.getPropertyValue(name).trim();
|
|
3103
|
-
if (val) return val;
|
|
3104
|
-
return fallback !== void 0 ? fallback.trim() : "";
|
|
3105
|
-
});
|
|
3106
|
-
if (next === out) break;
|
|
3107
|
-
out = next;
|
|
3108
|
-
}
|
|
3109
|
-
return out;
|
|
3110
|
-
}
|
|
3111
|
-
function withImportant(decl) {
|
|
3112
|
-
return decl.split(";").map((d) => d.trim()).filter(Boolean).map((d) => d.includes("!important") ? d : `${d} !important`).join("; ");
|
|
3113
|
-
}
|
|
3114
|
-
function collectVarDefs(declarations, root) {
|
|
3115
|
-
const defs = /* @__PURE__ */ new Map();
|
|
3116
|
-
if (typeof getComputedStyle === "undefined") return defs;
|
|
3117
|
-
const rootCs = getComputedStyle(root);
|
|
3118
|
-
const namesIn = (text) => {
|
|
3119
|
-
const found = [];
|
|
3120
|
-
const re = /var\(\s*(--[A-Za-z0-9_-]+)/g;
|
|
3121
|
-
let m;
|
|
3122
|
-
while ((m = re.exec(text)) !== null) found.push(m[1]);
|
|
3123
|
-
return found;
|
|
3124
|
-
};
|
|
3125
|
-
const queue = [];
|
|
3126
|
-
for (const decl of declarations) queue.push(...namesIn(decl));
|
|
3127
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3128
|
-
while (queue.length > 0) {
|
|
3129
|
-
const name = queue.shift();
|
|
3130
|
-
if (seen.has(name)) continue;
|
|
3131
|
-
seen.add(name);
|
|
3132
|
-
const val = rootCs.getPropertyValue(name).trim();
|
|
3133
|
-
if (!val) continue;
|
|
3134
|
-
defs.set(name, val);
|
|
3135
|
-
queue.push(...namesIn(val));
|
|
3136
|
-
}
|
|
3137
|
-
return defs;
|
|
3138
|
-
}
|
|
3139
|
-
function serializeWithComputedStyles(root) {
|
|
3140
|
-
if (typeof window === "undefined" || typeof getComputedStyle === "undefined") {
|
|
3141
|
-
return formatHtml(root.outerHTML);
|
|
3142
|
-
}
|
|
3143
|
-
const reader = createDefaultsReader();
|
|
3144
|
-
if (!reader) return formatHtml(root.outerHTML);
|
|
3145
|
-
try {
|
|
3146
|
-
const classToCss = collectClassRules(root);
|
|
3147
|
-
const usage = /* @__PURE__ */ new Map();
|
|
3148
|
-
const countWalk = (el) => {
|
|
3149
|
-
const raw = el.getAttribute("class");
|
|
3150
|
-
if (raw) {
|
|
3151
|
-
for (const cls of new Set(raw.trim().split(/\s+/))) {
|
|
3152
|
-
usage.set(cls, (usage.get(cls) ?? 0) + 1);
|
|
3153
|
-
}
|
|
3154
|
-
}
|
|
3155
|
-
for (const kid of el.children) countWalk(kid);
|
|
3156
|
-
};
|
|
3157
|
-
countWalk(root);
|
|
3158
|
-
const clone = root.cloneNode(true);
|
|
3159
|
-
let count = 0;
|
|
3160
|
-
let truncated = 0;
|
|
3161
|
-
const walk = (o, c, parent) => {
|
|
3162
|
-
if (count >= MAX_NODES) {
|
|
3163
|
-
truncated++;
|
|
3164
|
-
return;
|
|
3165
|
-
}
|
|
3166
|
-
count++;
|
|
3167
|
-
inlineStyles(o, c, parent, reader.defaultsFor);
|
|
3168
|
-
const raw = o.getAttribute("class");
|
|
3169
|
-
if (raw) {
|
|
3170
|
-
const parts = [];
|
|
3171
|
-
for (const cls of raw.trim().split(/\s+/)) {
|
|
3172
|
-
const decl = classToCss.get(cls);
|
|
3173
|
-
if (decl && usage.get(cls) === 1) parts.push(`.${cls} { ${decl} }`);
|
|
3174
|
-
}
|
|
3175
|
-
if (parts.length > 0) {
|
|
3176
|
-
const comment = c.ownerDocument.createComment(` ${parts.join(" ")} `);
|
|
3177
|
-
c.insertBefore(comment, c.firstChild);
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
|
-
const oKids = o.children;
|
|
3181
|
-
const cKids = c.children;
|
|
3182
|
-
for (let i = 0; i < oKids.length; i++) {
|
|
3183
|
-
const ok = oKids[i];
|
|
3184
|
-
const ck = cKids[i];
|
|
3185
|
-
if (ok && ck) walk(ok, ck, o);
|
|
3186
|
-
}
|
|
3187
|
-
};
|
|
3188
|
-
walk(root, clone, null);
|
|
3189
|
-
if (truncated > 0) {
|
|
3190
|
-
console.warn(
|
|
3191
|
-
`[render-picker] copie reproductible : ${truncated} n\u0153ud(s) au-del\xE0 de ${MAX_NODES} non stylis\xE9s.`
|
|
3192
|
-
);
|
|
3193
|
-
}
|
|
3194
|
-
const html = formatHtml(clone.outerHTML);
|
|
3195
|
-
const globalLines = [];
|
|
3196
|
-
for (const [cls, decl] of classToCss) {
|
|
3197
|
-
if ((usage.get(cls) ?? 0) >= 2) globalLines.push(` .${cls} { ${decl} }`);
|
|
3198
|
-
}
|
|
3199
|
-
let out = html;
|
|
3200
|
-
if (globalLines.length > 0) {
|
|
3201
|
-
out += `
|
|
3202
|
-
|
|
3203
|
-
<!-- Classes globales (utilis\xE9es sur plusieurs balises)
|
|
3204
|
-
${globalLines.join("\n")}
|
|
3205
|
-
-->`;
|
|
3206
|
-
}
|
|
3207
|
-
const stateRules = collectStateRules(root);
|
|
3208
|
-
if (stateRules.size > 0) {
|
|
3209
|
-
const styleLines = Array.from(
|
|
3210
|
-
stateRules,
|
|
3211
|
-
([selector, decl]) => ` ${selector} { ${withImportant(resolveVarsIn(decl, root))} }`
|
|
3212
|
-
);
|
|
3213
|
-
out += `
|
|
3214
|
-
|
|
3215
|
-
<style>
|
|
3216
|
-
${styleLines.join("\n")}
|
|
3217
|
-
</style>`;
|
|
3218
|
-
}
|
|
3219
|
-
const defs = collectVarDefs(
|
|
3220
|
-
[...classToCss.values(), ...stateRules.values()],
|
|
3221
|
-
root
|
|
3222
|
-
);
|
|
3223
|
-
if (defs.size > 0) {
|
|
3224
|
-
const varLines = Array.from(defs, ([name, val]) => ` ${name}: ${val}`);
|
|
3225
|
-
out += `
|
|
3226
|
-
|
|
3227
|
-
<!-- Variables CSS
|
|
3228
|
-
${varLines.join("\n")}
|
|
3229
|
-
-->`;
|
|
3230
|
-
}
|
|
3231
|
-
return out;
|
|
3232
|
-
} finally {
|
|
3233
|
-
reader.destroy();
|
|
3234
|
-
}
|
|
3235
|
-
}
|
|
3236
|
-
|
|
3237
|
-
// src/core/dev/admin-config.ts
|
|
3238
|
-
function resolveAdminDir(win) {
|
|
3239
|
-
const v = win.renderPickerAdminDir;
|
|
3240
|
-
return v || void 0;
|
|
3241
|
-
}
|
|
3242
|
-
|
|
3243
|
-
// src/core/dev/project-root.ts
|
|
3244
|
-
var ROOT_LS_KEY = "renderPickerRoot";
|
|
3245
|
-
function resolveProjectRoot(win, doc) {
|
|
3246
|
-
try {
|
|
3247
|
-
const ls = win.localStorage.getItem(ROOT_LS_KEY);
|
|
3248
|
-
if (ls) return { root: ls, source: "localStorage" };
|
|
3249
|
-
} catch {
|
|
3250
|
-
}
|
|
3251
|
-
const fromGlobal = win.renderPickerRoot;
|
|
3252
|
-
if (fromGlobal) return { root: fromGlobal, source: "jsDef" };
|
|
3253
|
-
const content = doc.querySelector('meta[name="render-picker-root"]')?.getAttribute("content");
|
|
3254
|
-
if (content) return { root: content, source: "meta" };
|
|
3255
|
-
return { root: void 0, source: "none" };
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
|
-
// src/core/source/module-overlay.ts
|
|
3259
|
-
var START_RE = /^rp-module:([^:]+):([^:]*):([\d.]+):(.+)$/;
|
|
3260
|
-
function parseModuleStart(text) {
|
|
3261
|
-
const m = START_RE.exec(text.trim());
|
|
3262
|
-
if (!m) return null;
|
|
3263
|
-
return { name: m[1], hookName: m[2] ? m[2] : null, durationMs: Number(m[3]), source: m[4] };
|
|
3013
|
+
|
|
3014
|
+
// src/core/source/module-overlay.ts
|
|
3015
|
+
var START_RE = /^rp-module:([^:]+):([^:]*):([\d.]+):(.+)$/;
|
|
3016
|
+
function parseModuleStart(text) {
|
|
3017
|
+
const m = START_RE.exec(text.trim());
|
|
3018
|
+
if (!m) return null;
|
|
3019
|
+
return { name: m[1], hookName: m[2] ? m[2] : null, durationMs: Number(m[3]), source: m[4] };
|
|
3264
3020
|
}
|
|
3265
3021
|
var CMS_START_RE = /^rp-cms:(\d+):(.+?:\d+):(.*)$/;
|
|
3266
3022
|
function parseCmsStart(text) {
|
|
@@ -3598,7 +3354,7 @@ function initModuleOverlaySurface() {
|
|
|
3598
3354
|
}
|
|
3599
3355
|
|
|
3600
3356
|
// src/ui/dev-panel/dev-panel.tsx
|
|
3601
|
-
var
|
|
3357
|
+
var import_react9 = require("react");
|
|
3602
3358
|
|
|
3603
3359
|
// src/ui/html-tree/html-tree.tsx
|
|
3604
3360
|
var import_react3 = require("react");
|
|
@@ -3650,59 +3406,7 @@ function inlineText(el) {
|
|
|
3650
3406
|
}
|
|
3651
3407
|
|
|
3652
3408
|
// src/core/search/highlight.ts
|
|
3653
|
-
function
|
|
3654
|
-
const tooltip = document.createElement("div");
|
|
3655
|
-
assign(tooltip, {
|
|
3656
|
-
position: "fixed",
|
|
3657
|
-
display: "none",
|
|
3658
|
-
zIndex: "3",
|
|
3659
|
-
maxWidth: "420px",
|
|
3660
|
-
padding: "6px 6px 6px 10px",
|
|
3661
|
-
borderRadius: "6px",
|
|
3662
|
-
font: "12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
3663
|
-
color: "#fff",
|
|
3664
|
-
background: SECONDARY_SURFACE,
|
|
3665
|
-
border: SECONDARY_BORDER,
|
|
3666
|
-
boxShadow: BTN_SHADOW,
|
|
3667
|
-
pointerEvents: "none",
|
|
3668
|
-
alignItems: "flex-start",
|
|
3669
|
-
gap: "10px"
|
|
3670
|
-
});
|
|
3671
|
-
const col = document.createElement("div");
|
|
3672
|
-
assign(col, { display: "flex", flexDirection: "column", minWidth: "0" });
|
|
3673
|
-
const label = document.createElement("span");
|
|
3674
|
-
assign(label, { whiteSpace: "pre-line" });
|
|
3675
|
-
col.appendChild(label);
|
|
3676
|
-
const divider = document.createElement("div");
|
|
3677
|
-
assign(divider, {
|
|
3678
|
-
display: "none",
|
|
3679
|
-
height: "1px",
|
|
3680
|
-
margin: "5px 0",
|
|
3681
|
-
alignSelf: "stretch",
|
|
3682
|
-
background: "rgba(255,255,255,0.14)"
|
|
3683
|
-
});
|
|
3684
|
-
col.appendChild(divider);
|
|
3685
|
-
const metrics = document.createElement("span");
|
|
3686
|
-
assign(metrics, { display: "none", whiteSpace: "pre-line", color: "#d4d4d8" });
|
|
3687
|
-
col.appendChild(metrics);
|
|
3688
|
-
tooltip.appendChild(col);
|
|
3689
|
-
const dims = document.createElement("span");
|
|
3690
|
-
assign(dims, {
|
|
3691
|
-
marginLeft: "auto",
|
|
3692
|
-
flexShrink: "0",
|
|
3693
|
-
padding: "1px 5px",
|
|
3694
|
-
borderRadius: "4px",
|
|
3695
|
-
font: "600 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
3696
|
-
color: "#60a5fa",
|
|
3697
|
-
background: "rgba(59,130,246,0.15)",
|
|
3698
|
-
border: "1px solid rgba(59,130,246,0.3)",
|
|
3699
|
-
whiteSpace: "nowrap"
|
|
3700
|
-
});
|
|
3701
|
-
tooltip.appendChild(dims);
|
|
3702
|
-
return { tooltip, label, divider, metrics, dims };
|
|
3703
|
-
}
|
|
3704
|
-
function createSearchHighlight(options = {}) {
|
|
3705
|
-
const interactive = !!(options.onPick || options.onContextMenu || options.onVscode);
|
|
3409
|
+
function createSearchHighlight() {
|
|
3706
3410
|
const root = document.createElement("div");
|
|
3707
3411
|
root.setAttribute(IGNORE_ATTR, "");
|
|
3708
3412
|
root.setAttribute(SEARCH_UI_ATTR, "");
|
|
@@ -3710,16 +3414,13 @@ function createSearchHighlight(options = {}) {
|
|
|
3710
3414
|
position: "fixed",
|
|
3711
3415
|
inset: "0",
|
|
3712
3416
|
pointerEvents: "none",
|
|
3713
|
-
zIndex: String(
|
|
3417
|
+
zIndex: String(HIGHLIGHT_Z)
|
|
3714
3418
|
});
|
|
3715
3419
|
document.documentElement.appendChild(root);
|
|
3716
|
-
const surface = createTooltipSurface();
|
|
3717
|
-
root.appendChild(surface.tooltip);
|
|
3718
3420
|
let rects = [];
|
|
3719
3421
|
let elements = [];
|
|
3720
3422
|
let activeSet = /* @__PURE__ */ new Set();
|
|
3721
3423
|
let filterSet = null;
|
|
3722
|
-
let hoveredIndex = -1;
|
|
3723
3424
|
let disposed = false;
|
|
3724
3425
|
let rafId = 0;
|
|
3725
3426
|
function makeRect() {
|
|
@@ -3731,8 +3432,7 @@ function createSearchHighlight(options = {}) {
|
|
|
3731
3432
|
border: HIGHLIGHT_BORDER,
|
|
3732
3433
|
borderRadius: OVERLAY_RADIUS,
|
|
3733
3434
|
boxSizing: "border-box",
|
|
3734
|
-
pointerEvents:
|
|
3735
|
-
cursor: interactive ? "crosshair" : "default",
|
|
3435
|
+
pointerEvents: "none",
|
|
3736
3436
|
display: "none"
|
|
3737
3437
|
});
|
|
3738
3438
|
root.appendChild(rect);
|
|
@@ -3758,25 +3458,11 @@ function createSearchHighlight(options = {}) {
|
|
|
3758
3458
|
if (rect) rect.style.display = "none";
|
|
3759
3459
|
return;
|
|
3760
3460
|
}
|
|
3761
|
-
const active = activeSet.has(i)
|
|
3461
|
+
const active = activeSet.has(i);
|
|
3762
3462
|
rect.style.background = active ? SELECTED_BG : HIGHLIGHT_BG;
|
|
3763
3463
|
rect.style.border = active ? HIGHLIGHT_BORDER : "1px solid rgba(59,130,246,0.35)";
|
|
3764
3464
|
place(rect, el);
|
|
3765
3465
|
});
|
|
3766
|
-
if (hoveredIndex >= 0 && rects[hoveredIndex] && elements[hoveredIndex]?.isConnected) {
|
|
3767
|
-
const el = elements[hoveredIndex];
|
|
3768
|
-
updateTooltip(
|
|
3769
|
-
surface.tooltip,
|
|
3770
|
-
surface.label,
|
|
3771
|
-
surface.divider,
|
|
3772
|
-
surface.metrics,
|
|
3773
|
-
surface.dims,
|
|
3774
|
-
el,
|
|
3775
|
-
[],
|
|
3776
|
-
el.getBoundingClientRect(),
|
|
3777
|
-
getComputedStyle(el)
|
|
3778
|
-
);
|
|
3779
|
-
}
|
|
3780
3466
|
}
|
|
3781
3467
|
const loop = () => {
|
|
3782
3468
|
if (disposed) return;
|
|
@@ -3791,38 +3477,6 @@ function createSearchHighlight(options = {}) {
|
|
|
3791
3477
|
while (rects.length < elements.length) rects.push(makeRect());
|
|
3792
3478
|
for (const rect of rects.slice(elements.length)) rect.style.display = "none";
|
|
3793
3479
|
rects.length = elements.length;
|
|
3794
|
-
rects.forEach((rect, i) => {
|
|
3795
|
-
rect.onmouseenter = () => {
|
|
3796
|
-
if (rect.style.display === "none") return;
|
|
3797
|
-
hoveredIndex = i;
|
|
3798
|
-
redraw();
|
|
3799
|
-
};
|
|
3800
|
-
rect.onmouseleave = () => {
|
|
3801
|
-
hoveredIndex = -1;
|
|
3802
|
-
surface.tooltip.style.display = "none";
|
|
3803
|
-
};
|
|
3804
|
-
rect.onmousedown = (e) => {
|
|
3805
|
-
e.preventDefault();
|
|
3806
|
-
e.stopPropagation();
|
|
3807
|
-
};
|
|
3808
|
-
rect.oncontextmenu = (e) => {
|
|
3809
|
-
e.preventDefault();
|
|
3810
|
-
e.stopPropagation();
|
|
3811
|
-
const el = elements[i];
|
|
3812
|
-
if (!el) return;
|
|
3813
|
-
options.onContextMenu?.(el, { x: e.clientX, y: e.clientY });
|
|
3814
|
-
};
|
|
3815
|
-
rect.onclick = (e) => {
|
|
3816
|
-
e.preventDefault();
|
|
3817
|
-
e.stopPropagation();
|
|
3818
|
-
const el = elements[i];
|
|
3819
|
-
if (!el) return;
|
|
3820
|
-
const action = vscodeActionFor(e);
|
|
3821
|
-
if (action && options.onVscode?.(el, action)) return;
|
|
3822
|
-
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
3823
|
-
options.onPick?.(el);
|
|
3824
|
-
};
|
|
3825
|
-
});
|
|
3826
3480
|
redraw();
|
|
3827
3481
|
},
|
|
3828
3482
|
setActive(indices) {
|
|
@@ -3833,12 +3487,17 @@ function createSearchHighlight(options = {}) {
|
|
|
3833
3487
|
filterSet = indices ? new Set(indices) : null;
|
|
3834
3488
|
redraw();
|
|
3835
3489
|
},
|
|
3490
|
+
covers(x, y) {
|
|
3491
|
+
return elements.some((el, i) => {
|
|
3492
|
+
if (rects[i]?.style.display !== "block") return false;
|
|
3493
|
+
const r = el.getBoundingClientRect();
|
|
3494
|
+
return x >= r.left && x <= r.right && y >= r.top && y <= r.bottom;
|
|
3495
|
+
});
|
|
3496
|
+
},
|
|
3836
3497
|
clear() {
|
|
3837
3498
|
elements = [];
|
|
3838
|
-
hoveredIndex = -1;
|
|
3839
3499
|
activeSet = /* @__PURE__ */ new Set();
|
|
3840
3500
|
filterSet = null;
|
|
3841
|
-
surface.tooltip.style.display = "none";
|
|
3842
3501
|
for (const rect of rects) rect.style.display = "none";
|
|
3843
3502
|
},
|
|
3844
3503
|
destroy() {
|
|
@@ -3851,17 +3510,347 @@ function createSearchHighlight(options = {}) {
|
|
|
3851
3510
|
};
|
|
3852
3511
|
}
|
|
3853
3512
|
|
|
3513
|
+
// src/core/computed-html.ts
|
|
3514
|
+
var MAX_NODES = 500;
|
|
3515
|
+
var INHERITED = /* @__PURE__ */ new Set([
|
|
3516
|
+
"color",
|
|
3517
|
+
"cursor",
|
|
3518
|
+
"font-family",
|
|
3519
|
+
"font-size",
|
|
3520
|
+
"font-weight",
|
|
3521
|
+
"font-style",
|
|
3522
|
+
"font-variant",
|
|
3523
|
+
"font-stretch",
|
|
3524
|
+
"line-height",
|
|
3525
|
+
"letter-spacing",
|
|
3526
|
+
"word-spacing",
|
|
3527
|
+
"text-align",
|
|
3528
|
+
"text-indent",
|
|
3529
|
+
"text-transform",
|
|
3530
|
+
"text-shadow",
|
|
3531
|
+
"white-space",
|
|
3532
|
+
"word-break",
|
|
3533
|
+
"overflow-wrap",
|
|
3534
|
+
"visibility",
|
|
3535
|
+
"caret-color",
|
|
3536
|
+
"list-style",
|
|
3537
|
+
"list-style-type",
|
|
3538
|
+
"list-style-position",
|
|
3539
|
+
"direction",
|
|
3540
|
+
"-webkit-font-smoothing",
|
|
3541
|
+
"-webkit-text-fill-color",
|
|
3542
|
+
"-webkit-locale"
|
|
3543
|
+
]);
|
|
3544
|
+
function createDefaultsReader() {
|
|
3545
|
+
const iframe = document.createElement("iframe");
|
|
3546
|
+
iframe.setAttribute(IGNORE_ATTR, "");
|
|
3547
|
+
iframe.style.cssText = "position:fixed;width:0;height:0;border:0;visibility:hidden;left:-9999px";
|
|
3548
|
+
iframe.srcdoc = "<!doctype html><html><head></head><body></body></html>";
|
|
3549
|
+
document.body.appendChild(iframe);
|
|
3550
|
+
const doc = iframe.contentDocument;
|
|
3551
|
+
const body = doc?.body;
|
|
3552
|
+
const view = iframe.contentWindow;
|
|
3553
|
+
if (!doc || !body || !view) {
|
|
3554
|
+
iframe.remove();
|
|
3555
|
+
return null;
|
|
3556
|
+
}
|
|
3557
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3558
|
+
return {
|
|
3559
|
+
defaultsFor(tag) {
|
|
3560
|
+
const cached = cache.get(tag);
|
|
3561
|
+
if (cached) return cached;
|
|
3562
|
+
const map = /* @__PURE__ */ new Map();
|
|
3563
|
+
try {
|
|
3564
|
+
const el = doc.createElement(tag);
|
|
3565
|
+
body.appendChild(el);
|
|
3566
|
+
const cs = view.getComputedStyle(el);
|
|
3567
|
+
for (let i = 0; i < cs.length; i++) {
|
|
3568
|
+
const p = cs[i];
|
|
3569
|
+
map.set(p, cs.getPropertyValue(p));
|
|
3570
|
+
}
|
|
3571
|
+
body.removeChild(el);
|
|
3572
|
+
} catch {
|
|
3573
|
+
}
|
|
3574
|
+
cache.set(tag, map);
|
|
3575
|
+
return map;
|
|
3576
|
+
},
|
|
3577
|
+
destroy() {
|
|
3578
|
+
iframe.remove();
|
|
3579
|
+
}
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
3582
|
+
function inlineStyles(orig, clone, parent, defaultsFor) {
|
|
3583
|
+
const cs = getComputedStyle(orig);
|
|
3584
|
+
const def2 = defaultsFor(orig.tagName.toLowerCase());
|
|
3585
|
+
const parentCs = parent ? getComputedStyle(parent) : null;
|
|
3586
|
+
const decls = [];
|
|
3587
|
+
for (let i = 0; i < cs.length; i++) {
|
|
3588
|
+
const p = cs[i];
|
|
3589
|
+
if (p.startsWith("--")) continue;
|
|
3590
|
+
const v = cs.getPropertyValue(p);
|
|
3591
|
+
if (!v || v === def2.get(p)) continue;
|
|
3592
|
+
if (INHERITED.has(p) && parentCs && parentCs.getPropertyValue(p) === v) continue;
|
|
3593
|
+
decls.push(`${p}: ${v}`);
|
|
3594
|
+
}
|
|
3595
|
+
if (decls.length > 0) clone.setAttribute("style", decls.join("; "));
|
|
3596
|
+
}
|
|
3597
|
+
function subtreeClasses(root) {
|
|
3598
|
+
const classes = [];
|
|
3599
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3600
|
+
const addClasses = (el) => {
|
|
3601
|
+
const raw = el.getAttribute("class");
|
|
3602
|
+
if (raw) {
|
|
3603
|
+
for (const c of raw.trim().split(/\s+/)) {
|
|
3604
|
+
if (c && !seen.has(c)) {
|
|
3605
|
+
seen.add(c);
|
|
3606
|
+
classes.push(c);
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
for (const kid of el.children) addClasses(kid);
|
|
3611
|
+
};
|
|
3612
|
+
addClasses(root);
|
|
3613
|
+
return classes;
|
|
3614
|
+
}
|
|
3615
|
+
function escClass(s) {
|
|
3616
|
+
return typeof CSS !== "undefined" && CSS.escape ? CSS.escape(s) : s.replace(/[^a-zA-Z0-9_-]/g, (ch) => `\\${ch}`);
|
|
3617
|
+
}
|
|
3618
|
+
function collectClassRules(root) {
|
|
3619
|
+
const classes = subtreeClasses(root);
|
|
3620
|
+
const out = /* @__PURE__ */ new Map();
|
|
3621
|
+
if (classes.length === 0 || typeof document === "undefined") return out;
|
|
3622
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
3623
|
+
for (const c of classes) wanted.set(`.${escClass(c)}`, c);
|
|
3624
|
+
const scan = (rules) => {
|
|
3625
|
+
for (const rule of Array.from(rules)) {
|
|
3626
|
+
const r = rule;
|
|
3627
|
+
if (typeof r.selectorText === "string" && r.style) {
|
|
3628
|
+
const cls = wanted.get(r.selectorText);
|
|
3629
|
+
if (cls) {
|
|
3630
|
+
const decl = r.style.cssText.trim().replace(/;\s*$/, "");
|
|
3631
|
+
if (decl) {
|
|
3632
|
+
const prev = out.get(cls);
|
|
3633
|
+
out.set(cls, prev ? `${prev} ${decl}` : decl);
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
} else if (r.cssRules) {
|
|
3637
|
+
scan(r.cssRules);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
};
|
|
3641
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
3642
|
+
try {
|
|
3643
|
+
scan(sheet.cssRules);
|
|
3644
|
+
} catch {
|
|
3645
|
+
continue;
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
const ordered = /* @__PURE__ */ new Map();
|
|
3649
|
+
for (const c of classes) {
|
|
3650
|
+
const d = out.get(c);
|
|
3651
|
+
if (d) ordered.set(c, d);
|
|
3652
|
+
}
|
|
3653
|
+
return ordered;
|
|
3654
|
+
}
|
|
3655
|
+
function collectStateRules(root) {
|
|
3656
|
+
const out = /* @__PURE__ */ new Map();
|
|
3657
|
+
const classes = subtreeClasses(root);
|
|
3658
|
+
if (classes.length === 0 || typeof document === "undefined") return out;
|
|
3659
|
+
const bases = classes.map((c, i) => ({
|
|
3660
|
+
base: `.${escClass(c)}`,
|
|
3661
|
+
order: i
|
|
3662
|
+
}));
|
|
3663
|
+
const hits = /* @__PURE__ */ new Map();
|
|
3664
|
+
const consider = (selector, decl) => {
|
|
3665
|
+
for (const { base, order } of bases) {
|
|
3666
|
+
if (!selector.startsWith(base)) continue;
|
|
3667
|
+
const rest = selector.slice(base.length);
|
|
3668
|
+
if (rest.startsWith("::") || !/^(:[^\s>+~,:]+(\([^)]*\))?)+$/.test(rest)) continue;
|
|
3669
|
+
const prev = hits.get(selector);
|
|
3670
|
+
if (prev) prev.decl = prev.decl ? `${prev.decl}; ${decl}` : decl;
|
|
3671
|
+
else hits.set(selector, { decl, order });
|
|
3672
|
+
return;
|
|
3673
|
+
}
|
|
3674
|
+
};
|
|
3675
|
+
const scan = (rules) => {
|
|
3676
|
+
for (const rule of Array.from(rules)) {
|
|
3677
|
+
const r = rule;
|
|
3678
|
+
if (typeof r.selectorText === "string" && r.style) {
|
|
3679
|
+
if (!r.selectorText.includes(":")) continue;
|
|
3680
|
+
const decl = r.style.cssText.trim().replace(/;\s*$/, "");
|
|
3681
|
+
if (!decl) continue;
|
|
3682
|
+
for (const part of r.selectorText.split(",")) consider(part.trim(), decl);
|
|
3683
|
+
} else if (r.cssRules) {
|
|
3684
|
+
scan(r.cssRules);
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
};
|
|
3688
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
3689
|
+
try {
|
|
3690
|
+
scan(sheet.cssRules);
|
|
3691
|
+
} catch {
|
|
3692
|
+
continue;
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
for (const [selector] of [...hits].sort((a, b) => a[1].order - b[1].order)) {
|
|
3696
|
+
out.set(selector, hits.get(selector).decl);
|
|
3697
|
+
}
|
|
3698
|
+
return out;
|
|
3699
|
+
}
|
|
3700
|
+
function resolveVarsIn(text, root) {
|
|
3701
|
+
if (typeof getComputedStyle === "undefined" || !text.includes("var(")) return text;
|
|
3702
|
+
const rootCs = getComputedStyle(root);
|
|
3703
|
+
const re = /var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,([^()]*(?:\([^()]*\)[^()]*)*))?\)/;
|
|
3704
|
+
let out = text;
|
|
3705
|
+
for (let i = 0; i < 20 && out.includes("var("); i++) {
|
|
3706
|
+
const next = out.replace(re, (_m, name, fallback) => {
|
|
3707
|
+
const val = rootCs.getPropertyValue(name).trim();
|
|
3708
|
+
if (val) return val;
|
|
3709
|
+
return fallback !== void 0 ? fallback.trim() : "";
|
|
3710
|
+
});
|
|
3711
|
+
if (next === out) break;
|
|
3712
|
+
out = next;
|
|
3713
|
+
}
|
|
3714
|
+
return out;
|
|
3715
|
+
}
|
|
3716
|
+
function withImportant(decl) {
|
|
3717
|
+
return decl.split(";").map((d) => d.trim()).filter(Boolean).map((d) => d.includes("!important") ? d : `${d} !important`).join("; ");
|
|
3718
|
+
}
|
|
3719
|
+
function collectVarDefs(declarations, root) {
|
|
3720
|
+
const defs = /* @__PURE__ */ new Map();
|
|
3721
|
+
if (typeof getComputedStyle === "undefined") return defs;
|
|
3722
|
+
const rootCs = getComputedStyle(root);
|
|
3723
|
+
const namesIn = (text) => {
|
|
3724
|
+
const found = [];
|
|
3725
|
+
const re = /var\(\s*(--[A-Za-z0-9_-]+)/g;
|
|
3726
|
+
let m;
|
|
3727
|
+
while ((m = re.exec(text)) !== null) found.push(m[1]);
|
|
3728
|
+
return found;
|
|
3729
|
+
};
|
|
3730
|
+
const queue = [];
|
|
3731
|
+
for (const decl of declarations) queue.push(...namesIn(decl));
|
|
3732
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3733
|
+
while (queue.length > 0) {
|
|
3734
|
+
const name = queue.shift();
|
|
3735
|
+
if (seen.has(name)) continue;
|
|
3736
|
+
seen.add(name);
|
|
3737
|
+
const val = rootCs.getPropertyValue(name).trim();
|
|
3738
|
+
if (!val) continue;
|
|
3739
|
+
defs.set(name, val);
|
|
3740
|
+
queue.push(...namesIn(val));
|
|
3741
|
+
}
|
|
3742
|
+
return defs;
|
|
3743
|
+
}
|
|
3744
|
+
function serializeWithComputedStyles(root) {
|
|
3745
|
+
if (typeof window === "undefined" || typeof getComputedStyle === "undefined") {
|
|
3746
|
+
return formatHtml(root.outerHTML);
|
|
3747
|
+
}
|
|
3748
|
+
const reader = createDefaultsReader();
|
|
3749
|
+
if (!reader) return formatHtml(root.outerHTML);
|
|
3750
|
+
try {
|
|
3751
|
+
const classToCss = collectClassRules(root);
|
|
3752
|
+
const usage = /* @__PURE__ */ new Map();
|
|
3753
|
+
const countWalk = (el) => {
|
|
3754
|
+
const raw = el.getAttribute("class");
|
|
3755
|
+
if (raw) {
|
|
3756
|
+
for (const cls of new Set(raw.trim().split(/\s+/))) {
|
|
3757
|
+
usage.set(cls, (usage.get(cls) ?? 0) + 1);
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
for (const kid of el.children) countWalk(kid);
|
|
3761
|
+
};
|
|
3762
|
+
countWalk(root);
|
|
3763
|
+
const clone = root.cloneNode(true);
|
|
3764
|
+
let count = 0;
|
|
3765
|
+
let truncated = 0;
|
|
3766
|
+
const walk = (o, c, parent) => {
|
|
3767
|
+
if (count >= MAX_NODES) {
|
|
3768
|
+
truncated++;
|
|
3769
|
+
return;
|
|
3770
|
+
}
|
|
3771
|
+
count++;
|
|
3772
|
+
inlineStyles(o, c, parent, reader.defaultsFor);
|
|
3773
|
+
const raw = o.getAttribute("class");
|
|
3774
|
+
if (raw) {
|
|
3775
|
+
const parts = [];
|
|
3776
|
+
for (const cls of raw.trim().split(/\s+/)) {
|
|
3777
|
+
const decl = classToCss.get(cls);
|
|
3778
|
+
if (decl && usage.get(cls) === 1) parts.push(`.${cls} { ${decl} }`);
|
|
3779
|
+
}
|
|
3780
|
+
if (parts.length > 0) {
|
|
3781
|
+
const comment = c.ownerDocument.createComment(` ${parts.join(" ")} `);
|
|
3782
|
+
c.insertBefore(comment, c.firstChild);
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
const oKids = o.children;
|
|
3786
|
+
const cKids = c.children;
|
|
3787
|
+
for (let i = 0; i < oKids.length; i++) {
|
|
3788
|
+
const ok = oKids[i];
|
|
3789
|
+
const ck = cKids[i];
|
|
3790
|
+
if (ok && ck) walk(ok, ck, o);
|
|
3791
|
+
}
|
|
3792
|
+
};
|
|
3793
|
+
walk(root, clone, null);
|
|
3794
|
+
if (truncated > 0) {
|
|
3795
|
+
console.warn(
|
|
3796
|
+
`[render-picker] copie reproductible : ${truncated} n\u0153ud(s) au-del\xE0 de ${MAX_NODES} non stylis\xE9s.`
|
|
3797
|
+
);
|
|
3798
|
+
}
|
|
3799
|
+
const html = formatHtml(clone.outerHTML);
|
|
3800
|
+
const globalLines = [];
|
|
3801
|
+
for (const [cls, decl] of classToCss) {
|
|
3802
|
+
if ((usage.get(cls) ?? 0) >= 2) globalLines.push(` .${cls} { ${decl} }`);
|
|
3803
|
+
}
|
|
3804
|
+
let out = html;
|
|
3805
|
+
if (globalLines.length > 0) {
|
|
3806
|
+
out += `
|
|
3807
|
+
|
|
3808
|
+
<!-- Classes globales (utilis\xE9es sur plusieurs balises)
|
|
3809
|
+
${globalLines.join("\n")}
|
|
3810
|
+
-->`;
|
|
3811
|
+
}
|
|
3812
|
+
const stateRules = collectStateRules(root);
|
|
3813
|
+
if (stateRules.size > 0) {
|
|
3814
|
+
const styleLines = Array.from(
|
|
3815
|
+
stateRules,
|
|
3816
|
+
([selector, decl]) => ` ${selector} { ${withImportant(resolveVarsIn(decl, root))} }`
|
|
3817
|
+
);
|
|
3818
|
+
out += `
|
|
3819
|
+
|
|
3820
|
+
<style>
|
|
3821
|
+
${styleLines.join("\n")}
|
|
3822
|
+
</style>`;
|
|
3823
|
+
}
|
|
3824
|
+
const defs = collectVarDefs(
|
|
3825
|
+
[...classToCss.values(), ...stateRules.values()],
|
|
3826
|
+
root
|
|
3827
|
+
);
|
|
3828
|
+
if (defs.size > 0) {
|
|
3829
|
+
const varLines = Array.from(defs, ([name, val]) => ` ${name}: ${val}`);
|
|
3830
|
+
out += `
|
|
3831
|
+
|
|
3832
|
+
<!-- Variables CSS
|
|
3833
|
+
${varLines.join("\n")}
|
|
3834
|
+
-->`;
|
|
3835
|
+
}
|
|
3836
|
+
return out;
|
|
3837
|
+
} finally {
|
|
3838
|
+
reader.destroy();
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3854
3842
|
// src/ui/context-menu.tsx
|
|
3855
3843
|
var import_react2 = require("react");
|
|
3844
|
+
var import_react_dom2 = require("react-dom");
|
|
3856
3845
|
|
|
3857
3846
|
// src/ui/icons.tsx
|
|
3858
3847
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
3859
|
-
function CrosshairIcon({ color }) {
|
|
3848
|
+
function CrosshairIcon({ color, size = 12 }) {
|
|
3860
3849
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
3861
3850
|
"svg",
|
|
3862
3851
|
{
|
|
3863
|
-
width:
|
|
3864
|
-
height:
|
|
3852
|
+
width: size,
|
|
3853
|
+
height: size,
|
|
3865
3854
|
viewBox: "0 0 24 24",
|
|
3866
3855
|
fill: "none",
|
|
3867
3856
|
stroke: color,
|
|
@@ -4298,6 +4287,44 @@ function TrashIcon({ color = "#f87171" }) {
|
|
|
4298
4287
|
}
|
|
4299
4288
|
);
|
|
4300
4289
|
}
|
|
4290
|
+
var GripIcon = ({ size = 14 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
4291
|
+
"svg",
|
|
4292
|
+
{
|
|
4293
|
+
width: size,
|
|
4294
|
+
height: size,
|
|
4295
|
+
viewBox: "0 0 24 24",
|
|
4296
|
+
fill: "none",
|
|
4297
|
+
stroke: "currentColor",
|
|
4298
|
+
strokeWidth: "2",
|
|
4299
|
+
strokeLinecap: "round",
|
|
4300
|
+
strokeLinejoin: "round",
|
|
4301
|
+
"aria-hidden": "true",
|
|
4302
|
+
children: [
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9", cy: "12", r: "1" }),
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9", cy: "5", r: "1" }),
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9", cy: "19", r: "1" }),
|
|
4306
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "15", cy: "12", r: "1" }),
|
|
4307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "15", cy: "5", r: "1" }),
|
|
4308
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "15", cy: "19", r: "1" })
|
|
4309
|
+
]
|
|
4310
|
+
}
|
|
4311
|
+
);
|
|
4312
|
+
var MoreIcon = ({ size = 14 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
4313
|
+
"svg",
|
|
4314
|
+
{
|
|
4315
|
+
width: size,
|
|
4316
|
+
height: size,
|
|
4317
|
+
viewBox: "0 0 24 24",
|
|
4318
|
+
fill: "currentColor",
|
|
4319
|
+
stroke: "none",
|
|
4320
|
+
"aria-hidden": "true",
|
|
4321
|
+
children: [
|
|
4322
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
|
|
4323
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "1.75" }),
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "19", cy: "12", r: "1.75" })
|
|
4325
|
+
]
|
|
4326
|
+
}
|
|
4327
|
+
);
|
|
4301
4328
|
|
|
4302
4329
|
// src/ui/tooltip.tsx
|
|
4303
4330
|
var import_react = require("react");
|
|
@@ -4435,7 +4462,12 @@ var PANEL_W = 200;
|
|
|
4435
4462
|
var SUBMENU_W = 210;
|
|
4436
4463
|
var SUBMENU_GAP = 4;
|
|
4437
4464
|
var SUBMENU_CLOSE_DELAY_MS = 200;
|
|
4438
|
-
var ContextMenu = ({
|
|
4465
|
+
var ContextMenu = ({
|
|
4466
|
+
at,
|
|
4467
|
+
onClose,
|
|
4468
|
+
items,
|
|
4469
|
+
attr
|
|
4470
|
+
}) => {
|
|
4439
4471
|
const ref = (0, import_react2.useRef)(null);
|
|
4440
4472
|
const onCloseRef = (0, import_react2.useRef)(onClose);
|
|
4441
4473
|
onCloseRef.current = onClose;
|
|
@@ -4483,7 +4515,8 @@ var ContextMenu = ({ at, onClose, items }) => {
|
|
|
4483
4515
|
return () => {
|
|
4484
4516
|
window.removeEventListener("scroll", onChange, true);
|
|
4485
4517
|
window.removeEventListener("resize", onChange);
|
|
4486
|
-
if (frame && typeof cancelAnimationFrame === "function")
|
|
4518
|
+
if (frame && typeof cancelAnimationFrame === "function")
|
|
4519
|
+
cancelAnimationFrame(frame);
|
|
4487
4520
|
};
|
|
4488
4521
|
}, [at]);
|
|
4489
4522
|
(0, import_react2.useEffect)(() => {
|
|
@@ -4543,164 +4576,202 @@ var ContextMenu = ({ at, onClose, items }) => {
|
|
|
4543
4576
|
};
|
|
4544
4577
|
}, [at]);
|
|
4545
4578
|
if (!at) return null;
|
|
4579
|
+
const extra = attr ? { [attr]: "" } : {};
|
|
4546
4580
|
const vw = window.innerWidth;
|
|
4547
4581
|
const vh = window.innerHeight;
|
|
4548
4582
|
const { dx, dy } = shift?.at === at ? shift : { dx: 0, dy: 0 };
|
|
4549
4583
|
const left = Math.max(8, Math.min(at.x, vw - PANEL_W - 8)) + dx;
|
|
4550
|
-
let topBase;
|
|
4551
|
-
if (at.y + panelHeight <= vh - 8) {
|
|
4552
|
-
topBase = at.y;
|
|
4553
|
-
} else if (at.y - panelHeight >= 8) {
|
|
4554
|
-
topBase = at.y - panelHeight;
|
|
4555
|
-
} else {
|
|
4556
|
-
topBase = Math.max(8, vh - panelHeight - 8);
|
|
4557
|
-
}
|
|
4558
|
-
const top = topBase + dy;
|
|
4559
|
-
const submenuOnLeft = left + PANEL_W + SUBMENU_GAP + SUBMENU_W > vw - 8;
|
|
4560
|
-
return
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: {
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4584
|
+
let topBase;
|
|
4585
|
+
if (at.y + panelHeight <= vh - 8) {
|
|
4586
|
+
topBase = at.y;
|
|
4587
|
+
} else if (at.y - panelHeight >= 8) {
|
|
4588
|
+
topBase = at.y - panelHeight;
|
|
4589
|
+
} else {
|
|
4590
|
+
topBase = Math.max(8, vh - panelHeight - 8);
|
|
4591
|
+
}
|
|
4592
|
+
const top = topBase + dy;
|
|
4593
|
+
const submenuOnLeft = left + PANEL_W + SUBMENU_GAP + SUBMENU_W > vw - 8;
|
|
4594
|
+
return (0, import_react_dom2.createPortal)(
|
|
4595
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4596
|
+
"div",
|
|
4597
|
+
{
|
|
4598
|
+
ref,
|
|
4599
|
+
"data-pathpicker-ignore": "",
|
|
4600
|
+
"data-rp-contextmenu": "",
|
|
4601
|
+
...extra,
|
|
4602
|
+
style: {
|
|
4603
|
+
position: "fixed",
|
|
4604
|
+
left,
|
|
4605
|
+
top,
|
|
4606
|
+
zIndex: UI_Z + 10,
|
|
4607
|
+
width: PANEL_W,
|
|
4608
|
+
background: ELEVATED_BG,
|
|
4609
|
+
border: "1px solid rgba(255,255,255,0.08)",
|
|
4610
|
+
borderRadius: 8,
|
|
4611
|
+
boxShadow: CARD_SHADOW,
|
|
4612
|
+
padding: 4,
|
|
4613
|
+
display: "flex",
|
|
4614
|
+
flexDirection: "column",
|
|
4615
|
+
transformOrigin: "top left"
|
|
4616
|
+
},
|
|
4617
|
+
children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4618
|
+
"div",
|
|
4619
|
+
{
|
|
4620
|
+
style: { position: "relative" },
|
|
4621
|
+
onMouseEnter: () => {
|
|
4622
|
+
if (item.submenu && !item.disabled) openSubmenu(i);
|
|
4623
|
+
},
|
|
4624
|
+
onMouseLeave: () => {
|
|
4625
|
+
if (item.submenu) scheduleCloseSubmenu(i);
|
|
4626
|
+
},
|
|
4627
|
+
children: [
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4629
|
+
"button",
|
|
4630
|
+
{
|
|
4631
|
+
type: "button",
|
|
4632
|
+
disabled: item.disabled,
|
|
4633
|
+
onClick: () => {
|
|
4634
|
+
if (!item.disabled) item.onClick();
|
|
4635
|
+
},
|
|
4636
|
+
onMouseEnter: (e) => {
|
|
4637
|
+
if (!item.disabled) e.currentTarget.style.background = HOVER_BG;
|
|
4638
|
+
},
|
|
4639
|
+
onMouseLeave: (e) => {
|
|
4640
|
+
e.currentTarget.style.background = "transparent";
|
|
4641
|
+
},
|
|
4642
|
+
style: {
|
|
4643
|
+
display: "flex",
|
|
4644
|
+
alignItems: "flex-start",
|
|
4645
|
+
gap: 8,
|
|
4646
|
+
width: "100%",
|
|
4647
|
+
padding: "5px 8px",
|
|
4648
|
+
borderRadius: 6,
|
|
4649
|
+
cursor: item.disabled ? "default" : "pointer",
|
|
4650
|
+
color: item.danger ? "#f87171" : "#fff",
|
|
4651
|
+
background: "transparent",
|
|
4652
|
+
border: "none",
|
|
4653
|
+
textAlign: "left",
|
|
4654
|
+
fontFamily: "system-ui, sans-serif",
|
|
4655
|
+
opacity: item.disabled ? 0.4 : 1
|
|
4656
|
+
},
|
|
4657
|
+
children: [
|
|
4658
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { flexShrink: 0, display: "block" }, children: item.icon }),
|
|
4659
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4660
|
+
"span",
|
|
4661
|
+
{
|
|
4662
|
+
style: { display: "flex", flexDirection: "column", minWidth: 0 },
|
|
4663
|
+
children: [
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4665
|
+
"span",
|
|
4666
|
+
{
|
|
4667
|
+
style: { fontSize: 11, fontWeight: 500, whiteSpace: "nowrap" },
|
|
4668
|
+
children: item.label
|
|
4669
|
+
}
|
|
4670
|
+
),
|
|
4671
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: 10, color: MUTED, marginTop: 1 }, children: item.description })
|
|
4672
|
+
]
|
|
4673
|
+
}
|
|
4674
|
+
),
|
|
4675
|
+
item.info && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4676
|
+
"span",
|
|
4677
|
+
{
|
|
4678
|
+
style: {
|
|
4679
|
+
marginLeft: "auto",
|
|
4680
|
+
alignSelf: "center",
|
|
4681
|
+
display: "flex"
|
|
4682
|
+
},
|
|
4683
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
4684
|
+
onClick: (e) => e.stopPropagation(),
|
|
4685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Tooltip, { content: item.info, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InfoIcon, {}) })
|
|
4686
|
+
}
|
|
4687
|
+
),
|
|
4688
|
+
item.submenu && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4689
|
+
"span",
|
|
4690
|
+
{
|
|
4691
|
+
style: {
|
|
4692
|
+
marginLeft: "auto",
|
|
4693
|
+
alignSelf: "center",
|
|
4694
|
+
display: "flex"
|
|
4695
|
+
},
|
|
4696
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4697
|
+
ChevronIcon,
|
|
4698
|
+
{
|
|
4699
|
+
dir: submenuOnLeft ? "left" : "right",
|
|
4700
|
+
color: MUTED
|
|
4701
|
+
}
|
|
4702
|
+
)
|
|
4703
|
+
}
|
|
4704
|
+
)
|
|
4705
|
+
]
|
|
4706
|
+
}
|
|
4707
|
+
),
|
|
4708
|
+
item.submenu && submenuIndex === i && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4709
|
+
"div",
|
|
4710
|
+
{
|
|
4711
|
+
"data-pathpicker-ignore": "",
|
|
4712
|
+
"data-rp-contextmenu": "",
|
|
4713
|
+
...extra,
|
|
4714
|
+
onMouseEnter: () => openSubmenu(i),
|
|
4715
|
+
onMouseLeave: () => scheduleCloseSubmenu(i),
|
|
4716
|
+
style: {
|
|
4717
|
+
position: "absolute",
|
|
4718
|
+
// Compense le padding (4px) de ce panneau : aligne le 1er item du flyout
|
|
4719
|
+
// avec la ligne déclenchante plutôt que 4px plus bas.
|
|
4720
|
+
top: -4,
|
|
4721
|
+
...submenuOnLeft ? { right: `calc(100% + ${SUBMENU_GAP}px)` } : { left: `calc(100% + ${SUBMENU_GAP}px)` },
|
|
4722
|
+
width: SUBMENU_W,
|
|
4723
|
+
background: ELEVATED_BG,
|
|
4724
|
+
border: "1px solid rgba(255,255,255,0.08)",
|
|
4725
|
+
borderRadius: 8,
|
|
4726
|
+
boxShadow: CARD_SHADOW,
|
|
4727
|
+
padding: 4,
|
|
4728
|
+
display: "flex",
|
|
4729
|
+
flexDirection: "column"
|
|
4730
|
+
},
|
|
4731
|
+
children: item.submenu.map((sub, j) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4732
|
+
"button",
|
|
4629
4733
|
{
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
display: "flex",
|
|
4660
|
-
flexDirection: "column"
|
|
4661
|
-
},
|
|
4662
|
-
children: item.submenu.map((sub, j) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4663
|
-
"button",
|
|
4664
|
-
{
|
|
4665
|
-
type: "button",
|
|
4666
|
-
onClick: () => sub.onClick(),
|
|
4667
|
-
onMouseEnter: (e) => {
|
|
4668
|
-
e.currentTarget.style.background = HOVER_BG;
|
|
4669
|
-
},
|
|
4670
|
-
onMouseLeave: (e) => {
|
|
4671
|
-
e.currentTarget.style.background = "transparent";
|
|
4672
|
-
},
|
|
4673
|
-
style: {
|
|
4674
|
-
display: "flex",
|
|
4675
|
-
alignItems: "center",
|
|
4676
|
-
gap: 8,
|
|
4677
|
-
width: "100%",
|
|
4678
|
-
padding: "5px 8px",
|
|
4679
|
-
borderRadius: 6,
|
|
4680
|
-
cursor: "pointer",
|
|
4681
|
-
color: "#fff",
|
|
4682
|
-
background: "transparent",
|
|
4683
|
-
border: "none",
|
|
4684
|
-
textAlign: "left",
|
|
4685
|
-
fontFamily: "system-ui, sans-serif",
|
|
4686
|
-
fontSize: 11,
|
|
4687
|
-
fontWeight: 500,
|
|
4688
|
-
whiteSpace: "nowrap"
|
|
4734
|
+
type: "button",
|
|
4735
|
+
onClick: () => sub.onClick(),
|
|
4736
|
+
onMouseEnter: (e) => {
|
|
4737
|
+
e.currentTarget.style.background = HOVER_BG;
|
|
4738
|
+
},
|
|
4739
|
+
onMouseLeave: (e) => {
|
|
4740
|
+
e.currentTarget.style.background = "transparent";
|
|
4741
|
+
},
|
|
4742
|
+
style: {
|
|
4743
|
+
display: "flex",
|
|
4744
|
+
alignItems: "center",
|
|
4745
|
+
gap: 8,
|
|
4746
|
+
width: "100%",
|
|
4747
|
+
padding: "5px 8px",
|
|
4748
|
+
borderRadius: 6,
|
|
4749
|
+
cursor: "pointer",
|
|
4750
|
+
color: "#fff",
|
|
4751
|
+
background: "transparent",
|
|
4752
|
+
border: "none",
|
|
4753
|
+
textAlign: "left",
|
|
4754
|
+
fontFamily: "system-ui, sans-serif",
|
|
4755
|
+
fontSize: 11,
|
|
4756
|
+
fontWeight: 500,
|
|
4757
|
+
whiteSpace: "nowrap"
|
|
4758
|
+
},
|
|
4759
|
+
children: [
|
|
4760
|
+
sub.icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { flexShrink: 0, display: "block" }, children: sub.icon }),
|
|
4761
|
+
sub.label
|
|
4762
|
+
]
|
|
4689
4763
|
},
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
i
|
|
4702
|
-
))
|
|
4703
|
-
}
|
|
4764
|
+
j
|
|
4765
|
+
))
|
|
4766
|
+
}
|
|
4767
|
+
)
|
|
4768
|
+
]
|
|
4769
|
+
},
|
|
4770
|
+
i
|
|
4771
|
+
))
|
|
4772
|
+
}
|
|
4773
|
+
),
|
|
4774
|
+
document.body
|
|
4704
4775
|
);
|
|
4705
4776
|
};
|
|
4706
4777
|
|
|
@@ -5120,33 +5191,241 @@ var HtmlTree = () => {
|
|
|
5120
5191
|
);
|
|
5121
5192
|
};
|
|
5122
5193
|
|
|
5123
|
-
// src/ui/
|
|
5194
|
+
// src/ui/use-movable.ts
|
|
5124
5195
|
var import_react4 = require("react");
|
|
5125
5196
|
|
|
5126
|
-
// src/core/
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5197
|
+
// src/core/movable.ts
|
|
5198
|
+
var ZERO_OFFSET = { x: 0, y: 0 };
|
|
5199
|
+
function isZeroOffset(offset) {
|
|
5200
|
+
return offset.x === 0 && offset.y === 0;
|
|
5201
|
+
}
|
|
5202
|
+
function clampAxis(start, length, max, margin) {
|
|
5203
|
+
const hi = max - margin - length;
|
|
5204
|
+
if (hi < margin) return margin;
|
|
5205
|
+
return Math.min(Math.max(start, margin), hi);
|
|
5206
|
+
}
|
|
5207
|
+
function clampOffset(offset, home, viewport2, margin) {
|
|
5208
|
+
return {
|
|
5209
|
+
x: clampAxis(home.x + offset.x, home.width, viewport2.width, margin) - home.x,
|
|
5210
|
+
y: clampAxis(home.y + offset.y, home.height, viewport2.height, margin) - home.y
|
|
5211
|
+
};
|
|
5212
|
+
}
|
|
5213
|
+
function isOverHome(rect, home, tolerance, minOverlap) {
|
|
5214
|
+
const area = rect.width * rect.height;
|
|
5215
|
+
if (area <= 0) return false;
|
|
5216
|
+
const w = Math.min(rect.x + rect.width, home.x + home.width + tolerance) - Math.max(rect.x, home.x - tolerance);
|
|
5217
|
+
const h = Math.min(rect.y + rect.height, home.y + home.height + tolerance) - Math.max(rect.y, home.y - tolerance);
|
|
5218
|
+
if (w <= 0 || h <= 0) return false;
|
|
5219
|
+
return w * h / area >= minOverlap;
|
|
5220
|
+
}
|
|
5221
|
+
function exceedsThreshold(start, current2, threshold) {
|
|
5222
|
+
return Math.hypot(current2.x - start.x, current2.y - start.y) >= threshold;
|
|
5223
|
+
}
|
|
5224
|
+
function positionKey(id) {
|
|
5225
|
+
return MOVE_STORAGE_PREFIX + id;
|
|
5226
|
+
}
|
|
5227
|
+
function parseOffset(raw) {
|
|
5228
|
+
if (!raw) return null;
|
|
5132
5229
|
try {
|
|
5133
|
-
const
|
|
5134
|
-
if (
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
console.log(result);
|
|
5142
|
-
} catch (e) {
|
|
5143
|
-
console.error(e);
|
|
5230
|
+
const value = JSON.parse(raw);
|
|
5231
|
+
if (typeof value !== "object" || value === null) return null;
|
|
5232
|
+
const { x, y } = value;
|
|
5233
|
+
if (typeof x !== "number" || typeof y !== "number") return null;
|
|
5234
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
|
|
5235
|
+
return { x, y };
|
|
5236
|
+
} catch {
|
|
5237
|
+
return null;
|
|
5144
5238
|
}
|
|
5145
5239
|
}
|
|
5146
|
-
function
|
|
5147
|
-
|
|
5240
|
+
function loadOffset(id) {
|
|
5241
|
+
try {
|
|
5242
|
+
return parseOffset(window.localStorage.getItem(positionKey(id)));
|
|
5243
|
+
} catch {
|
|
5244
|
+
return null;
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
function saveOffset(id, offset) {
|
|
5248
|
+
if (isZeroOffset(offset)) {
|
|
5249
|
+
clearOffset(id);
|
|
5250
|
+
return;
|
|
5251
|
+
}
|
|
5252
|
+
try {
|
|
5253
|
+
window.localStorage.setItem(positionKey(id), JSON.stringify({ x: offset.x, y: offset.y }));
|
|
5254
|
+
} catch {
|
|
5255
|
+
}
|
|
5256
|
+
}
|
|
5257
|
+
function clearOffset(id) {
|
|
5258
|
+
try {
|
|
5259
|
+
window.localStorage.removeItem(positionKey(id));
|
|
5260
|
+
} catch {
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
function prefersReducedMotion() {
|
|
5264
|
+
try {
|
|
5265
|
+
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
5266
|
+
} catch {
|
|
5267
|
+
return false;
|
|
5268
|
+
}
|
|
5269
|
+
}
|
|
5270
|
+
|
|
5271
|
+
// src/ui/use-movable.ts
|
|
5272
|
+
function viewport() {
|
|
5273
|
+
return { width: window.innerWidth, height: window.innerHeight };
|
|
5274
|
+
}
|
|
5275
|
+
function homeOf(el, offset) {
|
|
5276
|
+
if (!el) return null;
|
|
5277
|
+
const r = el.getBoundingClientRect();
|
|
5278
|
+
return {
|
|
5279
|
+
x: r.left - offset.x,
|
|
5280
|
+
y: r.top - offset.y,
|
|
5281
|
+
width: r.width,
|
|
5282
|
+
height: r.height
|
|
5283
|
+
};
|
|
5284
|
+
}
|
|
5285
|
+
function useMovable(id, { returnHome = true } = {}) {
|
|
5286
|
+
const ref = (0, import_react4.useRef)(null);
|
|
5287
|
+
const [offset, setOffset] = (0, import_react4.useState)(
|
|
5288
|
+
() => loadOffset(id) ?? ZERO_OFFSET
|
|
5289
|
+
);
|
|
5290
|
+
const [home, setHome] = (0, import_react4.useState)(null);
|
|
5291
|
+
const [overHome, setOverHome] = (0, import_react4.useState)(false);
|
|
5292
|
+
const [returning, setReturning] = (0, import_react4.useState)(false);
|
|
5293
|
+
const offsetRef = (0, import_react4.useRef)(offset);
|
|
5294
|
+
offsetRef.current = offset;
|
|
5295
|
+
const stopRef = (0, import_react4.useRef)(null);
|
|
5296
|
+
const returnTimer = (0, import_react4.useRef)(null);
|
|
5297
|
+
const apply = (next) => {
|
|
5298
|
+
offsetRef.current = next;
|
|
5299
|
+
setOffset(next);
|
|
5300
|
+
};
|
|
5301
|
+
const cancelReturn = () => {
|
|
5302
|
+
if (returnTimer.current) clearTimeout(returnTimer.current);
|
|
5303
|
+
returnTimer.current = null;
|
|
5304
|
+
setReturning(false);
|
|
5305
|
+
};
|
|
5306
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
5307
|
+
const fit = () => {
|
|
5308
|
+
const current2 = offsetRef.current;
|
|
5309
|
+
if (isZeroOffset(current2) || stopRef.current) return;
|
|
5310
|
+
const h = homeOf(ref.current, current2);
|
|
5311
|
+
if (!h) return;
|
|
5312
|
+
const next = clampOffset(current2, h, viewport(), MOVE_VIEWPORT_MARGIN);
|
|
5313
|
+
if (next.x !== current2.x || next.y !== current2.y) apply(next);
|
|
5314
|
+
};
|
|
5315
|
+
fit();
|
|
5316
|
+
window.addEventListener("resize", fit);
|
|
5317
|
+
return () => window.removeEventListener("resize", fit);
|
|
5318
|
+
}, []);
|
|
5319
|
+
(0, import_react4.useEffect)(
|
|
5320
|
+
() => () => {
|
|
5321
|
+
stopRef.current?.();
|
|
5322
|
+
if (returnTimer.current) clearTimeout(returnTimer.current);
|
|
5323
|
+
},
|
|
5324
|
+
[]
|
|
5325
|
+
);
|
|
5326
|
+
const onPointerDown = (0, import_react4.useCallback)(
|
|
5327
|
+
(e) => {
|
|
5328
|
+
if (e.button !== 0 || stopRef.current) return;
|
|
5329
|
+
const from = offsetRef.current;
|
|
5330
|
+
const h = homeOf(ref.current, from);
|
|
5331
|
+
if (!h) return;
|
|
5332
|
+
const handle = e.currentTarget;
|
|
5333
|
+
const pointerId = e.pointerId;
|
|
5334
|
+
const start = { x: e.clientX, y: e.clientY };
|
|
5335
|
+
const prevUserSelect = document.body.style.userSelect;
|
|
5336
|
+
let dragging = false;
|
|
5337
|
+
let over = false;
|
|
5338
|
+
let last = from;
|
|
5339
|
+
const move = (ev) => {
|
|
5340
|
+
if (ev.pointerId !== pointerId) return;
|
|
5341
|
+
const p = { x: ev.clientX, y: ev.clientY };
|
|
5342
|
+
if (!dragging) {
|
|
5343
|
+
if (!exceedsThreshold(start, p, MOVE_THRESHOLD_PX)) return;
|
|
5344
|
+
dragging = true;
|
|
5345
|
+
try {
|
|
5346
|
+
handle.setPointerCapture(pointerId);
|
|
5347
|
+
} catch {
|
|
5348
|
+
}
|
|
5349
|
+
document.body.style.userSelect = "none";
|
|
5350
|
+
cancelReturn();
|
|
5351
|
+
setHome(h);
|
|
5352
|
+
}
|
|
5353
|
+
ev.preventDefault();
|
|
5354
|
+
last = clampOffset(
|
|
5355
|
+
{ x: from.x + p.x - start.x, y: from.y + p.y - start.y },
|
|
5356
|
+
h,
|
|
5357
|
+
viewport(),
|
|
5358
|
+
MOVE_VIEWPORT_MARGIN
|
|
5359
|
+
);
|
|
5360
|
+
over = returnHome && isOverHome(
|
|
5361
|
+
{ ...h, x: h.x + last.x, y: h.y + last.y },
|
|
5362
|
+
h,
|
|
5363
|
+
MOVE_HOME_TOLERANCE,
|
|
5364
|
+
MOVE_HOME_OVERLAP
|
|
5365
|
+
);
|
|
5366
|
+
apply(last);
|
|
5367
|
+
setOverHome(over);
|
|
5368
|
+
};
|
|
5369
|
+
const stop = () => {
|
|
5370
|
+
window.removeEventListener("pointermove", move, true);
|
|
5371
|
+
window.removeEventListener("pointerup", end, true);
|
|
5372
|
+
window.removeEventListener("pointercancel", end, true);
|
|
5373
|
+
stopRef.current = null;
|
|
5374
|
+
if (!dragging) return;
|
|
5375
|
+
try {
|
|
5376
|
+
handle.releasePointerCapture(pointerId);
|
|
5377
|
+
} catch {
|
|
5378
|
+
}
|
|
5379
|
+
document.body.style.userSelect = prevUserSelect;
|
|
5380
|
+
setHome(null);
|
|
5381
|
+
setOverHome(false);
|
|
5382
|
+
};
|
|
5383
|
+
function end(ev) {
|
|
5384
|
+
if (ev.pointerId !== pointerId) return;
|
|
5385
|
+
const wasDragging = dragging;
|
|
5386
|
+
stop();
|
|
5387
|
+
if (!wasDragging) return;
|
|
5388
|
+
if (!over) {
|
|
5389
|
+
saveOffset(id, last);
|
|
5390
|
+
return;
|
|
5391
|
+
}
|
|
5392
|
+
clearOffset(id);
|
|
5393
|
+
if (!prefersReducedMotion()) {
|
|
5394
|
+
setReturning(true);
|
|
5395
|
+
returnTimer.current = setTimeout(() => {
|
|
5396
|
+
returnTimer.current = null;
|
|
5397
|
+
setReturning(false);
|
|
5398
|
+
}, MOVE_RETURN_MS);
|
|
5399
|
+
}
|
|
5400
|
+
apply(ZERO_OFFSET);
|
|
5401
|
+
}
|
|
5402
|
+
window.addEventListener("pointermove", move, true);
|
|
5403
|
+
window.addEventListener("pointerup", end, true);
|
|
5404
|
+
window.addEventListener("pointercancel", end, true);
|
|
5405
|
+
stopRef.current = stop;
|
|
5406
|
+
},
|
|
5407
|
+
[id, returnHome]
|
|
5408
|
+
);
|
|
5409
|
+
const moved = !isZeroOffset(offset);
|
|
5410
|
+
const style = {};
|
|
5411
|
+
if (moved || returning) style.translate = `${offset.x}px ${offset.y}px`;
|
|
5412
|
+
if (returning) style.transition = `translate ${MOVE_RETURN_MS}ms ease-out`;
|
|
5413
|
+
return {
|
|
5414
|
+
ref,
|
|
5415
|
+
style,
|
|
5416
|
+
handleProps: {
|
|
5417
|
+
onPointerDown,
|
|
5418
|
+
style: { touchAction: "none", cursor: home ? "grabbing" : "grab" }
|
|
5419
|
+
},
|
|
5420
|
+
home: returnHome ? home : null,
|
|
5421
|
+
overHome,
|
|
5422
|
+
moved
|
|
5423
|
+
};
|
|
5148
5424
|
}
|
|
5149
5425
|
|
|
5426
|
+
// src/ui/dev-panel/console-tab.tsx
|
|
5427
|
+
var import_react5 = require("react");
|
|
5428
|
+
|
|
5150
5429
|
// src/ui/dev-panel/styles.ts
|
|
5151
5430
|
var LEVEL_COLOR = {
|
|
5152
5431
|
log: "#d4d4d8",
|
|
@@ -5180,13 +5459,14 @@ var plainBtn = {
|
|
|
5180
5459
|
fontFamily: "system-ui, sans-serif",
|
|
5181
5460
|
transition: "background-color 150ms, color 150ms, box-shadow 150ms"
|
|
5182
5461
|
};
|
|
5462
|
+
var PANEL_INSET = 80;
|
|
5183
5463
|
|
|
5184
5464
|
// src/ui/dev-panel/console-tab.tsx
|
|
5185
5465
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5186
|
-
var ConsoleTab = ({ logs: logs2 }) => {
|
|
5187
|
-
const [cmd, setCmd] = (0,
|
|
5188
|
-
const history = (0,
|
|
5189
|
-
const histIndex = (0,
|
|
5466
|
+
var ConsoleTab = ({ logs: logs2, onRun }) => {
|
|
5467
|
+
const [cmd, setCmd] = (0, import_react5.useState)("");
|
|
5468
|
+
const history = (0, import_react5.useRef)([]);
|
|
5469
|
+
const histIndex = (0, import_react5.useRef)(-1);
|
|
5190
5470
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
5191
5471
|
"div",
|
|
5192
5472
|
{
|
|
@@ -5200,12 +5480,16 @@ var ConsoleTab = ({ logs: logs2 }) => {
|
|
|
5200
5480
|
logs2.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5201
5481
|
"div",
|
|
5202
5482
|
{
|
|
5203
|
-
style: {
|
|
5483
|
+
style: {
|
|
5484
|
+
color: LEVEL_COLOR[l.level],
|
|
5485
|
+
whiteSpace: "pre-wrap",
|
|
5486
|
+
wordBreak: "break-all"
|
|
5487
|
+
},
|
|
5204
5488
|
children: l.text
|
|
5205
5489
|
},
|
|
5206
5490
|
i
|
|
5207
5491
|
)),
|
|
5208
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
5492
|
+
onRun && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
5209
5493
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { color: "#60a5fa" }, children: "\u203A" }),
|
|
5210
5494
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5211
5495
|
"input",
|
|
@@ -5223,7 +5507,7 @@ var ConsoleTab = ({ logs: logs2 }) => {
|
|
|
5223
5507
|
e.stopPropagation();
|
|
5224
5508
|
const code = cmd.trim();
|
|
5225
5509
|
if (!code) return;
|
|
5226
|
-
|
|
5510
|
+
onRun(code);
|
|
5227
5511
|
history.current.push(code);
|
|
5228
5512
|
histIndex.current = -1;
|
|
5229
5513
|
setCmd("");
|
|
@@ -5271,10 +5555,10 @@ var ConsoleTab = ({ logs: logs2 }) => {
|
|
|
5271
5555
|
};
|
|
5272
5556
|
|
|
5273
5557
|
// src/ui/dev-panel/network-tab.tsx
|
|
5274
|
-
var
|
|
5558
|
+
var import_react7 = require("react");
|
|
5275
5559
|
|
|
5276
5560
|
// src/ui/dev-panel/net-detail.tsx
|
|
5277
|
-
var
|
|
5561
|
+
var import_react6 = require("react");
|
|
5278
5562
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5279
5563
|
var statusColor = (r) => r.status === 0 ? "#f87171" : r.ok ? "#4ade80" : "#fde68a";
|
|
5280
5564
|
var durationColor = (ms) => ms < 100 ? "#4ade80" : ms < 500 ? "#fde68a" : "#f87171";
|
|
@@ -5381,7 +5665,7 @@ function Section({
|
|
|
5381
5665
|
] });
|
|
5382
5666
|
}
|
|
5383
5667
|
function CopyAllBtn({ onCopy }) {
|
|
5384
|
-
const [done, setDone] = (0,
|
|
5668
|
+
const [done, setDone] = (0, import_react6.useState)(false);
|
|
5385
5669
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5386
5670
|
"button",
|
|
5387
5671
|
{
|
|
@@ -5436,7 +5720,7 @@ var NetDetail = ({ r }) => {
|
|
|
5436
5720
|
if (r.reqBody) tabs.push({ id: "payload", label: "Payload" });
|
|
5437
5721
|
if (r.resBody) tabs.push({ id: "response", label: "Response" });
|
|
5438
5722
|
if (r.initiator) tabs.push({ id: "initiator", label: "Initiator" });
|
|
5439
|
-
const [sub, setSub] = (0,
|
|
5723
|
+
const [sub, setSub] = (0, import_react6.useState)("headers");
|
|
5440
5724
|
const active = tabs.some((t) => t.id === sub) ? sub : "headers";
|
|
5441
5725
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5442
5726
|
"div",
|
|
@@ -5534,7 +5818,7 @@ var NetDetail = ({ r }) => {
|
|
|
5534
5818
|
// src/ui/dev-panel/network-tab.tsx
|
|
5535
5819
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5536
5820
|
var NetworkTab = ({ requests: requests2 }) => {
|
|
5537
|
-
const [openRows, setOpenRows] = (0,
|
|
5821
|
+
const [openRows, setOpenRows] = (0, import_react7.useState)(() => /* @__PURE__ */ new Set());
|
|
5538
5822
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5539
5823
|
"div",
|
|
5540
5824
|
{
|
|
@@ -5578,23 +5862,22 @@ var NetworkTab = ({ requests: requests2 }) => {
|
|
|
5578
5862
|
);
|
|
5579
5863
|
};
|
|
5580
5864
|
|
|
5581
|
-
// src/ui/dev-panel/use-
|
|
5582
|
-
var
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
const [
|
|
5587
|
-
const
|
|
5588
|
-
const resize = (0,
|
|
5589
|
-
const sizeRef = (0,
|
|
5865
|
+
// src/ui/dev-panel/use-resize.ts
|
|
5866
|
+
var import_react8 = require("react");
|
|
5867
|
+
var MIN_WIDTH = 280;
|
|
5868
|
+
var MIN_HEIGHT = 140;
|
|
5869
|
+
function useResize(ref, initSize, onSizeChange) {
|
|
5870
|
+
const [width, setWidth] = (0, import_react8.useState)(initSize.width);
|
|
5871
|
+
const [height, setHeight] = (0, import_react8.useState)(initSize.height);
|
|
5872
|
+
const resize = (0, import_react8.useRef)(null);
|
|
5873
|
+
const sizeRef = (0, import_react8.useRef)({ width, height });
|
|
5590
5874
|
sizeRef.current = { width, height };
|
|
5591
|
-
const onSizeChangeRef = (0,
|
|
5875
|
+
const onSizeChangeRef = (0, import_react8.useRef)(onSizeChange);
|
|
5592
5876
|
onSizeChangeRef.current = onSizeChange;
|
|
5593
|
-
const posRef = (0, import_react7.useRef)(pos);
|
|
5594
|
-
posRef.current = pos;
|
|
5595
5877
|
const beginResize = (axis, cursor) => (e) => {
|
|
5596
5878
|
e.preventDefault();
|
|
5597
|
-
|
|
5879
|
+
const rect = ref.current?.getBoundingClientRect();
|
|
5880
|
+
resize.current = { axis, left: rect?.left ?? 0, top: rect?.top ?? 0 };
|
|
5598
5881
|
document.body.style.cursor = cursor;
|
|
5599
5882
|
document.body.style.userSelect = "none";
|
|
5600
5883
|
try {
|
|
@@ -5602,32 +5885,23 @@ function useDragResize(init, initSize, onSizeChange) {
|
|
|
5602
5885
|
} catch {
|
|
5603
5886
|
}
|
|
5604
5887
|
};
|
|
5605
|
-
|
|
5606
|
-
drag.current = { dx: e.clientX - posRef.current.x, dy: e.clientY - posRef.current.y };
|
|
5607
|
-
};
|
|
5608
|
-
(0, import_react7.useEffect)(() => {
|
|
5888
|
+
(0, import_react8.useEffect)(() => {
|
|
5609
5889
|
const onUp = () => {
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
onSizeChangeRef.current?.({ ...sizeRef.current });
|
|
5616
|
-
}
|
|
5890
|
+
if (!resize.current) return;
|
|
5891
|
+
resize.current = null;
|
|
5892
|
+
document.body.style.cursor = "";
|
|
5893
|
+
document.body.style.userSelect = "";
|
|
5894
|
+
onSizeChangeRef.current?.({ ...sizeRef.current });
|
|
5617
5895
|
};
|
|
5618
5896
|
const onMove = (e) => {
|
|
5619
|
-
|
|
5897
|
+
const r = resize.current;
|
|
5898
|
+
if (!r) return;
|
|
5899
|
+
if (e.buttons === 0) {
|
|
5620
5900
|
onUp();
|
|
5621
5901
|
return;
|
|
5622
5902
|
}
|
|
5623
|
-
|
|
5624
|
-
if (
|
|
5625
|
-
if (ax === "x" || ax === "xy") setWidth(Math.max(280, e.clientX - posRef.current.x));
|
|
5626
|
-
if (ax === "y" || ax === "xy") setHeight(Math.max(140, e.clientY - posRef.current.y));
|
|
5627
|
-
return;
|
|
5628
|
-
}
|
|
5629
|
-
if (!drag.current) return;
|
|
5630
|
-
setPos({ x: e.clientX - drag.current.dx, y: e.clientY - drag.current.dy });
|
|
5903
|
+
if (r.axis === "x" || r.axis === "xy") setWidth(Math.max(MIN_WIDTH, e.clientX - r.left));
|
|
5904
|
+
if (r.axis === "y" || r.axis === "xy") setHeight(Math.max(MIN_HEIGHT, e.clientY - r.top));
|
|
5631
5905
|
};
|
|
5632
5906
|
window.addEventListener("pointermove", onMove);
|
|
5633
5907
|
window.addEventListener("pointerup", onUp);
|
|
@@ -5637,37 +5911,44 @@ function useDragResize(init, initSize, onSizeChange) {
|
|
|
5637
5911
|
window.removeEventListener("pointerup", onUp);
|
|
5638
5912
|
window.removeEventListener("pointercancel", onUp);
|
|
5639
5913
|
};
|
|
5640
|
-
}, []);
|
|
5641
|
-
return {
|
|
5914
|
+
}, [ref]);
|
|
5915
|
+
return { width, height, beginResize };
|
|
5642
5916
|
}
|
|
5643
5917
|
|
|
5644
5918
|
// src/ui/dev-panel/dev-panel.tsx
|
|
5645
5919
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5646
|
-
var DevPanel = ({
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5920
|
+
var DevPanel = ({
|
|
5921
|
+
onClose,
|
|
5922
|
+
size,
|
|
5923
|
+
onSizeChange,
|
|
5924
|
+
onConsoleRun
|
|
5925
|
+
}) => {
|
|
5926
|
+
const [tab, setTab] = (0, import_react9.useState)("html");
|
|
5927
|
+
const movable = useMovable("panel", { returnHome: false });
|
|
5928
|
+
const { width, height, beginResize } = useResize(
|
|
5929
|
+
movable.ref,
|
|
5651
5930
|
{ width: size?.width ?? 420, height: size?.height ?? 320 },
|
|
5652
5931
|
onSizeChange
|
|
5653
5932
|
);
|
|
5654
|
-
const [, force] = (0,
|
|
5655
|
-
const bodyRef = (0,
|
|
5656
|
-
const atBottom = (0,
|
|
5933
|
+
const [, force] = (0, import_react9.useReducer)((n) => n + 1, 0);
|
|
5934
|
+
const bodyRef = (0, import_react9.useRef)(null);
|
|
5935
|
+
const atBottom = (0, import_react9.useRef)(true);
|
|
5657
5936
|
const { logs: logs2, requests: requests2 } = getState();
|
|
5658
5937
|
const copyAll = () => {
|
|
5659
|
-
const text = tab === "console" ? logs2.map((l) => l.text).join("\n") : requests2.map(
|
|
5938
|
+
const text = tab === "console" ? logs2.map((l) => l.text).join("\n") : requests2.map(
|
|
5939
|
+
(r) => `${r.status || "ERR"} ${r.method} ${r.url} ${r.durationMs}ms`
|
|
5940
|
+
).join("\n");
|
|
5660
5941
|
navigator.clipboard?.writeText(text).catch(() => {
|
|
5661
5942
|
});
|
|
5662
5943
|
};
|
|
5663
|
-
(0,
|
|
5664
|
-
(0,
|
|
5944
|
+
(0, import_react9.useEffect)(() => subscribe(force), []);
|
|
5945
|
+
(0, import_react9.useEffect)(() => {
|
|
5665
5946
|
const el = bodyRef.current;
|
|
5666
5947
|
if (el && atBottom.current) el.scrollTop = el.scrollHeight;
|
|
5667
5948
|
}, [logs2.length, requests2.length, tab]);
|
|
5668
|
-
(0,
|
|
5669
|
-
savePanelState({ tab
|
|
5670
|
-
}, [tab
|
|
5949
|
+
(0, import_react9.useEffect)(() => {
|
|
5950
|
+
savePanelState({ tab });
|
|
5951
|
+
}, [tab]);
|
|
5671
5952
|
const tabBtn = (id, label) => {
|
|
5672
5953
|
const on = tab === id;
|
|
5673
5954
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5691,15 +5972,16 @@ var DevPanel = ({ onClose, size, onSizeChange }) => {
|
|
|
5691
5972
|
}
|
|
5692
5973
|
);
|
|
5693
5974
|
};
|
|
5694
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5695
5976
|
"div",
|
|
5696
5977
|
{
|
|
5978
|
+
ref: movable.ref,
|
|
5697
5979
|
"data-pathpicker-ignore": "",
|
|
5698
5980
|
"data-rp-devpanel": "",
|
|
5699
5981
|
style: {
|
|
5700
5982
|
position: "fixed",
|
|
5701
|
-
top:
|
|
5702
|
-
left:
|
|
5983
|
+
top: PANEL_INSET,
|
|
5984
|
+
left: PANEL_INSET,
|
|
5703
5985
|
zIndex: UI_Z,
|
|
5704
5986
|
width,
|
|
5705
5987
|
height,
|
|
@@ -5713,26 +5995,35 @@ var DevPanel = ({ onClose, size, onSizeChange }) => {
|
|
|
5713
5995
|
boxShadow: CARD_SHADOW,
|
|
5714
5996
|
color: "#fff",
|
|
5715
5997
|
fontFamily: "system-ui, sans-serif",
|
|
5716
|
-
overflow: "hidden"
|
|
5998
|
+
overflow: "hidden",
|
|
5999
|
+
...movable.style
|
|
5717
6000
|
},
|
|
5718
6001
|
children: [
|
|
5719
6002
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5720
6003
|
"div",
|
|
5721
6004
|
{
|
|
5722
|
-
|
|
6005
|
+
"data-rp-move-handle": "",
|
|
6006
|
+
title: "Glisser pour d\xE9placer.",
|
|
6007
|
+
onPointerDown: movable.handleProps.onPointerDown,
|
|
5723
6008
|
style: {
|
|
6009
|
+
...movable.handleProps.style,
|
|
5724
6010
|
display: "flex",
|
|
5725
6011
|
alignItems: "center",
|
|
5726
6012
|
gap: 4,
|
|
5727
6013
|
padding: "6px 8px",
|
|
5728
6014
|
background: ELEVATED_BG,
|
|
5729
|
-
cursor: "move",
|
|
5730
6015
|
borderBottom: SECONDARY_BORDER
|
|
5731
6016
|
},
|
|
5732
6017
|
children: [
|
|
5733
6018
|
tabBtn("html", "HTML"),
|
|
5734
|
-
tabBtn(
|
|
5735
|
-
|
|
6019
|
+
tabBtn(
|
|
6020
|
+
"console",
|
|
6021
|
+
`Console${logs2.length ? ` (${logs2.length})` : ""}`
|
|
6022
|
+
),
|
|
6023
|
+
tabBtn(
|
|
6024
|
+
"network",
|
|
6025
|
+
`Network${requests2.length ? ` (${requests2.length})` : ""}`
|
|
6026
|
+
),
|
|
5736
6027
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { marginLeft: "auto" } }),
|
|
5737
6028
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5738
6029
|
"button",
|
|
@@ -5752,12 +6043,12 @@ var DevPanel = ({ onClose, size, onSizeChange }) => {
|
|
|
5752
6043
|
children: "Copier"
|
|
5753
6044
|
}
|
|
5754
6045
|
),
|
|
5755
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6046
|
+
tab === "console" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5756
6047
|
"button",
|
|
5757
6048
|
{
|
|
5758
6049
|
type: "button",
|
|
5759
6050
|
"aria-label": "Vider",
|
|
5760
|
-
onClick:
|
|
6051
|
+
onClick: clearLogs,
|
|
5761
6052
|
onMouseEnter: (e) => {
|
|
5762
6053
|
e.currentTarget.style.background = HOVER_BG;
|
|
5763
6054
|
e.currentTarget.style.color = "#fff";
|
|
@@ -5810,7 +6101,7 @@ var DevPanel = ({ onClose, size, onSizeChange }) => {
|
|
|
5810
6101
|
fontSize: 11
|
|
5811
6102
|
},
|
|
5812
6103
|
children: [
|
|
5813
|
-
tab === "console" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConsoleTab, { logs: logs2 }),
|
|
6104
|
+
tab === "console" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConsoleTab, { logs: logs2, onRun: onConsoleRun }),
|
|
5814
6105
|
tab === "network" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(NetworkTab, { requests: requests2 }),
|
|
5815
6106
|
tab === "html" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HtmlTree, {})
|
|
5816
6107
|
]
|
|
@@ -5874,11 +6165,11 @@ var DevPanel = ({ onClose, size, onSizeChange }) => {
|
|
|
5874
6165
|
)
|
|
5875
6166
|
]
|
|
5876
6167
|
}
|
|
5877
|
-
);
|
|
6168
|
+
) });
|
|
5878
6169
|
};
|
|
5879
6170
|
|
|
5880
6171
|
// src/ui/search/popover.tsx
|
|
5881
|
-
var
|
|
6172
|
+
var import_react13 = require("react");
|
|
5882
6173
|
|
|
5883
6174
|
// src/core/search/query-history.ts
|
|
5884
6175
|
var MAX_HISTORY = 100;
|
|
@@ -5915,15 +6206,227 @@ function makeQueryHistory(initial = "") {
|
|
|
5915
6206
|
canRedo() {
|
|
5916
6207
|
return cursor < stack.length - 1;
|
|
5917
6208
|
}
|
|
5918
|
-
};
|
|
5919
|
-
}
|
|
6209
|
+
};
|
|
6210
|
+
}
|
|
6211
|
+
|
|
6212
|
+
// src/core/search/page-click.ts
|
|
6213
|
+
var TRAILING_EVENTS = ["mousedown", "pointerup", "mouseup", "click"];
|
|
6214
|
+
function initSearchPageClick(options) {
|
|
6215
|
+
const { onElement, onContextMenu, onEditor, covers } = options;
|
|
6216
|
+
let swallowing = false;
|
|
6217
|
+
let timer = null;
|
|
6218
|
+
const stop = (e) => {
|
|
6219
|
+
e.preventDefault();
|
|
6220
|
+
e.stopPropagation();
|
|
6221
|
+
e.stopImmediatePropagation();
|
|
6222
|
+
};
|
|
6223
|
+
const targetOf = (e) => {
|
|
6224
|
+
const path = e.composedPath?.() ?? [];
|
|
6225
|
+
const ui = path.some(
|
|
6226
|
+
(n) => n instanceof Element && (n.hasAttribute(IGNORE_ATTR) || n.hasAttribute(SEARCH_UI_ATTR))
|
|
6227
|
+
);
|
|
6228
|
+
if (ui) return null;
|
|
6229
|
+
if (typeof document.elementFromPoint === "function") return resolveTarget(e.clientX, e.clientY);
|
|
6230
|
+
const fallback = path[0] ?? e.target;
|
|
6231
|
+
return fallback instanceof Element ? fallback : null;
|
|
6232
|
+
};
|
|
6233
|
+
const swallowTrailing = () => {
|
|
6234
|
+
swallowing = true;
|
|
6235
|
+
if (timer) clearTimeout(timer);
|
|
6236
|
+
timer = setTimeout(() => {
|
|
6237
|
+
swallowing = false;
|
|
6238
|
+
}, SWALLOW_MS);
|
|
6239
|
+
};
|
|
6240
|
+
const onDown = (e) => {
|
|
6241
|
+
if (e.button !== 0 && e.button !== 2) return;
|
|
6242
|
+
const modified = e.ctrlKey || e.altKey || e.metaKey || e.shiftKey;
|
|
6243
|
+
const onHighlight = covers?.(e.clientX, e.clientY) ?? false;
|
|
6244
|
+
if ((e.button === 2 || modified) && !onHighlight) return;
|
|
6245
|
+
const target = targetOf(e);
|
|
6246
|
+
if (!target) return;
|
|
6247
|
+
stop(e);
|
|
6248
|
+
if (e.button === 2) return;
|
|
6249
|
+
swallowTrailing();
|
|
6250
|
+
const action = modified ? vscodeActionFor(e) : null;
|
|
6251
|
+
if (action && target instanceof HTMLElement && onEditor?.(target, action)) return;
|
|
6252
|
+
onElement(target);
|
|
6253
|
+
};
|
|
6254
|
+
const onMenu = (e) => {
|
|
6255
|
+
if (!covers?.(e.clientX, e.clientY)) return;
|
|
6256
|
+
const target = targetOf(e);
|
|
6257
|
+
if (!target) return;
|
|
6258
|
+
stop(e);
|
|
6259
|
+
onContextMenu?.(target, { x: e.clientX, y: e.clientY });
|
|
6260
|
+
};
|
|
6261
|
+
const onTrailing = (e) => {
|
|
6262
|
+
if (!swallowing) return;
|
|
6263
|
+
stop(e);
|
|
6264
|
+
if (e.type === "click") swallowing = false;
|
|
6265
|
+
};
|
|
6266
|
+
window.addEventListener("pointerdown", onDown, true);
|
|
6267
|
+
window.addEventListener("contextmenu", onMenu, true);
|
|
6268
|
+
for (const type of TRAILING_EVENTS) window.addEventListener(type, onTrailing, true);
|
|
6269
|
+
return () => {
|
|
6270
|
+
window.removeEventListener("pointerdown", onDown, true);
|
|
6271
|
+
window.removeEventListener("contextmenu", onMenu, true);
|
|
6272
|
+
for (const type of TRAILING_EVENTS) window.removeEventListener(type, onTrailing, true);
|
|
6273
|
+
if (timer) clearTimeout(timer);
|
|
6274
|
+
};
|
|
6275
|
+
}
|
|
6276
|
+
|
|
6277
|
+
// src/ui/control-frame.ts
|
|
6278
|
+
var CONTROL_FRAME = {
|
|
6279
|
+
display: "flex",
|
|
6280
|
+
alignItems: "center",
|
|
6281
|
+
gap: CONTROL_GAP,
|
|
6282
|
+
boxSizing: "border-box",
|
|
6283
|
+
padding: CONTROL_PADDING,
|
|
6284
|
+
background: ELEVATED_BG,
|
|
6285
|
+
border: CONTROL_BORDER,
|
|
6286
|
+
borderRadius: CONTROL_RADIUS
|
|
6287
|
+
};
|
|
6288
|
+
|
|
6289
|
+
// src/ui/icon-button.tsx
|
|
6290
|
+
var import_react10 = require("react");
|
|
6291
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6292
|
+
var TRANSITION = ["background-color", "box-shadow", "color"].map((prop) => `${prop} ${CONTROL_TRANSITION_MS}ms ease-in-out`).join(", ");
|
|
6293
|
+
function isFocusVisible(el) {
|
|
6294
|
+
try {
|
|
6295
|
+
return el.matches(":focus-visible");
|
|
6296
|
+
} catch {
|
|
6297
|
+
return false;
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
var IconButton = ({
|
|
6301
|
+
active = false,
|
|
6302
|
+
activeColor,
|
|
6303
|
+
children,
|
|
6304
|
+
style,
|
|
6305
|
+
type = "button",
|
|
6306
|
+
onMouseEnter,
|
|
6307
|
+
onMouseLeave,
|
|
6308
|
+
onFocus,
|
|
6309
|
+
onBlur,
|
|
6310
|
+
onPointerDown,
|
|
6311
|
+
onPointerUp,
|
|
6312
|
+
onPointerCancel,
|
|
6313
|
+
...rest
|
|
6314
|
+
}) => {
|
|
6315
|
+
const [hover, setHover] = (0, import_react10.useState)(false);
|
|
6316
|
+
const [focusRing, setFocusRing] = (0, import_react10.useState)(false);
|
|
6317
|
+
const [pressed, setPressed] = (0, import_react10.useState)(false);
|
|
6318
|
+
const filled = active && activeColor !== void 0;
|
|
6319
|
+
const lit = hover || active;
|
|
6320
|
+
const background = filled ? activeColor : lit ? HOVER_BG : "transparent";
|
|
6321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6322
|
+
"button",
|
|
6323
|
+
{
|
|
6324
|
+
type,
|
|
6325
|
+
...rest,
|
|
6326
|
+
onMouseEnter: (e) => {
|
|
6327
|
+
setHover(true);
|
|
6328
|
+
onMouseEnter?.(e);
|
|
6329
|
+
},
|
|
6330
|
+
onMouseLeave: (e) => {
|
|
6331
|
+
setHover(false);
|
|
6332
|
+
setPressed(false);
|
|
6333
|
+
onMouseLeave?.(e);
|
|
6334
|
+
},
|
|
6335
|
+
onFocus: (e) => {
|
|
6336
|
+
setFocusRing(isFocusVisible(e.currentTarget));
|
|
6337
|
+
onFocus?.(e);
|
|
6338
|
+
},
|
|
6339
|
+
onBlur: (e) => {
|
|
6340
|
+
setFocusRing(false);
|
|
6341
|
+
onBlur?.(e);
|
|
6342
|
+
},
|
|
6343
|
+
onPointerDown: (e) => {
|
|
6344
|
+
if (e.button === 0) setPressed(true);
|
|
6345
|
+
onPointerDown?.(e);
|
|
6346
|
+
},
|
|
6347
|
+
onPointerUp: (e) => {
|
|
6348
|
+
setPressed(false);
|
|
6349
|
+
onPointerUp?.(e);
|
|
6350
|
+
},
|
|
6351
|
+
onPointerCancel: (e) => {
|
|
6352
|
+
setPressed(false);
|
|
6353
|
+
onPointerCancel?.(e);
|
|
6354
|
+
},
|
|
6355
|
+
style: {
|
|
6356
|
+
display: "inline-flex",
|
|
6357
|
+
alignItems: "center",
|
|
6358
|
+
justifyContent: "center",
|
|
6359
|
+
flexShrink: 0,
|
|
6360
|
+
boxSizing: "border-box",
|
|
6361
|
+
width: ICON_BUTTON_SIZE,
|
|
6362
|
+
height: ICON_BUTTON_SIZE,
|
|
6363
|
+
margin: 0,
|
|
6364
|
+
padding: 0,
|
|
6365
|
+
border: "none",
|
|
6366
|
+
borderRadius: ICON_BUTTON_RADIUS,
|
|
6367
|
+
outline: "none",
|
|
6368
|
+
cursor: "pointer",
|
|
6369
|
+
background,
|
|
6370
|
+
color: filled || lit ? SUBTLE_FG_HOVER : SUBTLE_FG,
|
|
6371
|
+
boxShadow: focusRing ? FOCUS_RING : "none",
|
|
6372
|
+
transform: pressed ? `scale(${ICON_BUTTON_PRESSED_SCALE})` : void 0,
|
|
6373
|
+
transition: TRANSITION,
|
|
6374
|
+
...style
|
|
6375
|
+
},
|
|
6376
|
+
children
|
|
6377
|
+
}
|
|
6378
|
+
);
|
|
6379
|
+
};
|
|
6380
|
+
|
|
6381
|
+
// src/ui/move-handle.tsx
|
|
6382
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6383
|
+
var MoveHandle = ({ onPointerDown, style }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6384
|
+
IconButton,
|
|
6385
|
+
{
|
|
6386
|
+
"data-rp-move-handle": "",
|
|
6387
|
+
"aria-label": "D\xE9placer",
|
|
6388
|
+
title: "Glisser pour d\xE9placer. L\xE2cher sur l'encart pointill\xE9 pour remettre \xE0 sa place.",
|
|
6389
|
+
onPointerDown,
|
|
6390
|
+
style,
|
|
6391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GripIcon, {})
|
|
6392
|
+
}
|
|
6393
|
+
);
|
|
6394
|
+
|
|
6395
|
+
// src/ui/move-home-slot.tsx
|
|
6396
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6397
|
+
var MoveHomeSlot = ({ home, over, radius = CONTROL_RADIUS }) => {
|
|
6398
|
+
if (!home) return null;
|
|
6399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6400
|
+
"div",
|
|
6401
|
+
{
|
|
6402
|
+
...{ [IGNORE_ATTR]: "" },
|
|
6403
|
+
"data-rp-move-home": "",
|
|
6404
|
+
"data-active": over ? "" : void 0,
|
|
6405
|
+
"aria-hidden": "true",
|
|
6406
|
+
style: {
|
|
6407
|
+
position: "fixed",
|
|
6408
|
+
left: home.x,
|
|
6409
|
+
top: home.y,
|
|
6410
|
+
width: home.width,
|
|
6411
|
+
height: home.height,
|
|
6412
|
+
boxSizing: "border-box",
|
|
6413
|
+
border: over ? MOVE_HOME_BORDER_OVER : MOVE_HOME_BORDER,
|
|
6414
|
+
borderRadius: radius,
|
|
6415
|
+
background: over ? MOVE_HOME_BG_OVER : MOVE_HOME_BG,
|
|
6416
|
+
transition: `border-color ${CONTROL_TRANSITION_MS}ms, background-color ${CONTROL_TRANSITION_MS}ms`,
|
|
6417
|
+
pointerEvents: "none",
|
|
6418
|
+
zIndex: UI_Z
|
|
6419
|
+
}
|
|
6420
|
+
}
|
|
6421
|
+
);
|
|
6422
|
+
};
|
|
5920
6423
|
|
|
5921
6424
|
// src/ui/use-outside-close.ts
|
|
5922
|
-
var
|
|
6425
|
+
var import_react11 = require("react");
|
|
5923
6426
|
function useOutsideClose(attr, onClose) {
|
|
5924
|
-
const onCloseRef = (0,
|
|
6427
|
+
const onCloseRef = (0, import_react11.useRef)(onClose);
|
|
5925
6428
|
onCloseRef.current = onClose;
|
|
5926
|
-
(0,
|
|
6429
|
+
(0, import_react11.useEffect)(() => {
|
|
5927
6430
|
const onDown = (e) => {
|
|
5928
6431
|
const path = e.composedPath?.() ?? [];
|
|
5929
6432
|
const inside = path.some(
|
|
@@ -5936,237 +6439,342 @@ function useOutsideClose(attr, onClose) {
|
|
|
5936
6439
|
}, [attr]);
|
|
5937
6440
|
}
|
|
5938
6441
|
|
|
6442
|
+
// src/ui/search/menu-items.tsx
|
|
6443
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6444
|
+
function searchMenuItems({ el, all, selector, route }, copy2, close) {
|
|
6445
|
+
const run = (fn) => () => {
|
|
6446
|
+
fn();
|
|
6447
|
+
close();
|
|
6448
|
+
};
|
|
6449
|
+
const context = (target) => enrichResult(pickResultFromElement(target, route));
|
|
6450
|
+
const sourceEl = el.closest("[data-source]");
|
|
6451
|
+
const cls = (el.getAttribute("class") ?? "").trim().replace(/\s+/g, " ");
|
|
6452
|
+
const txt = elementText(el);
|
|
6453
|
+
const items = [
|
|
6454
|
+
{
|
|
6455
|
+
label: "Copier le contexte",
|
|
6456
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CrosshairIcon, { color: "#d4d4d8", size: 13 }),
|
|
6457
|
+
onClick: run(() => copy2(formatResult(context(el)), "Copi\xE9 \u2713"))
|
|
6458
|
+
}
|
|
6459
|
+
];
|
|
6460
|
+
if (all.length > 1) {
|
|
6461
|
+
items.push({
|
|
6462
|
+
label: `Copier le contexte de tous (${all.length})`,
|
|
6463
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MultiIcon, {}),
|
|
6464
|
+
onClick: run(() => copy2(formatResults(all.map(context)), `Copi\xE9 \u2713 \xB7 ${all.length}`))
|
|
6465
|
+
});
|
|
6466
|
+
}
|
|
6467
|
+
items.push(
|
|
6468
|
+
{
|
|
6469
|
+
label: "Copier le texte",
|
|
6470
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TypeIcon, {}),
|
|
6471
|
+
onClick: run(() => copy2(txt ?? "", txt ? "Texte copi\xE9 \u2713" : "Aucun texte"))
|
|
6472
|
+
},
|
|
6473
|
+
{
|
|
6474
|
+
label: "Copier le s\xE9lecteur",
|
|
6475
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SearchIcon, {}),
|
|
6476
|
+
onClick: run(() => copy2(selector, "S\xE9lecteur copi\xE9 \u2713"))
|
|
6477
|
+
},
|
|
6478
|
+
{
|
|
6479
|
+
label: "Copier le HTML",
|
|
6480
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CodeIcon, {}),
|
|
6481
|
+
onClick: run(() => copy2(formatHtml(el.outerHTML), "HTML copi\xE9 \u2713"))
|
|
6482
|
+
},
|
|
6483
|
+
{
|
|
6484
|
+
label: "Copier le rendu",
|
|
6485
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EyeIcon, {}),
|
|
6486
|
+
info: "Permet de copier \xE0 l'identique l'UI d'un composant",
|
|
6487
|
+
onClick: run(() => copy2(serializeWithComputedStyles(el), "HTML reproductible copi\xE9 \u2713"))
|
|
6488
|
+
},
|
|
6489
|
+
{
|
|
6490
|
+
label: "Copier les classes",
|
|
6491
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TagIcon, {}),
|
|
6492
|
+
onClick: run(() => copy2(cls, cls ? "Classes copi\xE9es \u2713" : "Aucune classe"))
|
|
6493
|
+
},
|
|
6494
|
+
{
|
|
6495
|
+
label: "Copier le XPath",
|
|
6496
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GitBranchIcon, {}),
|
|
6497
|
+
onClick: run(() => copy2(getXPath(el), "XPath copi\xE9 \u2713"))
|
|
6498
|
+
}
|
|
6499
|
+
);
|
|
6500
|
+
if (sourceEl && canOpenInEditor()) {
|
|
6501
|
+
items.push({
|
|
6502
|
+
label: "Ouvrir dans l'\xE9diteur",
|
|
6503
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VsCodeIcon, {}),
|
|
6504
|
+
onClick: run(() => vscodeOpenFor(sourceEl, "source"))
|
|
6505
|
+
});
|
|
6506
|
+
}
|
|
6507
|
+
return items;
|
|
6508
|
+
}
|
|
6509
|
+
|
|
5939
6510
|
// src/ui/search/results.tsx
|
|
5940
|
-
var
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
6511
|
+
var import_react12 = require("react");
|
|
6512
|
+
|
|
6513
|
+
// src/core/wheel.ts
|
|
6514
|
+
var WHEEL_LINE_PX = 16;
|
|
6515
|
+
function wheelPixels(deltaY, deltaMode, pageSize) {
|
|
6516
|
+
if (deltaMode === 1) return deltaY * WHEEL_LINE_PX;
|
|
6517
|
+
if (deltaMode === 2) return deltaY * pageSize;
|
|
6518
|
+
return deltaY;
|
|
6519
|
+
}
|
|
6520
|
+
function initWheelScroll(el) {
|
|
6521
|
+
const onWheel = (e) => {
|
|
6522
|
+
e.stopPropagation();
|
|
6523
|
+
if (el.scrollHeight <= el.clientHeight) return;
|
|
6524
|
+
e.preventDefault();
|
|
6525
|
+
el.scrollTop += wheelPixels(e.deltaY, e.deltaMode, el.clientHeight);
|
|
6526
|
+
};
|
|
6527
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
6528
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
6529
|
+
}
|
|
6530
|
+
|
|
6531
|
+
// src/ui/search/results.tsx
|
|
6532
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5951
6533
|
var ResultList = ({
|
|
5952
|
-
query,
|
|
5953
|
-
results,
|
|
5954
6534
|
groups,
|
|
5955
6535
|
index,
|
|
5956
6536
|
onHoverRow,
|
|
5957
6537
|
onLeave,
|
|
5958
|
-
onPick
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
children: [
|
|
5994
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { style: { fontWeight: 600 }, children: g.tag }),
|
|
5995
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { opacity: 0.7 }, children: g.cls })
|
|
5996
|
-
]
|
|
5997
|
-
}
|
|
5998
|
-
),
|
|
5999
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 6 }, children: [
|
|
6000
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6001
|
-
"span",
|
|
6002
|
-
{
|
|
6003
|
-
style: {
|
|
6004
|
-
color: "#93c5fd",
|
|
6005
|
-
whiteSpace: "nowrap",
|
|
6006
|
-
overflow: "hidden",
|
|
6007
|
-
textOverflow: "ellipsis",
|
|
6008
|
-
maxWidth: 110,
|
|
6009
|
-
fontSize: 10,
|
|
6010
|
-
fontWeight: 600
|
|
6011
|
-
},
|
|
6012
|
-
children: component
|
|
6013
|
-
}
|
|
6014
|
-
),
|
|
6015
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6016
|
-
"span",
|
|
6017
|
-
{
|
|
6018
|
-
style: {
|
|
6019
|
-
color: "#60a5fa",
|
|
6020
|
-
background: "rgba(59,130,246,0.15)",
|
|
6021
|
-
border: "1px solid rgba(59,130,246,0.3)",
|
|
6022
|
-
borderRadius: 4,
|
|
6023
|
-
padding: "0 5px",
|
|
6024
|
-
font: "600 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
6025
|
-
whiteSpace: "nowrap"
|
|
6026
|
-
},
|
|
6027
|
-
children: [
|
|
6028
|
-
"\xD7",
|
|
6029
|
-
g.count
|
|
6030
|
-
]
|
|
6031
|
-
}
|
|
6032
|
-
)
|
|
6033
|
-
] })
|
|
6034
|
-
]
|
|
6035
|
-
},
|
|
6036
|
-
g.key
|
|
6037
|
-
);
|
|
6038
|
-
})
|
|
6039
|
-
]
|
|
6040
|
-
}
|
|
6041
|
-
);
|
|
6042
|
-
|
|
6043
|
-
// src/ui/search/nav.tsx
|
|
6044
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6045
|
-
var SearchNav = ({ counter, disabled, onPrev, onNext }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
6046
|
-
"div",
|
|
6047
|
-
{
|
|
6048
|
-
"data-pathpicker-ignore": "",
|
|
6049
|
-
"data-rp-search-ui": "",
|
|
6050
|
-
style: {
|
|
6051
|
-
display: "flex",
|
|
6052
|
-
alignItems: "center",
|
|
6053
|
-
gap: 6,
|
|
6054
|
-
background: ELEVATED_BG,
|
|
6055
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
6056
|
-
borderRadius: 8,
|
|
6057
|
-
boxShadow: CARD_SHADOW,
|
|
6058
|
-
padding: 6
|
|
6059
|
-
},
|
|
6060
|
-
children: [
|
|
6061
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: MUTED, whiteSpace: "nowrap" }, children: counter }),
|
|
6062
|
-
[
|
|
6063
|
-
{ dir: "left", onClick: onPrev, label: "Occurrence pr\xE9c\xE9dente" },
|
|
6064
|
-
{ dir: "right", onClick: onNext, label: "Occurrence suivante" }
|
|
6065
|
-
].map(({ dir, onClick, label }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6066
|
-
"button",
|
|
6538
|
+
onPick,
|
|
6539
|
+
menuIndex,
|
|
6540
|
+
onMenu
|
|
6541
|
+
}) => {
|
|
6542
|
+
const listRef = (0, import_react12.useRef)(null);
|
|
6543
|
+
const [hovered, setHovered] = (0, import_react12.useState)(-1);
|
|
6544
|
+
const [focused, setFocused] = (0, import_react12.useState)(-1);
|
|
6545
|
+
(0, import_react12.useEffect)(() => {
|
|
6546
|
+
listRef.current?.querySelector("[role='option'][aria-selected='true']")?.scrollIntoView?.({ block: "nearest" });
|
|
6547
|
+
}, [index]);
|
|
6548
|
+
(0, import_react12.useEffect)(() => {
|
|
6549
|
+
const el = listRef.current;
|
|
6550
|
+
return el ? initWheelScroll(el) : void 0;
|
|
6551
|
+
}, []);
|
|
6552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6553
|
+
"div",
|
|
6554
|
+
{
|
|
6555
|
+
ref: listRef,
|
|
6556
|
+
role: "listbox",
|
|
6557
|
+
onMouseLeave: () => {
|
|
6558
|
+
setHovered(-1);
|
|
6559
|
+
onLeave();
|
|
6560
|
+
},
|
|
6561
|
+
style: {
|
|
6562
|
+
display: "flex",
|
|
6563
|
+
flexDirection: "column",
|
|
6564
|
+
maxHeight: SEARCH_LIST_MAX_HEIGHT,
|
|
6565
|
+
overflowY: "auto",
|
|
6566
|
+
overscrollBehavior: "contain",
|
|
6567
|
+
padding: CONTROL_PADDING,
|
|
6568
|
+
borderTop: `1px solid ${CONTROL_DIVIDER}`,
|
|
6569
|
+
...THIN_SCROLLBAR
|
|
6570
|
+
},
|
|
6571
|
+
children: groups.map((g, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6572
|
+
"div",
|
|
6067
6573
|
{
|
|
6068
|
-
|
|
6069
|
-
"aria-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
if (!disabled) e.currentTarget.style.background = SECONDARY_BG_HOVER;
|
|
6574
|
+
role: "option",
|
|
6575
|
+
"aria-selected": i === index,
|
|
6576
|
+
onMouseEnter: () => {
|
|
6577
|
+
setHovered(i);
|
|
6578
|
+
onHoverRow(i);
|
|
6074
6579
|
},
|
|
6075
|
-
|
|
6076
|
-
|
|
6580
|
+
onClick: () => onPick(i),
|
|
6581
|
+
onContextMenu: (e) => {
|
|
6582
|
+
e.preventDefault();
|
|
6583
|
+
e.stopPropagation();
|
|
6584
|
+
onMenu(i, {
|
|
6585
|
+
x: e.clientX,
|
|
6586
|
+
y: e.clientY,
|
|
6587
|
+
row: e.currentTarget,
|
|
6588
|
+
keyboard: false,
|
|
6589
|
+
toggle: false
|
|
6590
|
+
});
|
|
6077
6591
|
},
|
|
6078
6592
|
style: {
|
|
6079
|
-
display: "
|
|
6593
|
+
display: "flex",
|
|
6080
6594
|
alignItems: "center",
|
|
6081
|
-
justifyContent: "
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
padding: 0
|
|
6595
|
+
justifyContent: "space-between",
|
|
6596
|
+
gap: 12,
|
|
6597
|
+
flexShrink: 0,
|
|
6598
|
+
height: SEARCH_ROW_HEIGHT,
|
|
6599
|
+
// Bouton ⋯ collé au bord droit (même retrait que le cadre).
|
|
6600
|
+
padding: "0 2px 0 8px",
|
|
6601
|
+
borderRadius: ICON_BUTTON_RADIUS,
|
|
6602
|
+
cursor: "pointer",
|
|
6603
|
+
background: i === index ? HOVER_BG : "transparent",
|
|
6604
|
+
font: `${SEARCH_META_FONT_SIZE}px/1 ${MONO_FONT}`
|
|
6092
6605
|
},
|
|
6093
|
-
children:
|
|
6606
|
+
children: [
|
|
6607
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6608
|
+
"span",
|
|
6609
|
+
{
|
|
6610
|
+
style: {
|
|
6611
|
+
minWidth: 0,
|
|
6612
|
+
overflow: "hidden",
|
|
6613
|
+
textOverflow: "ellipsis",
|
|
6614
|
+
whiteSpace: "nowrap",
|
|
6615
|
+
color: SUBTLE_FG_HOVER
|
|
6616
|
+
},
|
|
6617
|
+
children: [
|
|
6618
|
+
g.tag,
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { color: SUBTLE_FG }, children: g.cls })
|
|
6620
|
+
]
|
|
6621
|
+
}
|
|
6622
|
+
),
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6624
|
+
"span",
|
|
6625
|
+
{
|
|
6626
|
+
style: {
|
|
6627
|
+
display: "flex",
|
|
6628
|
+
alignItems: "center",
|
|
6629
|
+
gap: 4,
|
|
6630
|
+
flexShrink: 0
|
|
6631
|
+
},
|
|
6632
|
+
children: [
|
|
6633
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6634
|
+
"span",
|
|
6635
|
+
{
|
|
6636
|
+
"data-rp-search-count": "",
|
|
6637
|
+
style: { color: SUBTLE_FG, fontVariantNumeric: "tabular-nums" },
|
|
6638
|
+
children: g.count
|
|
6639
|
+
}
|
|
6640
|
+
),
|
|
6641
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6642
|
+
IconButton,
|
|
6643
|
+
{
|
|
6644
|
+
"aria-label": "Actions",
|
|
6645
|
+
"aria-haspopup": "menu",
|
|
6646
|
+
"aria-expanded": menuIndex === i,
|
|
6647
|
+
title: "Actions",
|
|
6648
|
+
active: menuIndex === i,
|
|
6649
|
+
"data-rp-contextmenu": "",
|
|
6650
|
+
onClick: (e) => {
|
|
6651
|
+
e.stopPropagation();
|
|
6652
|
+
const row = e.currentTarget.closest("[role='option']");
|
|
6653
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
6654
|
+
onMenu(i, {
|
|
6655
|
+
x: r.right + 4,
|
|
6656
|
+
y: r.bottom,
|
|
6657
|
+
row,
|
|
6658
|
+
keyboard: e.detail === 0,
|
|
6659
|
+
toggle: true
|
|
6660
|
+
});
|
|
6661
|
+
},
|
|
6662
|
+
onFocus: () => setFocused(i),
|
|
6663
|
+
onBlur: () => setFocused(-1),
|
|
6664
|
+
style: {
|
|
6665
|
+
opacity: i === index || i === hovered || i === focused || menuIndex === i ? 1 : 0
|
|
6666
|
+
},
|
|
6667
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MoreIcon, {})
|
|
6668
|
+
}
|
|
6669
|
+
)
|
|
6670
|
+
]
|
|
6671
|
+
}
|
|
6672
|
+
)
|
|
6673
|
+
]
|
|
6094
6674
|
},
|
|
6095
|
-
|
|
6675
|
+
g.key
|
|
6096
6676
|
))
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6677
|
+
}
|
|
6678
|
+
);
|
|
6679
|
+
};
|
|
6100
6680
|
|
|
6101
6681
|
// src/ui/search/popover.tsx
|
|
6102
|
-
var
|
|
6103
|
-
//
|
|
6104
|
-
// `left:50% translateX(-50%)`).
|
|
6105
|
-
//
|
|
6682
|
+
var import_jsx_runtime15 = (
|
|
6683
|
+
// Bloc centré sur le viewport = aligné avec la barre du bas (elle aussi
|
|
6684
|
+
// `left:50% translateX(-50%)`). Le déplacement passe par `translate`
|
|
6685
|
+
// (propriété distincte de `transform`) : centrage et animation d'entrée intacts.
|
|
6106
6686
|
require("react/jsx-runtime")
|
|
6107
6687
|
);
|
|
6108
|
-
|
|
6688
|
+
var SearchPopover = ({
|
|
6109
6689
|
onClose,
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
const
|
|
6115
|
-
const
|
|
6116
|
-
const
|
|
6117
|
-
|
|
6690
|
+
onContextMenuElement,
|
|
6691
|
+
pathname,
|
|
6692
|
+
onCopied
|
|
6693
|
+
}) => {
|
|
6694
|
+
const movable = useMovable("search");
|
|
6695
|
+
const ref = movable.ref;
|
|
6696
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
6697
|
+
const onContextMenuRef = (0, import_react13.useRef)(onContextMenuElement);
|
|
6118
6698
|
onContextMenuRef.current = onContextMenuElement;
|
|
6119
|
-
const [query, setQuery] = (0,
|
|
6120
|
-
const [index, setIndex] = (0,
|
|
6121
|
-
const [rowHover, setRowHover] = (0,
|
|
6122
|
-
const [member, setMember] = (0,
|
|
6123
|
-
const
|
|
6124
|
-
const
|
|
6699
|
+
const [query, setQuery] = (0, import_react13.useState)("");
|
|
6700
|
+
const [index, setIndex] = (0, import_react13.useState)(0);
|
|
6701
|
+
const [rowHover, setRowHover] = (0, import_react13.useState)(-1);
|
|
6702
|
+
const [member, setMember] = (0, import_react13.useState)(0);
|
|
6703
|
+
const [menu, setMenu] = (0, import_react13.useState)(null);
|
|
6704
|
+
const locatedRef = (0, import_react13.useRef)(null);
|
|
6705
|
+
const historyRef = (0, import_react13.useRef)(makeQueryHistory(""));
|
|
6706
|
+
const commit = (0, import_react13.useCallback)((next) => {
|
|
6125
6707
|
historyRef.current.push(next);
|
|
6126
6708
|
setQuery(next);
|
|
6127
6709
|
}, []);
|
|
6128
|
-
const
|
|
6710
|
+
const fillFrom = (el) => {
|
|
6711
|
+
commit(classQueryOf(el));
|
|
6712
|
+
setMenu(null);
|
|
6713
|
+
setIndex(0);
|
|
6714
|
+
setMember(0);
|
|
6715
|
+
setRowHover(-1);
|
|
6716
|
+
inputRef.current?.focus();
|
|
6717
|
+
};
|
|
6718
|
+
const fillFromRef = (0, import_react13.useRef)(fillFrom);
|
|
6719
|
+
fillFromRef.current = fillFrom;
|
|
6720
|
+
const stepHistory = (0, import_react13.useCallback)((forward) => {
|
|
6129
6721
|
const history = historyRef.current;
|
|
6130
6722
|
const moved = forward ? history.redo() : history.undo();
|
|
6131
6723
|
if (!moved) return;
|
|
6724
|
+
setMenu(null);
|
|
6132
6725
|
setQuery(history.current);
|
|
6133
6726
|
setIndex(0);
|
|
6134
6727
|
setMember(0);
|
|
6135
6728
|
}, []);
|
|
6136
|
-
const results = (0,
|
|
6137
|
-
const prefix = (0,
|
|
6138
|
-
const groups = (0,
|
|
6139
|
-
|
|
6140
|
-
|
|
6729
|
+
const results = (0, import_react13.useMemo)(() => searchElements(query), [query]);
|
|
6730
|
+
const prefix = (0, import_react13.useMemo)(() => classPrefixOf(query) ?? "", [query]);
|
|
6731
|
+
const groups = (0, import_react13.useMemo)(
|
|
6732
|
+
() => groupResults(results, prefix),
|
|
6733
|
+
[results, prefix]
|
|
6734
|
+
);
|
|
6735
|
+
const highlightRef = (0, import_react13.useRef)(
|
|
6736
|
+
null
|
|
6737
|
+
);
|
|
6738
|
+
(0, import_react13.useEffect)(() => {
|
|
6141
6739
|
inputRef.current?.focus();
|
|
6142
6740
|
ref.current?.animate?.(
|
|
6143
6741
|
[
|
|
6144
|
-
{
|
|
6742
|
+
{
|
|
6743
|
+
opacity: 0,
|
|
6744
|
+
transform: "translateX(-50%) scale(.95) translateY(4px)"
|
|
6745
|
+
},
|
|
6145
6746
|
{ opacity: 1, transform: "translateX(-50%)" }
|
|
6146
6747
|
],
|
|
6147
6748
|
{ duration: 120, easing: "ease-out" }
|
|
6148
6749
|
);
|
|
6149
|
-
const highlight = createSearchHighlight(
|
|
6150
|
-
onPick: (el) => onPickRef.current?.(el),
|
|
6151
|
-
onContextMenu: (el, pos) => onContextMenuRef.current?.(el, pos),
|
|
6152
|
-
onVscode: (el, action) => vscodeOpenFor(el, action)
|
|
6153
|
-
});
|
|
6750
|
+
const highlight = createSearchHighlight();
|
|
6154
6751
|
highlightRef.current = highlight;
|
|
6752
|
+
const stopPageClick = initSearchPageClick({
|
|
6753
|
+
onElement: (el) => fillFromRef.current(el),
|
|
6754
|
+
onContextMenu: (el, pos) => {
|
|
6755
|
+
if (el instanceof HTMLElement) onContextMenuRef.current?.(el, pos);
|
|
6756
|
+
},
|
|
6757
|
+
onEditor: (el, action) => vscodeOpenFor(el, action),
|
|
6758
|
+
covers: (x, y) => highlight.covers(x, y)
|
|
6759
|
+
});
|
|
6155
6760
|
return () => {
|
|
6761
|
+
stopPageClick();
|
|
6156
6762
|
highlight.destroy();
|
|
6157
6763
|
highlightRef.current = null;
|
|
6158
6764
|
};
|
|
6159
6765
|
}, []);
|
|
6160
|
-
(0,
|
|
6766
|
+
(0, import_react13.useEffect)(() => {
|
|
6161
6767
|
highlightRef.current?.update(results);
|
|
6162
6768
|
}, [results]);
|
|
6163
|
-
(0,
|
|
6769
|
+
(0, import_react13.useEffect)(() => {
|
|
6164
6770
|
const highlight = highlightRef.current;
|
|
6165
6771
|
if (!highlight) return;
|
|
6166
6772
|
const group = groups[index];
|
|
6167
|
-
const currentFlat = group && group.indices.length > 0 ? group.indices[(member
|
|
6773
|
+
const currentFlat = group && group.indices.length > 0 ? group.indices[wrapIndex(member, group.indices.length)] : -1;
|
|
6168
6774
|
highlight.setActive(currentFlat === -1 ? [] : [currentFlat]);
|
|
6169
|
-
highlight.setFilter(
|
|
6775
|
+
highlight.setFilter(
|
|
6776
|
+
groups[rowHover === -1 ? index : rowHover]?.indices ?? null
|
|
6777
|
+
);
|
|
6170
6778
|
}, [index, groups, rowHover, member]);
|
|
6171
6779
|
useOutsideClose(SEARCH_UI_ATTR, onClose);
|
|
6172
6780
|
const locate = (el) => {
|
|
@@ -6175,8 +6783,65 @@ function SearchPopover({
|
|
|
6175
6783
|
const stepTo = (m) => {
|
|
6176
6784
|
const group = groups[index];
|
|
6177
6785
|
if (!group || group.indices.length === 0) return;
|
|
6178
|
-
setMember((m
|
|
6786
|
+
setMember(wrapIndex(m, group.indices.length));
|
|
6787
|
+
};
|
|
6788
|
+
const goToOccurrence = (gi, back = false) => {
|
|
6789
|
+
const group = groups[gi];
|
|
6790
|
+
if (!group || group.indices.length === 0) return;
|
|
6791
|
+
const n = group.indices.length;
|
|
6792
|
+
const current2 = gi === index ? wrapIndex(member, n) : 0;
|
|
6793
|
+
const target = locatedRef.current === `${gi}:${current2}` ? wrapIndex(current2 + (back ? -1 : 1), n) : current2;
|
|
6794
|
+
setIndex(gi);
|
|
6795
|
+
setMember(target);
|
|
6796
|
+
locatedRef.current = `${gi}:${target}`;
|
|
6797
|
+
locate(results[group.indices[target]]);
|
|
6798
|
+
};
|
|
6799
|
+
const closeMenu = (0, import_react13.useCallback)(() => {
|
|
6800
|
+
setMenu(null);
|
|
6801
|
+
inputRef.current?.focus();
|
|
6802
|
+
}, []);
|
|
6803
|
+
const openMenu = (gi, req) => {
|
|
6804
|
+
const group = groups[gi];
|
|
6805
|
+
if (!group || group.indices.length === 0) return;
|
|
6806
|
+
if (req.toggle && menu?.group === gi) {
|
|
6807
|
+
closeMenu();
|
|
6808
|
+
return;
|
|
6809
|
+
}
|
|
6810
|
+
const m = gi === index ? wrapIndex(member, group.indices.length) : 0;
|
|
6811
|
+
setIndex(gi);
|
|
6812
|
+
setMember(m);
|
|
6813
|
+
setRowHover(-1);
|
|
6814
|
+
setMenu({
|
|
6815
|
+
at: { el: req.row, x: req.x, y: req.y },
|
|
6816
|
+
group: gi,
|
|
6817
|
+
target: results[group.indices[m]],
|
|
6818
|
+
keyboard: req.keyboard
|
|
6819
|
+
});
|
|
6179
6820
|
};
|
|
6821
|
+
const menuItems = (0, import_react13.useMemo)(() => {
|
|
6822
|
+
if (!menu) return [];
|
|
6823
|
+
const group = groups[menu.group];
|
|
6824
|
+
if (!group) return [];
|
|
6825
|
+
return searchMenuItems(
|
|
6826
|
+
{
|
|
6827
|
+
el: menu.target,
|
|
6828
|
+
all: group.indices.map((k) => results[k]),
|
|
6829
|
+
selector: group.selector,
|
|
6830
|
+
route: resolveRoute(pathname, window.location)
|
|
6831
|
+
},
|
|
6832
|
+
(text, message) => {
|
|
6833
|
+
navigator.clipboard?.writeText(text).catch(() => {
|
|
6834
|
+
});
|
|
6835
|
+
onCopied?.(message);
|
|
6836
|
+
},
|
|
6837
|
+
closeMenu
|
|
6838
|
+
);
|
|
6839
|
+
}, [menu, groups, results, pathname, onCopied, closeMenu]);
|
|
6840
|
+
(0, import_react13.useEffect)(() => {
|
|
6841
|
+
if (!menu?.keyboard) return;
|
|
6842
|
+
const rootNode = ref.current?.getRootNode();
|
|
6843
|
+
rootNode?.querySelector(`[${SEARCH_UI_ATTR}][data-rp-contextmenu] button`)?.focus();
|
|
6844
|
+
}, [menu]);
|
|
6180
6845
|
const onKeyDown = (e) => {
|
|
6181
6846
|
const metaHeld = e.ctrlKey || e.metaKey;
|
|
6182
6847
|
if (metaHeld && (e.key === "z" || e.key === "Z")) {
|
|
@@ -6193,108 +6858,229 @@ function SearchPopover({
|
|
|
6193
6858
|
return;
|
|
6194
6859
|
}
|
|
6195
6860
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
6196
|
-
|
|
6197
|
-
if (!group || group.indices.length === 0) return;
|
|
6861
|
+
if (groups.length === 0) return;
|
|
6198
6862
|
e.preventDefault();
|
|
6199
|
-
|
|
6863
|
+
setIndex(
|
|
6864
|
+
wrapIndex(index + (e.key === "ArrowDown" ? 1 : -1), groups.length)
|
|
6865
|
+
);
|
|
6866
|
+
setMember(0);
|
|
6867
|
+
setRowHover(-1);
|
|
6200
6868
|
return;
|
|
6201
6869
|
}
|
|
6202
6870
|
if (e.key === "Enter") {
|
|
6203
6871
|
e.preventDefault();
|
|
6204
6872
|
e.stopPropagation();
|
|
6205
|
-
|
|
6206
|
-
if (!group || group.indices.length === 0) return;
|
|
6207
|
-
const m = (member % group.indices.length + group.indices.length) % group.indices.length;
|
|
6208
|
-
locate(results[group.indices[m]]);
|
|
6873
|
+
goToOccurrence(index, e.shiftKey);
|
|
6209
6874
|
}
|
|
6210
6875
|
};
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6876
|
+
const counter = searchCounter(query, groups[index], member);
|
|
6877
|
+
const empty = groups.length === 0;
|
|
6878
|
+
const showList = query.trim() !== "" && !empty;
|
|
6879
|
+
const arrows = [
|
|
6880
|
+
{ dir: "left", step: -1, label: "Occurrence pr\xE9c\xE9dente" },
|
|
6881
|
+
{ dir: "right", step: 1, label: "Occurrence suivante" }
|
|
6882
|
+
];
|
|
6883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
6884
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MoveHomeSlot, { home: movable.home, over: movable.overHome }),
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
6886
|
+
"div",
|
|
6887
|
+
{
|
|
6888
|
+
ref,
|
|
6889
|
+
"data-pathpicker-ignore": "",
|
|
6890
|
+
"data-rp-search-popover": "",
|
|
6891
|
+
"data-rp-search-ui": "",
|
|
6892
|
+
style: {
|
|
6893
|
+
position: "fixed",
|
|
6894
|
+
bottom: SEARCH_BOTTOM,
|
|
6895
|
+
left: "50%",
|
|
6896
|
+
transform: "translateX(-50%)",
|
|
6897
|
+
zIndex: UI_Z,
|
|
6898
|
+
...CONTROL_FRAME,
|
|
6899
|
+
flexDirection: "column",
|
|
6900
|
+
alignItems: "stretch",
|
|
6901
|
+
gap: 0,
|
|
6902
|
+
padding: 0,
|
|
6903
|
+
width: SEARCH_WIDTH,
|
|
6904
|
+
overflow: "hidden",
|
|
6905
|
+
...movable.style
|
|
6906
|
+
},
|
|
6907
|
+
children: [
|
|
6908
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
6909
|
+
"div",
|
|
6910
|
+
{
|
|
6911
|
+
style: {
|
|
6912
|
+
display: "flex",
|
|
6913
|
+
alignItems: "center",
|
|
6914
|
+
gap: CONTROL_GAP,
|
|
6915
|
+
boxSizing: "border-box",
|
|
6916
|
+
// Hauteur du cadre moins sa bordure (1 px en haut et en bas).
|
|
6917
|
+
height: CONTROL_HEIGHT - 2,
|
|
6918
|
+
padding: CONTROL_PADDING,
|
|
6919
|
+
flexShrink: 0
|
|
6920
|
+
},
|
|
6921
|
+
children: [
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MoveHandle, { ...movable.handleProps }),
|
|
6923
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6924
|
+
"span",
|
|
6925
|
+
{
|
|
6926
|
+
style: {
|
|
6927
|
+
display: "inline-flex",
|
|
6928
|
+
justifyContent: "center",
|
|
6929
|
+
width: ICON_BUTTON_SIZE,
|
|
6930
|
+
flexShrink: 0
|
|
6931
|
+
},
|
|
6932
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SearchIcon, { color: SUBTLE_FG })
|
|
6933
|
+
}
|
|
6934
|
+
),
|
|
6935
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6936
|
+
"input",
|
|
6937
|
+
{
|
|
6938
|
+
ref: inputRef,
|
|
6939
|
+
role: "searchbox",
|
|
6940
|
+
"aria-label": "Rechercher un \xE9l\xE9ment",
|
|
6941
|
+
placeholder: "Rechercher un \xE9l\xE9ment",
|
|
6942
|
+
spellCheck: false,
|
|
6943
|
+
autoComplete: "off",
|
|
6944
|
+
value: query,
|
|
6945
|
+
onChange: (e) => {
|
|
6946
|
+
commit(e.target.value);
|
|
6947
|
+
setMenu(null);
|
|
6948
|
+
setIndex(0);
|
|
6949
|
+
setMember(0);
|
|
6950
|
+
},
|
|
6951
|
+
onKeyDown,
|
|
6952
|
+
style: {
|
|
6953
|
+
flex: 1,
|
|
6954
|
+
minWidth: 0,
|
|
6955
|
+
height: "100%",
|
|
6956
|
+
margin: 0,
|
|
6957
|
+
padding: 0,
|
|
6958
|
+
border: "none",
|
|
6959
|
+
outline: "none",
|
|
6960
|
+
background: "transparent",
|
|
6961
|
+
color: SUBTLE_FG_HOVER,
|
|
6962
|
+
font: `${SEARCH_INPUT_FONT_SIZE}px ${UI_FONT}`
|
|
6963
|
+
}
|
|
6964
|
+
}
|
|
6965
|
+
),
|
|
6966
|
+
counter !== "" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6967
|
+
"span",
|
|
6968
|
+
{
|
|
6969
|
+
"data-rp-search-counter": "",
|
|
6970
|
+
style: {
|
|
6971
|
+
flexShrink: 0,
|
|
6972
|
+
padding: "0 4px",
|
|
6973
|
+
font: `${SEARCH_META_FONT_SIZE}px ${MONO_FONT}`,
|
|
6974
|
+
fontVariantNumeric: "tabular-nums",
|
|
6975
|
+
color: empty ? FAINT_FG : MUTED
|
|
6976
|
+
},
|
|
6977
|
+
children: counter
|
|
6978
|
+
}
|
|
6979
|
+
),
|
|
6980
|
+
arrows.map(({ dir, step, label }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6981
|
+
IconButton,
|
|
6982
|
+
{
|
|
6983
|
+
"aria-label": label,
|
|
6984
|
+
title: label,
|
|
6985
|
+
disabled: empty,
|
|
6986
|
+
onClick: () => stepTo(member + step),
|
|
6987
|
+
style: empty ? {
|
|
6988
|
+
opacity: DISABLED_OPACITY,
|
|
6989
|
+
cursor: "default",
|
|
6990
|
+
background: "transparent"
|
|
6991
|
+
} : void 0,
|
|
6992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronIcon, { dir, color: "currentColor" })
|
|
6993
|
+
},
|
|
6994
|
+
dir
|
|
6995
|
+
))
|
|
6996
|
+
]
|
|
6259
6997
|
}
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
setRowHover(
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6998
|
+
),
|
|
6999
|
+
showList && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
7000
|
+
ResultList,
|
|
7001
|
+
{
|
|
7002
|
+
groups,
|
|
7003
|
+
index,
|
|
7004
|
+
onHoverRow: (i) => {
|
|
7005
|
+
if (menu) return;
|
|
7006
|
+
setIndex(i);
|
|
7007
|
+
setRowHover(i);
|
|
7008
|
+
},
|
|
7009
|
+
onLeave: () => setRowHover(-1),
|
|
7010
|
+
onPick: (i) => {
|
|
7011
|
+
goToOccurrence(i);
|
|
7012
|
+
inputRef.current?.focus();
|
|
7013
|
+
},
|
|
7014
|
+
menuIndex: menu?.group ?? -1,
|
|
7015
|
+
onMenu: openMenu
|
|
7016
|
+
}
|
|
7017
|
+
)
|
|
7018
|
+
]
|
|
7019
|
+
}
|
|
7020
|
+
),
|
|
7021
|
+
menu && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
7022
|
+
ContextMenu,
|
|
7023
|
+
{
|
|
7024
|
+
at: menu.at,
|
|
7025
|
+
onClose: closeMenu,
|
|
7026
|
+
items: menuItems,
|
|
7027
|
+
attr: SEARCH_UI_ATTR
|
|
7028
|
+
}
|
|
7029
|
+
)
|
|
7030
|
+
] });
|
|
7031
|
+
};
|
|
7032
|
+
|
|
7033
|
+
// src/ui/picker-toolbar.tsx
|
|
7034
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
7035
|
+
var PickerToolbar = ({ active, accent, onToggle, label }) => {
|
|
7036
|
+
const toolbar = useMovable("toolbar");
|
|
7037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
7038
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MoveHomeSlot, { home: toolbar.home, over: toolbar.overHome }),
|
|
7039
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
7040
|
+
"div",
|
|
7041
|
+
{
|
|
7042
|
+
ref: toolbar.ref,
|
|
7043
|
+
"data-pathpicker-ignore": "",
|
|
7044
|
+
"data-rp-toolbar": "",
|
|
7045
|
+
style: {
|
|
7046
|
+
...CONTROL_FRAME,
|
|
7047
|
+
position: "fixed",
|
|
7048
|
+
top: CONTROL_INSET,
|
|
7049
|
+
right: CONTROL_INSET,
|
|
7050
|
+
zIndex: UI_Z,
|
|
7051
|
+
height: CONTROL_HEIGHT,
|
|
7052
|
+
...toolbar.style
|
|
7053
|
+
},
|
|
7054
|
+
children: [
|
|
7055
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MoveHandle, { ...toolbar.handleProps }),
|
|
7056
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7057
|
+
"span",
|
|
7058
|
+
{
|
|
7059
|
+
"aria-hidden": "true",
|
|
7060
|
+
style: { width: 1, height: CONTROL_DIVIDER_HEIGHT, background: CONTROL_DIVIDER }
|
|
7061
|
+
}
|
|
7062
|
+
),
|
|
7063
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7064
|
+
IconButton,
|
|
7065
|
+
{
|
|
7066
|
+
"data-pathpicker-ignore": "",
|
|
7067
|
+
"data-rp-picker": "",
|
|
7068
|
+
"aria-label": label,
|
|
7069
|
+
"aria-pressed": active,
|
|
7070
|
+
active,
|
|
7071
|
+
activeColor: accent,
|
|
7072
|
+
onClick: onToggle,
|
|
7073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CrosshairIcon, { color: "currentColor", size: ICON_BUTTON_ICON_SIZE })
|
|
6279
7074
|
}
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
disabled: groups.length === 0,
|
|
6287
|
-
onPrev: () => stepTo(member - 1),
|
|
6288
|
-
onNext: () => stepTo(member + 1)
|
|
6289
|
-
}
|
|
6290
|
-
) })
|
|
6291
|
-
]
|
|
6292
|
-
}
|
|
6293
|
-
);
|
|
6294
|
-
}
|
|
7075
|
+
)
|
|
7076
|
+
]
|
|
7077
|
+
}
|
|
7078
|
+
)
|
|
7079
|
+
] });
|
|
7080
|
+
};
|
|
6295
7081
|
|
|
6296
7082
|
// src/ui/settings-menu/settings-menu.tsx
|
|
6297
|
-
var
|
|
7083
|
+
var import_react15 = require("react");
|
|
6298
7084
|
|
|
6299
7085
|
// src/ui/commands.ts
|
|
6300
7086
|
var MODIFIER_OPTIONS = [
|
|
@@ -6357,8 +7143,8 @@ function keyFromToken(t) {
|
|
|
6357
7143
|
}
|
|
6358
7144
|
|
|
6359
7145
|
// src/ui/select.tsx
|
|
6360
|
-
var
|
|
6361
|
-
var
|
|
7146
|
+
var import_react14 = require("react");
|
|
7147
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
6362
7148
|
var BLUE_BG = "rgba(59,130,246,0.15)";
|
|
6363
7149
|
var BLUE_BG_HOVER = "rgba(59,130,246,0.22)";
|
|
6364
7150
|
var BLUE_TEXT = "#60a5fa";
|
|
@@ -6372,10 +7158,10 @@ function Select({
|
|
|
6372
7158
|
width = 80,
|
|
6373
7159
|
highlight = false
|
|
6374
7160
|
}) {
|
|
6375
|
-
const [open, setOpen] = (0,
|
|
6376
|
-
const ref = (0,
|
|
7161
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
7162
|
+
const ref = (0, import_react14.useRef)(null);
|
|
6377
7163
|
const current2 = options.find((o) => o.value === value);
|
|
6378
|
-
(0,
|
|
7164
|
+
(0, import_react14.useEffect)(() => {
|
|
6379
7165
|
if (!open) return;
|
|
6380
7166
|
const onDown = (e) => {
|
|
6381
7167
|
const path = e.composedPath?.() ?? [];
|
|
@@ -6384,14 +7170,14 @@ function Select({
|
|
|
6384
7170
|
document.addEventListener("pointerdown", onDown, true);
|
|
6385
7171
|
return () => document.removeEventListener("pointerdown", onDown, true);
|
|
6386
7172
|
}, [open]);
|
|
6387
|
-
return /* @__PURE__ */ (0,
|
|
7173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6388
7174
|
"div",
|
|
6389
7175
|
{
|
|
6390
7176
|
ref,
|
|
6391
7177
|
"data-rp-settings": "",
|
|
6392
7178
|
style: { position: "relative", display: "inline-block" },
|
|
6393
7179
|
children: [
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
7180
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6395
7181
|
"button",
|
|
6396
7182
|
{
|
|
6397
7183
|
type: "button",
|
|
@@ -6425,12 +7211,12 @@ function Select({
|
|
|
6425
7211
|
transition: "background-color 150ms ease, box-shadow 150ms ease"
|
|
6426
7212
|
},
|
|
6427
7213
|
children: [
|
|
6428
|
-
/* @__PURE__ */ (0,
|
|
6429
|
-
/* @__PURE__ */ (0,
|
|
7214
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { overflow: "hidden", textOverflow: "ellipsis" }, children: current2?.label ?? value }),
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": true, style: { opacity: highlight ? 0.9 : 0.6, fontSize: 9 }, children: "\u25BE" })
|
|
6430
7216
|
]
|
|
6431
7217
|
}
|
|
6432
7218
|
),
|
|
6433
|
-
open && /* @__PURE__ */ (0,
|
|
7219
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6434
7220
|
"div",
|
|
6435
7221
|
{
|
|
6436
7222
|
role: "listbox",
|
|
@@ -6448,7 +7234,7 @@ function Select({
|
|
|
6448
7234
|
display: "flex",
|
|
6449
7235
|
flexDirection: "column"
|
|
6450
7236
|
},
|
|
6451
|
-
children: options.map((o) => /* @__PURE__ */ (0,
|
|
7237
|
+
children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6452
7238
|
"button",
|
|
6453
7239
|
{
|
|
6454
7240
|
type: "button",
|
|
@@ -6488,8 +7274,8 @@ function Select({
|
|
|
6488
7274
|
}
|
|
6489
7275
|
|
|
6490
7276
|
// src/ui/settings-menu/rows.tsx
|
|
6491
|
-
var
|
|
6492
|
-
var
|
|
7277
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7278
|
+
var rowStyle = {
|
|
6493
7279
|
display: "flex",
|
|
6494
7280
|
alignItems: "center",
|
|
6495
7281
|
justifyContent: "space-between",
|
|
@@ -6500,9 +7286,9 @@ var rowStyle2 = {
|
|
|
6500
7286
|
fontFamily: "system-ui, sans-serif"
|
|
6501
7287
|
};
|
|
6502
7288
|
var def = DEFAULT_SETTINGS.commands;
|
|
6503
|
-
var KeyRow = ({ label, cmdKey, options, commands, onChange }) => /* @__PURE__ */ (0,
|
|
6504
|
-
/* @__PURE__ */ (0,
|
|
6505
|
-
/* @__PURE__ */ (0,
|
|
7289
|
+
var KeyRow = ({ label, cmdKey, options, commands, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: rowStyle, children: [
|
|
7290
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { whiteSpace: "nowrap" }, children: label }),
|
|
7291
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6506
7292
|
Select,
|
|
6507
7293
|
{
|
|
6508
7294
|
ariaLabel: label,
|
|
@@ -6516,10 +7302,10 @@ var KeyRow = ({ label, cmdKey, options, commands, onChange }) => /* @__PURE__ */
|
|
|
6516
7302
|
] });
|
|
6517
7303
|
var KeyGestureRow = ({ label, cmdKey, keyOptions, commands, onChange }) => {
|
|
6518
7304
|
const b = commands[cmdKey];
|
|
6519
|
-
return /* @__PURE__ */ (0,
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6521
|
-
/* @__PURE__ */ (0,
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
7305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: rowStyle, children: [
|
|
7306
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { whiteSpace: "nowrap" }, children: label }),
|
|
7307
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 6 }, children: [
|
|
7308
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6523
7309
|
Select,
|
|
6524
7310
|
{
|
|
6525
7311
|
ariaLabel: `${label} \u2014 modificateur`,
|
|
@@ -6530,8 +7316,8 @@ var KeyGestureRow = ({ label, cmdKey, keyOptions, commands, onChange }) => {
|
|
|
6530
7316
|
highlight: b.modifier !== def[cmdKey].modifier
|
|
6531
7317
|
}
|
|
6532
7318
|
),
|
|
6533
|
-
/* @__PURE__ */ (0,
|
|
6534
|
-
/* @__PURE__ */ (0,
|
|
7319
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { opacity: 0.6 }, children: "+" }),
|
|
7320
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6535
7321
|
Select,
|
|
6536
7322
|
{
|
|
6537
7323
|
ariaLabel: `${label} \u2014 touche`,
|
|
@@ -6545,12 +7331,12 @@ var KeyGestureRow = ({ label, cmdKey, keyOptions, commands, onChange }) => {
|
|
|
6545
7331
|
] })
|
|
6546
7332
|
] });
|
|
6547
7333
|
};
|
|
6548
|
-
var ToggleRow = ({ label, checked, defaultChecked, icon, onChange }) => /* @__PURE__ */ (0,
|
|
6549
|
-
/* @__PURE__ */ (0,
|
|
7334
|
+
var ToggleRow = ({ label, checked, defaultChecked, icon, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: rowStyle, children: [
|
|
7335
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, whiteSpace: "nowrap" }, children: [
|
|
6550
7336
|
icon,
|
|
6551
7337
|
label
|
|
6552
7338
|
] }),
|
|
6553
|
-
/* @__PURE__ */ (0,
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6554
7340
|
"input",
|
|
6555
7341
|
{
|
|
6556
7342
|
type: "checkbox",
|
|
@@ -6575,8 +7361,8 @@ var GestureRow = ({
|
|
|
6575
7361
|
}) => {
|
|
6576
7362
|
const b = commands[cmdKey];
|
|
6577
7363
|
const setGesture = (patch) => onChange({ ...commands, [cmdKey]: { ...b, ...patch } });
|
|
6578
|
-
return /* @__PURE__ */ (0,
|
|
6579
|
-
/* @__PURE__ */ (0,
|
|
7364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: rowStyle, children: [
|
|
7365
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6580
7366
|
"span",
|
|
6581
7367
|
{
|
|
6582
7368
|
style: { display: "inline-flex", alignItems: "center", gap: 6, whiteSpace: "nowrap" },
|
|
@@ -6586,8 +7372,8 @@ var GestureRow = ({
|
|
|
6586
7372
|
]
|
|
6587
7373
|
}
|
|
6588
7374
|
),
|
|
6589
|
-
/* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
7375
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 6 }, children: [
|
|
7376
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6591
7377
|
Select,
|
|
6592
7378
|
{
|
|
6593
7379
|
ariaLabel: `${label} \u2014 modificateur`,
|
|
@@ -6598,8 +7384,8 @@ var GestureRow = ({
|
|
|
6598
7384
|
highlight: b.modifier !== def[cmdKey].modifier
|
|
6599
7385
|
}
|
|
6600
7386
|
),
|
|
6601
|
-
/* @__PURE__ */ (0,
|
|
6602
|
-
/* @__PURE__ */ (0,
|
|
7387
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { opacity: 0.6 }, children: "+" }),
|
|
7388
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6603
7389
|
Select,
|
|
6604
7390
|
{
|
|
6605
7391
|
ariaLabel: `${label} \u2014 action`,
|
|
@@ -6615,7 +7401,7 @@ var GestureRow = ({
|
|
|
6615
7401
|
};
|
|
6616
7402
|
|
|
6617
7403
|
// src/ui/settings-menu/settings-menu.tsx
|
|
6618
|
-
var
|
|
7404
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6619
7405
|
var SettingsMenu = ({
|
|
6620
7406
|
commands,
|
|
6621
7407
|
onChangeCommands,
|
|
@@ -6624,8 +7410,8 @@ var SettingsMenu = ({
|
|
|
6624
7410
|
showModuleOverlay,
|
|
6625
7411
|
onChangeShowModuleOverlay
|
|
6626
7412
|
}) => {
|
|
6627
|
-
const ref = (0,
|
|
6628
|
-
(0,
|
|
7413
|
+
const ref = (0, import_react15.useRef)(null);
|
|
7414
|
+
(0, import_react15.useEffect)(() => {
|
|
6629
7415
|
ref.current?.animate?.(
|
|
6630
7416
|
[
|
|
6631
7417
|
{ opacity: 0, transform: "scale(.95) translateY(4px)" },
|
|
@@ -6636,7 +7422,7 @@ var SettingsMenu = ({
|
|
|
6636
7422
|
}, []);
|
|
6637
7423
|
useOutsideClose("data-rp-settings", onClose);
|
|
6638
7424
|
const def2 = DEFAULT_SETTINGS.commands;
|
|
6639
|
-
return /* @__PURE__ */ (0,
|
|
7425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6640
7426
|
"div",
|
|
6641
7427
|
{
|
|
6642
7428
|
ref,
|
|
@@ -6654,7 +7440,7 @@ var SettingsMenu = ({
|
|
|
6654
7440
|
transformOrigin: "bottom center"
|
|
6655
7441
|
},
|
|
6656
7442
|
children: [
|
|
6657
|
-
/* @__PURE__ */ (0,
|
|
7443
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6658
7444
|
"div",
|
|
6659
7445
|
{
|
|
6660
7446
|
style: {
|
|
@@ -6664,7 +7450,7 @@ var SettingsMenu = ({
|
|
|
6664
7450
|
gap: 8
|
|
6665
7451
|
},
|
|
6666
7452
|
children: [
|
|
6667
|
-
/* @__PURE__ */ (0,
|
|
7453
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6668
7454
|
"span",
|
|
6669
7455
|
{
|
|
6670
7456
|
style: {
|
|
@@ -6677,7 +7463,7 @@ var SettingsMenu = ({
|
|
|
6677
7463
|
children: "Commandes"
|
|
6678
7464
|
}
|
|
6679
7465
|
),
|
|
6680
|
-
/* @__PURE__ */ (0,
|
|
7466
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6681
7467
|
"button",
|
|
6682
7468
|
{
|
|
6683
7469
|
type: "button",
|
|
@@ -6706,9 +7492,9 @@ var SettingsMenu = ({
|
|
|
6706
7492
|
]
|
|
6707
7493
|
}
|
|
6708
7494
|
),
|
|
6709
|
-
/* @__PURE__ */ (0,
|
|
6710
|
-
/* @__PURE__ */ (0,
|
|
6711
|
-
/* @__PURE__ */ (0,
|
|
7495
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { display: "flex", flexDirection: "column", paddingTop: 2 }, children: [
|
|
7496
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: rowStyle, children: [
|
|
7497
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6712
7498
|
"span",
|
|
6713
7499
|
{
|
|
6714
7500
|
style: {
|
|
@@ -6718,12 +7504,12 @@ var SettingsMenu = ({
|
|
|
6718
7504
|
whiteSpace: "nowrap"
|
|
6719
7505
|
},
|
|
6720
7506
|
children: [
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
7507
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CrosshairIcon, { color: "#d4d4d8" }),
|
|
6722
7508
|
"Armer le picker"
|
|
6723
7509
|
]
|
|
6724
7510
|
}
|
|
6725
7511
|
),
|
|
6726
|
-
/* @__PURE__ */ (0,
|
|
7512
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6727
7513
|
Select,
|
|
6728
7514
|
{
|
|
6729
7515
|
ariaLabel: "Armer le picker",
|
|
@@ -6735,10 +7521,28 @@ var SettingsMenu = ({
|
|
|
6735
7521
|
}
|
|
6736
7522
|
)
|
|
6737
7523
|
] }),
|
|
6738
|
-
/* @__PURE__ */ (0,
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
7524
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7525
|
+
GestureRow,
|
|
7526
|
+
{
|
|
7527
|
+
label: "Copier l'\xE9l\xE9ment",
|
|
7528
|
+
cmdKey: "copy",
|
|
7529
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopyIcon, {}),
|
|
7530
|
+
commands,
|
|
7531
|
+
onChange: onChangeCommands
|
|
7532
|
+
}
|
|
7533
|
+
),
|
|
7534
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7535
|
+
GestureRow,
|
|
7536
|
+
{
|
|
7537
|
+
label: "S\xE9lection multiple",
|
|
7538
|
+
cmdKey: "multi",
|
|
7539
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MultiIcon, {}),
|
|
7540
|
+
commands,
|
|
7541
|
+
onChange: onChangeCommands
|
|
7542
|
+
}
|
|
7543
|
+
),
|
|
7544
|
+
showVsCode && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: rowStyle, children: [
|
|
7545
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6742
7546
|
"span",
|
|
6743
7547
|
{
|
|
6744
7548
|
style: {
|
|
@@ -6748,12 +7552,12 @@ var SettingsMenu = ({
|
|
|
6748
7552
|
whiteSpace: "nowrap"
|
|
6749
7553
|
},
|
|
6750
7554
|
children: [
|
|
6751
|
-
/* @__PURE__ */ (0,
|
|
7555
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(VsCodeIcon, {}),
|
|
6752
7556
|
"\xC9diteur"
|
|
6753
7557
|
]
|
|
6754
7558
|
}
|
|
6755
7559
|
),
|
|
6756
|
-
/* @__PURE__ */ (0,
|
|
7560
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6757
7561
|
Select,
|
|
6758
7562
|
{
|
|
6759
7563
|
ariaLabel: "\xC9diteur",
|
|
@@ -6765,23 +7569,97 @@ var SettingsMenu = ({
|
|
|
6765
7569
|
}
|
|
6766
7570
|
)
|
|
6767
7571
|
] }),
|
|
6768
|
-
showVsCode && /* @__PURE__ */ (0,
|
|
6769
|
-
|
|
6770
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: 1, background: "rgba(255,255,255,0.08)", margin: "4px 8px" } }),
|
|
6771
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KeyRow, { label: "Valider la s\xE9lection", cmdKey: "confirm", options: CONFIRM_KEY_OPTIONS, commands, onChange: onChangeCommands }),
|
|
6772
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KeyRow, { label: "Annuler / d\xE9sarmer", cmdKey: "cancel", options: CANCEL_KEY_OPTIONS, commands, onChange: onChangeCommands }),
|
|
6773
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KeyGestureRow, { label: "Rechercher", cmdKey: "search", keyOptions: SEARCH_KEY_OPTIONS, commands, onChange: onChangeCommands }),
|
|
6774
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KeyGestureRow, { label: "Ouvrir l'inspecteur", cmdKey: "inspect", keyOptions: INSPECT_OPTIONS, commands, onChange: onChangeCommands }),
|
|
6775
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: 1, background: "rgba(255,255,255,0.08)", margin: "4px 8px" } }),
|
|
6776
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6777
|
-
ToggleRow,
|
|
7572
|
+
showVsCode && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7573
|
+
GestureRow,
|
|
6778
7574
|
{
|
|
6779
|
-
label: "
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
7575
|
+
label: "Ouvrir le composant (global)",
|
|
7576
|
+
cmdKey: "source",
|
|
7577
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(VsCodeIcon, {}),
|
|
7578
|
+
commands,
|
|
7579
|
+
onChange: onChangeCommands
|
|
6783
7580
|
}
|
|
6784
|
-
)
|
|
7581
|
+
),
|
|
7582
|
+
showVsCode && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7583
|
+
GestureRow,
|
|
7584
|
+
{
|
|
7585
|
+
label: "Ouvrir le composant (local)",
|
|
7586
|
+
cmdKey: "usage",
|
|
7587
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(VsCodeIcon, {}),
|
|
7588
|
+
commands,
|
|
7589
|
+
onChange: onChangeCommands
|
|
7590
|
+
}
|
|
7591
|
+
),
|
|
7592
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7593
|
+
"div",
|
|
7594
|
+
{
|
|
7595
|
+
style: {
|
|
7596
|
+
height: 1,
|
|
7597
|
+
background: "rgba(255,255,255,0.08)",
|
|
7598
|
+
margin: "4px 8px"
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
),
|
|
7602
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7603
|
+
KeyRow,
|
|
7604
|
+
{
|
|
7605
|
+
label: "Valider la s\xE9lection",
|
|
7606
|
+
cmdKey: "confirm",
|
|
7607
|
+
options: CONFIRM_KEY_OPTIONS,
|
|
7608
|
+
commands,
|
|
7609
|
+
onChange: onChangeCommands
|
|
7610
|
+
}
|
|
7611
|
+
),
|
|
7612
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7613
|
+
KeyRow,
|
|
7614
|
+
{
|
|
7615
|
+
label: "Annuler / d\xE9sarmer",
|
|
7616
|
+
cmdKey: "cancel",
|
|
7617
|
+
options: CANCEL_KEY_OPTIONS,
|
|
7618
|
+
commands,
|
|
7619
|
+
onChange: onChangeCommands
|
|
7620
|
+
}
|
|
7621
|
+
),
|
|
7622
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7623
|
+
KeyGestureRow,
|
|
7624
|
+
{
|
|
7625
|
+
label: "Rechercher",
|
|
7626
|
+
cmdKey: "search",
|
|
7627
|
+
keyOptions: SEARCH_KEY_OPTIONS,
|
|
7628
|
+
commands,
|
|
7629
|
+
onChange: onChangeCommands
|
|
7630
|
+
}
|
|
7631
|
+
),
|
|
7632
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7633
|
+
KeyGestureRow,
|
|
7634
|
+
{
|
|
7635
|
+
label: "Ouvrir l'inspecteur",
|
|
7636
|
+
cmdKey: "inspect",
|
|
7637
|
+
keyOptions: INSPECT_OPTIONS,
|
|
7638
|
+
commands,
|
|
7639
|
+
onChange: onChangeCommands
|
|
7640
|
+
}
|
|
7641
|
+
),
|
|
7642
|
+
onChangeShowModuleOverlay && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7643
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7644
|
+
"div",
|
|
7645
|
+
{
|
|
7646
|
+
style: {
|
|
7647
|
+
height: 1,
|
|
7648
|
+
background: "rgba(255,255,255,0.08)",
|
|
7649
|
+
margin: "4px 8px"
|
|
7650
|
+
}
|
|
7651
|
+
}
|
|
7652
|
+
),
|
|
7653
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7654
|
+
ToggleRow,
|
|
7655
|
+
{
|
|
7656
|
+
label: "Rectangles modules PrestaShop",
|
|
7657
|
+
checked: showModuleOverlay ?? DEFAULT_SETTINGS.showModuleOverlay,
|
|
7658
|
+
defaultChecked: DEFAULT_SETTINGS.showModuleOverlay,
|
|
7659
|
+
onChange: onChangeShowModuleOverlay
|
|
7660
|
+
}
|
|
7661
|
+
)
|
|
7662
|
+
] })
|
|
6785
7663
|
] })
|
|
6786
7664
|
]
|
|
6787
7665
|
}
|
|
@@ -6789,17 +7667,17 @@ var SettingsMenu = ({
|
|
|
6789
7667
|
};
|
|
6790
7668
|
|
|
6791
7669
|
// src/ui/toolbar-tooltip.tsx
|
|
6792
|
-
var
|
|
6793
|
-
var
|
|
7670
|
+
var import_react16 = require("react");
|
|
7671
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6794
7672
|
function ToolbarTooltip({
|
|
6795
7673
|
label,
|
|
6796
7674
|
shortcut,
|
|
6797
7675
|
side = "top",
|
|
6798
7676
|
children
|
|
6799
7677
|
}) {
|
|
6800
|
-
const [open, setOpen] = (0,
|
|
6801
|
-
const timer = (0,
|
|
6802
|
-
(0,
|
|
7678
|
+
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
7679
|
+
const timer = (0, import_react16.useRef)(null);
|
|
7680
|
+
(0, import_react16.useEffect)(
|
|
6803
7681
|
() => () => {
|
|
6804
7682
|
if (timer.current) clearTimeout(timer.current);
|
|
6805
7683
|
},
|
|
@@ -6837,7 +7715,7 @@ function ToolbarTooltip({
|
|
|
6837
7715
|
boxShadow: TOOLTIP_SHADOW,
|
|
6838
7716
|
pointerEvents: "none"
|
|
6839
7717
|
};
|
|
6840
|
-
return /* @__PURE__ */ (0,
|
|
7718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
6841
7719
|
"span",
|
|
6842
7720
|
{
|
|
6843
7721
|
style: wrapStyle,
|
|
@@ -6846,9 +7724,9 @@ function ToolbarTooltip({
|
|
|
6846
7724
|
onFocus: show,
|
|
6847
7725
|
onBlur: hide,
|
|
6848
7726
|
children: [
|
|
6849
|
-
open && /* @__PURE__ */ (0,
|
|
7727
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { role: "tooltip", style: bubbleStyle, children: [
|
|
6850
7728
|
label,
|
|
6851
|
-
shortcut && /* @__PURE__ */ (0,
|
|
7729
|
+
shortcut && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6852
7730
|
"span",
|
|
6853
7731
|
{
|
|
6854
7732
|
style: {
|
|
@@ -6866,21 +7744,8 @@ function ToolbarTooltip({
|
|
|
6866
7744
|
}
|
|
6867
7745
|
|
|
6868
7746
|
// src/ui/settings-bar.tsx
|
|
6869
|
-
var
|
|
6870
|
-
var
|
|
6871
|
-
display: "inline-flex",
|
|
6872
|
-
alignItems: "center",
|
|
6873
|
-
justifyContent: "center",
|
|
6874
|
-
width: 22,
|
|
6875
|
-
height: 22,
|
|
6876
|
-
borderRadius: 4,
|
|
6877
|
-
cursor: "pointer",
|
|
6878
|
-
background: active ? HOVER_BG : "transparent",
|
|
6879
|
-
border: "none",
|
|
6880
|
-
color: MUTED,
|
|
6881
|
-
padding: 0
|
|
6882
|
-
});
|
|
6883
|
-
function SettingsBar({
|
|
7747
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7748
|
+
var SettingsBar = ({
|
|
6884
7749
|
hasSelection,
|
|
6885
7750
|
settingsOpen,
|
|
6886
7751
|
onToggleSettings,
|
|
@@ -6894,144 +7759,176 @@ function SettingsBar({
|
|
|
6894
7759
|
searchOpen,
|
|
6895
7760
|
showVsCode = true,
|
|
6896
7761
|
onOpenSitePlan
|
|
6897
|
-
}) {
|
|
6898
|
-
|
|
6899
|
-
|
|
7762
|
+
}) => {
|
|
7763
|
+
const movable = useMovable("settings-bar");
|
|
7764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
7765
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MoveHomeSlot, { home: movable.home, over: movable.overHome }),
|
|
7766
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7767
|
+
"div",
|
|
7768
|
+
{
|
|
7769
|
+
ref: movable.ref,
|
|
7770
|
+
"data-pathpicker-ignore": "",
|
|
7771
|
+
"data-rp-settings": "",
|
|
7772
|
+
style: {
|
|
7773
|
+
position: "fixed",
|
|
7774
|
+
bottom: 16,
|
|
7775
|
+
left: "50%",
|
|
7776
|
+
transform: "translateX(-50%)",
|
|
7777
|
+
zIndex: UI_Z,
|
|
7778
|
+
display: "flex",
|
|
7779
|
+
flexDirection: "column",
|
|
7780
|
+
alignItems: "center",
|
|
7781
|
+
gap: 8,
|
|
7782
|
+
pointerEvents: "none",
|
|
7783
|
+
...movable.style
|
|
7784
|
+
},
|
|
7785
|
+
children: [
|
|
7786
|
+
settingsOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7787
|
+
SettingsMenu,
|
|
7788
|
+
{
|
|
7789
|
+
commands,
|
|
7790
|
+
onChangeCommands,
|
|
7791
|
+
onClose: onCloseSettings,
|
|
7792
|
+
showVsCode,
|
|
7793
|
+
showModuleOverlay,
|
|
7794
|
+
onChangeShowModuleOverlay
|
|
7795
|
+
}
|
|
7796
|
+
),
|
|
7797
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7798
|
+
"div",
|
|
7799
|
+
{
|
|
7800
|
+
style: {
|
|
7801
|
+
...CONTROL_FRAME,
|
|
7802
|
+
pointerEvents: "auto",
|
|
7803
|
+
fontSize: 12,
|
|
7804
|
+
fontWeight: 500,
|
|
7805
|
+
fontFamily: "system-ui, sans-serif",
|
|
7806
|
+
color: "#fff"
|
|
7807
|
+
},
|
|
7808
|
+
children: [
|
|
7809
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MoveHandle, { ...movable.handleProps }),
|
|
7810
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { padding: "0 4px" }, children: hasSelection ? "Entr\xE9e pour valider" : "\xC9chap pour annuler" }),
|
|
7811
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarTooltip, { label: "Inspecteur", shortcut: "Ctrl+I", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7812
|
+
IconButton,
|
|
7813
|
+
{
|
|
7814
|
+
"data-rp-panel": "",
|
|
7815
|
+
"aria-label": "Ouvrir l'inspecteur",
|
|
7816
|
+
onClick: onTogglePanel,
|
|
7817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PanelIcon, { color: "currentColor" })
|
|
7818
|
+
}
|
|
7819
|
+
) }),
|
|
7820
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarTooltip, { label: "Rechercher", shortcut: "Ctrl+F", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7821
|
+
IconButton,
|
|
7822
|
+
{
|
|
7823
|
+
"data-rp-search": "",
|
|
7824
|
+
"data-rp-search-ui": "",
|
|
7825
|
+
"aria-label": "Rechercher des \xE9l\xE9ments",
|
|
7826
|
+
"aria-expanded": searchOpen,
|
|
7827
|
+
active: searchOpen,
|
|
7828
|
+
onClick: onToggleSearch,
|
|
7829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchIcon, { color: "currentColor" })
|
|
7830
|
+
}
|
|
7831
|
+
) }),
|
|
7832
|
+
onOpenSitePlan && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarTooltip, { label: "Plan du site", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7833
|
+
IconButton,
|
|
7834
|
+
{
|
|
7835
|
+
"data-rp-site-plan-btn": "",
|
|
7836
|
+
"aria-label": "Plan du site",
|
|
7837
|
+
onClick: onOpenSitePlan,
|
|
7838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MapIcon, { color: "currentColor" })
|
|
7839
|
+
}
|
|
7840
|
+
) }),
|
|
7841
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarTooltip, { label: "Param\xE8tres", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7842
|
+
IconButton,
|
|
7843
|
+
{
|
|
7844
|
+
"data-rp-gear": "",
|
|
7845
|
+
"aria-label": "Param\xE8tres d'affichage",
|
|
7846
|
+
"aria-expanded": settingsOpen,
|
|
7847
|
+
active: settingsOpen,
|
|
7848
|
+
onClick: onToggleSettings,
|
|
7849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GearIcon, { color: "currentColor" })
|
|
7850
|
+
}
|
|
7851
|
+
) })
|
|
7852
|
+
]
|
|
7853
|
+
}
|
|
7854
|
+
)
|
|
7855
|
+
]
|
|
7856
|
+
}
|
|
7857
|
+
)
|
|
7858
|
+
] });
|
|
7859
|
+
};
|
|
7860
|
+
|
|
7861
|
+
// src/ui/element-menu-items.tsx
|
|
7862
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7863
|
+
function elementMenuItems(el, selection, copy2, done) {
|
|
7864
|
+
const run = (fn) => () => {
|
|
7865
|
+
fn();
|
|
7866
|
+
done();
|
|
7867
|
+
};
|
|
7868
|
+
const targets = selection.length > 0 && selection.some((s) => s.contains(el)) ? selection : [el];
|
|
7869
|
+
const many = targets.length > 1;
|
|
7870
|
+
return [
|
|
6900
7871
|
{
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
transform: "translateX(-50%)",
|
|
6908
|
-
zIndex: UI_Z,
|
|
6909
|
-
display: "flex",
|
|
6910
|
-
flexDirection: "column",
|
|
6911
|
-
alignItems: "center",
|
|
6912
|
-
gap: 8,
|
|
6913
|
-
pointerEvents: "none"
|
|
6914
|
-
},
|
|
6915
|
-
children: [
|
|
6916
|
-
settingsOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6917
|
-
SettingsMenu,
|
|
6918
|
-
{
|
|
6919
|
-
commands,
|
|
6920
|
-
onChangeCommands,
|
|
6921
|
-
onClose: onCloseSettings,
|
|
6922
|
-
showVsCode,
|
|
6923
|
-
showModuleOverlay,
|
|
6924
|
-
onChangeShowModuleOverlay
|
|
6925
|
-
}
|
|
6926
|
-
),
|
|
6927
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6928
|
-
"div",
|
|
6929
|
-
{
|
|
6930
|
-
style: {
|
|
6931
|
-
pointerEvents: "auto",
|
|
6932
|
-
display: "inline-flex",
|
|
6933
|
-
alignItems: "center",
|
|
6934
|
-
gap: 8,
|
|
6935
|
-
padding: "4px 6px",
|
|
6936
|
-
borderRadius: 6,
|
|
6937
|
-
fontSize: 12,
|
|
6938
|
-
fontWeight: 500,
|
|
6939
|
-
fontFamily: "system-ui, sans-serif",
|
|
6940
|
-
color: "#fff",
|
|
6941
|
-
background: SECONDARY_SURFACE,
|
|
6942
|
-
border: SECONDARY_BORDER,
|
|
6943
|
-
boxShadow: BTN_SHADOW
|
|
6944
|
-
},
|
|
6945
|
-
children: [
|
|
6946
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { padding: "0 2px" }, children: hasSelection ? "Entr\xE9e pour valider" : "\xC9chap pour annuler" }),
|
|
6947
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarTooltip, { label: "Inspecteur", shortcut: "Ctrl+I", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6948
|
-
"button",
|
|
6949
|
-
{
|
|
6950
|
-
type: "button",
|
|
6951
|
-
"data-rp-panel": "",
|
|
6952
|
-
"aria-label": "Ouvrir l'inspecteur",
|
|
6953
|
-
onClick: onTogglePanel,
|
|
6954
|
-
onMouseEnter: (e) => {
|
|
6955
|
-
e.currentTarget.style.background = SECONDARY_BG_HOVER;
|
|
6956
|
-
},
|
|
6957
|
-
onMouseLeave: (e) => {
|
|
6958
|
-
e.currentTarget.style.background = "transparent";
|
|
6959
|
-
},
|
|
6960
|
-
style: ghostButton(false),
|
|
6961
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PanelIcon, { color: MUTED })
|
|
6962
|
-
}
|
|
6963
|
-
) }),
|
|
6964
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarTooltip, { label: "Rechercher", shortcut: "Ctrl+F", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6965
|
-
"button",
|
|
6966
|
-
{
|
|
6967
|
-
type: "button",
|
|
6968
|
-
"data-rp-search": "",
|
|
6969
|
-
"data-rp-search-ui": "",
|
|
6970
|
-
"aria-label": "Rechercher des \xE9l\xE9ments",
|
|
6971
|
-
"aria-expanded": searchOpen,
|
|
6972
|
-
onClick: onToggleSearch,
|
|
6973
|
-
onMouseEnter: (e) => {
|
|
6974
|
-
e.currentTarget.style.background = SECONDARY_BG_HOVER;
|
|
6975
|
-
},
|
|
6976
|
-
onMouseLeave: (e) => {
|
|
6977
|
-
e.currentTarget.style.background = searchOpen ? HOVER_BG : "transparent";
|
|
6978
|
-
},
|
|
6979
|
-
style: ghostButton(searchOpen),
|
|
6980
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SearchIcon, { color: MUTED })
|
|
6981
|
-
}
|
|
6982
|
-
) }),
|
|
6983
|
-
onOpenSitePlan && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarTooltip, { label: "Plan du site", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6984
|
-
"button",
|
|
6985
|
-
{
|
|
6986
|
-
type: "button",
|
|
6987
|
-
"data-rp-site-plan-btn": "",
|
|
6988
|
-
"aria-label": "Plan du site",
|
|
6989
|
-
onClick: onOpenSitePlan,
|
|
6990
|
-
onMouseEnter: (e) => {
|
|
6991
|
-
e.currentTarget.style.background = SECONDARY_BG_HOVER;
|
|
6992
|
-
},
|
|
6993
|
-
onMouseLeave: (e) => {
|
|
6994
|
-
e.currentTarget.style.background = "transparent";
|
|
6995
|
-
},
|
|
6996
|
-
style: ghostButton(false),
|
|
6997
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MapIcon, { color: MUTED })
|
|
6998
|
-
}
|
|
6999
|
-
) }),
|
|
7000
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarTooltip, { label: "Param\xE8tres", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7001
|
-
"button",
|
|
7002
|
-
{
|
|
7003
|
-
type: "button",
|
|
7004
|
-
"data-rp-gear": "",
|
|
7005
|
-
"aria-label": "Param\xE8tres d'affichage",
|
|
7006
|
-
"aria-expanded": settingsOpen,
|
|
7007
|
-
onClick: onToggleSettings,
|
|
7008
|
-
onMouseEnter: (e) => {
|
|
7009
|
-
e.currentTarget.style.background = SECONDARY_BG_HOVER;
|
|
7010
|
-
},
|
|
7011
|
-
onMouseLeave: (e) => {
|
|
7012
|
-
e.currentTarget.style.background = settingsOpen ? HOVER_BG : "transparent";
|
|
7013
|
-
},
|
|
7014
|
-
style: ghostButton(settingsOpen),
|
|
7015
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GearIcon, { color: MUTED })
|
|
7016
|
-
}
|
|
7017
|
-
) })
|
|
7018
|
-
]
|
|
7019
|
-
}
|
|
7872
|
+
label: "Copier en HTML",
|
|
7873
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CodeIcon, {}),
|
|
7874
|
+
onClick: run(
|
|
7875
|
+
() => copy2(
|
|
7876
|
+
targets.map((t) => formatHtml(t.outerHTML)).join("\n\n"),
|
|
7877
|
+
many ? `HTML copi\xE9 \u2713 \xB7 ${targets.length}` : "HTML copi\xE9 \u2713"
|
|
7020
7878
|
)
|
|
7021
|
-
|
|
7879
|
+
)
|
|
7880
|
+
},
|
|
7881
|
+
{
|
|
7882
|
+
label: "Copier le rendu",
|
|
7883
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EyeIcon, {}),
|
|
7884
|
+
info: "Permet de copier \xE0 l'identique l'UI d'un composant",
|
|
7885
|
+
onClick: run(
|
|
7886
|
+
() => copy2(serializeWithComputedStyles(el), "HTML reproductible copi\xE9 \u2713")
|
|
7887
|
+
)
|
|
7888
|
+
},
|
|
7889
|
+
{
|
|
7890
|
+
label: "Copier les classes",
|
|
7891
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TagIcon, {}),
|
|
7892
|
+
onClick: run(() => {
|
|
7893
|
+
const list = targets.map((t) => t.getAttribute("class") ?? "");
|
|
7894
|
+
const toast = !list.some(Boolean) ? "Aucune classe" : many ? `Classes copi\xE9es \u2713 \xB7 ${targets.length}` : "Classes copi\xE9es \u2713";
|
|
7895
|
+
copy2(list.join("\n\n"), toast);
|
|
7896
|
+
})
|
|
7897
|
+
},
|
|
7898
|
+
{
|
|
7899
|
+
label: "Copier le texte",
|
|
7900
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TypeIcon, {}),
|
|
7901
|
+
onClick: run(() => {
|
|
7902
|
+
const txt = elementText(el);
|
|
7903
|
+
copy2(txt ?? "", txt ? "Texte copi\xE9 \u2713" : "Aucun texte");
|
|
7904
|
+
})
|
|
7905
|
+
},
|
|
7906
|
+
{
|
|
7907
|
+
label: "Copier le XPath",
|
|
7908
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GitBranchIcon, {}),
|
|
7909
|
+
onClick: run(() => copy2(getXPath(el), "XPath copi\xE9 \u2713"))
|
|
7910
|
+
},
|
|
7911
|
+
{
|
|
7912
|
+
label: "Supprimer l'\xE9l\xE9ment",
|
|
7913
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TrashIcon, {}),
|
|
7914
|
+
danger: true,
|
|
7915
|
+
disabled: el === document.body || el === document.documentElement,
|
|
7916
|
+
// Masqué plutôt que retiré : le reconciler React de l'app hôte recréerait le
|
|
7917
|
+
// nœud au prochain rendu, alors qu'un `display: none !important` survit.
|
|
7918
|
+
onClick: run(() => el.style.setProperty("display", "none", "important"))
|
|
7022
7919
|
}
|
|
7023
|
-
|
|
7920
|
+
];
|
|
7024
7921
|
}
|
|
7025
7922
|
|
|
7026
7923
|
// src/ui/site-plan/site-plan.tsx
|
|
7027
|
-
var
|
|
7028
|
-
var
|
|
7924
|
+
var import_react17 = require("react");
|
|
7925
|
+
var import_react_dom3 = require("react-dom");
|
|
7029
7926
|
|
|
7030
7927
|
// src/ui/site-plan/plan-row.tsx
|
|
7031
|
-
var
|
|
7032
|
-
var PlanRow = ({ row }) => /* @__PURE__ */ (0,
|
|
7033
|
-
/* @__PURE__ */ (0,
|
|
7034
|
-
/* @__PURE__ */ (0,
|
|
7928
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
7929
|
+
var PlanRow = ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { style: { listStyle: "none", padding: "6px 8px", borderRadius: 6 }, children: [
|
|
7930
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "baseline", gap: 8, minWidth: 0 }, children: [
|
|
7931
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7035
7932
|
"a",
|
|
7036
7933
|
{
|
|
7037
7934
|
href: row.url,
|
|
@@ -7045,7 +7942,7 @@ var PlanRow = ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li",
|
|
|
7045
7942
|
children: row.label
|
|
7046
7943
|
}
|
|
7047
7944
|
),
|
|
7048
|
-
/* @__PURE__ */ (0,
|
|
7945
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7049
7946
|
"a",
|
|
7050
7947
|
{
|
|
7051
7948
|
href: row.url,
|
|
@@ -7064,13 +7961,13 @@ var PlanRow = ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li",
|
|
|
7064
7961
|
children: shortUrl(row.url)
|
|
7065
7962
|
}
|
|
7066
7963
|
),
|
|
7067
|
-
row.error !== null && /* @__PURE__ */ (0,
|
|
7964
|
+
row.error !== null && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { style: { color: MUTED, fontSize: 11, whiteSpace: "nowrap" }, children: [
|
|
7068
7965
|
"(erreur HTTP ",
|
|
7069
7966
|
row.error || "r\xE9seau",
|
|
7070
7967
|
")"
|
|
7071
7968
|
] })
|
|
7072
7969
|
] }),
|
|
7073
|
-
row.modules.length > 0 && /* @__PURE__ */ (0,
|
|
7970
|
+
row.modules.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginTop: 4 }, children: row.modules.map((mod) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7074
7971
|
"span",
|
|
7075
7972
|
{
|
|
7076
7973
|
style: {
|
|
@@ -7088,18 +7985,18 @@ var PlanRow = ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li",
|
|
|
7088
7985
|
] });
|
|
7089
7986
|
|
|
7090
7987
|
// src/ui/site-plan/tree-node.tsx
|
|
7091
|
-
var
|
|
7988
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
7092
7989
|
var mono = "ui-monospace, SFMono-Regular, Menlo, monospace";
|
|
7093
|
-
var TreeNode2 = ({ node }) => /* @__PURE__ */ (0,
|
|
7094
|
-
/* @__PURE__ */ (0,
|
|
7095
|
-
/* @__PURE__ */ (0,
|
|
7096
|
-
node.row && /* @__PURE__ */ (0,
|
|
7990
|
+
var TreeNode2 = ({ node }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { style: { listStyle: "none" }, children: [
|
|
7991
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", alignItems: "baseline", gap: 8, padding: "2px 0" }, children: [
|
|
7992
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { color: MUTED, fontFamily: mono, fontSize: 11 }, children: node.segment }),
|
|
7993
|
+
node.row && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { href: node.row.url, style: { color: PRIMARY, fontWeight: 600, textDecoration: "none" }, children: node.row.label })
|
|
7097
7994
|
] }),
|
|
7098
|
-
node.children.length > 0 && /* @__PURE__ */ (0,
|
|
7995
|
+
node.children.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { style: { margin: 0, paddingLeft: 16, borderLeft: "1px solid rgba(255,255,255,0.08)" }, children: node.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TreeNode2, { node: child }, child.segment)) })
|
|
7099
7996
|
] });
|
|
7100
7997
|
|
|
7101
7998
|
// src/ui/site-plan/site-plan.tsx
|
|
7102
|
-
var
|
|
7999
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
7103
8000
|
var matches = (row, q) => row.label.toLowerCase().includes(q) || row.url.toLowerCase().includes(q) || row.modules.some((m) => m.toLowerCase().includes(q));
|
|
7104
8001
|
var headerButton = (active = false) => ({
|
|
7105
8002
|
display: "inline-flex",
|
|
@@ -7121,10 +8018,10 @@ var sectionTitle = {
|
|
|
7121
8018
|
color: "#fff"
|
|
7122
8019
|
};
|
|
7123
8020
|
var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
7124
|
-
const [state, setState] = (0,
|
|
7125
|
-
const [query, setQuery] = (0,
|
|
7126
|
-
const [view, setView] = (0,
|
|
7127
|
-
(0,
|
|
8021
|
+
const [state, setState] = (0, import_react17.useState)({ status: "loading", done: 0, total: 0 });
|
|
8022
|
+
const [query, setQuery] = (0, import_react17.useState)("");
|
|
8023
|
+
const [view, setView] = (0, import_react17.useState)("list");
|
|
8024
|
+
(0, import_react17.useEffect)(() => {
|
|
7128
8025
|
let alive = true;
|
|
7129
8026
|
buildSitePlan(indexUrl, fetch, (done, total) => {
|
|
7130
8027
|
if (alive) setState({ status: "loading", done, total });
|
|
@@ -7137,14 +8034,14 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7137
8034
|
alive = false;
|
|
7138
8035
|
};
|
|
7139
8036
|
}, [indexUrl]);
|
|
7140
|
-
(0,
|
|
8037
|
+
(0, import_react17.useEffect)(() => {
|
|
7141
8038
|
const onKey = (e) => {
|
|
7142
8039
|
if (e.key === "Escape") onClose();
|
|
7143
8040
|
};
|
|
7144
8041
|
window.addEventListener("keydown", onKey);
|
|
7145
8042
|
return () => window.removeEventListener("keydown", onKey);
|
|
7146
8043
|
}, [onClose]);
|
|
7147
|
-
const filtered = (0,
|
|
8044
|
+
const filtered = (0, import_react17.useMemo)(() => {
|
|
7148
8045
|
if (state.status !== "ready") return null;
|
|
7149
8046
|
const q = query.trim().toLowerCase();
|
|
7150
8047
|
if (!q) return state.plan;
|
|
@@ -7154,14 +8051,14 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7154
8051
|
links: state.plan.links.filter((r) => matches(r, q))
|
|
7155
8052
|
};
|
|
7156
8053
|
}, [state, query]);
|
|
7157
|
-
const tree = (0,
|
|
8054
|
+
const tree = (0, import_react17.useMemo)(() => filtered && view === "tree" ? buildPageTree(filtered) : null, [filtered, view]);
|
|
7158
8055
|
const copyText = (text, message) => {
|
|
7159
8056
|
navigator.clipboard?.writeText(text).catch(() => {
|
|
7160
8057
|
});
|
|
7161
8058
|
onCopied?.(message);
|
|
7162
8059
|
};
|
|
7163
|
-
return (0,
|
|
7164
|
-
/* @__PURE__ */ (0,
|
|
8060
|
+
return (0, import_react_dom3.createPortal)(
|
|
8061
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7165
8062
|
"div",
|
|
7166
8063
|
{
|
|
7167
8064
|
...{ [IGNORE_ATTR]: "" },
|
|
@@ -7177,7 +8074,7 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7177
8074
|
justifyContent: "center",
|
|
7178
8075
|
fontFamily: "system-ui, sans-serif"
|
|
7179
8076
|
},
|
|
7180
|
-
children: /* @__PURE__ */ (0,
|
|
8077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
7181
8078
|
"div",
|
|
7182
8079
|
{
|
|
7183
8080
|
role: "dialog",
|
|
@@ -7196,23 +8093,23 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7196
8093
|
fontSize: 12
|
|
7197
8094
|
},
|
|
7198
8095
|
children: [
|
|
7199
|
-
/* @__PURE__ */ (0,
|
|
7200
|
-
/* @__PURE__ */ (0,
|
|
7201
|
-
state.status === "ready" && /* @__PURE__ */ (0,
|
|
7202
|
-
/* @__PURE__ */ (0,
|
|
7203
|
-
/* @__PURE__ */ (0,
|
|
7204
|
-
/* @__PURE__ */ (0,
|
|
8096
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "10px 12px", borderBottom: PANEL_BORDER }, children: [
|
|
8097
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: 14, fontWeight: 700, flex: 1 }, children: "Plan du site" }),
|
|
8098
|
+
state.status === "ready" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
8099
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "group", "aria-label": "Affichage", style: { display: "inline-flex", gap: 2 }, children: [
|
|
8100
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": view === "list", onClick: () => setView("list"), style: headerButton(view === "list"), children: "Liste" }),
|
|
8101
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": view === "tree", onClick: () => setView("tree"), style: headerButton(view === "tree"), children: "Arbre" })
|
|
7205
8102
|
] }),
|
|
7206
|
-
/* @__PURE__ */ (0,
|
|
7207
|
-
/* @__PURE__ */ (0,
|
|
8103
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("button", { type: "button", onClick: () => copyText(sitePlanMarkdown(state.plan), "Plan copi\xE9 \u2713"), style: headerButton(), children: [
|
|
8104
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopyIcon, {}),
|
|
7208
8105
|
"Copier en Markdown"
|
|
7209
8106
|
] }),
|
|
7210
|
-
/* @__PURE__ */ (0,
|
|
7211
|
-
/* @__PURE__ */ (0,
|
|
8107
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("button", { type: "button", onClick: () => copyText(pageTreeText(state.plan), "Arbre copi\xE9 \u2713"), style: headerButton(), children: [
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GitBranchIcon, {}),
|
|
7212
8109
|
"Copier l'arbre"
|
|
7213
8110
|
] })
|
|
7214
8111
|
] }),
|
|
7215
|
-
/* @__PURE__ */ (0,
|
|
8112
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7216
8113
|
"button",
|
|
7217
8114
|
{
|
|
7218
8115
|
type: "button",
|
|
@@ -7223,7 +8120,7 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7223
8120
|
}
|
|
7224
8121
|
)
|
|
7225
8122
|
] }),
|
|
7226
|
-
state.status === "ready" && /* @__PURE__ */ (0,
|
|
8123
|
+
state.status === "ready" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7227
8124
|
"input",
|
|
7228
8125
|
{
|
|
7229
8126
|
type: "search",
|
|
@@ -7243,31 +8140,31 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7243
8140
|
}
|
|
7244
8141
|
}
|
|
7245
8142
|
),
|
|
7246
|
-
/* @__PURE__ */ (0,
|
|
7247
|
-
state.status === "loading" && /* @__PURE__ */ (0,
|
|
7248
|
-
state.status === "error" && /* @__PURE__ */ (0,
|
|
7249
|
-
tree && /* @__PURE__ */ (0,
|
|
7250
|
-
filtered && view === "list" && /* @__PURE__ */ (0,
|
|
7251
|
-
/* @__PURE__ */ (0,
|
|
8143
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { overflowY: "auto", padding: "0 4px 12px" }, children: [
|
|
8144
|
+
state.status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { padding: "12px 8px", color: MUTED, margin: 0 }, children: state.total ? `Chargement des pages (${state.done}/${state.total})\u2026` : "Chargement de la liste des pages\u2026" }),
|
|
8145
|
+
state.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { padding: "12px 8px", color: MUTED, margin: 0 }, children: "Liste des pages indisponible. V\xE9rifie que le module PrestaShop renderpicker est \xE0 jour." }),
|
|
8146
|
+
tree && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { style: { margin: "8px 0 0", padding: "0 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TreeNode2, { node: tree }) }),
|
|
8147
|
+
filtered && view === "list" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
8148
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { style: sectionTitle, children: [
|
|
7252
8149
|
"Pages CMS (",
|
|
7253
8150
|
filtered.cms.length,
|
|
7254
8151
|
")"
|
|
7255
8152
|
] }),
|
|
7256
|
-
/* @__PURE__ */ (0,
|
|
7257
|
-
/* @__PURE__ */ (0,
|
|
8153
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { style: { margin: 0, padding: 0 }, children: filtered.cms.map((row) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PlanRow, { row }, row.url)) }),
|
|
8154
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { style: sectionTitle, children: [
|
|
7258
8155
|
"Pages avec modules (",
|
|
7259
8156
|
filtered.pages.length,
|
|
7260
8157
|
")"
|
|
7261
8158
|
] }),
|
|
7262
|
-
/* @__PURE__ */ (0,
|
|
7263
|
-
filtered.links.length > 0 && /* @__PURE__ */ (0,
|
|
7264
|
-
/* @__PURE__ */ (0,
|
|
8159
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { style: { margin: 0, padding: 0 }, children: filtered.pages.map((row) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PlanRow, { row }, row.url)) }),
|
|
8160
|
+
filtered.links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
8161
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { style: sectionTitle, children: [
|
|
7265
8162
|
"Autres liens (",
|
|
7266
8163
|
filtered.links.length,
|
|
7267
8164
|
")"
|
|
7268
8165
|
] }),
|
|
7269
|
-
/* @__PURE__ */ (0,
|
|
7270
|
-
/* @__PURE__ */ (0,
|
|
8166
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { margin: "0 8px 4px", color: MUTED, fontSize: 11 }, children: "Liens trouv\xE9s dans les pages ci-dessus (cat\xE9gories, marques, blog, produits\u2026), non charg\xE9s." }),
|
|
8167
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { style: { margin: 0, padding: 0 }, children: filtered.links.map((row) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PlanRow, { row }, row.url)) })
|
|
7271
8168
|
] })
|
|
7272
8169
|
] })
|
|
7273
8170
|
] })
|
|
@@ -7281,7 +8178,7 @@ var SitePlan = ({ indexUrl, onClose, onCopied }) => {
|
|
|
7281
8178
|
};
|
|
7282
8179
|
|
|
7283
8180
|
// src/ui/use-render-picker.ts
|
|
7284
|
-
var
|
|
8181
|
+
var import_react18 = require("react");
|
|
7285
8182
|
|
|
7286
8183
|
// src/core/inspector/hotkey.ts
|
|
7287
8184
|
var MOD_INFO = {
|
|
@@ -7402,9 +8299,9 @@ function useRenderPicker(options) {
|
|
|
7402
8299
|
onSearch,
|
|
7403
8300
|
onSelectionChange
|
|
7404
8301
|
} = options;
|
|
7405
|
-
const [isActive, setActive] = (0,
|
|
7406
|
-
const inspectorRef = (0,
|
|
7407
|
-
const optsRef = (0,
|
|
8302
|
+
const [isActive, setActive] = (0, import_react18.useState)(false);
|
|
8303
|
+
const inspectorRef = (0, import_react18.useRef)(null);
|
|
8304
|
+
const optsRef = (0, import_react18.useRef)({
|
|
7408
8305
|
pathname,
|
|
7409
8306
|
multi,
|
|
7410
8307
|
onPick,
|
|
@@ -7430,22 +8327,23 @@ function useRenderPicker(options) {
|
|
|
7430
8327
|
onSearch,
|
|
7431
8328
|
onSelectionChange
|
|
7432
8329
|
};
|
|
7433
|
-
const toggle = (0,
|
|
7434
|
-
const disarm = (0,
|
|
7435
|
-
const getSelection = (0,
|
|
8330
|
+
const toggle = (0, import_react18.useCallback)(() => setActive((a) => !a), []);
|
|
8331
|
+
const disarm = (0, import_react18.useCallback)(() => setActive(false), []);
|
|
8332
|
+
const getSelection = (0, import_react18.useCallback)(
|
|
7436
8333
|
() => inspectorRef.current?.getSelection() ?? [],
|
|
7437
8334
|
[]
|
|
7438
8335
|
);
|
|
7439
|
-
const setSearchMode = (0,
|
|
8336
|
+
const setSearchMode = (0, import_react18.useCallback)((on) => {
|
|
7440
8337
|
inspectorRef.current?.setSearchMode(on);
|
|
7441
8338
|
}, []);
|
|
7442
|
-
(0,
|
|
7443
|
-
(0,
|
|
8339
|
+
(0, import_react18.useEffect)(() => onDisarmRequest(() => setActive(false)), []);
|
|
8340
|
+
(0, import_react18.useEffect)(() => {
|
|
7444
8341
|
if (typeof window === "undefined") return;
|
|
7445
8342
|
const matcher = createHotkeyMatcher(hotkey);
|
|
7446
8343
|
const searchMatcher = createKeyCommandMatcher();
|
|
7447
8344
|
const onKeyDown = (e) => {
|
|
7448
8345
|
if (e.key === "Escape") {
|
|
8346
|
+
if (CONTEXT_MENU_OPEN.value) return;
|
|
7449
8347
|
setActive(false);
|
|
7450
8348
|
return;
|
|
7451
8349
|
}
|
|
@@ -7485,7 +8383,7 @@ function useRenderPicker(options) {
|
|
|
7485
8383
|
window.removeEventListener("blur", reset);
|
|
7486
8384
|
};
|
|
7487
8385
|
}, [hotkey]);
|
|
7488
|
-
(0,
|
|
8386
|
+
(0, import_react18.useEffect)(() => {
|
|
7489
8387
|
if (!isActive || typeof window === "undefined") return;
|
|
7490
8388
|
const inspector = createInspector({
|
|
7491
8389
|
// L'inspecteur se démonte lui-même après un pick ; on synchronise l'état
|
|
@@ -7516,14 +8414,14 @@ function useRenderPicker(options) {
|
|
|
7516
8414
|
inspectorRef.current = null;
|
|
7517
8415
|
};
|
|
7518
8416
|
}, [isActive]);
|
|
7519
|
-
(0,
|
|
8417
|
+
(0, import_react18.useEffect)(() => {
|
|
7520
8418
|
inspectorRef.current?.refreshDecorations();
|
|
7521
8419
|
}, [overlays?.padding, overlays?.gap, overlays?.margin]);
|
|
7522
8420
|
return { isActive, toggle, setSearchMode, disarm, getSelection };
|
|
7523
8421
|
}
|
|
7524
8422
|
|
|
7525
8423
|
// src/react.tsx
|
|
7526
|
-
var
|
|
8424
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
7527
8425
|
function copy(text) {
|
|
7528
8426
|
navigator.clipboard?.writeText(text).catch(() => {
|
|
7529
8427
|
});
|
|
@@ -7537,38 +8435,40 @@ var RenderPickerButton = ({
|
|
|
7537
8435
|
color = ACCENT,
|
|
7538
8436
|
useRoute = true
|
|
7539
8437
|
}) => {
|
|
7540
|
-
const [toast, setToast] = (0,
|
|
7541
|
-
const [
|
|
7542
|
-
const [
|
|
7543
|
-
const [
|
|
7544
|
-
const [sitePlanOpen, setSitePlanOpen] = (0, import_react16.useState)(false);
|
|
8438
|
+
const [toast, setToast] = (0, import_react19.useState)(null);
|
|
8439
|
+
const [hasSelection, setHasSelection] = (0, import_react19.useState)(false);
|
|
8440
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react19.useState)(false);
|
|
8441
|
+
const [sitePlanOpen, setSitePlanOpen] = (0, import_react19.useState)(false);
|
|
7545
8442
|
const pagesUrl = resolvePagesUrl(window);
|
|
7546
|
-
const [panelOpen, setPanelOpen] = (0,
|
|
7547
|
-
const [searchOpen, setSearchOpen] = (0,
|
|
7548
|
-
const [contextMenu, setContextMenu] = (0,
|
|
7549
|
-
const [commands, setCommands] = (0,
|
|
7550
|
-
const [
|
|
8443
|
+
const [panelOpen, setPanelOpen] = (0, import_react19.useState)(() => loadPanelState().open);
|
|
8444
|
+
const [searchOpen, setSearchOpen] = (0, import_react19.useState)(false);
|
|
8445
|
+
const [contextMenu, setContextMenu] = (0, import_react19.useState)(null);
|
|
8446
|
+
const [commands, setCommands] = (0, import_react19.useState)(() => loadSettings().commands);
|
|
8447
|
+
const [isPrestaShop] = (0, import_react19.useState)(
|
|
8448
|
+
() => typeof window !== "undefined" && detectPrestaShop(window, document)
|
|
8449
|
+
);
|
|
8450
|
+
const [showModuleOverlay, setShowModuleOverlay] = (0, import_react19.useState)(
|
|
7551
8451
|
() => loadSettings().showModuleOverlay
|
|
7552
8452
|
);
|
|
7553
|
-
const toastTimer = (0,
|
|
7554
|
-
const lastSavedRef = (0,
|
|
7555
|
-
const showToast = (0,
|
|
8453
|
+
const toastTimer = (0, import_react19.useRef)(null);
|
|
8454
|
+
const lastSavedRef = (0, import_react19.useRef)(null);
|
|
8455
|
+
const showToast = (0, import_react19.useCallback)((msg) => {
|
|
7556
8456
|
setToast(msg);
|
|
7557
8457
|
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
7558
8458
|
toastTimer.current = setTimeout(() => setToast(null), 1600);
|
|
7559
8459
|
}, []);
|
|
7560
|
-
(0,
|
|
8460
|
+
(0, import_react19.useEffect)(
|
|
7561
8461
|
() => () => {
|
|
7562
8462
|
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
7563
8463
|
},
|
|
7564
8464
|
[]
|
|
7565
8465
|
);
|
|
7566
|
-
(0,
|
|
8466
|
+
(0, import_react19.useEffect)(() => {
|
|
7567
8467
|
document.documentElement.setAttribute(NPM_MARKER_ATTR, "npm");
|
|
7568
8468
|
return () => document.documentElement.removeAttribute(NPM_MARKER_ATTR);
|
|
7569
8469
|
}, []);
|
|
7570
|
-
(0,
|
|
7571
|
-
(0,
|
|
8470
|
+
(0, import_react19.useEffect)(() => startCapture(), []);
|
|
8471
|
+
(0, import_react19.useEffect)(() => {
|
|
7572
8472
|
const onContextMenu = (e) => {
|
|
7573
8473
|
if (!e.ctrlKey) return;
|
|
7574
8474
|
e.preventDefault();
|
|
@@ -7577,7 +8477,7 @@ var RenderPickerButton = ({
|
|
|
7577
8477
|
window.addEventListener("contextmenu", onContextMenu, true);
|
|
7578
8478
|
return () => window.removeEventListener("contextmenu", onContextMenu, true);
|
|
7579
8479
|
}, []);
|
|
7580
|
-
(0,
|
|
8480
|
+
(0, import_react19.useEffect)(() => {
|
|
7581
8481
|
if (!useRoute) return;
|
|
7582
8482
|
const stop = initSettingsRefresh();
|
|
7583
8483
|
const sync = async () => {
|
|
@@ -7598,7 +8498,7 @@ var RenderPickerButton = ({
|
|
|
7598
8498
|
document.removeEventListener("visibilitychange", onVisibility);
|
|
7599
8499
|
};
|
|
7600
8500
|
}, [useRoute]);
|
|
7601
|
-
const handlePick = (0,
|
|
8501
|
+
const handlePick = (0, import_react19.useCallback)(
|
|
7602
8502
|
(result) => {
|
|
7603
8503
|
const enriched = enrichResult(result);
|
|
7604
8504
|
const text = formatResult(enriched);
|
|
@@ -7610,7 +8510,7 @@ var RenderPickerButton = ({
|
|
|
7610
8510
|
},
|
|
7611
8511
|
[onPick, showToast]
|
|
7612
8512
|
);
|
|
7613
|
-
const handlePickMany = (0,
|
|
8513
|
+
const handlePickMany = (0, import_react19.useCallback)(
|
|
7614
8514
|
(results) => {
|
|
7615
8515
|
const enriched = results.map((r) => enrichResult(r));
|
|
7616
8516
|
const text = formatResults(enriched);
|
|
@@ -7624,21 +8524,6 @@ var RenderPickerButton = ({
|
|
|
7624
8524
|
[onPickMany, showToast]
|
|
7625
8525
|
);
|
|
7626
8526
|
const effectiveHotkey = hotkey !== void 0 ? hotkey : commands.arm === "off" ? false : commands.arm;
|
|
7627
|
-
const handleCopyHtml = (0, import_react16.useCallback)(
|
|
7628
|
-
(el) => {
|
|
7629
|
-
copy(formatHtml(el.outerHTML));
|
|
7630
|
-
showToast("HTML copi\xE9 \u2713");
|
|
7631
|
-
},
|
|
7632
|
-
[showToast]
|
|
7633
|
-
);
|
|
7634
|
-
const handleCopyClasses = (0, import_react16.useCallback)(
|
|
7635
|
-
(el) => {
|
|
7636
|
-
const cls = (el.getAttribute("class") ?? "").trim().replace(/\s+/g, " ");
|
|
7637
|
-
copy(cls);
|
|
7638
|
-
showToast(cls ? "Classes copi\xE9es \u2713" : "Aucune classe");
|
|
7639
|
-
},
|
|
7640
|
-
[showToast]
|
|
7641
|
-
);
|
|
7642
8527
|
const { isActive, toggle, setSearchMode, disarm, getSelection } = useRenderPicker({
|
|
7643
8528
|
pathname,
|
|
7644
8529
|
hotkey: effectiveHotkey,
|
|
@@ -7670,18 +8555,20 @@ var RenderPickerButton = ({
|
|
|
7670
8555
|
// que soit le mode de clic — Maj ou clic simple accumulé).
|
|
7671
8556
|
onSelectionChange: (n) => setHasSelection(n > 0)
|
|
7672
8557
|
});
|
|
7673
|
-
const closeContextMenu = (0,
|
|
7674
|
-
const closeSitePlan = (0,
|
|
7675
|
-
const contextMenuItems = (0,
|
|
8558
|
+
const closeContextMenu = (0, import_react19.useCallback)(() => setContextMenu(null), []);
|
|
8559
|
+
const closeSitePlan = (0, import_react19.useCallback)(() => setSitePlanOpen(false), []);
|
|
8560
|
+
const contextMenuItems = (0, import_react19.useMemo)(
|
|
7676
8561
|
() => [
|
|
7677
8562
|
...contextMenu?.modulePath !== void 0 ? [
|
|
7678
8563
|
{
|
|
7679
8564
|
label: "Copier le contexte",
|
|
7680
|
-
icon: /* @__PURE__ */ (0,
|
|
8565
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CrosshairIcon, { color: "#d4d4d8" }),
|
|
7681
8566
|
onClick: () => {
|
|
7682
8567
|
if (!contextMenu) return;
|
|
7683
8568
|
const route = resolveRoute(pathname, window.location);
|
|
7684
|
-
const enriched = enrichResult(
|
|
8569
|
+
const enriched = enrichResult(
|
|
8570
|
+
pickResultFromElement(contextMenu.el, route)
|
|
8571
|
+
);
|
|
7685
8572
|
copy(formatResult(enriched));
|
|
7686
8573
|
showToast("Copi\xE9 \u2713");
|
|
7687
8574
|
closeContextMenu();
|
|
@@ -7692,7 +8579,7 @@ var RenderPickerButton = ({
|
|
|
7692
8579
|
...contextMenu?.modulePath !== void 0 ? [
|
|
7693
8580
|
{
|
|
7694
8581
|
label: "Modules",
|
|
7695
|
-
icon: /* @__PURE__ */ (0,
|
|
8582
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PackageIcon, {}),
|
|
7696
8583
|
onClick: () => {
|
|
7697
8584
|
if (!contextMenu.modulePath) return;
|
|
7698
8585
|
copy(contextMenu.modulePath.name);
|
|
@@ -7703,7 +8590,7 @@ var RenderPickerButton = ({
|
|
|
7703
8590
|
submenu: [
|
|
7704
8591
|
{
|
|
7705
8592
|
label: "Copier le nom du module",
|
|
7706
|
-
icon: /* @__PURE__ */ (0,
|
|
8593
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TagIcon, {}),
|
|
7707
8594
|
onClick: () => {
|
|
7708
8595
|
if (!contextMenu.modulePath) return;
|
|
7709
8596
|
copy(contextMenu.modulePath.name);
|
|
@@ -7714,7 +8601,7 @@ var RenderPickerButton = ({
|
|
|
7714
8601
|
},
|
|
7715
8602
|
{
|
|
7716
8603
|
label: "Copier le chemin relatif",
|
|
7717
|
-
icon: /* @__PURE__ */ (0,
|
|
8604
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FolderIcon, {}),
|
|
7718
8605
|
onClick: () => {
|
|
7719
8606
|
if (!contextMenu.modulePath?.relative) return;
|
|
7720
8607
|
copy(contextMenu.modulePath.relative);
|
|
@@ -7725,7 +8612,7 @@ var RenderPickerButton = ({
|
|
|
7725
8612
|
},
|
|
7726
8613
|
{
|
|
7727
8614
|
label: "Copier le chemin absolu",
|
|
7728
|
-
icon: /* @__PURE__ */ (0,
|
|
8615
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HardDriveIcon, {}),
|
|
7729
8616
|
onClick: () => {
|
|
7730
8617
|
if (!contextMenu.modulePath?.absolute) return;
|
|
7731
8618
|
copy(contextMenu.modulePath.absolute);
|
|
@@ -7736,7 +8623,7 @@ var RenderPickerButton = ({
|
|
|
7736
8623
|
},
|
|
7737
8624
|
{
|
|
7738
8625
|
label: "Copier l'URL de configuration",
|
|
7739
|
-
icon: /* @__PURE__ */ (0,
|
|
8626
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ExternalLinkIcon, {}),
|
|
7740
8627
|
onClick: () => {
|
|
7741
8628
|
if (!contextMenu.modulePath?.configUrl) return;
|
|
7742
8629
|
copy(contextMenu.modulePath.configUrl);
|
|
@@ -7747,7 +8634,7 @@ var RenderPickerButton = ({
|
|
|
7747
8634
|
},
|
|
7748
8635
|
{
|
|
7749
8636
|
label: "Copier l'arbre des modules",
|
|
7750
|
-
icon: /* @__PURE__ */ (0,
|
|
8637
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(GitBranchIcon, {}),
|
|
7751
8638
|
onClick: () => {
|
|
7752
8639
|
if (!contextMenu.getModulesTree) return;
|
|
7753
8640
|
copy(contextMenu.getModulesTree());
|
|
@@ -7762,7 +8649,7 @@ var RenderPickerButton = ({
|
|
|
7762
8649
|
...contextMenu?.modulePath?.hookName ? [
|
|
7763
8650
|
{
|
|
7764
8651
|
label: "Hook",
|
|
7765
|
-
icon: /* @__PURE__ */ (0,
|
|
8652
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HookIcon, {}),
|
|
7766
8653
|
onClick: () => {
|
|
7767
8654
|
if (!contextMenu.modulePath?.hookName) return;
|
|
7768
8655
|
copy(contextMenu.modulePath.hookName);
|
|
@@ -7773,7 +8660,7 @@ var RenderPickerButton = ({
|
|
|
7773
8660
|
submenu: [
|
|
7774
8661
|
{
|
|
7775
8662
|
label: "Copier le nom du hook",
|
|
7776
|
-
icon: /* @__PURE__ */ (0,
|
|
8663
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TagIcon, {}),
|
|
7777
8664
|
onClick: () => {
|
|
7778
8665
|
if (!contextMenu.modulePath?.hookName) return;
|
|
7779
8666
|
copy(contextMenu.modulePath.hookName);
|
|
@@ -7785,91 +8672,22 @@ var RenderPickerButton = ({
|
|
|
7785
8672
|
]
|
|
7786
8673
|
}
|
|
7787
8674
|
] : [],
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
(el) => formatHtml(el.outerHTML)
|
|
7797
|
-
);
|
|
7798
|
-
copy(formatted.join("\n\n"));
|
|
7799
|
-
showToast(
|
|
7800
|
-
targets.length > 1 ? `HTML copi\xE9 \u2713 \xB7 ${targets.length}` : "HTML copi\xE9 \u2713"
|
|
7801
|
-
);
|
|
7802
|
-
closeContextMenu();
|
|
7803
|
-
disarm();
|
|
7804
|
-
}
|
|
7805
|
-
},
|
|
7806
|
-
{
|
|
7807
|
-
label: "Copier le rendu",
|
|
7808
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EyeIcon, {}),
|
|
7809
|
-
info: "Permet de copier \xE0 l'identique l'UI d'un composant",
|
|
7810
|
-
onClick: () => {
|
|
7811
|
-
if (!contextMenu) return;
|
|
7812
|
-
copy(serializeWithComputedStyles(contextMenu.el));
|
|
7813
|
-
showToast("HTML reproductible copi\xE9 \u2713");
|
|
7814
|
-
closeContextMenu();
|
|
7815
|
-
disarm();
|
|
7816
|
-
}
|
|
7817
|
-
},
|
|
7818
|
-
{
|
|
7819
|
-
label: "Copier les classes",
|
|
7820
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TagIcon, {}),
|
|
7821
|
-
onClick: () => {
|
|
7822
|
-
if (!contextMenu) return;
|
|
7823
|
-
const sel = getSelection();
|
|
7824
|
-
const targets = sel.length > 0 && sel.some((s) => s.contains(contextMenu.el)) ? sel : [contextMenu.el];
|
|
7825
|
-
const list = targets.map((el) => el.getAttribute("class") ?? "");
|
|
7826
|
-
copy(list.join("\n\n"));
|
|
7827
|
-
showToast(
|
|
7828
|
-
list.some(Boolean) ? targets.length > 1 ? `Classes copi\xE9es \u2713 \xB7 ${targets.length}` : "Classes copi\xE9es \u2713" : "Aucune classe"
|
|
7829
|
-
);
|
|
7830
|
-
closeContextMenu();
|
|
7831
|
-
disarm();
|
|
7832
|
-
}
|
|
7833
|
-
},
|
|
7834
|
-
{
|
|
7835
|
-
label: "Copier le texte",
|
|
7836
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TypeIcon, {}),
|
|
7837
|
-
onClick: () => {
|
|
7838
|
-
if (!contextMenu) return;
|
|
7839
|
-
const txt = elementText(contextMenu.el);
|
|
7840
|
-
copy(txt ?? "");
|
|
7841
|
-
showToast(txt ? "Texte copi\xE9 \u2713" : "Aucun texte");
|
|
7842
|
-
closeContextMenu();
|
|
7843
|
-
disarm();
|
|
7844
|
-
}
|
|
7845
|
-
},
|
|
7846
|
-
{
|
|
7847
|
-
label: "Copier le XPath",
|
|
7848
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GitBranchIcon, {}),
|
|
7849
|
-
onClick: () => {
|
|
7850
|
-
if (!contextMenu) return;
|
|
7851
|
-
copy(getXPath(contextMenu.el));
|
|
7852
|
-
showToast("XPath copi\xE9 \u2713");
|
|
7853
|
-
closeContextMenu();
|
|
7854
|
-
disarm();
|
|
7855
|
-
}
|
|
7856
|
-
},
|
|
7857
|
-
{
|
|
7858
|
-
label: "Supprimer l'\xE9l\xE9ment",
|
|
7859
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TrashIcon, {}),
|
|
7860
|
-
danger: true,
|
|
7861
|
-
disabled: contextMenu?.el === document.body || contextMenu?.el === document.documentElement,
|
|
7862
|
-
onClick: () => {
|
|
7863
|
-
if (!contextMenu) return;
|
|
7864
|
-
contextMenu.el.style.setProperty("display", "none", "important");
|
|
8675
|
+
...contextMenu ? elementMenuItems(
|
|
8676
|
+
contextMenu.el,
|
|
8677
|
+
getSelection(),
|
|
8678
|
+
(text, msg) => {
|
|
8679
|
+
copy(text);
|
|
8680
|
+
showToast(msg);
|
|
8681
|
+
},
|
|
8682
|
+
() => {
|
|
7865
8683
|
closeContextMenu();
|
|
7866
8684
|
disarm();
|
|
7867
8685
|
}
|
|
7868
|
-
|
|
8686
|
+
) : []
|
|
7869
8687
|
],
|
|
7870
|
-
[contextMenu, closeContextMenu,
|
|
8688
|
+
[contextMenu, closeContextMenu, getSelection, disarm, showToast, pathname]
|
|
7871
8689
|
);
|
|
7872
|
-
(0,
|
|
8690
|
+
(0, import_react19.useEffect)(() => {
|
|
7873
8691
|
if (!isActive) {
|
|
7874
8692
|
setHasSelection(false);
|
|
7875
8693
|
setSettingsOpen(false);
|
|
@@ -7877,11 +8695,11 @@ var RenderPickerButton = ({
|
|
|
7877
8695
|
setContextMenu(null);
|
|
7878
8696
|
}
|
|
7879
8697
|
}, [isActive]);
|
|
7880
|
-
(0,
|
|
8698
|
+
(0, import_react19.useEffect)(() => {
|
|
7881
8699
|
setSearchMode(searchOpen);
|
|
7882
8700
|
return () => setSearchMode(false);
|
|
7883
8701
|
}, [searchOpen, setSearchMode]);
|
|
7884
|
-
(0,
|
|
8702
|
+
(0, import_react19.useEffect)(() => {
|
|
7885
8703
|
const json = JSON.stringify(commands);
|
|
7886
8704
|
if (lastSavedRef.current === null) {
|
|
7887
8705
|
lastSavedRef.current = json;
|
|
@@ -7891,8 +8709,8 @@ var RenderPickerButton = ({
|
|
|
7891
8709
|
lastSavedRef.current = json;
|
|
7892
8710
|
saveSettings({ ...loadSettings(), commands }, useRoute);
|
|
7893
8711
|
}, [commands, useRoute]);
|
|
7894
|
-
const lastSavedOverlayRef = (0,
|
|
7895
|
-
(0,
|
|
8712
|
+
const lastSavedOverlayRef = (0, import_react19.useRef)(null);
|
|
8713
|
+
(0, import_react19.useEffect)(() => {
|
|
7896
8714
|
if (lastSavedOverlayRef.current === null) {
|
|
7897
8715
|
lastSavedOverlayRef.current = showModuleOverlay;
|
|
7898
8716
|
return;
|
|
@@ -7901,52 +8719,37 @@ var RenderPickerButton = ({
|
|
|
7901
8719
|
lastSavedOverlayRef.current = showModuleOverlay;
|
|
7902
8720
|
saveSettings({ ...loadSettings(), showModuleOverlay }, useRoute);
|
|
7903
8721
|
}, [showModuleOverlay, useRoute]);
|
|
7904
|
-
(0,
|
|
7905
|
-
if (!showModuleOverlay) return;
|
|
7906
|
-
setModuleOverlayContextMenuHandler(
|
|
7907
|
-
|
|
7908
|
-
|
|
8722
|
+
(0, import_react19.useEffect)(() => {
|
|
8723
|
+
if (!showModuleOverlay || !isPrestaShop) return;
|
|
8724
|
+
setModuleOverlayContextMenuHandler(
|
|
8725
|
+
(el, pos, modulePath, getModulesTree) => {
|
|
8726
|
+
if (el instanceof HTMLElement)
|
|
8727
|
+
setContextMenu({
|
|
8728
|
+
el,
|
|
8729
|
+
x: pos.x,
|
|
8730
|
+
y: pos.y,
|
|
8731
|
+
modulePath,
|
|
8732
|
+
getModulesTree
|
|
8733
|
+
});
|
|
8734
|
+
}
|
|
8735
|
+
);
|
|
7909
8736
|
const stop = initModuleOverlaySurface();
|
|
7910
8737
|
return () => {
|
|
7911
8738
|
setModuleOverlayContextMenuHandler(null);
|
|
7912
8739
|
stop();
|
|
7913
8740
|
};
|
|
7914
|
-
}, [showModuleOverlay]);
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
top: 6,
|
|
7919
|
-
right: 6,
|
|
7920
|
-
zIndex: UI_Z,
|
|
7921
|
-
width: 18,
|
|
7922
|
-
height: 18,
|
|
7923
|
-
display: "inline-flex",
|
|
7924
|
-
alignItems: "center",
|
|
7925
|
-
justifyContent: "center",
|
|
7926
|
-
borderRadius: 4,
|
|
7927
|
-
cursor: "pointer",
|
|
7928
|
-
background: isActive ? color : hovered ? borderColor : "rgba(24,24,27,0.82)",
|
|
7929
|
-
border: `1px solid ${borderColor}`,
|
|
7930
|
-
boxShadow: isActive ? `0 0 0 3px ${color}40, 0 2px 8px rgba(0,0,0,0.4)` : "0 2px 8px rgba(0,0,0,0.35)",
|
|
7931
|
-
transition: "background 120ms, box-shadow 120ms, border-color 120ms",
|
|
7932
|
-
padding: 0,
|
|
7933
|
-
backdropFilter: "blur(4px)"
|
|
7934
|
-
};
|
|
7935
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
7936
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7937
|
-
"button",
|
|
8741
|
+
}, [showModuleOverlay, isPrestaShop]);
|
|
8742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
8743
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8744
|
+
PickerToolbar,
|
|
7938
8745
|
{
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
onMouseLeave: () => setHovered(false),
|
|
7944
|
-
"aria-label": "renderPicker \u2014 pick an element (Alt+click opens VS Code)",
|
|
7945
|
-
style: buttonStyle,
|
|
7946
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CrosshairIcon, { color: isActive ? "#fff" : "rgba(255,255,255,0.85)" })
|
|
8746
|
+
active: isActive,
|
|
8747
|
+
accent: color,
|
|
8748
|
+
onToggle: toggle,
|
|
8749
|
+
label: "renderPicker \u2014 pick an element (Alt+click opens VS Code)"
|
|
7947
8750
|
}
|
|
7948
8751
|
),
|
|
7949
|
-
isActive && /* @__PURE__ */ (0,
|
|
8752
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7950
8753
|
SettingsBar,
|
|
7951
8754
|
{
|
|
7952
8755
|
hasSelection,
|
|
@@ -7956,7 +8759,7 @@ var RenderPickerButton = ({
|
|
|
7956
8759
|
commands,
|
|
7957
8760
|
onChangeCommands: setCommands,
|
|
7958
8761
|
showModuleOverlay,
|
|
7959
|
-
onChangeShowModuleOverlay: setShowModuleOverlay,
|
|
8762
|
+
onChangeShowModuleOverlay: isPrestaShop ? setShowModuleOverlay : void 0,
|
|
7960
8763
|
searchOpen,
|
|
7961
8764
|
onToggleSearch: () => setSearchOpen((o) => !o),
|
|
7962
8765
|
onOpenSitePlan: pagesUrl ? () => {
|
|
@@ -7971,24 +8774,21 @@ var RenderPickerButton = ({
|
|
|
7971
8774
|
}
|
|
7972
8775
|
}
|
|
7973
8776
|
),
|
|
7974
|
-
searchOpen && /* @__PURE__ */ (0,
|
|
8777
|
+
searchOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7975
8778
|
SearchPopover,
|
|
7976
8779
|
{
|
|
7977
8780
|
onClose: () => setSearchOpen(false),
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
const enriched = enrichResult(pickResultFromElement(el, route));
|
|
7981
|
-
copy(formatResult(enriched));
|
|
7982
|
-
showToast("Copi\xE9 \u2713");
|
|
7983
|
-
},
|
|
8781
|
+
pathname,
|
|
8782
|
+
onCopied: showToast,
|
|
7984
8783
|
onContextMenuElement: (el, pos) => {
|
|
7985
8784
|
setContextMenu({ el, x: pos.x, y: pos.y });
|
|
7986
8785
|
}
|
|
7987
8786
|
}
|
|
7988
8787
|
),
|
|
7989
|
-
panelOpen && /* @__PURE__ */ (0,
|
|
8788
|
+
panelOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7990
8789
|
DevPanel,
|
|
7991
8790
|
{
|
|
8791
|
+
onConsoleRun: runConsoleExpression,
|
|
7992
8792
|
size: loadSettings().panel,
|
|
7993
8793
|
onSizeChange: (panel) => saveSettings({ ...loadSettings(), panel }, useRoute),
|
|
7994
8794
|
onClose: () => {
|
|
@@ -7997,8 +8797,15 @@ var RenderPickerButton = ({
|
|
|
7997
8797
|
}
|
|
7998
8798
|
}
|
|
7999
8799
|
),
|
|
8000
|
-
contextMenu && /* @__PURE__ */ (0,
|
|
8001
|
-
|
|
8800
|
+
contextMenu && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8801
|
+
ContextMenu,
|
|
8802
|
+
{
|
|
8803
|
+
at: contextMenu,
|
|
8804
|
+
onClose: closeContextMenu,
|
|
8805
|
+
items: contextMenuItems
|
|
8806
|
+
}
|
|
8807
|
+
),
|
|
8808
|
+
toast && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8002
8809
|
"div",
|
|
8003
8810
|
{
|
|
8004
8811
|
"data-pathpicker-ignore": "",
|
|
@@ -8021,7 +8828,7 @@ var RenderPickerButton = ({
|
|
|
8021
8828
|
children: toast
|
|
8022
8829
|
}
|
|
8023
8830
|
),
|
|
8024
|
-
sitePlanOpen && pagesUrl && /* @__PURE__ */ (0,
|
|
8831
|
+
sitePlanOpen && pagesUrl && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8025
8832
|
SitePlan,
|
|
8026
8833
|
{
|
|
8027
8834
|
indexUrl: pagesUrl,
|