@antone-io/render-picker 0.0.0-stage → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +300 -2
- package/dist/chunk-2N6FOIM5.js +2587 -0
- package/dist/chunk-2N6FOIM5.js.map +1 -0
- package/dist/chunk-WUA7VWEU.js +105 -0
- package/dist/chunk-WUA7VWEU.js.map +1 -0
- package/dist/chunk-ZZUJJL22.js +5460 -0
- package/dist/chunk-ZZUJJL22.js.map +1 -0
- package/dist/client.cjs +2496 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +165 -0
- package/dist/client.d.ts +165 -0
- package/dist/client.js +78 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +8078 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +92 -0
- package/dist/index.js.map +1 -0
- package/dist/next.cjs +261 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +19 -0
- package/dist/next.d.ts +19 -0
- package/dist/next.js +234 -0
- package/dist/next.js.map +1 -0
- package/dist/react.cjs +7298 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +94 -0
- package/dist/react.d.ts +94 -0
- package/dist/react.js +20 -0
- package/dist/react.js.map +1 -0
- package/dist/types-DrSxB-xa.d.cts +207 -0
- package/dist/types-DrSxB-xa.d.ts +207 -0
- package/package.json +112 -4
package/dist/client.cjs
ADDED
|
@@ -0,0 +1,2496 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/client.ts
|
|
22
|
+
var client_exports = {};
|
|
23
|
+
__export(client_exports, {
|
|
24
|
+
ACCENT: () => ACCENT,
|
|
25
|
+
DEFAULT_HUSH_RULES: () => DEFAULT_HUSH_RULES,
|
|
26
|
+
DEFAULT_SETTINGS: () => DEFAULT_SETTINGS,
|
|
27
|
+
EDITORS: () => EDITORS,
|
|
28
|
+
PANEL_BORDER: () => PANEL_BORDER,
|
|
29
|
+
SOLID_BG: () => SOLID_BG,
|
|
30
|
+
TOOLTIP_SHADOW: () => TOOLTIP_SHADOW,
|
|
31
|
+
annotate: () => annotate,
|
|
32
|
+
annotateFromComments: () => annotateFromComments,
|
|
33
|
+
annotateTree: () => annotateTree,
|
|
34
|
+
buildEditorUri: () => buildEditorUri,
|
|
35
|
+
buildVscodeUri: () => buildVscodeUri,
|
|
36
|
+
componentInfo: () => componentInfo,
|
|
37
|
+
createInspector: () => createInspector,
|
|
38
|
+
enrichResult: () => enrichResult,
|
|
39
|
+
fetchSettings: () => fetchSettings,
|
|
40
|
+
findPickedElement: () => findPickedElement,
|
|
41
|
+
getCssSelector: () => getCssSelector,
|
|
42
|
+
getXPath: () => getXPath,
|
|
43
|
+
hushConsoleNoise: () => hushConsoleNoise,
|
|
44
|
+
initClickToSource: () => initClickToSource,
|
|
45
|
+
initComponentAnnotator: () => initComponentAnnotator,
|
|
46
|
+
initRenderPicker: () => initRenderPicker,
|
|
47
|
+
initSettingsRefresh: () => initSettingsRefresh,
|
|
48
|
+
initTplAnnotator: () => initTplAnnotator,
|
|
49
|
+
loadSettings: () => loadSettings,
|
|
50
|
+
normalizeSourcePath: () => normalizeSourcePath,
|
|
51
|
+
parseTplMarker: () => parseTplMarker,
|
|
52
|
+
pickResultFromElement: () => pickResultFromElement,
|
|
53
|
+
refreshSettings: () => refreshSettings,
|
|
54
|
+
resolvePosition: () => resolvePosition,
|
|
55
|
+
saveSettings: () => saveSettings,
|
|
56
|
+
searchElements: () => searchElements,
|
|
57
|
+
settingsDelta: () => settingsDelta,
|
|
58
|
+
toSelector: () => toSelector
|
|
59
|
+
});
|
|
60
|
+
module.exports = __toCommonJS(client_exports);
|
|
61
|
+
|
|
62
|
+
// src/core/devpanel/console-capture.ts
|
|
63
|
+
var LEVELS = ["log", "info", "warn", "error", "debug"];
|
|
64
|
+
var MAX_LEN = 2e3;
|
|
65
|
+
function argToText(arg) {
|
|
66
|
+
if (typeof arg === "string") return arg;
|
|
67
|
+
if (arg instanceof Error) return `${arg.name}: ${arg.message}`;
|
|
68
|
+
if (arg === null) return "null";
|
|
69
|
+
if (arg === void 0) return "undefined";
|
|
70
|
+
if (typeof arg === "object") {
|
|
71
|
+
try {
|
|
72
|
+
return JSON.stringify(arg);
|
|
73
|
+
} catch {
|
|
74
|
+
return Object.prototype.toString.call(arg);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return String(arg);
|
|
78
|
+
}
|
|
79
|
+
function initConsoleCapture(onEntry) {
|
|
80
|
+
if (typeof console === "undefined") return () => {
|
|
81
|
+
};
|
|
82
|
+
const originals = /* @__PURE__ */ new Map();
|
|
83
|
+
for (const level of LEVELS) {
|
|
84
|
+
const original = console[level];
|
|
85
|
+
originals.set(level, original);
|
|
86
|
+
console[level] = (...args) => {
|
|
87
|
+
try {
|
|
88
|
+
const text = args.map(argToText).join(" ").slice(0, MAX_LEN);
|
|
89
|
+
onEntry({ level, text, ts: Date.now() });
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
original.apply(console, args);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return () => {
|
|
96
|
+
for (const [level, original] of originals) console[level] = original;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/core/devpanel/network-capture.ts
|
|
101
|
+
var BODY_CAP = 1e4;
|
|
102
|
+
var STACK_CAP = 4e3;
|
|
103
|
+
function cap(s, n) {
|
|
104
|
+
return s.length > n ? `${s.slice(0, n)}\u2026` : s;
|
|
105
|
+
}
|
|
106
|
+
function urlOf(input) {
|
|
107
|
+
if (typeof input === "string") return input;
|
|
108
|
+
if (input instanceof URL) return input.href;
|
|
109
|
+
if (input && typeof input === "object" && "url" in input) {
|
|
110
|
+
return String(input.url);
|
|
111
|
+
}
|
|
112
|
+
return String(input);
|
|
113
|
+
}
|
|
114
|
+
function initiatorStack() {
|
|
115
|
+
const raw = new Error().stack ?? "";
|
|
116
|
+
const lines = raw.split("\n").slice(3).join("\n").trim();
|
|
117
|
+
return cap(lines, STACK_CAP);
|
|
118
|
+
}
|
|
119
|
+
function normalizeHeaders(h) {
|
|
120
|
+
if (!h) return void 0;
|
|
121
|
+
const out = {};
|
|
122
|
+
if (typeof Headers !== "undefined" && h instanceof Headers) {
|
|
123
|
+
h.forEach((v, k) => out[k] = v);
|
|
124
|
+
} else if (Array.isArray(h)) {
|
|
125
|
+
for (const [k, v] of h) out[k] = v;
|
|
126
|
+
} else {
|
|
127
|
+
Object.assign(out, h);
|
|
128
|
+
}
|
|
129
|
+
return Object.keys(out).length ? out : void 0;
|
|
130
|
+
}
|
|
131
|
+
function headersOf(h) {
|
|
132
|
+
const out = {};
|
|
133
|
+
h.forEach((v, k) => out[k] = v);
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
function parseRawHeaders(raw) {
|
|
137
|
+
const out = {};
|
|
138
|
+
for (const line of raw.trim().split(/[\r\n]+/)) {
|
|
139
|
+
const i = line.indexOf(":");
|
|
140
|
+
if (i > 0) out[line.slice(0, i).trim()] = line.slice(i + 1).trim();
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
function bodyToText(body) {
|
|
145
|
+
if (typeof body === "string") return cap(body, BODY_CAP);
|
|
146
|
+
if (body == null) return void 0;
|
|
147
|
+
return `[${Object.prototype.toString.call(body).slice(8, -1)}]`;
|
|
148
|
+
}
|
|
149
|
+
function initNetworkCapture(onEntry) {
|
|
150
|
+
if (typeof window === "undefined") return () => {
|
|
151
|
+
};
|
|
152
|
+
const cleanups = [];
|
|
153
|
+
if (typeof window.fetch === "function") {
|
|
154
|
+
const original = window.fetch;
|
|
155
|
+
window.fetch = ((input, init) => {
|
|
156
|
+
const start = Date.now();
|
|
157
|
+
const method = (init?.method || input?.method || "GET").toUpperCase();
|
|
158
|
+
const url = urlOf(input);
|
|
159
|
+
const initiator = initiatorStack();
|
|
160
|
+
const reqHeaders = normalizeHeaders(init?.headers);
|
|
161
|
+
const reqBody = bodyToText(init?.body);
|
|
162
|
+
const base = { method, url, ts: start, initiator, reqHeaders, reqBody };
|
|
163
|
+
return original.call(window, input, init).then(
|
|
164
|
+
(res) => {
|
|
165
|
+
const meta = {
|
|
166
|
+
...base,
|
|
167
|
+
status: res.status,
|
|
168
|
+
ok: res.ok,
|
|
169
|
+
durationMs: Date.now() - start,
|
|
170
|
+
resHeaders: headersOf(res.headers),
|
|
171
|
+
type: res.headers.get("content-type") ?? void 0
|
|
172
|
+
};
|
|
173
|
+
res.clone().text().then(
|
|
174
|
+
(text) => onEntry({ ...meta, resBody: cap(text, BODY_CAP) }),
|
|
175
|
+
() => onEntry(meta)
|
|
176
|
+
);
|
|
177
|
+
return res;
|
|
178
|
+
},
|
|
179
|
+
(err) => {
|
|
180
|
+
onEntry({ ...base, status: 0, ok: false, durationMs: Date.now() - start });
|
|
181
|
+
throw err;
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
});
|
|
185
|
+
cleanups.push(() => {
|
|
186
|
+
window.fetch = original;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const XHR = window.XMLHttpRequest;
|
|
190
|
+
if (XHR) {
|
|
191
|
+
const open = XHR.prototype.open;
|
|
192
|
+
const send = XHR.prototype.send;
|
|
193
|
+
const setHeader = XHR.prototype.setRequestHeader;
|
|
194
|
+
XHR.prototype.open = function(method, url, ...rest) {
|
|
195
|
+
this.__rp = {
|
|
196
|
+
method: (method || "GET").toUpperCase(),
|
|
197
|
+
url: urlOf(url),
|
|
198
|
+
start: 0,
|
|
199
|
+
reqHeaders: {},
|
|
200
|
+
initiator: ""
|
|
201
|
+
};
|
|
202
|
+
return open.call(this, method, url, ...rest);
|
|
203
|
+
};
|
|
204
|
+
XHR.prototype.setRequestHeader = function(name, value) {
|
|
205
|
+
if (this.__rp) this.__rp.reqHeaders[name] = value;
|
|
206
|
+
return setHeader.call(this, name, value);
|
|
207
|
+
};
|
|
208
|
+
XHR.prototype.send = function(...args) {
|
|
209
|
+
const rp = this.__rp;
|
|
210
|
+
if (rp) {
|
|
211
|
+
rp.start = Date.now();
|
|
212
|
+
rp.reqBody = bodyToText(args[0]);
|
|
213
|
+
rp.initiator = initiatorStack();
|
|
214
|
+
this.addEventListener("loadend", () => {
|
|
215
|
+
let resBody;
|
|
216
|
+
try {
|
|
217
|
+
resBody = typeof this.responseText === "string" ? cap(this.responseText, BODY_CAP) : void 0;
|
|
218
|
+
} catch {
|
|
219
|
+
resBody = void 0;
|
|
220
|
+
}
|
|
221
|
+
onEntry({
|
|
222
|
+
method: rp.method,
|
|
223
|
+
url: rp.url,
|
|
224
|
+
status: this.status,
|
|
225
|
+
ok: this.status >= 200 && this.status < 400,
|
|
226
|
+
durationMs: Date.now() - rp.start,
|
|
227
|
+
ts: rp.start,
|
|
228
|
+
reqHeaders: Object.keys(rp.reqHeaders).length ? rp.reqHeaders : void 0,
|
|
229
|
+
reqBody: rp.reqBody,
|
|
230
|
+
resHeaders: parseRawHeaders(this.getAllResponseHeaders?.() ?? ""),
|
|
231
|
+
resBody,
|
|
232
|
+
type: this.getResponseHeader?.("content-type") ?? void 0,
|
|
233
|
+
initiator: rp.initiator
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return send.apply(this, args);
|
|
238
|
+
};
|
|
239
|
+
cleanups.push(() => {
|
|
240
|
+
XHR.prototype.open = open;
|
|
241
|
+
XHR.prototype.send = send;
|
|
242
|
+
XHR.prototype.setRequestHeader = setHeader;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
return () => {
|
|
246
|
+
for (const fn of cleanups) fn();
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/core/devpanel/store.ts
|
|
251
|
+
var MAX = 500;
|
|
252
|
+
var logs = [];
|
|
253
|
+
var requests = [];
|
|
254
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
255
|
+
function emit() {
|
|
256
|
+
for (const fn of listeners) fn();
|
|
257
|
+
}
|
|
258
|
+
function addLog(entry) {
|
|
259
|
+
logs.push(entry);
|
|
260
|
+
if (logs.length > MAX) logs.shift();
|
|
261
|
+
emit();
|
|
262
|
+
}
|
|
263
|
+
function addRequest(entry) {
|
|
264
|
+
requests.push(entry);
|
|
265
|
+
if (requests.length > MAX) requests.shift();
|
|
266
|
+
emit();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/core/devpanel/capture.ts
|
|
270
|
+
var started = false;
|
|
271
|
+
function startCapture() {
|
|
272
|
+
if (started || typeof window === "undefined") return () => {
|
|
273
|
+
};
|
|
274
|
+
started = true;
|
|
275
|
+
const stopConsole = initConsoleCapture(addLog);
|
|
276
|
+
const stopNetwork = initNetworkCapture(addRequest);
|
|
277
|
+
return () => {
|
|
278
|
+
stopConsole();
|
|
279
|
+
stopNetwork();
|
|
280
|
+
started = false;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/core/inspector/constants/behavior.ts
|
|
285
|
+
var IGNORE_ATTR = "data-pathpicker-ignore";
|
|
286
|
+
var NPM_MARKER_ATTR = "data-render-picker";
|
|
287
|
+
var MAX_DESCEND = 32;
|
|
288
|
+
var SWALLOW_MS = 700;
|
|
289
|
+
var DOUBLE_TAP_WINDOW = 400;
|
|
290
|
+
var PRESS_EVENTS = [
|
|
291
|
+
"pointerdown",
|
|
292
|
+
"mousedown",
|
|
293
|
+
"pointerup",
|
|
294
|
+
"mouseup",
|
|
295
|
+
"click",
|
|
296
|
+
"auxclick",
|
|
297
|
+
"dblclick",
|
|
298
|
+
"contextmenu"
|
|
299
|
+
];
|
|
300
|
+
var CONTEXT_MENU_OPEN = { value: false };
|
|
301
|
+
var ARMED_WINDOW_KEY = "__renderPickerArmed";
|
|
302
|
+
var PICKER_ARMED = {
|
|
303
|
+
get value() {
|
|
304
|
+
return typeof window !== "undefined" && window[ARMED_WINDOW_KEY] === true;
|
|
305
|
+
},
|
|
306
|
+
set value(armed) {
|
|
307
|
+
if (typeof window === "undefined") return;
|
|
308
|
+
window[ARMED_WINDOW_KEY] = armed;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
var hasPointer = typeof window !== "undefined" && "PointerEvent" in window;
|
|
312
|
+
var DOWN_TYPE = hasPointer ? "pointerdown" : "mousedown";
|
|
313
|
+
|
|
314
|
+
// src/core/dev/editors.ts
|
|
315
|
+
var EDITORS = [
|
|
316
|
+
{ id: "vscode", label: "VS Code", scheme: "vscode", family: "vscode" },
|
|
317
|
+
{ id: "vscode-insiders", label: "VS Code Insiders", scheme: "vscode-insiders", family: "vscode" },
|
|
318
|
+
{ id: "cursor", label: "Cursor", scheme: "cursor", family: "vscode" },
|
|
319
|
+
{ id: "windsurf", label: "Windsurf", scheme: "windsurf", family: "vscode" },
|
|
320
|
+
{ id: "vscodium", label: "VSCodium", scheme: "vscodium", family: "vscode" },
|
|
321
|
+
{ id: "zed", label: "Zed", scheme: "zed", family: "zed" },
|
|
322
|
+
{ id: "webstorm", label: "WebStorm", scheme: "webstorm", family: "jetbrains" },
|
|
323
|
+
{ id: "phpstorm", label: "PhpStorm", scheme: "phpstorm", family: "jetbrains" },
|
|
324
|
+
{ id: "idea", label: "IntelliJ IDEA", scheme: "idea", family: "jetbrains" },
|
|
325
|
+
{ id: "pycharm", label: "PyCharm", scheme: "pycharm", family: "jetbrains" }
|
|
326
|
+
];
|
|
327
|
+
var DEFAULT_EDITOR = "vscode";
|
|
328
|
+
function isEditorId(value) {
|
|
329
|
+
return typeof value === "string" && EDITORS.some((e) => e.id === value);
|
|
330
|
+
}
|
|
331
|
+
function parseSource(source) {
|
|
332
|
+
const m = /^(.*?)(?::(\d+))?(?::(\d+))?$/.exec(source);
|
|
333
|
+
return { file: m?.[1] ?? source, line: m?.[2], col: m?.[3] };
|
|
334
|
+
}
|
|
335
|
+
function buildEditorUri(editor, root, source) {
|
|
336
|
+
if (!root || !source) return null;
|
|
337
|
+
const normalizedRoot = root.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
338
|
+
if (!normalizedRoot) return null;
|
|
339
|
+
const rel = source.replace(/^\/+/, "");
|
|
340
|
+
if (!rel) return null;
|
|
341
|
+
const info = EDITORS.find((e) => e.id === editor) ?? EDITORS[0];
|
|
342
|
+
switch (info.family) {
|
|
343
|
+
case "vscode":
|
|
344
|
+
return `${info.scheme}://file/${normalizedRoot}/${rel}`;
|
|
345
|
+
case "zed":
|
|
346
|
+
return `zed://file/${normalizedRoot.replace(/^\/+/, "")}/${rel}`;
|
|
347
|
+
case "jetbrains": {
|
|
348
|
+
const { file, line, col } = parseSource(rel);
|
|
349
|
+
let uri = `${info.scheme}://open?file=${encodeURIComponent(`${normalizedRoot}/${file}`)}`;
|
|
350
|
+
if (line) uri += `&line=${line}`;
|
|
351
|
+
if (line && col) uri += `&column=${col}`;
|
|
352
|
+
return uri;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/core/settings.ts
|
|
358
|
+
var DEFAULT_SETTINGS = {
|
|
359
|
+
commands: {
|
|
360
|
+
arm: "shift shift",
|
|
361
|
+
copy: { modifier: "none", trigger: "click" },
|
|
362
|
+
copyHtml: { modifier: "none", trigger: "rightclick" },
|
|
363
|
+
multi: { modifier: "shift", trigger: "click" },
|
|
364
|
+
confirm: "enter",
|
|
365
|
+
cancel: "escape",
|
|
366
|
+
inspect: { modifier: "ctrl", key: "i", double: false },
|
|
367
|
+
search: { modifier: "ctrl", key: "f", double: true },
|
|
368
|
+
source: { modifier: "alt", trigger: "click" },
|
|
369
|
+
usage: { modifier: "ctrl", trigger: "click" },
|
|
370
|
+
editor: DEFAULT_EDITOR
|
|
371
|
+
},
|
|
372
|
+
panel: { width: 420, height: 320 },
|
|
373
|
+
showModuleOverlay: false
|
|
374
|
+
};
|
|
375
|
+
function modifierMatches(mod, e) {
|
|
376
|
+
switch (mod) {
|
|
377
|
+
case "ctrl":
|
|
378
|
+
return e.ctrlKey;
|
|
379
|
+
case "alt":
|
|
380
|
+
return e.altKey;
|
|
381
|
+
case "meta":
|
|
382
|
+
return e.metaKey;
|
|
383
|
+
case "shift":
|
|
384
|
+
return e.shiftKey;
|
|
385
|
+
case "none":
|
|
386
|
+
return !e.ctrlKey && !e.altKey && !e.metaKey && !e.shiftKey;
|
|
387
|
+
case "off":
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function gestureMatches(b, e, kind) {
|
|
392
|
+
return b.trigger === kind && modifierMatches(b.modifier, e);
|
|
393
|
+
}
|
|
394
|
+
var KEY_OF = {
|
|
395
|
+
enter: "Enter",
|
|
396
|
+
escape: "Escape",
|
|
397
|
+
space: " "
|
|
398
|
+
};
|
|
399
|
+
function keyMatches(choice, key) {
|
|
400
|
+
return KEY_OF[choice] === key;
|
|
401
|
+
}
|
|
402
|
+
var STORAGE_KEY = "render-picker:settings";
|
|
403
|
+
var ROUTE_ENDPOINT = "/api/render-picker";
|
|
404
|
+
var ENDPOINT = ROUTE_ENDPOINT;
|
|
405
|
+
function configSettings() {
|
|
406
|
+
try {
|
|
407
|
+
const raw = process.env.NEXT_PUBLIC_RENDER_PICKER_CONFIG;
|
|
408
|
+
if (!raw) return null;
|
|
409
|
+
return JSON.parse(raw);
|
|
410
|
+
} catch {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function sameBinding(a, b) {
|
|
415
|
+
return a.modifier === b.modifier && a.trigger === b.trigger;
|
|
416
|
+
}
|
|
417
|
+
function sameKeyBinding(a, b) {
|
|
418
|
+
return a.modifier === b.modifier && a.key === b.key && a.double === b.double;
|
|
419
|
+
}
|
|
420
|
+
function normalizeKeyBinding(raw, def) {
|
|
421
|
+
if (raw == null) return def;
|
|
422
|
+
if (typeof raw === "string") return { ...def, key: raw, double: false };
|
|
423
|
+
const o = raw;
|
|
424
|
+
return {
|
|
425
|
+
modifier: o.modifier ?? def.modifier,
|
|
426
|
+
key: o.key ?? def.key,
|
|
427
|
+
double: o.double ?? def.double
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function settingsDelta(settings, base = DEFAULT_SETTINGS) {
|
|
431
|
+
const delta = {};
|
|
432
|
+
const commands = {};
|
|
433
|
+
const sc = settings.commands;
|
|
434
|
+
const bc = base.commands;
|
|
435
|
+
if (sc.arm !== bc.arm) commands.arm = sc.arm;
|
|
436
|
+
if (!sameBinding(sc.copy, bc.copy)) commands.copy = sc.copy;
|
|
437
|
+
if (!sameBinding(sc.copyHtml, bc.copyHtml)) commands.copyHtml = sc.copyHtml;
|
|
438
|
+
if (!sameBinding(sc.multi, bc.multi)) commands.multi = sc.multi;
|
|
439
|
+
if (sc.confirm !== bc.confirm) commands.confirm = sc.confirm;
|
|
440
|
+
if (sc.cancel !== bc.cancel) commands.cancel = sc.cancel;
|
|
441
|
+
if (!sameKeyBinding(sc.inspect, bc.inspect)) commands.inspect = sc.inspect;
|
|
442
|
+
if (!sameKeyBinding(sc.search, bc.search)) commands.search = sc.search;
|
|
443
|
+
if (!sameBinding(sc.source, bc.source)) commands.source = sc.source;
|
|
444
|
+
if (!sameBinding(sc.usage, bc.usage)) commands.usage = sc.usage;
|
|
445
|
+
if (sc.editor !== bc.editor) commands.editor = sc.editor;
|
|
446
|
+
if (Object.keys(commands).length > 0) delta.commands = commands;
|
|
447
|
+
if (settings.panel.width !== base.panel.width || settings.panel.height !== base.panel.height) {
|
|
448
|
+
delta.panel = { width: settings.panel.width, height: settings.panel.height };
|
|
449
|
+
}
|
|
450
|
+
if (settings.showModuleOverlay !== base.showModuleOverlay) {
|
|
451
|
+
delta.showModuleOverlay = settings.showModuleOverlay;
|
|
452
|
+
}
|
|
453
|
+
return delta;
|
|
454
|
+
}
|
|
455
|
+
function merge(base, patch) {
|
|
456
|
+
if (!patch) return base;
|
|
457
|
+
const patchCommands = patch.commands ?? {};
|
|
458
|
+
return {
|
|
459
|
+
...base,
|
|
460
|
+
...patch,
|
|
461
|
+
commands: {
|
|
462
|
+
arm: patchCommands.arm ?? base.commands.arm,
|
|
463
|
+
copy: { ...base.commands.copy, ...patchCommands.copy ?? {} },
|
|
464
|
+
copyHtml: { ...base.commands.copyHtml, ...patchCommands.copyHtml ?? {} },
|
|
465
|
+
multi: { ...base.commands.multi, ...patchCommands.multi ?? {} },
|
|
466
|
+
confirm: patchCommands.confirm ?? base.commands.confirm,
|
|
467
|
+
cancel: patchCommands.cancel ?? base.commands.cancel,
|
|
468
|
+
inspect: normalizeKeyBinding(patchCommands.inspect, base.commands.inspect),
|
|
469
|
+
search: normalizeKeyBinding(patchCommands.search, base.commands.search),
|
|
470
|
+
source: { ...base.commands.source, ...patchCommands.source ?? {} },
|
|
471
|
+
usage: { ...base.commands.usage, ...patchCommands.usage ?? {} },
|
|
472
|
+
// Valeur inconnue (config éditée à la main) → éditeur de base.
|
|
473
|
+
editor: isEditorId(patchCommands.editor) ? patchCommands.editor : base.commands.editor
|
|
474
|
+
},
|
|
475
|
+
panel: { ...base.panel, ...patch.panel ?? {} }
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function loadSettings() {
|
|
479
|
+
if (routePatch !== void 0) return merge(DEFAULT_SETTINGS, routePatch);
|
|
480
|
+
const file = configSettings();
|
|
481
|
+
if (file) return merge(DEFAULT_SETTINGS, file);
|
|
482
|
+
if (typeof window === "undefined") return DEFAULT_SETTINGS;
|
|
483
|
+
try {
|
|
484
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
485
|
+
return raw ? merge(DEFAULT_SETTINGS, JSON.parse(raw)) : DEFAULT_SETTINGS;
|
|
486
|
+
} catch {
|
|
487
|
+
return DEFAULT_SETTINGS;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
var warnedNoRoute = false;
|
|
491
|
+
function warnNoRoute(detail) {
|
|
492
|
+
if (warnedNoRoute) return;
|
|
493
|
+
warnedNoRoute = true;
|
|
494
|
+
console.warn(
|
|
495
|
+
`[render-picker] render-picker.config.json non \xE9crit (POST ${ENDPOINT} \u2192 ${detail}). Ajoute app/api/render-picker/route.ts : export { GET, POST } from "@antone-io/render-picker/next".`
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
function saveSettings(settings, useRoute = true) {
|
|
499
|
+
if (typeof window === "undefined") return;
|
|
500
|
+
const delta = settingsDelta(settings);
|
|
501
|
+
try {
|
|
502
|
+
if (Object.keys(delta).length === 0) {
|
|
503
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
504
|
+
} else {
|
|
505
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(delta));
|
|
506
|
+
}
|
|
507
|
+
} catch {
|
|
508
|
+
}
|
|
509
|
+
if (useRoute && typeof fetch !== "undefined") {
|
|
510
|
+
fetch(ENDPOINT, {
|
|
511
|
+
method: "POST",
|
|
512
|
+
headers: { "content-type": "application/json" },
|
|
513
|
+
body: JSON.stringify(delta)
|
|
514
|
+
}).then((res) => {
|
|
515
|
+
if (!res.ok) {
|
|
516
|
+
warnNoRoute(`status ${res.status}`);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
routePatch = delta;
|
|
520
|
+
}).catch((e) => warnNoRoute(String(e)));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
var routePatch;
|
|
524
|
+
var refreshUsers = 0;
|
|
525
|
+
var stopRefresh = null;
|
|
526
|
+
async function fetchPatch() {
|
|
527
|
+
if (typeof fetch === "undefined") return null;
|
|
528
|
+
try {
|
|
529
|
+
const res = await fetch(ENDPOINT);
|
|
530
|
+
if (!res.ok) return null;
|
|
531
|
+
const data = await res.json();
|
|
532
|
+
if (!data || typeof data !== "object") return null;
|
|
533
|
+
if (Object.keys(data).length === 0) return null;
|
|
534
|
+
return data;
|
|
535
|
+
} catch {
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
async function refreshSettings() {
|
|
540
|
+
const patch = await fetchPatch();
|
|
541
|
+
if (patch) routePatch = patch;
|
|
542
|
+
}
|
|
543
|
+
function initSettingsRefresh() {
|
|
544
|
+
if (typeof window === "undefined") return () => {
|
|
545
|
+
};
|
|
546
|
+
if (refreshUsers === 0) {
|
|
547
|
+
void refreshSettings();
|
|
548
|
+
const onFocus = () => {
|
|
549
|
+
void refreshSettings();
|
|
550
|
+
};
|
|
551
|
+
const onVisibility = () => {
|
|
552
|
+
if (document.visibilityState === "visible") void refreshSettings();
|
|
553
|
+
};
|
|
554
|
+
window.addEventListener("focus", onFocus);
|
|
555
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
556
|
+
stopRefresh = () => {
|
|
557
|
+
window.removeEventListener("focus", onFocus);
|
|
558
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
559
|
+
stopRefresh = null;
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
refreshUsers++;
|
|
563
|
+
return () => {
|
|
564
|
+
refreshUsers--;
|
|
565
|
+
if (refreshUsers === 0 && stopRefresh) stopRefresh();
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
async function fetchSettings() {
|
|
569
|
+
const patch = await fetchPatch();
|
|
570
|
+
if (!patch || !patch.commands) return null;
|
|
571
|
+
return merge(DEFAULT_SETTINGS, patch);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// src/core/dev/click-to-source.ts
|
|
575
|
+
function buildVscodeUri(root, source) {
|
|
576
|
+
return buildEditorUri("vscode", root, source);
|
|
577
|
+
}
|
|
578
|
+
var SWALLOWED_EVENTS = ["click", "auxclick", "pointerup", "mouseup"];
|
|
579
|
+
var ROUTE_TIMEOUT_MS = 3e3;
|
|
580
|
+
async function openViaRoute(editor, source) {
|
|
581
|
+
if (typeof fetch === "undefined") return false;
|
|
582
|
+
const ctrl = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
583
|
+
const timer = ctrl ? setTimeout(() => ctrl.abort(), ROUTE_TIMEOUT_MS) : null;
|
|
584
|
+
try {
|
|
585
|
+
const res = await fetch(ROUTE_ENDPOINT, {
|
|
586
|
+
method: "POST",
|
|
587
|
+
headers: { "content-type": "application/json" },
|
|
588
|
+
body: JSON.stringify({ open: { editor, source } }),
|
|
589
|
+
signal: ctrl?.signal
|
|
590
|
+
});
|
|
591
|
+
return res.ok;
|
|
592
|
+
} catch {
|
|
593
|
+
return false;
|
|
594
|
+
} finally {
|
|
595
|
+
if (timer) clearTimeout(timer);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function followUri(uri) {
|
|
599
|
+
const a = document.createElement("a");
|
|
600
|
+
a.href = uri;
|
|
601
|
+
a.click();
|
|
602
|
+
}
|
|
603
|
+
var vscodeOpenRef = null;
|
|
604
|
+
function initClickToSource(root, getCommands = () => loadSettings().commands, useRoute = true) {
|
|
605
|
+
if (!root) {
|
|
606
|
+
console.warn(
|
|
607
|
+
"[render-picker] projectRoot absent (NEXT_PUBLIC_PROJECT_ROOT non inject\xE9 ?) \u2014 ouverture dans l'\xE9diteur d\xE9sactiv\xE9e."
|
|
608
|
+
);
|
|
609
|
+
return () => {
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
let suppressNext = false;
|
|
613
|
+
let suppressTimer = null;
|
|
614
|
+
const swallow = (e) => {
|
|
615
|
+
if (!suppressNext) return;
|
|
616
|
+
e.preventDefault();
|
|
617
|
+
e.stopImmediatePropagation();
|
|
618
|
+
};
|
|
619
|
+
for (const type of SWALLOWED_EVENTS) {
|
|
620
|
+
window.addEventListener(type, swallow, { capture: true });
|
|
621
|
+
}
|
|
622
|
+
function resolveAction(e, kind) {
|
|
623
|
+
const { source, usage } = getCommands();
|
|
624
|
+
if (PICKER_ARMED.value && usage.trigger === kind && modifierMatches(usage.modifier, e)) {
|
|
625
|
+
return "usage";
|
|
626
|
+
}
|
|
627
|
+
if (source.trigger === kind && modifierMatches(source.modifier, e)) return "source";
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
function open(e, action) {
|
|
631
|
+
const target = e.target;
|
|
632
|
+
const el = target?.closest("[data-source]");
|
|
633
|
+
if (!el) return;
|
|
634
|
+
openEl(el, action);
|
|
635
|
+
e.preventDefault();
|
|
636
|
+
e.stopImmediatePropagation();
|
|
637
|
+
}
|
|
638
|
+
function openEl(el, action) {
|
|
639
|
+
const rel = action === "usage" ? el.getAttribute("data-owner-source") ?? el.getAttribute("data-source") : el.getAttribute("data-source");
|
|
640
|
+
const editor = getCommands().editor;
|
|
641
|
+
const uri = buildEditorUri(editor, root, rel);
|
|
642
|
+
if (!uri || !rel) return;
|
|
643
|
+
document.dispatchEvent(
|
|
644
|
+
new KeyboardEvent("keydown", { key: "Escape", bubbles: true })
|
|
645
|
+
);
|
|
646
|
+
suppressNext = true;
|
|
647
|
+
if (suppressTimer) clearTimeout(suppressTimer);
|
|
648
|
+
suppressTimer = setTimeout(() => {
|
|
649
|
+
suppressNext = false;
|
|
650
|
+
}, 500);
|
|
651
|
+
const prevOutline = el.style.outline;
|
|
652
|
+
el.style.outline = "2px solid #3b82f6";
|
|
653
|
+
setTimeout(() => {
|
|
654
|
+
el.style.outline = prevOutline;
|
|
655
|
+
}, 400);
|
|
656
|
+
if (!useRoute) {
|
|
657
|
+
followUri(uri);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
void openViaRoute(editor, rel).then((ok) => {
|
|
661
|
+
if (!ok) followUri(uri);
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
vscodeOpenRef = openEl;
|
|
665
|
+
const onPointerDown = (e) => {
|
|
666
|
+
if (e.button !== 0) return;
|
|
667
|
+
const action = resolveAction(e, "click");
|
|
668
|
+
if (action) open(e, action);
|
|
669
|
+
};
|
|
670
|
+
const onContextMenu = (e) => {
|
|
671
|
+
const action = resolveAction(e, "rightclick");
|
|
672
|
+
if (action) open(e, action);
|
|
673
|
+
};
|
|
674
|
+
const onDblClick = (e) => {
|
|
675
|
+
const action = resolveAction(e, "dblclick");
|
|
676
|
+
if (action) open(e, action);
|
|
677
|
+
};
|
|
678
|
+
window.addEventListener("pointerdown", onPointerDown, { capture: true });
|
|
679
|
+
window.addEventListener("contextmenu", onContextMenu, { capture: true });
|
|
680
|
+
window.addEventListener("dblclick", onDblClick, { capture: true });
|
|
681
|
+
return () => {
|
|
682
|
+
window.removeEventListener("pointerdown", onPointerDown, { capture: true });
|
|
683
|
+
window.removeEventListener("contextmenu", onContextMenu, { capture: true });
|
|
684
|
+
window.removeEventListener("dblclick", onDblClick, { capture: true });
|
|
685
|
+
for (const type of SWALLOWED_EVENTS) {
|
|
686
|
+
window.removeEventListener(type, swallow, { capture: true });
|
|
687
|
+
}
|
|
688
|
+
if (suppressTimer) clearTimeout(suppressTimer);
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// src/core/source/source-map-resolver.ts
|
|
693
|
+
var CHUNK_CACHE_KEY = "__rfComponentTraceChunkCache__";
|
|
694
|
+
var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
695
|
+
var CHAR_TO_INT = {};
|
|
696
|
+
for (let i = 0; i < BASE64.length; i++) CHAR_TO_INT[BASE64[i]] = i;
|
|
697
|
+
function decodeVLQ(str, offset) {
|
|
698
|
+
let result = 0;
|
|
699
|
+
let shift = 0;
|
|
700
|
+
let index = offset;
|
|
701
|
+
let value;
|
|
702
|
+
do {
|
|
703
|
+
value = CHAR_TO_INT[str[index]] ?? -1;
|
|
704
|
+
index++;
|
|
705
|
+
result += (value & 31) << shift;
|
|
706
|
+
shift += 5;
|
|
707
|
+
} while (value >= 32);
|
|
708
|
+
const negated = result & 1;
|
|
709
|
+
result >>>= 1;
|
|
710
|
+
return [negated ? -result : result, index];
|
|
711
|
+
}
|
|
712
|
+
function isMappingContinued(char) {
|
|
713
|
+
return char !== "," && char !== ";" && char !== "";
|
|
714
|
+
}
|
|
715
|
+
function parsePlainMap(raw) {
|
|
716
|
+
const mappings = [];
|
|
717
|
+
let sourceIndex = 0;
|
|
718
|
+
let sourceLine = 0;
|
|
719
|
+
let sourceColumn = 0;
|
|
720
|
+
const lines = raw.mappings.split(";");
|
|
721
|
+
for (const line of lines) {
|
|
722
|
+
if (!line) {
|
|
723
|
+
mappings.push(null);
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
const columns = [];
|
|
727
|
+
let generatedColumn = 0;
|
|
728
|
+
let offset = 0;
|
|
729
|
+
while (offset < line.length) {
|
|
730
|
+
const [deltaCol, next] = decodeVLQ(line, offset);
|
|
731
|
+
generatedColumn += deltaCol;
|
|
732
|
+
offset = next;
|
|
733
|
+
let mapping = { generatedColumn };
|
|
734
|
+
if (offset < line.length && isMappingContinued(line[offset])) {
|
|
735
|
+
const [dSrcIdx, o2] = decodeVLQ(line, offset);
|
|
736
|
+
const [dSrcLine, o3] = decodeVLQ(line, o2);
|
|
737
|
+
const [dSrcCol, o4] = decodeVLQ(line, o3);
|
|
738
|
+
sourceIndex += dSrcIdx;
|
|
739
|
+
sourceLine += dSrcLine;
|
|
740
|
+
sourceColumn += dSrcCol;
|
|
741
|
+
mapping = {
|
|
742
|
+
generatedColumn,
|
|
743
|
+
sourceIndex,
|
|
744
|
+
sourceLine,
|
|
745
|
+
sourceColumn
|
|
746
|
+
};
|
|
747
|
+
offset = o4;
|
|
748
|
+
} else {
|
|
749
|
+
mapping = { generatedColumn };
|
|
750
|
+
}
|
|
751
|
+
columns.push(mapping);
|
|
752
|
+
while (offset < line.length && line[offset] === ",") offset++;
|
|
753
|
+
}
|
|
754
|
+
mappings.push(columns);
|
|
755
|
+
}
|
|
756
|
+
return { mappings, sources: raw.sources ?? [], sourcesContent: raw.sourcesContent ?? [] };
|
|
757
|
+
}
|
|
758
|
+
function parseChunkMap(json) {
|
|
759
|
+
const raw = json;
|
|
760
|
+
if (raw.sections) {
|
|
761
|
+
const sections = raw.sections.map((section) => ({
|
|
762
|
+
offset: section.offset,
|
|
763
|
+
parsed: parsePlainMap(section.map)
|
|
764
|
+
}));
|
|
765
|
+
return {
|
|
766
|
+
kind: "index",
|
|
767
|
+
spanSources: sections.map((s) => s.parsed.sources),
|
|
768
|
+
spanMappings: sections.map((s) => s.parsed.mappings),
|
|
769
|
+
spanContents: sections.map((s) => s.parsed.sourcesContent),
|
|
770
|
+
offsets: sections.map((s) => s.offset)
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
const plain = parsePlainMap(raw);
|
|
774
|
+
return { kind: "plain", ...plain };
|
|
775
|
+
}
|
|
776
|
+
async function getChunkMap(chunkUrl) {
|
|
777
|
+
const cache = chunkCache();
|
|
778
|
+
const cached = cache.get(chunkUrl);
|
|
779
|
+
if (cached) return cached;
|
|
780
|
+
const promise = (async () => {
|
|
781
|
+
try {
|
|
782
|
+
const scriptRes = await fetch(chunkUrl);
|
|
783
|
+
if (!scriptRes.ok) return null;
|
|
784
|
+
const source = await scriptRes.text();
|
|
785
|
+
const mapMatch = source.match(/\/\/#\s*sourceMappingURL=(\S+?\.map)\b/);
|
|
786
|
+
if (!mapMatch) return null;
|
|
787
|
+
const mapUrl = mapMatch[1];
|
|
788
|
+
const fullMapUrl = /^[a-z]+:\/\//i.test(mapUrl) ? mapUrl : `${chunkUrl.replace(/\/[^/]*$/, "/")}${mapUrl}`;
|
|
789
|
+
const res = await fetch(fullMapUrl);
|
|
790
|
+
if (!res.ok) return null;
|
|
791
|
+
return parseChunkMap(await res.json());
|
|
792
|
+
} catch {
|
|
793
|
+
return null;
|
|
794
|
+
}
|
|
795
|
+
})();
|
|
796
|
+
cache.set(chunkUrl, promise);
|
|
797
|
+
return promise;
|
|
798
|
+
}
|
|
799
|
+
function chunkCache() {
|
|
800
|
+
const g = globalThis;
|
|
801
|
+
const key = CHUNK_CACHE_KEY;
|
|
802
|
+
if (!g[key]) g[key] = /* @__PURE__ */ new Map();
|
|
803
|
+
return g[key];
|
|
804
|
+
}
|
|
805
|
+
function normalizeSourcePath(path) {
|
|
806
|
+
const normalized = path.replace(/\\/g, "/");
|
|
807
|
+
const match = normalized.match(
|
|
808
|
+
/(?:^|[\\/])((?:src|app)\/[^?#]*?\.(?:tsx?|jsx?|css))/
|
|
809
|
+
);
|
|
810
|
+
return match ? match[1] : normalized;
|
|
811
|
+
}
|
|
812
|
+
var resolvedByCache = /* @__PURE__ */ new WeakMap();
|
|
813
|
+
function resolvePosition(chunkUrl, line, column) {
|
|
814
|
+
const cache = chunkCache();
|
|
815
|
+
let resolvedPositions = resolvedByCache.get(cache);
|
|
816
|
+
if (!resolvedPositions) {
|
|
817
|
+
resolvedPositions = /* @__PURE__ */ new Map();
|
|
818
|
+
resolvedByCache.set(cache, resolvedPositions);
|
|
819
|
+
}
|
|
820
|
+
const key = `${chunkUrl}:${line}:${column}`;
|
|
821
|
+
let resolved = resolvedPositions.get(key);
|
|
822
|
+
if (!resolved) {
|
|
823
|
+
resolved = resolvePositionUncached(chunkUrl, line, column);
|
|
824
|
+
resolvedPositions.set(key, resolved);
|
|
825
|
+
}
|
|
826
|
+
return resolved;
|
|
827
|
+
}
|
|
828
|
+
async function resolvePositionUncached(chunkUrl, line, column) {
|
|
829
|
+
const sm = await getChunkMap(chunkUrl);
|
|
830
|
+
if (!sm) return null;
|
|
831
|
+
if (sm.kind === "plain") {
|
|
832
|
+
return resolveInPlain(sm.mappings, sm.sources, line, column, sm.sourcesContent);
|
|
833
|
+
}
|
|
834
|
+
for (let i = sm.offsets.length - 1; i >= 0; i--) {
|
|
835
|
+
const offset = sm.offsets[i];
|
|
836
|
+
if (line - 1 <= offset.line) {
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
839
|
+
if (line - 1 > offset.line) {
|
|
840
|
+
return resolveInPlain(
|
|
841
|
+
sm.spanMappings[i] ?? [],
|
|
842
|
+
sm.spanSources[i] ?? [],
|
|
843
|
+
line - offset.line,
|
|
844
|
+
column,
|
|
845
|
+
sm.spanContents[i] ?? []
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return null;
|
|
850
|
+
}
|
|
851
|
+
var sourceLines = /* @__PURE__ */ new Map();
|
|
852
|
+
function linesOf(content) {
|
|
853
|
+
let lines = sourceLines.get(content);
|
|
854
|
+
if (!lines) {
|
|
855
|
+
lines = content.split("\n");
|
|
856
|
+
sourceLines.set(content, lines);
|
|
857
|
+
}
|
|
858
|
+
return lines;
|
|
859
|
+
}
|
|
860
|
+
function isNonCodeSourceLine(content, line) {
|
|
861
|
+
if (content == null) return false;
|
|
862
|
+
const raw = linesOf(content)[line - 1] ?? "";
|
|
863
|
+
const text = raw.trim();
|
|
864
|
+
return text === "" || /^(interface\b|type\b|import\b|export type\b|declare\b|export interface\b)/.test(
|
|
865
|
+
text
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
function resolveInPlain(mappings, sources, line, column, sourcesContent) {
|
|
869
|
+
const rows = mappings[line - 1];
|
|
870
|
+
if (!rows) return null;
|
|
871
|
+
let selected = rows[0] ?? { generatedColumn: 0 };
|
|
872
|
+
let selectedIndex = 0;
|
|
873
|
+
for (let i = 0; i < rows.length; i++) {
|
|
874
|
+
const m = rows[i];
|
|
875
|
+
if (m.generatedColumn <= column) {
|
|
876
|
+
selected = m;
|
|
877
|
+
selectedIndex = i;
|
|
878
|
+
} else break;
|
|
879
|
+
}
|
|
880
|
+
if (!("sourceIndex" in selected)) return null;
|
|
881
|
+
const source = sources[selected.sourceIndex];
|
|
882
|
+
if (source == null) return null;
|
|
883
|
+
const relative = normalizeSourcePath(source);
|
|
884
|
+
const base = {
|
|
885
|
+
source: relative,
|
|
886
|
+
line: selected.sourceLine + 1,
|
|
887
|
+
column: selected.sourceColumn
|
|
888
|
+
};
|
|
889
|
+
if (sourcesContent.length > 0 && isNonCodeSourceLine(
|
|
890
|
+
sourcesContent[selected.sourceIndex] ?? null,
|
|
891
|
+
base.line
|
|
892
|
+
)) {
|
|
893
|
+
for (let i = selectedIndex + 1; i < rows.length; i++) {
|
|
894
|
+
const m = rows[i];
|
|
895
|
+
if (!("sourceIndex" in m)) continue;
|
|
896
|
+
if (m.sourceIndex !== selected.sourceIndex) continue;
|
|
897
|
+
const altSource = sources[m.sourceIndex];
|
|
898
|
+
if (altSource == null) continue;
|
|
899
|
+
const altLine = m.sourceLine + 1;
|
|
900
|
+
if (isNonCodeSourceLine(sourcesContent[m.sourceIndex] ?? null, altLine)) {
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
return {
|
|
904
|
+
source: normalizeSourcePath(altSource),
|
|
905
|
+
line: altLine,
|
|
906
|
+
column: m.sourceColumn
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return base;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// src/core/source/component-annotate.ts
|
|
914
|
+
var FIBER_KEY_PREFIX = "__reactFiber$";
|
|
915
|
+
var STACK_FRAME_RE = /(https?:\/\/[^\s()]+?\/_next\/static\/chunks\/[^\s()]+?\._\.js):(\d+):(\d+)/;
|
|
916
|
+
function componentInfo(el) {
|
|
917
|
+
const fiber = getFiber(el);
|
|
918
|
+
if (!fiber) return null;
|
|
919
|
+
let current = fiber;
|
|
920
|
+
while (current) {
|
|
921
|
+
const name = fiberName(current);
|
|
922
|
+
if (name) {
|
|
923
|
+
return { component: name, source: null };
|
|
924
|
+
}
|
|
925
|
+
current = current.return;
|
|
926
|
+
}
|
|
927
|
+
return null;
|
|
928
|
+
}
|
|
929
|
+
function componentChain(el, max = 4) {
|
|
930
|
+
const fiber = getFiber(el);
|
|
931
|
+
if (!fiber) return [];
|
|
932
|
+
const names = [];
|
|
933
|
+
let owner = fiber._debugOwner;
|
|
934
|
+
while (owner && names.length < max) {
|
|
935
|
+
const name = displayNameOf(owner.type);
|
|
936
|
+
if (name && names[names.length - 1] !== name) names.push(name);
|
|
937
|
+
owner = owner._debugOwner;
|
|
938
|
+
}
|
|
939
|
+
if (names.length === 0) {
|
|
940
|
+
const single = fiberName(fiber);
|
|
941
|
+
return single ? [single] : [];
|
|
942
|
+
}
|
|
943
|
+
return names.reverse();
|
|
944
|
+
}
|
|
945
|
+
function displayNameOf(type) {
|
|
946
|
+
const fn = type;
|
|
947
|
+
return fn?.displayName || fn?.name || null;
|
|
948
|
+
}
|
|
949
|
+
function fiberName(fiber) {
|
|
950
|
+
const direct = displayNameOf(fiber.type);
|
|
951
|
+
if (direct) return direct;
|
|
952
|
+
let owner = fiber._debugOwner;
|
|
953
|
+
while (owner) {
|
|
954
|
+
const ownerName = displayNameOf(owner.type);
|
|
955
|
+
if (ownerName) return ownerName;
|
|
956
|
+
owner = owner._debugOwner;
|
|
957
|
+
}
|
|
958
|
+
if (fiber._debugInfo)
|
|
959
|
+
for (const entry of fiber._debugInfo) {
|
|
960
|
+
const name = entry?.name;
|
|
961
|
+
if (name) return name;
|
|
962
|
+
}
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
var DIRECT_SOURCE_RE = /(?:^|[\s(/])((?:src|app)\/.+?\.(?:tsx?|jsx?))(?:\?[^\s:)]*)?:(\d+):(\d+)/g;
|
|
966
|
+
var FRAMEWORK_INTERNAL_RE = /(?:^|\/)(?:node_modules|next\/dist)\/|^(?:src|app)\/(?:client|server|shared)\//;
|
|
967
|
+
function extractDirectSources(stackText) {
|
|
968
|
+
const text = stackText.replace(/\\/g, "/");
|
|
969
|
+
const out = [];
|
|
970
|
+
const re = new RegExp(DIRECT_SOURCE_RE.source, "g");
|
|
971
|
+
let m;
|
|
972
|
+
while (m = re.exec(text)) {
|
|
973
|
+
const source = m[1];
|
|
974
|
+
if (FRAMEWORK_INTERNAL_RE.test(source) || /node_modules|next\/dist/.test(m[0])) {
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
out.push({ source, line: Number(m[2]) });
|
|
978
|
+
}
|
|
979
|
+
return out;
|
|
980
|
+
}
|
|
981
|
+
function stackCandidates(stack) {
|
|
982
|
+
const text = stack?.stack;
|
|
983
|
+
if (!text) return [];
|
|
984
|
+
const frames = [];
|
|
985
|
+
const regex = new RegExp(STACK_FRAME_RE.source, "g");
|
|
986
|
+
let m;
|
|
987
|
+
while (m = regex.exec(text)) {
|
|
988
|
+
frames.push({ url: m[1], line: Number(m[2]), col: Number(m[3]) });
|
|
989
|
+
}
|
|
990
|
+
return frames;
|
|
991
|
+
}
|
|
992
|
+
function getFiber(el) {
|
|
993
|
+
for (const key in el) {
|
|
994
|
+
if (key.startsWith(FIBER_KEY_PREFIX)) {
|
|
995
|
+
return el[key];
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
var SOURCE_RE = /(?:^|)(?:src|app)\/[^?]*\.(?:tsx?|jsx?|css)$/;
|
|
1001
|
+
var PROCESSED_KEY = "__rfComponentTraceDone__";
|
|
1002
|
+
var SUSPENSE_TAG = 13;
|
|
1003
|
+
function isDehydrated(f) {
|
|
1004
|
+
const state = f?.memoizedState;
|
|
1005
|
+
return !!state?.dehydrated;
|
|
1006
|
+
}
|
|
1007
|
+
function isCommittedFiber(fiber) {
|
|
1008
|
+
let f = fiber.return;
|
|
1009
|
+
while (f) {
|
|
1010
|
+
if (f.tag === SUSPENSE_TAG && isDehydrated(f) && (!f.alternate || isDehydrated(f.alternate)))
|
|
1011
|
+
return false;
|
|
1012
|
+
f = f.return;
|
|
1013
|
+
}
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
var pendingCount = 0;
|
|
1017
|
+
function pendingAnnotations() {
|
|
1018
|
+
return pendingCount;
|
|
1019
|
+
}
|
|
1020
|
+
function annotateTree(root) {
|
|
1021
|
+
const els = root.querySelectorAll("*");
|
|
1022
|
+
let count = 0;
|
|
1023
|
+
pendingCount = 0;
|
|
1024
|
+
for (const el of els) {
|
|
1025
|
+
if (annotate(el)) count++;
|
|
1026
|
+
}
|
|
1027
|
+
return count;
|
|
1028
|
+
}
|
|
1029
|
+
function annotate(el) {
|
|
1030
|
+
const done = el[PROCESSED_KEY];
|
|
1031
|
+
if (done) return false;
|
|
1032
|
+
const fiberNow = getFiber(el);
|
|
1033
|
+
if (fiberNow && !isCommittedFiber(fiberNow)) {
|
|
1034
|
+
pendingCount++;
|
|
1035
|
+
return false;
|
|
1036
|
+
}
|
|
1037
|
+
const info = componentInfo(el);
|
|
1038
|
+
if (!info) return false;
|
|
1039
|
+
el[PROCESSED_KEY] = true;
|
|
1040
|
+
el.setAttribute("data-component", info.component);
|
|
1041
|
+
const fiber = getFiber(el);
|
|
1042
|
+
if (!fiber || !fiber._debugStack) return true;
|
|
1043
|
+
resolveFirstSource(fiber._debugStack).then(async (source) => {
|
|
1044
|
+
if (source) el.setAttribute("data-source", source);
|
|
1045
|
+
const owner = await resolveOwnerSource(fiber, fileOf(source));
|
|
1046
|
+
if (owner) el.setAttribute("data-owner-source", owner);
|
|
1047
|
+
});
|
|
1048
|
+
return true;
|
|
1049
|
+
}
|
|
1050
|
+
function fileOf(source) {
|
|
1051
|
+
return source ? source.replace(/:\d+(?::\d+)?$/, "") : null;
|
|
1052
|
+
}
|
|
1053
|
+
async function resolveStackSources(stack) {
|
|
1054
|
+
const direct = [];
|
|
1055
|
+
for (const f of extractDirectSources(stack.stack ?? "")) {
|
|
1056
|
+
if (SOURCE_RE.test(f.source)) direct.push({ source: f.source, line: f.line });
|
|
1057
|
+
}
|
|
1058
|
+
if (direct.length > 0) return direct;
|
|
1059
|
+
const out = [];
|
|
1060
|
+
for (const frame of stackCandidates(stack)) {
|
|
1061
|
+
const resolved = await resolvePosition(frame.url, frame.line, frame.col);
|
|
1062
|
+
if (resolved && SOURCE_RE.test(resolved.source)) {
|
|
1063
|
+
out.push({ source: resolved.source, line: resolved.line });
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
return out;
|
|
1067
|
+
}
|
|
1068
|
+
async function resolveFirstSource(stack) {
|
|
1069
|
+
const frames = await resolveStackSources(stack);
|
|
1070
|
+
return frames.length > 0 ? `${frames[0].source}:${frames[0].line}` : null;
|
|
1071
|
+
}
|
|
1072
|
+
async function resolveOwnerSource(fiber, sourceFile) {
|
|
1073
|
+
if (sourceFile && fiber._debugStack) {
|
|
1074
|
+
for (const f of await resolveStackSources(fiber._debugStack)) {
|
|
1075
|
+
if (fileOf(f.source) !== sourceFile) return `${f.source}:${f.line}`;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
let owner = fiber._debugOwner;
|
|
1079
|
+
let depth = 0;
|
|
1080
|
+
while (owner && depth < 12) {
|
|
1081
|
+
if (owner._debugStack) {
|
|
1082
|
+
const s = await resolveFirstSource(owner._debugStack);
|
|
1083
|
+
if (s && fileOf(s) !== sourceFile) return s;
|
|
1084
|
+
}
|
|
1085
|
+
owner = owner._debugOwner;
|
|
1086
|
+
depth++;
|
|
1087
|
+
}
|
|
1088
|
+
return null;
|
|
1089
|
+
}
|
|
1090
|
+
var PENDING_RETRY_MS = 300;
|
|
1091
|
+
var MAX_PENDING_RETRIES = 100;
|
|
1092
|
+
var SETTLE_MS = 1e4;
|
|
1093
|
+
function initComponentAnnotator() {
|
|
1094
|
+
let queued = false;
|
|
1095
|
+
let frame = null;
|
|
1096
|
+
let retryTimer = null;
|
|
1097
|
+
let retries = 0;
|
|
1098
|
+
const startedAt = Date.now();
|
|
1099
|
+
const run = () => {
|
|
1100
|
+
queued = false;
|
|
1101
|
+
frame = null;
|
|
1102
|
+
if (!document.body) return;
|
|
1103
|
+
const added = annotateTree(document.body);
|
|
1104
|
+
const settling = Date.now() - startedAt < SETTLE_MS;
|
|
1105
|
+
if ((pendingAnnotations() > 0 || added > 0 || settling) && retries < MAX_PENDING_RETRIES) {
|
|
1106
|
+
retries++;
|
|
1107
|
+
if (retryTimer === null)
|
|
1108
|
+
retryTimer = setTimeout(() => {
|
|
1109
|
+
retryTimer = null;
|
|
1110
|
+
queue();
|
|
1111
|
+
}, PENDING_RETRY_MS);
|
|
1112
|
+
} else {
|
|
1113
|
+
retries = 0;
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
const queue = () => {
|
|
1117
|
+
if (queued) return;
|
|
1118
|
+
queued = true;
|
|
1119
|
+
frame = requestAnimationFrame(run);
|
|
1120
|
+
};
|
|
1121
|
+
const observer = new MutationObserver(queue);
|
|
1122
|
+
const start = () => {
|
|
1123
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1124
|
+
run();
|
|
1125
|
+
};
|
|
1126
|
+
if (document.readyState === "loading")
|
|
1127
|
+
document.addEventListener("DOMContentLoaded", start, { once: true });
|
|
1128
|
+
else start();
|
|
1129
|
+
return () => {
|
|
1130
|
+
document.removeEventListener("DOMContentLoaded", start);
|
|
1131
|
+
observer.disconnect();
|
|
1132
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
1133
|
+
if (retryTimer !== null) clearTimeout(retryTimer);
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// src/core/source/tpl-annotate.ts
|
|
1138
|
+
var PROCESSED_KEY2 = "__rpTplDone__";
|
|
1139
|
+
function parseTplMarker(text) {
|
|
1140
|
+
const m = /^rp@(.+):(\d+)$/.exec(text.trim());
|
|
1141
|
+
if (!m) return null;
|
|
1142
|
+
return { source: m[1], line: Number(m[2]) };
|
|
1143
|
+
}
|
|
1144
|
+
function basename(path) {
|
|
1145
|
+
const parts = path.split("/");
|
|
1146
|
+
return parts[parts.length - 1] || path;
|
|
1147
|
+
}
|
|
1148
|
+
function moduleNameFromSource(source) {
|
|
1149
|
+
const m = /(?:^|\/)modules\/([^/]+)\//.exec(source);
|
|
1150
|
+
return m ? m[1] : null;
|
|
1151
|
+
}
|
|
1152
|
+
function tplLabel(el) {
|
|
1153
|
+
const src = el.closest("[data-source]")?.getAttribute("data-source");
|
|
1154
|
+
if (!src) return null;
|
|
1155
|
+
const path = src.replace(/:\d+(?::\d+)?$/, "");
|
|
1156
|
+
const mod = moduleNameFromSource(path);
|
|
1157
|
+
if (mod) return mod;
|
|
1158
|
+
return /\.tpl$/.test(path) ? basename(path) : null;
|
|
1159
|
+
}
|
|
1160
|
+
function annotateEl(el, source, component) {
|
|
1161
|
+
if (el[PROCESSED_KEY2]) return 0;
|
|
1162
|
+
el[PROCESSED_KEY2] = true;
|
|
1163
|
+
el.setAttribute("data-source", source);
|
|
1164
|
+
if (component) el.setAttribute("data-component", component);
|
|
1165
|
+
return 1;
|
|
1166
|
+
}
|
|
1167
|
+
function annotateFromComments(root = document.body, seedSource = null, seedComponent = null) {
|
|
1168
|
+
if (!root) return 0;
|
|
1169
|
+
let currentSource = seedSource;
|
|
1170
|
+
let currentComponent = seedComponent;
|
|
1171
|
+
let count = 0;
|
|
1172
|
+
if (root.nodeType === Node.ELEMENT_NODE && currentSource) {
|
|
1173
|
+
count += annotateEl(root, currentSource, currentComponent);
|
|
1174
|
+
}
|
|
1175
|
+
const walker = document.createTreeWalker(
|
|
1176
|
+
root,
|
|
1177
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT
|
|
1178
|
+
);
|
|
1179
|
+
let node = walker.nextNode();
|
|
1180
|
+
while (node) {
|
|
1181
|
+
if (node.nodeType === Node.COMMENT_NODE) {
|
|
1182
|
+
const marker = parseTplMarker(node.data);
|
|
1183
|
+
if (marker) {
|
|
1184
|
+
currentSource = `${marker.source}:${marker.line}`;
|
|
1185
|
+
currentComponent = basename(marker.source);
|
|
1186
|
+
}
|
|
1187
|
+
} else if (currentSource) {
|
|
1188
|
+
count += annotateEl(node, currentSource, currentComponent);
|
|
1189
|
+
}
|
|
1190
|
+
node = walker.nextNode();
|
|
1191
|
+
}
|
|
1192
|
+
return count;
|
|
1193
|
+
}
|
|
1194
|
+
function previousInDocOrder(node) {
|
|
1195
|
+
if (node.previousSibling) {
|
|
1196
|
+
let p = node.previousSibling;
|
|
1197
|
+
while (p.lastChild) p = p.lastChild;
|
|
1198
|
+
return p;
|
|
1199
|
+
}
|
|
1200
|
+
return node.parentNode;
|
|
1201
|
+
}
|
|
1202
|
+
function precedingSource(start) {
|
|
1203
|
+
let n = previousInDocOrder(start);
|
|
1204
|
+
for (let steps = 0; n && steps < 5e3; steps++) {
|
|
1205
|
+
if (n.nodeType === Node.COMMENT_NODE) {
|
|
1206
|
+
const m = parseTplMarker(n.data);
|
|
1207
|
+
if (m) return { source: `${m.source}:${m.line}`, component: basename(m.source) };
|
|
1208
|
+
}
|
|
1209
|
+
n = previousInDocOrder(n);
|
|
1210
|
+
}
|
|
1211
|
+
return null;
|
|
1212
|
+
}
|
|
1213
|
+
function annotateSubtree(el) {
|
|
1214
|
+
const pre = precedingSource(el);
|
|
1215
|
+
return annotateFromComments(el, pre?.source ?? null, pre?.component ?? null);
|
|
1216
|
+
}
|
|
1217
|
+
function initTplAnnotator() {
|
|
1218
|
+
const pending = /* @__PURE__ */ new Set();
|
|
1219
|
+
let frame = null;
|
|
1220
|
+
const flush = () => {
|
|
1221
|
+
frame = null;
|
|
1222
|
+
for (const el of pending) {
|
|
1223
|
+
if (el.isConnected) annotateSubtree(el);
|
|
1224
|
+
}
|
|
1225
|
+
pending.clear();
|
|
1226
|
+
};
|
|
1227
|
+
const observer = new MutationObserver((mutations) => {
|
|
1228
|
+
for (const m of mutations) {
|
|
1229
|
+
for (const added of m.addedNodes) {
|
|
1230
|
+
if (added.nodeType === Node.ELEMENT_NODE) pending.add(added);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
if (pending.size > 0 && frame === null) frame = requestAnimationFrame(flush);
|
|
1234
|
+
});
|
|
1235
|
+
const start = () => {
|
|
1236
|
+
annotateFromComments(document.body);
|
|
1237
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1238
|
+
};
|
|
1239
|
+
if (document.readyState === "loading")
|
|
1240
|
+
document.addEventListener("DOMContentLoaded", start, { once: true });
|
|
1241
|
+
else start();
|
|
1242
|
+
return () => {
|
|
1243
|
+
document.removeEventListener("DOMContentLoaded", start);
|
|
1244
|
+
observer.disconnect();
|
|
1245
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
// src/core/dev/console-hush.ts
|
|
1250
|
+
var DEFAULT_HUSH_RULES = [
|
|
1251
|
+
/Download the React DevTools/,
|
|
1252
|
+
/^\[HMR\] connected$/,
|
|
1253
|
+
/^\[Fast Refresh\]/
|
|
1254
|
+
];
|
|
1255
|
+
var METHODS = ["log", "info", "debug"];
|
|
1256
|
+
function hushConsoleNoise(rules = DEFAULT_HUSH_RULES) {
|
|
1257
|
+
const originals = /* @__PURE__ */ new Map();
|
|
1258
|
+
for (const name of METHODS) {
|
|
1259
|
+
const original = console[name];
|
|
1260
|
+
originals.set(name, original);
|
|
1261
|
+
console[name] = (...args) => {
|
|
1262
|
+
const first = args[0];
|
|
1263
|
+
if (typeof first === "string" && rules.some((r) => r.test(first))) {
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
original.apply(console, args);
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
return () => {
|
|
1270
|
+
for (const [name, original] of originals) {
|
|
1271
|
+
console[name] = original;
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// src/core/inspector/css-selector.ts
|
|
1277
|
+
var HASH_CLASS_RE = /^css-[a-z0-9]+$/i;
|
|
1278
|
+
function retainedClasses(el) {
|
|
1279
|
+
return Array.from(el.classList).filter((c) => !HASH_CLASS_RE.test(c));
|
|
1280
|
+
}
|
|
1281
|
+
function isUnique(selector) {
|
|
1282
|
+
try {
|
|
1283
|
+
return document.querySelectorAll(selector).length === 1;
|
|
1284
|
+
} catch {
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
function getElementSelector(el) {
|
|
1289
|
+
if (el.id) return `#${el.id}`;
|
|
1290
|
+
const tag = el.tagName.toLowerCase();
|
|
1291
|
+
const classes = retainedClasses(el);
|
|
1292
|
+
let selector = tag + classes.map((c) => `.${c}`).join("");
|
|
1293
|
+
const parent = el.parentElement;
|
|
1294
|
+
if (parent) {
|
|
1295
|
+
const classKey = classes.join(" ");
|
|
1296
|
+
const twins = Array.from(parent.children).filter(
|
|
1297
|
+
(s) => s.tagName === el.tagName && retainedClasses(s).join(" ") === classKey
|
|
1298
|
+
);
|
|
1299
|
+
if (twins.length > 1) {
|
|
1300
|
+
const index = Array.from(parent.children).indexOf(el) + 1;
|
|
1301
|
+
selector += `:nth-child(${index})`;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
return selector;
|
|
1305
|
+
}
|
|
1306
|
+
function getCssSelector(el) {
|
|
1307
|
+
if (el.id) return `#${el.id}`;
|
|
1308
|
+
const parts = [];
|
|
1309
|
+
let current = el;
|
|
1310
|
+
let depth = 0;
|
|
1311
|
+
while (current && current.nodeType === 1 && current !== document.body && depth < 5) {
|
|
1312
|
+
const segment = getElementSelector(current);
|
|
1313
|
+
parts.unshift(segment);
|
|
1314
|
+
const combined = parts.join(" > ");
|
|
1315
|
+
if (isUnique(combined)) return combined;
|
|
1316
|
+
if (segment.startsWith("#")) break;
|
|
1317
|
+
current = current.parentElement;
|
|
1318
|
+
depth++;
|
|
1319
|
+
}
|
|
1320
|
+
return parts.join(" > ");
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
// src/core/inspector/xpath.ts
|
|
1324
|
+
function isUsableId(id) {
|
|
1325
|
+
return !!id && !id.includes(":") && // React 18 useId / radix (`:r3:`)
|
|
1326
|
+
!id.includes("\xAB") && // variantes useId
|
|
1327
|
+
!id.includes("_r_") && // React 19 useId / headlessui (`..._r_3b_`)
|
|
1328
|
+
!/^(headlessui|radix)-/.test(id);
|
|
1329
|
+
}
|
|
1330
|
+
function getXPath(el) {
|
|
1331
|
+
if (isUsableId(el.id)) return `//*[@id="${el.id}"]`;
|
|
1332
|
+
const parts = [];
|
|
1333
|
+
let current = el.closest("svg") ?? el;
|
|
1334
|
+
while (current && current.nodeType === 1 && current !== document.documentElement) {
|
|
1335
|
+
const tag = current.tagName.toLowerCase();
|
|
1336
|
+
if (current !== el && isUsableId(current.id)) {
|
|
1337
|
+
parts.unshift(`*[@id="${current.id}"]`);
|
|
1338
|
+
return `//${parts.join("/")}`;
|
|
1339
|
+
}
|
|
1340
|
+
const parent = current.parentElement;
|
|
1341
|
+
let segment = tag;
|
|
1342
|
+
if (parent) {
|
|
1343
|
+
const sameTag = Array.from(parent.children).filter(
|
|
1344
|
+
(c) => c.tagName.toLowerCase() === tag
|
|
1345
|
+
);
|
|
1346
|
+
if (sameTag.length > 1) {
|
|
1347
|
+
segment = `${tag}[${sameTag.indexOf(current) + 1}]`;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
parts.unshift(segment);
|
|
1351
|
+
current = parent;
|
|
1352
|
+
}
|
|
1353
|
+
return `/html/${parts.join("/")}`;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// src/core/format.ts
|
|
1357
|
+
function elementText(el) {
|
|
1358
|
+
const t = (el.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
1359
|
+
if (!t) return null;
|
|
1360
|
+
return t.length > 200 ? `${t.slice(0, 200)}\u2026` : t;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
// src/core/search/element-search.ts
|
|
1364
|
+
var SEARCH_MAX_RESULTS = 50;
|
|
1365
|
+
var IGNORE_SELECTOR = "[data-pathpicker-ignore]";
|
|
1366
|
+
var WORD_RE = /^[a-zA-Z][\w-]*$/;
|
|
1367
|
+
var CLASS_TOKEN_RE = /^[A-Za-z][A-Za-z0-9_:/.-]*$/;
|
|
1368
|
+
var PARTIAL_RE = /^([a-zA-Z][\w-]*)?\.(\w*)$/;
|
|
1369
|
+
function searchElements(query, root = document) {
|
|
1370
|
+
const partial = PARTIAL_RE.exec(query.trim());
|
|
1371
|
+
if (partial) return searchPartial(partial[1] ?? null, partial[2] ?? "");
|
|
1372
|
+
const selector = toSelector(query);
|
|
1373
|
+
if (!selector) return [];
|
|
1374
|
+
let matches;
|
|
1375
|
+
try {
|
|
1376
|
+
matches = root.querySelectorAll(selector);
|
|
1377
|
+
} catch {
|
|
1378
|
+
return [];
|
|
1379
|
+
}
|
|
1380
|
+
return collect(matches);
|
|
1381
|
+
}
|
|
1382
|
+
function collect(matches) {
|
|
1383
|
+
const results = [];
|
|
1384
|
+
for (const el of matches) {
|
|
1385
|
+
if (results.length >= SEARCH_MAX_RESULTS) break;
|
|
1386
|
+
if (!el.isConnected) continue;
|
|
1387
|
+
if (el.closest(IGNORE_SELECTOR)) continue;
|
|
1388
|
+
results.push(el);
|
|
1389
|
+
}
|
|
1390
|
+
return results;
|
|
1391
|
+
}
|
|
1392
|
+
function searchPartial(tag, prefix, root = document) {
|
|
1393
|
+
let candidates;
|
|
1394
|
+
try {
|
|
1395
|
+
candidates = root.querySelectorAll(tag ?? "*");
|
|
1396
|
+
} catch {
|
|
1397
|
+
return [];
|
|
1398
|
+
}
|
|
1399
|
+
const results = [];
|
|
1400
|
+
const lower = prefix.toLowerCase();
|
|
1401
|
+
const anyClass = lower === "";
|
|
1402
|
+
for (const el of candidates) {
|
|
1403
|
+
if (results.length >= SEARCH_MAX_RESULTS) break;
|
|
1404
|
+
if (!el.isConnected) continue;
|
|
1405
|
+
if (el.closest(IGNORE_SELECTOR)) continue;
|
|
1406
|
+
const raw = el.getAttribute("class");
|
|
1407
|
+
if (!anyClass) {
|
|
1408
|
+
const hit = raw ? raw.trim().split(/\s+/).some((cls) => cls.toLowerCase().startsWith(lower)) : false;
|
|
1409
|
+
if (!hit) continue;
|
|
1410
|
+
}
|
|
1411
|
+
results.push(el);
|
|
1412
|
+
}
|
|
1413
|
+
return results;
|
|
1414
|
+
}
|
|
1415
|
+
function toSelector(query) {
|
|
1416
|
+
const q = query.trim();
|
|
1417
|
+
if (!q) return null;
|
|
1418
|
+
const tokens = q.split(/\s+/);
|
|
1419
|
+
if (tokens.length > 1 && tokens.every((t) => CLASS_TOKEN_RE.test(t))) {
|
|
1420
|
+
return tokens.map((t) => `.${escapeClassToken(t)}`).join("");
|
|
1421
|
+
}
|
|
1422
|
+
const isSimpleWord = WORD_RE.test(q);
|
|
1423
|
+
if (!isSimpleWord) {
|
|
1424
|
+
return q;
|
|
1425
|
+
}
|
|
1426
|
+
const escaped = typeof CSS !== "undefined" && CSS.escape ? CSS.escape(q) : q;
|
|
1427
|
+
return `${q}, .${escaped}, [data-component="${q}" i], [class^="${q}"], [class*=" ${q}"]`;
|
|
1428
|
+
}
|
|
1429
|
+
function pickResultFromElement(el, route) {
|
|
1430
|
+
return {
|
|
1431
|
+
route,
|
|
1432
|
+
xpath: getXPath(el),
|
|
1433
|
+
cssSelector: getCssSelector(el),
|
|
1434
|
+
text: elementText(el),
|
|
1435
|
+
tagName: el.tagName.toLowerCase(),
|
|
1436
|
+
id: el.id || null,
|
|
1437
|
+
reactComponent: null,
|
|
1438
|
+
reactSource: null
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
function escapeClassToken(token) {
|
|
1442
|
+
if (WORD_RE.test(token)) return token;
|
|
1443
|
+
if (typeof CSS !== "undefined" && CSS.escape) return CSS.escape(token);
|
|
1444
|
+
if (/^[0-9]/.test(token)) return `\\3${token} `;
|
|
1445
|
+
return token.replace(/[^a-zA-Z0-9_-]/g, (c) => `\\${c}`);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// src/core/source/enrich.ts
|
|
1449
|
+
function findPickedElement(result, doc = document) {
|
|
1450
|
+
if (result.xpath) {
|
|
1451
|
+
try {
|
|
1452
|
+
const node = doc.evaluate(
|
|
1453
|
+
result.xpath,
|
|
1454
|
+
doc,
|
|
1455
|
+
null,
|
|
1456
|
+
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
1457
|
+
null
|
|
1458
|
+
).singleNodeValue;
|
|
1459
|
+
if (node instanceof Element) return node;
|
|
1460
|
+
} catch {
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
if (result.cssSelector) {
|
|
1464
|
+
try {
|
|
1465
|
+
return doc.querySelector(result.cssSelector);
|
|
1466
|
+
} catch {
|
|
1467
|
+
return null;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return null;
|
|
1471
|
+
}
|
|
1472
|
+
function enrichResult(result, doc = document) {
|
|
1473
|
+
if (result.reactSource && result.reactComponent) return result;
|
|
1474
|
+
const el = findPickedElement(result, doc);
|
|
1475
|
+
const annotated = el?.closest("[data-source]");
|
|
1476
|
+
const source = annotated?.getAttribute("data-source") ?? null;
|
|
1477
|
+
const chain = el instanceof HTMLElement ? componentChain(el) : [];
|
|
1478
|
+
const component = chain.length > 0 ? chain.join(" > ") : el?.closest("[data-component]")?.getAttribute("data-component") ?? null;
|
|
1479
|
+
return {
|
|
1480
|
+
...result,
|
|
1481
|
+
reactSource: result.reactSource ?? source,
|
|
1482
|
+
reactComponent: result.reactComponent ?? component
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// src/core/devpanel/inspected.ts
|
|
1487
|
+
var treeSelectMode = false;
|
|
1488
|
+
function isTreeSelectMode() {
|
|
1489
|
+
return treeSelectMode;
|
|
1490
|
+
}
|
|
1491
|
+
var selectListeners = /* @__PURE__ */ new Set();
|
|
1492
|
+
function requestSelect(el) {
|
|
1493
|
+
for (const fn of selectListeners) fn(el);
|
|
1494
|
+
}
|
|
1495
|
+
var ctxListeners = /* @__PURE__ */ new Set();
|
|
1496
|
+
function requestContextMenu(el, x, y) {
|
|
1497
|
+
for (const fn of ctxListeners) fn(el, x, y);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// src/core/inspector/key-command.ts
|
|
1501
|
+
function createKeyCommandMatcher() {
|
|
1502
|
+
let tapAt = null;
|
|
1503
|
+
return {
|
|
1504
|
+
status(e, b) {
|
|
1505
|
+
if (b.key === "off") return null;
|
|
1506
|
+
if (!modifierMatches(b.modifier, e)) return null;
|
|
1507
|
+
if (e.key.toLowerCase() !== b.key) return null;
|
|
1508
|
+
if (!b.double) return "fire";
|
|
1509
|
+
if (e.repeat) return "wait";
|
|
1510
|
+
if (tapAt !== null && e.timeStamp - tapAt <= DOUBLE_TAP_WINDOW) {
|
|
1511
|
+
tapAt = null;
|
|
1512
|
+
return "fire";
|
|
1513
|
+
}
|
|
1514
|
+
tapAt = e.timeStamp;
|
|
1515
|
+
return "wait";
|
|
1516
|
+
},
|
|
1517
|
+
reset() {
|
|
1518
|
+
tapAt = null;
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
// src/core/inspector/constants/picker.ts
|
|
1524
|
+
var ACCENT = "#3b82f6";
|
|
1525
|
+
var OVERLAY_Z = 2147482e3;
|
|
1526
|
+
var SELECTED_BG = "rgba(59,130,246,0.24)";
|
|
1527
|
+
var HIGHLIGHT_BORDER = `2px solid ${ACCENT}`;
|
|
1528
|
+
var OVERLAY_RADIUS = "3px";
|
|
1529
|
+
var OVERLAY_GLIDE = "top .2s cubic-bezier(.25,.1,.25,1), left .2s cubic-bezier(.25,.1,.25,1), width .2s cubic-bezier(.25,.1,.25,1), height .2s cubic-bezier(.25,.1,.25,1), opacity .12s ease-out";
|
|
1530
|
+
var PICKING_CSS = ':disabled,[disabled],[aria-disabled="true"]{pointer-events:none!important}';
|
|
1531
|
+
|
|
1532
|
+
// src/core/inspector/hit-test.ts
|
|
1533
|
+
function shouldIgnore(el) {
|
|
1534
|
+
return !!el?.closest?.(`[${IGNORE_ATTR}]`);
|
|
1535
|
+
}
|
|
1536
|
+
function containsPoint(el, x, y) {
|
|
1537
|
+
const rects = el.getClientRects?.();
|
|
1538
|
+
const list = rects && rects.length ? Array.from(rects) : [el.getBoundingClientRect()];
|
|
1539
|
+
return list.some(
|
|
1540
|
+
(r) => r.width > 0 && r.height > 0 && x >= r.left && x <= r.right && y >= r.top && y <= r.bottom
|
|
1541
|
+
);
|
|
1542
|
+
}
|
|
1543
|
+
function skippedChildAt(el, x, y) {
|
|
1544
|
+
const children = Array.from(el.children);
|
|
1545
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
1546
|
+
const child = children[i];
|
|
1547
|
+
if (shouldIgnore(child)) continue;
|
|
1548
|
+
if (!containsPoint(child, x, y)) continue;
|
|
1549
|
+
const cs = getComputedStyle(child);
|
|
1550
|
+
if (cs.pointerEvents !== "none") continue;
|
|
1551
|
+
if (cs.visibility === "hidden" || cs.opacity === "0") continue;
|
|
1552
|
+
return child;
|
|
1553
|
+
}
|
|
1554
|
+
return null;
|
|
1555
|
+
}
|
|
1556
|
+
function isDisabled(el) {
|
|
1557
|
+
try {
|
|
1558
|
+
return el.matches(':disabled,[disabled],[aria-disabled="true"]');
|
|
1559
|
+
} catch {
|
|
1560
|
+
return false;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
function resolveTarget(x, y) {
|
|
1564
|
+
const hit = document.elementFromPoint(x, y);
|
|
1565
|
+
if (!hit || shouldIgnore(hit)) return null;
|
|
1566
|
+
let current = hit;
|
|
1567
|
+
for (let i = 0; i < MAX_DESCEND; i++) {
|
|
1568
|
+
if (isDisabled(current)) break;
|
|
1569
|
+
const child = skippedChildAt(current, x, y);
|
|
1570
|
+
if (!child) break;
|
|
1571
|
+
current = child;
|
|
1572
|
+
}
|
|
1573
|
+
return current;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
// src/core/inspector/constants/theme.ts
|
|
1577
|
+
var SOLID_BG = "#18181b";
|
|
1578
|
+
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)";
|
|
1579
|
+
var PANEL_BORDER = "1px solid rgba(255,255,255,0.1)";
|
|
1580
|
+
var SECONDARY_SURFACE = "linear-gradient(rgba(255,255,255,0.04), rgba(255,255,255,0.04)), #18181b";
|
|
1581
|
+
var SECONDARY_BORDER = "1px solid rgba(255,255,255,0.08)";
|
|
1582
|
+
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)";
|
|
1583
|
+
|
|
1584
|
+
// src/core/inspector/surfaces/dom.ts
|
|
1585
|
+
function assign(el, style) {
|
|
1586
|
+
Object.assign(el.style, style);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
// src/core/inspector/surfaces/create.ts
|
|
1590
|
+
var TOOLTIP_MAX_W = 420;
|
|
1591
|
+
function createSurfaces() {
|
|
1592
|
+
const container = document.createElement("div");
|
|
1593
|
+
container.setAttribute(IGNORE_ATTR, "");
|
|
1594
|
+
assign(container, {
|
|
1595
|
+
position: "fixed",
|
|
1596
|
+
inset: "0",
|
|
1597
|
+
pointerEvents: "none",
|
|
1598
|
+
zIndex: String(OVERLAY_Z)
|
|
1599
|
+
});
|
|
1600
|
+
const decorLayer = document.createElement("div");
|
|
1601
|
+
container.appendChild(decorLayer);
|
|
1602
|
+
const markerLayer = document.createElement("div");
|
|
1603
|
+
container.appendChild(markerLayer);
|
|
1604
|
+
const overlay = document.createElement("div");
|
|
1605
|
+
assign(overlay, {
|
|
1606
|
+
position: "fixed",
|
|
1607
|
+
display: "block",
|
|
1608
|
+
opacity: "0",
|
|
1609
|
+
background: "transparent",
|
|
1610
|
+
border: HIGHLIGHT_BORDER,
|
|
1611
|
+
borderRadius: OVERLAY_RADIUS,
|
|
1612
|
+
boxSizing: "border-box",
|
|
1613
|
+
pointerEvents: "none",
|
|
1614
|
+
transition: OVERLAY_GLIDE
|
|
1615
|
+
});
|
|
1616
|
+
container.appendChild(overlay);
|
|
1617
|
+
const tooltip = document.createElement("div");
|
|
1618
|
+
assign(tooltip, {
|
|
1619
|
+
position: "fixed",
|
|
1620
|
+
display: "none",
|
|
1621
|
+
zIndex: "2",
|
|
1622
|
+
maxWidth: `${TOOLTIP_MAX_W}px`,
|
|
1623
|
+
padding: "6px 6px 6px 10px",
|
|
1624
|
+
borderRadius: "6px",
|
|
1625
|
+
font: "12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
1626
|
+
color: "#fff",
|
|
1627
|
+
background: SECONDARY_SURFACE,
|
|
1628
|
+
border: SECONDARY_BORDER,
|
|
1629
|
+
boxShadow: BTN_SHADOW,
|
|
1630
|
+
pointerEvents: "none",
|
|
1631
|
+
alignItems: "flex-start",
|
|
1632
|
+
gap: "10px"
|
|
1633
|
+
});
|
|
1634
|
+
const tooltipCol = document.createElement("div");
|
|
1635
|
+
assign(tooltipCol, { display: "flex", flexDirection: "column", minWidth: "0" });
|
|
1636
|
+
const tooltipLabel = document.createElement("span");
|
|
1637
|
+
assign(tooltipLabel, { whiteSpace: "pre-line" });
|
|
1638
|
+
tooltipCol.appendChild(tooltipLabel);
|
|
1639
|
+
const tooltipDivider = document.createElement("div");
|
|
1640
|
+
assign(tooltipDivider, {
|
|
1641
|
+
display: "none",
|
|
1642
|
+
height: "1px",
|
|
1643
|
+
margin: "5px 0",
|
|
1644
|
+
alignSelf: "stretch",
|
|
1645
|
+
background: "rgba(255,255,255,0.14)"
|
|
1646
|
+
});
|
|
1647
|
+
tooltipCol.appendChild(tooltipDivider);
|
|
1648
|
+
const tooltipMetrics = document.createElement("span");
|
|
1649
|
+
assign(tooltipMetrics, {
|
|
1650
|
+
display: "none",
|
|
1651
|
+
whiteSpace: "pre-line",
|
|
1652
|
+
color: "#d4d4d8"
|
|
1653
|
+
});
|
|
1654
|
+
tooltipCol.appendChild(tooltipMetrics);
|
|
1655
|
+
tooltip.appendChild(tooltipCol);
|
|
1656
|
+
const dims = document.createElement("span");
|
|
1657
|
+
assign(dims, {
|
|
1658
|
+
marginLeft: "auto",
|
|
1659
|
+
flexShrink: "0",
|
|
1660
|
+
padding: "1px 5px",
|
|
1661
|
+
borderRadius: "4px",
|
|
1662
|
+
font: "600 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
1663
|
+
color: "#60a5fa",
|
|
1664
|
+
background: "rgba(59,130,246,0.15)",
|
|
1665
|
+
border: "1px solid rgba(59,130,246,0.3)",
|
|
1666
|
+
whiteSpace: "nowrap"
|
|
1667
|
+
});
|
|
1668
|
+
tooltip.appendChild(dims);
|
|
1669
|
+
container.appendChild(tooltip);
|
|
1670
|
+
return {
|
|
1671
|
+
container,
|
|
1672
|
+
overlay,
|
|
1673
|
+
tooltip,
|
|
1674
|
+
tooltipLabel,
|
|
1675
|
+
tooltipDivider,
|
|
1676
|
+
tooltipMetrics,
|
|
1677
|
+
dims,
|
|
1678
|
+
decorLayer,
|
|
1679
|
+
markerLayer
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// src/core/inspector/constants/layout.ts
|
|
1684
|
+
var PADDING_FILL = "#B8C480";
|
|
1685
|
+
var GAP_STRIPES = "repeating-linear-gradient(-45deg, rgba(127,32,210,0.8) 0, rgba(127,32,210,0.8) 1px, rgba(127,32,210,0.3) 1px, rgba(127,32,210,0.3) 10px)";
|
|
1686
|
+
var GAP_DASH = "rgba(127,32,210,0.8)";
|
|
1687
|
+
var MARGIN_FILL = "#B08355";
|
|
1688
|
+
|
|
1689
|
+
// src/core/inspector/surfaces/decorations.ts
|
|
1690
|
+
function clearDecorations(layer) {
|
|
1691
|
+
layer.textContent = "";
|
|
1692
|
+
}
|
|
1693
|
+
function fillRect(layer, x, y, w, h, color) {
|
|
1694
|
+
if (w <= 0 || h <= 0) return;
|
|
1695
|
+
const box = document.createElement("div");
|
|
1696
|
+
assign(box, {
|
|
1697
|
+
position: "fixed",
|
|
1698
|
+
top: `${y}px`,
|
|
1699
|
+
left: `${x}px`,
|
|
1700
|
+
width: `${w}px`,
|
|
1701
|
+
height: `${h}px`,
|
|
1702
|
+
background: color,
|
|
1703
|
+
pointerEvents: "none"
|
|
1704
|
+
});
|
|
1705
|
+
layer.appendChild(box);
|
|
1706
|
+
}
|
|
1707
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1708
|
+
function dashedRect(layer, x, y, w, h, color, radius) {
|
|
1709
|
+
if (w <= 0 || h <= 0) return;
|
|
1710
|
+
const svg = document.createElementNS(SVG_NS, "svg");
|
|
1711
|
+
svg.setAttribute("data-rp-dash", "");
|
|
1712
|
+
svg.setAttribute("width", `${w}`);
|
|
1713
|
+
svg.setAttribute("height", `${h}`);
|
|
1714
|
+
assign(svg, {
|
|
1715
|
+
position: "fixed",
|
|
1716
|
+
top: `${y}px`,
|
|
1717
|
+
left: `${x}px`,
|
|
1718
|
+
overflow: "visible",
|
|
1719
|
+
zIndex: "1",
|
|
1720
|
+
pointerEvents: "none"
|
|
1721
|
+
});
|
|
1722
|
+
const rect = document.createElementNS(SVG_NS, "rect");
|
|
1723
|
+
rect.setAttribute("x", "0.5");
|
|
1724
|
+
rect.setAttribute("y", "0.5");
|
|
1725
|
+
rect.setAttribute("width", `${Math.max(0, w - 1)}`);
|
|
1726
|
+
rect.setAttribute("height", `${Math.max(0, h - 1)}`);
|
|
1727
|
+
rect.setAttribute("rx", `${radius}`);
|
|
1728
|
+
rect.setAttribute("fill", "none");
|
|
1729
|
+
rect.setAttribute("stroke", color);
|
|
1730
|
+
rect.setAttribute("stroke-width", "1");
|
|
1731
|
+
rect.setAttribute("stroke-dasharray", "3 3");
|
|
1732
|
+
svg.appendChild(rect);
|
|
1733
|
+
layer.appendChild(svg);
|
|
1734
|
+
}
|
|
1735
|
+
function renderDecorations(layer, el, rect, { padding, gap, margin }, cs) {
|
|
1736
|
+
clearDecorations(layer);
|
|
1737
|
+
if (margin) {
|
|
1738
|
+
const mt = parseFloat(cs.marginTop) || 0;
|
|
1739
|
+
const mr = parseFloat(cs.marginRight) || 0;
|
|
1740
|
+
const mb = parseFloat(cs.marginBottom) || 0;
|
|
1741
|
+
const ml = parseFloat(cs.marginLeft) || 0;
|
|
1742
|
+
fillRect(layer, rect.left - ml, rect.top - mt, rect.width + ml + mr, mt, MARGIN_FILL);
|
|
1743
|
+
fillRect(layer, rect.left - ml, rect.bottom, rect.width + ml + mr, mb, MARGIN_FILL);
|
|
1744
|
+
fillRect(layer, rect.left - ml, rect.top, ml, rect.height, MARGIN_FILL);
|
|
1745
|
+
fillRect(layer, rect.right, rect.top, mr, rect.height, MARGIN_FILL);
|
|
1746
|
+
}
|
|
1747
|
+
if (padding) {
|
|
1748
|
+
const bt = parseFloat(cs.borderTopWidth) || 0;
|
|
1749
|
+
const br = parseFloat(cs.borderRightWidth) || 0;
|
|
1750
|
+
const bb = parseFloat(cs.borderBottomWidth) || 0;
|
|
1751
|
+
const bl = parseFloat(cs.borderLeftWidth) || 0;
|
|
1752
|
+
const pt = parseFloat(cs.paddingTop) || 0;
|
|
1753
|
+
const pr = parseFloat(cs.paddingRight) || 0;
|
|
1754
|
+
const pb = parseFloat(cs.paddingBottom) || 0;
|
|
1755
|
+
const pl = parseFloat(cs.paddingLeft) || 0;
|
|
1756
|
+
const ring = document.createElement("div");
|
|
1757
|
+
assign(ring, {
|
|
1758
|
+
position: "fixed",
|
|
1759
|
+
top: `${rect.top + bt}px`,
|
|
1760
|
+
left: `${rect.left + bl}px`,
|
|
1761
|
+
width: `${rect.width - bl - br}px`,
|
|
1762
|
+
height: `${rect.height - bt - bb}px`,
|
|
1763
|
+
borderStyle: "solid",
|
|
1764
|
+
borderColor: PADDING_FILL,
|
|
1765
|
+
borderWidth: `${pt}px ${pr}px ${pb}px ${pl}px`,
|
|
1766
|
+
borderRadius: OVERLAY_RADIUS,
|
|
1767
|
+
boxSizing: "border-box",
|
|
1768
|
+
background: "transparent",
|
|
1769
|
+
pointerEvents: "none"
|
|
1770
|
+
});
|
|
1771
|
+
layer.appendChild(ring);
|
|
1772
|
+
}
|
|
1773
|
+
if (gap && /flex|grid/.test(cs.display)) {
|
|
1774
|
+
const kids = [];
|
|
1775
|
+
for (const node of Array.from(el.childNodes)) {
|
|
1776
|
+
let r = null;
|
|
1777
|
+
if (node.nodeType === 1) {
|
|
1778
|
+
r = node.getBoundingClientRect();
|
|
1779
|
+
} else if (node.nodeType === 3 && node.textContent && node.textContent.trim()) {
|
|
1780
|
+
const range = document.createRange();
|
|
1781
|
+
range.selectNodeContents(node);
|
|
1782
|
+
r = range.getBoundingClientRect();
|
|
1783
|
+
}
|
|
1784
|
+
if (r && r.width > 0 && r.height > 0) kids.push(r);
|
|
1785
|
+
}
|
|
1786
|
+
const bt = parseFloat(cs.borderTopWidth) || 0;
|
|
1787
|
+
const br = parseFloat(cs.borderRightWidth) || 0;
|
|
1788
|
+
const bb = parseFloat(cs.borderBottomWidth) || 0;
|
|
1789
|
+
const bl = parseFloat(cs.borderLeftWidth) || 0;
|
|
1790
|
+
const ct = rect.top + bt + (parseFloat(cs.paddingTop) || 0);
|
|
1791
|
+
const cb = rect.bottom - bb - (parseFloat(cs.paddingBottom) || 0);
|
|
1792
|
+
const cl = rect.left + bl + (parseFloat(cs.paddingLeft) || 0);
|
|
1793
|
+
const cr = rect.right - br - (parseFloat(cs.paddingRight) || 0);
|
|
1794
|
+
const rowGap = parseFloat(cs.rowGap) || 0;
|
|
1795
|
+
const colGap = parseFloat(cs.columnGap) || 0;
|
|
1796
|
+
let drew = false;
|
|
1797
|
+
if (colGap > 0) {
|
|
1798
|
+
const byX = [...kids].sort((a, b) => a.left - b.left);
|
|
1799
|
+
for (let i = 0; i < byX.length - 1; i++) {
|
|
1800
|
+
const a = byX[i];
|
|
1801
|
+
const b = byX[i + 1];
|
|
1802
|
+
if (b.left >= a.right && a.bottom > b.top && b.bottom > a.top) {
|
|
1803
|
+
fillRect(layer, a.right, ct, b.left - a.right, cb - ct, GAP_STRIPES);
|
|
1804
|
+
drew = true;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
if (rowGap > 0) {
|
|
1809
|
+
const byY = [...kids].sort((a, b) => a.top - b.top);
|
|
1810
|
+
for (let i = 0; i < byY.length - 1; i++) {
|
|
1811
|
+
const a = byY[i];
|
|
1812
|
+
const b = byY[i + 1];
|
|
1813
|
+
if (b.top >= a.bottom && a.right > b.left && b.right > a.left) {
|
|
1814
|
+
fillRect(layer, cl, a.bottom, cr - cl, b.top - a.bottom, GAP_STRIPES);
|
|
1815
|
+
drew = true;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
const inset = cl !== rect.left || ct !== rect.top || cr !== rect.right || cb !== rect.bottom;
|
|
1820
|
+
const dashRadius = inset ? 0 : parseFloat(OVERLAY_RADIUS);
|
|
1821
|
+
if (drew) dashedRect(layer, cl, ct, cr - cl, cb - ct, GAP_DASH, dashRadius);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
// src/core/inspector/surfaces/tooltip.ts
|
|
1826
|
+
var TOOLTIP_MAX_W2 = 420;
|
|
1827
|
+
function isDisabled2(el) {
|
|
1828
|
+
try {
|
|
1829
|
+
return el.matches(':disabled,[disabled],[aria-disabled="true"]');
|
|
1830
|
+
} catch {
|
|
1831
|
+
return false;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
var px = (v) => parseFloat(v) || 0;
|
|
1835
|
+
function boxValue(t, r, b, l) {
|
|
1836
|
+
if (!t && !r && !b && !l) return null;
|
|
1837
|
+
if (t === r && r === b && b === l) return `${t}px`;
|
|
1838
|
+
if (t === b && l === r) return `${t}px ${r}px`;
|
|
1839
|
+
return `${t}px ${r}px ${b}px ${l}px`;
|
|
1840
|
+
}
|
|
1841
|
+
function dimsText(rect) {
|
|
1842
|
+
return `${Math.round(rect.width)}\xD7${Math.round(rect.height)}`;
|
|
1843
|
+
}
|
|
1844
|
+
function titleSuffixes(el, selection) {
|
|
1845
|
+
const parts = [];
|
|
1846
|
+
if (isDisabled2(el)) parts.push("disabled");
|
|
1847
|
+
const selIdx = selection.indexOf(el);
|
|
1848
|
+
if (selIdx >= 0) parts.push(`selected #${selIdx + 1}`);
|
|
1849
|
+
return parts;
|
|
1850
|
+
}
|
|
1851
|
+
function tooltipClassSummary(el) {
|
|
1852
|
+
const raw = el.getAttribute("class") || "";
|
|
1853
|
+
const tokens = raw.trim().length > 0 ? raw.trim().split(/\s+/) : [];
|
|
1854
|
+
if (tokens.length === 0) return "";
|
|
1855
|
+
const head = tokens.slice(0, 3).map((cls) => `.${cls}`).join("");
|
|
1856
|
+
return tokens.length > 3 ? `${head} (+${tokens.length - 3})` : head;
|
|
1857
|
+
}
|
|
1858
|
+
function tooltipTitle(el, selection) {
|
|
1859
|
+
const parts = [];
|
|
1860
|
+
const comp = componentChain(el).join(" > ") || componentInfo(el)?.component || tplLabel(el);
|
|
1861
|
+
if (comp) parts.push(comp);
|
|
1862
|
+
parts.push(...titleSuffixes(el, selection));
|
|
1863
|
+
return parts.join(" \xB7 ");
|
|
1864
|
+
}
|
|
1865
|
+
function tooltipMetricsFromStyle(el, cs) {
|
|
1866
|
+
const lines = [];
|
|
1867
|
+
const cls = tooltipClassSummary(el);
|
|
1868
|
+
if (cls) lines.push(cls + (el.id ? ` \xB7 #${el.id}` : ""));
|
|
1869
|
+
else if (el.id) lines.push(`#${el.id}`);
|
|
1870
|
+
const padding = boxValue(
|
|
1871
|
+
px(cs.paddingTop),
|
|
1872
|
+
px(cs.paddingRight),
|
|
1873
|
+
px(cs.paddingBottom),
|
|
1874
|
+
px(cs.paddingLeft)
|
|
1875
|
+
);
|
|
1876
|
+
if (padding) lines.push(`padding: ${padding}`);
|
|
1877
|
+
const rowGap = px(cs.rowGap);
|
|
1878
|
+
const colGap = px(cs.columnGap);
|
|
1879
|
+
if (/flex|grid/.test(cs.display) && (rowGap || colGap)) {
|
|
1880
|
+
lines.push(`gap: ${rowGap === colGap ? `${rowGap}px` : `${rowGap}px ${colGap}px`}`);
|
|
1881
|
+
}
|
|
1882
|
+
const margin = boxValue(
|
|
1883
|
+
px(cs.marginTop),
|
|
1884
|
+
px(cs.marginRight),
|
|
1885
|
+
px(cs.marginBottom),
|
|
1886
|
+
px(cs.marginLeft)
|
|
1887
|
+
);
|
|
1888
|
+
if (margin) lines.push(`margin: ${margin}`);
|
|
1889
|
+
return lines.join("\n");
|
|
1890
|
+
}
|
|
1891
|
+
function updateTooltip(tooltip, label, divider, metrics, dims, el, selection, rect, cs, titleOf = tooltipTitle) {
|
|
1892
|
+
const title = titleOf(el, selection);
|
|
1893
|
+
const metricsText = tooltipMetricsFromStyle(el, cs);
|
|
1894
|
+
label.textContent = title;
|
|
1895
|
+
label.style.display = title ? "block" : "none";
|
|
1896
|
+
metrics.textContent = metricsText;
|
|
1897
|
+
metrics.style.display = metricsText ? "block" : "none";
|
|
1898
|
+
divider.style.display = title && metricsText ? "block" : "none";
|
|
1899
|
+
dims.textContent = dimsText(rect);
|
|
1900
|
+
tooltip.style.display = "flex";
|
|
1901
|
+
const tipH = tooltip.offsetHeight;
|
|
1902
|
+
let top = rect.bottom + 8;
|
|
1903
|
+
if (top + tipH > window.innerHeight) top = rect.top - tipH - 8;
|
|
1904
|
+
let left = rect.left;
|
|
1905
|
+
if (left + TOOLTIP_MAX_W2 > window.innerWidth) {
|
|
1906
|
+
left = window.innerWidth - TOOLTIP_MAX_W2 - 10;
|
|
1907
|
+
}
|
|
1908
|
+
if (left < 4) left = 4;
|
|
1909
|
+
assign(tooltip, { top: `${top}px`, left: `${left}px` });
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
// src/core/inspector/surfaces/markers.ts
|
|
1913
|
+
function renderMarkers(layer, selection) {
|
|
1914
|
+
layer.textContent = "";
|
|
1915
|
+
selection.forEach((el, i) => {
|
|
1916
|
+
if (!el.isConnected) return;
|
|
1917
|
+
const rect = el.getBoundingClientRect();
|
|
1918
|
+
const marker = document.createElement("div");
|
|
1919
|
+
assign(marker, {
|
|
1920
|
+
position: "fixed",
|
|
1921
|
+
top: `${rect.top}px`,
|
|
1922
|
+
left: `${rect.left}px`,
|
|
1923
|
+
width: `${rect.width}px`,
|
|
1924
|
+
height: `${rect.height}px`,
|
|
1925
|
+
background: SELECTED_BG,
|
|
1926
|
+
border: HIGHLIGHT_BORDER,
|
|
1927
|
+
borderRadius: "4px",
|
|
1928
|
+
boxSizing: "border-box",
|
|
1929
|
+
pointerEvents: "none"
|
|
1930
|
+
});
|
|
1931
|
+
const badge = document.createElement("span");
|
|
1932
|
+
badge.textContent = String(i + 1);
|
|
1933
|
+
assign(badge, {
|
|
1934
|
+
position: "absolute",
|
|
1935
|
+
top: "-7px",
|
|
1936
|
+
left: "-7px",
|
|
1937
|
+
minWidth: "14px",
|
|
1938
|
+
height: "14px",
|
|
1939
|
+
padding: "0 3px",
|
|
1940
|
+
borderRadius: "7px",
|
|
1941
|
+
background: HIGHLIGHT_BORDER.split(" ").pop() ?? "#3b82f6",
|
|
1942
|
+
color: "#fff",
|
|
1943
|
+
font: "600 9px/14px ui-monospace, monospace",
|
|
1944
|
+
textAlign: "center",
|
|
1945
|
+
boxSizing: "border-box"
|
|
1946
|
+
});
|
|
1947
|
+
marker.appendChild(badge);
|
|
1948
|
+
const dimsBadge = document.createElement("span");
|
|
1949
|
+
dimsBadge.textContent = dimsText(rect);
|
|
1950
|
+
assign(dimsBadge, {
|
|
1951
|
+
position: "absolute",
|
|
1952
|
+
top: "-20px",
|
|
1953
|
+
right: "0",
|
|
1954
|
+
padding: "1px 5px",
|
|
1955
|
+
borderRadius: "4px",
|
|
1956
|
+
font: "600 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
1957
|
+
color: "#fff",
|
|
1958
|
+
background: SOLID_BG,
|
|
1959
|
+
border: PANEL_BORDER,
|
|
1960
|
+
boxShadow: TOOLTIP_SHADOW,
|
|
1961
|
+
whiteSpace: "nowrap",
|
|
1962
|
+
boxSizing: "border-box"
|
|
1963
|
+
});
|
|
1964
|
+
marker.appendChild(dimsBadge);
|
|
1965
|
+
layer.appendChild(marker);
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
// src/core/inspector/surfaces/overlay.ts
|
|
1970
|
+
function positionOverlay(overlay, rect, animate = true) {
|
|
1971
|
+
if (!animate) overlay.style.transition = "none";
|
|
1972
|
+
assign(overlay, {
|
|
1973
|
+
opacity: "1",
|
|
1974
|
+
top: `${rect.top}px`,
|
|
1975
|
+
left: `${rect.left}px`,
|
|
1976
|
+
width: `${rect.width}px`,
|
|
1977
|
+
height: `${rect.height}px`
|
|
1978
|
+
});
|
|
1979
|
+
if (!animate) {
|
|
1980
|
+
void overlay.offsetWidth;
|
|
1981
|
+
overlay.style.transition = OVERLAY_GLIDE;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
function hideHover(overlay, tooltip) {
|
|
1985
|
+
overlay.style.opacity = "0";
|
|
1986
|
+
tooltip.style.display = "none";
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
// src/core/inspector/inspector.ts
|
|
1990
|
+
var Inspector = class {
|
|
1991
|
+
constructor(callbacks) {
|
|
1992
|
+
this.callbacks = callbacks;
|
|
1993
|
+
this.active = false;
|
|
1994
|
+
this.styleEl = null;
|
|
1995
|
+
this.surfaces = null;
|
|
1996
|
+
this.lastTarget = null;
|
|
1997
|
+
this.selection = [];
|
|
1998
|
+
this.observer = null;
|
|
1999
|
+
this.hovering = false;
|
|
2000
|
+
/**
|
|
2001
|
+
* Dernier rect affiché par l'overlay. `refreshHover` ne repositionne que s'il a
|
|
2002
|
+
* bougé : la notification initiale d'un `ResizeObserver` (à chaque `observe()`
|
|
2003
|
+
* d'une nouvelle cible) couperait sinon la glisse en cours.
|
|
2004
|
+
*/
|
|
2005
|
+
this.hoverRect = null;
|
|
2006
|
+
/** rAF en attente du repositionnement du survol (scroll/resize coalescés par frame). */
|
|
2007
|
+
this.frame = 0;
|
|
2008
|
+
/** rAF en attente du traitement mousemove (coalescé par frame, indépendant de `frame`
|
|
2009
|
+
* ci-dessus — déclenchement différent, peuvent être en vol simultanément). */
|
|
2010
|
+
this.moveFrame = 0;
|
|
2011
|
+
/** Dernière position mousemove reçue, traitée une fois par frame. */
|
|
2012
|
+
this.pendingMove = null;
|
|
2013
|
+
/** Mode recherche actif : pas de rect de survol (les rects de recherche prennent le relais). */
|
|
2014
|
+
this.searchMode = false;
|
|
2015
|
+
/** Matcher de la commande clavier « inspect » (modificateur + touche, simple/double-tap). */
|
|
2016
|
+
this.inspectMatcher = createKeyCommandMatcher();
|
|
2017
|
+
/** Coalesce le traitement mousemove à une fois par frame (jusqu'à 60-120 events/s
|
|
2018
|
+
* natifs sinon, chacun forçant un hit-test complet — voir `processMouseMove`). */
|
|
2019
|
+
this.onMouseMove = (e) => {
|
|
2020
|
+
this.pendingMove = { x: e.clientX, y: e.clientY };
|
|
2021
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
2022
|
+
this.processMouseMove();
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
if (this.moveFrame) return;
|
|
2026
|
+
this.moveFrame = requestAnimationFrame(() => {
|
|
2027
|
+
this.moveFrame = 0;
|
|
2028
|
+
this.processMouseMove();
|
|
2029
|
+
});
|
|
2030
|
+
};
|
|
2031
|
+
this.onPress = (e) => {
|
|
2032
|
+
if (this.searchMode) return;
|
|
2033
|
+
if (CONTEXT_MENU_OPEN.value) return;
|
|
2034
|
+
const me = e;
|
|
2035
|
+
if (shouldIgnore(e.target)) return;
|
|
2036
|
+
const target = this.pickTargetAt(me.clientX, me.clientY);
|
|
2037
|
+
if (!target) return;
|
|
2038
|
+
e.preventDefault();
|
|
2039
|
+
e.stopPropagation();
|
|
2040
|
+
e.stopImmediatePropagation();
|
|
2041
|
+
const kind = this.kindOf(e, me);
|
|
2042
|
+
if (!kind) return;
|
|
2043
|
+
const cmds = this.commands();
|
|
2044
|
+
const isMulti = this.multi && gestureMatches(cmds.multi, me, kind);
|
|
2045
|
+
const isCopyHtml = gestureMatches(cmds.copyHtml, me, kind);
|
|
2046
|
+
const isCopy = cmds.copy.modifier === "none" && cmds.copy.trigger === "click" ? kind === "click" && !isMulti && !isCopyHtml : gestureMatches(cmds.copy, me, kind);
|
|
2047
|
+
if (this.multi && (isMulti || this.selection.length > 0 && isCopy)) {
|
|
2048
|
+
this.toggleSelection(target);
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
if (isCopy) {
|
|
2052
|
+
if (isTreeSelectMode()) {
|
|
2053
|
+
this.swallowTrailingPress();
|
|
2054
|
+
requestSelect(target);
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
const result = this.buildResult(target);
|
|
2058
|
+
this.deactivate();
|
|
2059
|
+
this.swallowTrailingPress();
|
|
2060
|
+
this.callbacks.onPick(result);
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
if (isCopyHtml) {
|
|
2064
|
+
if (isTreeSelectMode()) {
|
|
2065
|
+
requestContextMenu(target, me.clientX, me.clientY);
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2068
|
+
if (target !== this.lastTarget) {
|
|
2069
|
+
this.lastTarget = target;
|
|
2070
|
+
this.showHover(target, target.getBoundingClientRect(), false);
|
|
2071
|
+
this.syncObserver();
|
|
2072
|
+
}
|
|
2073
|
+
this.callbacks.onContextMenu?.(target, { x: me.clientX, y: me.clientY });
|
|
2074
|
+
}
|
|
2075
|
+
};
|
|
2076
|
+
this.onKeyDown = (e) => {
|
|
2077
|
+
const cmds = this.commands();
|
|
2078
|
+
const inspectStatus = this.callbacks.onInspect ? this.inspectMatcher.status(e, cmds.inspect) : null;
|
|
2079
|
+
if (inspectStatus === "wait") {
|
|
2080
|
+
e.preventDefault();
|
|
2081
|
+
e.stopPropagation();
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
if (inspectStatus === "fire" && this.callbacks.onInspect && this.lastTarget && this.lastTarget.isConnected) {
|
|
2085
|
+
e.preventDefault();
|
|
2086
|
+
e.stopPropagation();
|
|
2087
|
+
this.callbacks.onInspect(this.lastTarget);
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
if (keyMatches(cmds.confirm, e.key) && this.multi && this.selection.length > 0) {
|
|
2091
|
+
e.preventDefault();
|
|
2092
|
+
e.stopPropagation();
|
|
2093
|
+
this.finishMulti();
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
if (keyMatches(cmds.cancel, e.key)) {
|
|
2097
|
+
e.preventDefault();
|
|
2098
|
+
e.stopPropagation();
|
|
2099
|
+
this.deactivate();
|
|
2100
|
+
this.callbacks.onCancel();
|
|
2101
|
+
}
|
|
2102
|
+
};
|
|
2103
|
+
// Ne touche QUE les markers de sélection : les `transitionend`/`animationend`
|
|
2104
|
+
// d'une page animée réinitialiseraient en boucle la transition de l'overlay
|
|
2105
|
+
// → pas de glisse. Le survol suit scroll/resize via `onViewportChange`.
|
|
2106
|
+
this.refreshAll = () => {
|
|
2107
|
+
if (!this.active) return;
|
|
2108
|
+
this.renderSelection();
|
|
2109
|
+
};
|
|
2110
|
+
/** Scroll (fenêtre ou sous-conteneur, capture) / resize : markers + survol recollé à l'élément. */
|
|
2111
|
+
this.onViewportChange = () => {
|
|
2112
|
+
if (!this.active) return;
|
|
2113
|
+
this.refreshAll();
|
|
2114
|
+
this.scheduleHover();
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
get multi() {
|
|
2118
|
+
return this.callbacks.multi !== false && typeof this.callbacks.onPickMany === "function";
|
|
2119
|
+
}
|
|
2120
|
+
activate() {
|
|
2121
|
+
if (this.active || typeof document === "undefined") return;
|
|
2122
|
+
this.active = true;
|
|
2123
|
+
PICKER_ARMED.value = true;
|
|
2124
|
+
this.styleEl = document.createElement("style");
|
|
2125
|
+
this.styleEl.setAttribute(IGNORE_ATTR, "");
|
|
2126
|
+
this.styleEl.textContent = PICKING_CSS;
|
|
2127
|
+
document.head.appendChild(this.styleEl);
|
|
2128
|
+
this.surfaces = createSurfaces();
|
|
2129
|
+
document.body.appendChild(this.surfaces.container);
|
|
2130
|
+
document.body.style.cursor = "crosshair";
|
|
2131
|
+
window.addEventListener("mousemove", this.onMouseMove, true);
|
|
2132
|
+
for (const type of PRESS_EVENTS) {
|
|
2133
|
+
window.addEventListener(type, this.onPress, true);
|
|
2134
|
+
}
|
|
2135
|
+
window.addEventListener("keydown", this.onKeyDown, true);
|
|
2136
|
+
window.addEventListener("scroll", this.onViewportChange, true);
|
|
2137
|
+
window.addEventListener("resize", this.onViewportChange);
|
|
2138
|
+
window.addEventListener("transitionend", this.refreshAll, true);
|
|
2139
|
+
window.addEventListener("animationend", this.refreshAll, true);
|
|
2140
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
2141
|
+
this.observer = new ResizeObserver(() => this.onViewportChange());
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
deactivate() {
|
|
2145
|
+
if (!this.active) return;
|
|
2146
|
+
this.active = false;
|
|
2147
|
+
PICKER_ARMED.value = false;
|
|
2148
|
+
this.lastTarget = null;
|
|
2149
|
+
this.hoverRect = null;
|
|
2150
|
+
this.selection = [];
|
|
2151
|
+
this.inspectMatcher.reset();
|
|
2152
|
+
if (typeof document !== "undefined") document.body.style.cursor = "";
|
|
2153
|
+
window.removeEventListener("mousemove", this.onMouseMove, true);
|
|
2154
|
+
for (const type of PRESS_EVENTS) {
|
|
2155
|
+
window.removeEventListener(type, this.onPress, true);
|
|
2156
|
+
}
|
|
2157
|
+
window.removeEventListener("keydown", this.onKeyDown, true);
|
|
2158
|
+
window.removeEventListener("scroll", this.onViewportChange, true);
|
|
2159
|
+
window.removeEventListener("resize", this.onViewportChange);
|
|
2160
|
+
window.removeEventListener("transitionend", this.refreshAll, true);
|
|
2161
|
+
window.removeEventListener("animationend", this.refreshAll, true);
|
|
2162
|
+
if (this.frame && typeof cancelAnimationFrame === "function") {
|
|
2163
|
+
cancelAnimationFrame(this.frame);
|
|
2164
|
+
}
|
|
2165
|
+
this.frame = 0;
|
|
2166
|
+
if (this.moveFrame && typeof cancelAnimationFrame === "function") {
|
|
2167
|
+
cancelAnimationFrame(this.moveFrame);
|
|
2168
|
+
}
|
|
2169
|
+
this.moveFrame = 0;
|
|
2170
|
+
this.pendingMove = null;
|
|
2171
|
+
this.observer?.disconnect();
|
|
2172
|
+
this.observer = null;
|
|
2173
|
+
this.styleEl?.remove();
|
|
2174
|
+
this.surfaces?.container.remove();
|
|
2175
|
+
this.styleEl = null;
|
|
2176
|
+
this.surfaces = null;
|
|
2177
|
+
}
|
|
2178
|
+
// --- Rendu (délègue à surfaces) ------------------------------------------
|
|
2179
|
+
hideHover() {
|
|
2180
|
+
this.hovering = false;
|
|
2181
|
+
this.hoverRect = null;
|
|
2182
|
+
if (!this.surfaces) return;
|
|
2183
|
+
hideHover(this.surfaces.overlay, this.surfaces.tooltip);
|
|
2184
|
+
clearDecorations(this.surfaces.decorLayer);
|
|
2185
|
+
}
|
|
2186
|
+
showHover(el, rect, animate = true) {
|
|
2187
|
+
if (!this.surfaces) return;
|
|
2188
|
+
positionOverlay(this.surfaces.overlay, rect, animate);
|
|
2189
|
+
const cs = getComputedStyle(el);
|
|
2190
|
+
updateTooltip(
|
|
2191
|
+
this.surfaces.tooltip,
|
|
2192
|
+
this.surfaces.tooltipLabel,
|
|
2193
|
+
this.surfaces.tooltipDivider,
|
|
2194
|
+
this.surfaces.tooltipMetrics,
|
|
2195
|
+
this.surfaces.dims,
|
|
2196
|
+
el,
|
|
2197
|
+
this.selection,
|
|
2198
|
+
rect,
|
|
2199
|
+
cs,
|
|
2200
|
+
this.callbacks.getTitle
|
|
2201
|
+
);
|
|
2202
|
+
this.renderDecor(el, rect, cs);
|
|
2203
|
+
this.hovering = true;
|
|
2204
|
+
this.hoverRect = { top: rect.top, left: rect.left, width: rect.width, height: rect.height };
|
|
2205
|
+
}
|
|
2206
|
+
/** Dessine (ou efface) les décorations layout selon `getOverlays`. `cs` : réutilisé s'il
|
|
2207
|
+
* vient d'être calculé par l'appelant (`showHover`), sinon recalculé (`refreshDecorations`,
|
|
2208
|
+
* toggle sans survol). */
|
|
2209
|
+
renderDecor(el, rect, cs) {
|
|
2210
|
+
if (!this.surfaces) return;
|
|
2211
|
+
const overlays = this.callbacks.getOverlays?.();
|
|
2212
|
+
if (overlays && (overlays.padding || overlays.gap || overlays.margin)) {
|
|
2213
|
+
renderDecorations(this.surfaces.decorLayer, el, rect, overlays, cs ?? getComputedStyle(el));
|
|
2214
|
+
} else {
|
|
2215
|
+
clearDecorations(this.surfaces.decorLayer);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
/** Re-render des décorations sur l'élément survolé (toggle sans mousemove). */
|
|
2219
|
+
refreshDecorations() {
|
|
2220
|
+
if (!this.active || !this.surfaces) return;
|
|
2221
|
+
if (this.lastTarget && this.lastTarget.isConnected) {
|
|
2222
|
+
this.renderDecor(this.lastTarget, this.lastTarget.getBoundingClientRect());
|
|
2223
|
+
} else {
|
|
2224
|
+
clearDecorations(this.surfaces.decorLayer);
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
renderSelection() {
|
|
2228
|
+
if (this.surfaces) renderMarkers(this.surfaces.markerLayer, this.selection);
|
|
2229
|
+
}
|
|
2230
|
+
pickTargetAt(x, y) {
|
|
2231
|
+
if (this.lastTarget && this.lastTarget.isConnected && containsPoint(this.lastTarget, x, y)) {
|
|
2232
|
+
return this.lastTarget;
|
|
2233
|
+
}
|
|
2234
|
+
return resolveTarget(x, y);
|
|
2235
|
+
}
|
|
2236
|
+
syncObserver() {
|
|
2237
|
+
if (!this.observer) return;
|
|
2238
|
+
this.observer.disconnect();
|
|
2239
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2240
|
+
const watch = (el) => {
|
|
2241
|
+
if (el && el.isConnected && !seen.has(el)) {
|
|
2242
|
+
seen.add(el);
|
|
2243
|
+
this.observer.observe(el);
|
|
2244
|
+
}
|
|
2245
|
+
};
|
|
2246
|
+
watch(this.lastTarget);
|
|
2247
|
+
for (const el of this.selection) watch(el);
|
|
2248
|
+
}
|
|
2249
|
+
// --- Mutations de sélection ----------------------------------------------
|
|
2250
|
+
afterSelectionChange() {
|
|
2251
|
+
this.syncObserver();
|
|
2252
|
+
this.renderSelection();
|
|
2253
|
+
this.callbacks.onSelectionChange?.(this.selection.length);
|
|
2254
|
+
if (this.lastTarget && this.lastTarget.isConnected) {
|
|
2255
|
+
this.showHover(
|
|
2256
|
+
this.lastTarget,
|
|
2257
|
+
this.lastTarget.getBoundingClientRect(),
|
|
2258
|
+
false
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
toggleSelection(el) {
|
|
2263
|
+
const idx = this.selection.indexOf(el);
|
|
2264
|
+
if (idx >= 0) this.selection.splice(idx, 1);
|
|
2265
|
+
else this.selection.push(el);
|
|
2266
|
+
this.afterSelectionChange();
|
|
2267
|
+
}
|
|
2268
|
+
// --- Résultat -------------------------------------------------------------
|
|
2269
|
+
buildResult(el) {
|
|
2270
|
+
const annotated = el.closest("[data-source]");
|
|
2271
|
+
const chain = el instanceof HTMLElement ? componentChain(el) : [];
|
|
2272
|
+
return {
|
|
2273
|
+
route: this.callbacks.getRoute(),
|
|
2274
|
+
xpath: getXPath(el),
|
|
2275
|
+
cssSelector: getCssSelector(el),
|
|
2276
|
+
text: elementText(el),
|
|
2277
|
+
tagName: el.tagName.toLowerCase(),
|
|
2278
|
+
id: el.id || null,
|
|
2279
|
+
reactComponent: chain.length > 0 ? chain.join(" > ") : el.closest("[data-component]")?.getAttribute("data-component") ?? null,
|
|
2280
|
+
reactSource: annotated?.getAttribute("data-source") ?? null
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
finishMulti() {
|
|
2284
|
+
const results = this.selection.filter((el) => el.isConnected).map((el) => this.buildResult(el));
|
|
2285
|
+
this.deactivate();
|
|
2286
|
+
this.callbacks.onPickMany?.(results);
|
|
2287
|
+
}
|
|
2288
|
+
/** Avale les events résiduels (pointerup/click) après un pick consommé. */
|
|
2289
|
+
swallowTrailingPress() {
|
|
2290
|
+
const swallow = (e) => {
|
|
2291
|
+
e.preventDefault();
|
|
2292
|
+
e.stopPropagation();
|
|
2293
|
+
e.stopImmediatePropagation();
|
|
2294
|
+
};
|
|
2295
|
+
const cleanup = () => {
|
|
2296
|
+
for (const type of PRESS_EVENTS) {
|
|
2297
|
+
window.removeEventListener(type, swallow, true);
|
|
2298
|
+
}
|
|
2299
|
+
window.removeEventListener("click", cleanup, true);
|
|
2300
|
+
};
|
|
2301
|
+
for (const type of PRESS_EVENTS) {
|
|
2302
|
+
window.addEventListener(type, swallow, true);
|
|
2303
|
+
}
|
|
2304
|
+
window.addEventListener("click", cleanup, true);
|
|
2305
|
+
setTimeout(cleanup, SWALLOW_MS);
|
|
2306
|
+
}
|
|
2307
|
+
// --- Handlers (arrow = identité stable pour add/remove) -------------------
|
|
2308
|
+
/** Active/désactive le mode recherche : fige le rect de survol de l'inspecteur. */
|
|
2309
|
+
setSearchMode(on) {
|
|
2310
|
+
this.searchMode = on;
|
|
2311
|
+
if (on) this.hideHover();
|
|
2312
|
+
}
|
|
2313
|
+
processMouseMove() {
|
|
2314
|
+
const pending = this.pendingMove;
|
|
2315
|
+
if (!pending) return;
|
|
2316
|
+
const { x, y } = pending;
|
|
2317
|
+
if (this.searchMode) {
|
|
2318
|
+
this.lastTarget = null;
|
|
2319
|
+
this.hideHover();
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
if (CONTEXT_MENU_OPEN.value) return;
|
|
2323
|
+
const target = this.lastTarget && this.lastTarget.isConnected && document.elementFromPoint(x, y) === this.lastTarget ? this.lastTarget : resolveTarget(x, y);
|
|
2324
|
+
if (!target || shouldIgnore(target)) {
|
|
2325
|
+
this.lastTarget = null;
|
|
2326
|
+
this.hideHover();
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2329
|
+
if (target === this.lastTarget) return;
|
|
2330
|
+
this.lastTarget = target;
|
|
2331
|
+
this.callbacks.onHover?.(target);
|
|
2332
|
+
const rect = target.getBoundingClientRect();
|
|
2333
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
2334
|
+
this.hideHover();
|
|
2335
|
+
} else {
|
|
2336
|
+
this.showHover(target, rect, this.hovering);
|
|
2337
|
+
}
|
|
2338
|
+
this.syncObserver();
|
|
2339
|
+
}
|
|
2340
|
+
commands() {
|
|
2341
|
+
return this.callbacks.getCommands?.() ?? DEFAULT_SETTINGS.commands;
|
|
2342
|
+
}
|
|
2343
|
+
/** Type de clic de cet event (ou `null` : avalé mais sans action). */
|
|
2344
|
+
kindOf(e, me) {
|
|
2345
|
+
if (e.type === DOWN_TYPE && me.button === 0) return "click";
|
|
2346
|
+
if (e.type === "contextmenu") return "rightclick";
|
|
2347
|
+
if (e.type === "dblclick") return "dblclick";
|
|
2348
|
+
return null;
|
|
2349
|
+
}
|
|
2350
|
+
/** Snapshot de la sélection multiple (Maj+clics). */
|
|
2351
|
+
getSelection() {
|
|
2352
|
+
return [...this.selection];
|
|
2353
|
+
}
|
|
2354
|
+
/** Coalesce les repositionnements du survol à une fois par frame. */
|
|
2355
|
+
scheduleHover() {
|
|
2356
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
2357
|
+
this.refreshHover();
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
if (this.frame) return;
|
|
2361
|
+
this.frame = requestAnimationFrame(() => {
|
|
2362
|
+
this.frame = 0;
|
|
2363
|
+
this.refreshHover();
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
/** Repositionne instantanément (sans glisse) le survol sur `lastTarget`. */
|
|
2367
|
+
refreshHover() {
|
|
2368
|
+
if (!this.active || !this.hovering || this.searchMode || !this.lastTarget) return;
|
|
2369
|
+
if (!this.lastTarget.isConnected) {
|
|
2370
|
+
this.lastTarget = null;
|
|
2371
|
+
this.hideHover();
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
const rect = this.lastTarget.getBoundingClientRect();
|
|
2375
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
2376
|
+
this.hideHover();
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
const prev = this.hoverRect;
|
|
2380
|
+
if (prev && prev.top === rect.top && prev.left === rect.left && prev.width === rect.width && prev.height === rect.height) {
|
|
2381
|
+
return;
|
|
2382
|
+
}
|
|
2383
|
+
this.showHover(this.lastTarget, rect, false);
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
function createInspector(callbacks) {
|
|
2387
|
+
const inspector = new Inspector(callbacks);
|
|
2388
|
+
return {
|
|
2389
|
+
activate: () => inspector.activate(),
|
|
2390
|
+
deactivate: () => inspector.deactivate(),
|
|
2391
|
+
refreshDecorations: () => inspector.refreshDecorations(),
|
|
2392
|
+
setSearchMode: (on) => inspector.setSearchMode(on),
|
|
2393
|
+
getSelection: () => inspector.getSelection()
|
|
2394
|
+
};
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
// src/client.ts
|
|
2398
|
+
var DEFAULT_ANNOTATE_DELAY_MS = 2e3;
|
|
2399
|
+
function defaultEnabled() {
|
|
2400
|
+
try {
|
|
2401
|
+
return process.env.NODE_ENV !== "production";
|
|
2402
|
+
} catch {
|
|
2403
|
+
return false;
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
function defaultProjectRoot() {
|
|
2407
|
+
try {
|
|
2408
|
+
if (process.env.NEXT_PUBLIC_PROJECT_ROOT) return process.env.NEXT_PUBLIC_PROJECT_ROOT;
|
|
2409
|
+
} catch {
|
|
2410
|
+
}
|
|
2411
|
+
if (typeof document !== "undefined") {
|
|
2412
|
+
const meta = document.querySelector('meta[name="render-picker-root"]');
|
|
2413
|
+
return meta?.getAttribute("content") ?? void 0;
|
|
2414
|
+
}
|
|
2415
|
+
return void 0;
|
|
2416
|
+
}
|
|
2417
|
+
function initRenderPicker(options = {}) {
|
|
2418
|
+
const {
|
|
2419
|
+
enabled = defaultEnabled(),
|
|
2420
|
+
projectRoot = defaultProjectRoot(),
|
|
2421
|
+
source = "react",
|
|
2422
|
+
clickToSource = true,
|
|
2423
|
+
annotate: annotate2 = true,
|
|
2424
|
+
hushConsole = true
|
|
2425
|
+
} = options;
|
|
2426
|
+
if (!enabled || typeof window === "undefined") return () => {
|
|
2427
|
+
};
|
|
2428
|
+
const cleanups = [];
|
|
2429
|
+
document.documentElement.setAttribute(NPM_MARKER_ATTR, "npm");
|
|
2430
|
+
cleanups.push(() => document.documentElement.removeAttribute(NPM_MARKER_ATTR));
|
|
2431
|
+
cleanups.push(startCapture());
|
|
2432
|
+
cleanups.push(initSettingsRefresh());
|
|
2433
|
+
if (hushConsole) {
|
|
2434
|
+
cleanups.push(
|
|
2435
|
+
hushConsoleNoise(hushConsole === true ? DEFAULT_HUSH_RULES : hushConsole)
|
|
2436
|
+
);
|
|
2437
|
+
}
|
|
2438
|
+
if (clickToSource) cleanups.push(initClickToSource(projectRoot));
|
|
2439
|
+
if (annotate2) {
|
|
2440
|
+
if (source === "prestashop") {
|
|
2441
|
+
cleanups.push(initTplAnnotator());
|
|
2442
|
+
} else {
|
|
2443
|
+
const delayMs = typeof annotate2 === "object" && annotate2.delayMs !== void 0 ? annotate2.delayMs : DEFAULT_ANNOTATE_DELAY_MS;
|
|
2444
|
+
let stopAnnotator = null;
|
|
2445
|
+
const timer = setTimeout(() => {
|
|
2446
|
+
stopAnnotator = initComponentAnnotator();
|
|
2447
|
+
}, delayMs);
|
|
2448
|
+
cleanups.push(() => {
|
|
2449
|
+
clearTimeout(timer);
|
|
2450
|
+
stopAnnotator?.();
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
return () => {
|
|
2455
|
+
for (const cleanup of cleanups.reverse()) cleanup();
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2459
|
+
0 && (module.exports = {
|
|
2460
|
+
ACCENT,
|
|
2461
|
+
DEFAULT_HUSH_RULES,
|
|
2462
|
+
DEFAULT_SETTINGS,
|
|
2463
|
+
EDITORS,
|
|
2464
|
+
PANEL_BORDER,
|
|
2465
|
+
SOLID_BG,
|
|
2466
|
+
TOOLTIP_SHADOW,
|
|
2467
|
+
annotate,
|
|
2468
|
+
annotateFromComments,
|
|
2469
|
+
annotateTree,
|
|
2470
|
+
buildEditorUri,
|
|
2471
|
+
buildVscodeUri,
|
|
2472
|
+
componentInfo,
|
|
2473
|
+
createInspector,
|
|
2474
|
+
enrichResult,
|
|
2475
|
+
fetchSettings,
|
|
2476
|
+
findPickedElement,
|
|
2477
|
+
getCssSelector,
|
|
2478
|
+
getXPath,
|
|
2479
|
+
hushConsoleNoise,
|
|
2480
|
+
initClickToSource,
|
|
2481
|
+
initComponentAnnotator,
|
|
2482
|
+
initRenderPicker,
|
|
2483
|
+
initSettingsRefresh,
|
|
2484
|
+
initTplAnnotator,
|
|
2485
|
+
loadSettings,
|
|
2486
|
+
normalizeSourcePath,
|
|
2487
|
+
parseTplMarker,
|
|
2488
|
+
pickResultFromElement,
|
|
2489
|
+
refreshSettings,
|
|
2490
|
+
resolvePosition,
|
|
2491
|
+
saveSettings,
|
|
2492
|
+
searchElements,
|
|
2493
|
+
settingsDelta,
|
|
2494
|
+
toSelector
|
|
2495
|
+
});
|
|
2496
|
+
//# sourceMappingURL=client.cjs.map
|