@githumbi/grabby 0.2.1 → 0.3.0
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/dist/angular/index.d.ts +2 -0
- package/dist/angular/index.js +536 -354
- package/dist/angular/index.js.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/core/index.cjs +683 -501
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +536 -354
- package/dist/core/index.js.map +1 -1
- package/dist/grabby.global.js +101 -96
- package/dist/live/index.d.cts +1 -1
- package/dist/live/index.d.ts +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +536 -354
- package/dist/react/index.js.map +1 -1
- package/dist/{types-CMgpkvBz.d.cts → types-DjpIHekd.d.cts} +2 -0
- package/dist/{types-CMgpkvBz.d.ts → types-DjpIHekd.d.ts} +2 -0
- package/package.json +4 -4
package/dist/core/index.cjs
CHANGED
|
@@ -142,12 +142,378 @@ function disposeUiRoot() {
|
|
|
142
142
|
root = null;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
// src/core/capture/kind.ts
|
|
146
|
+
var ACTION_TAGS = /* @__PURE__ */ new Set(["BUTTON", "A", "SUMMARY"]);
|
|
147
|
+
var ACTION_ROLES = /* @__PURE__ */ new Set(["button", "link", "tab", "menuitem", "menuitemcheckbox", "menuitemradio", "switch", "option", "checkbox", "radio"]);
|
|
148
|
+
var BUTTON_INPUT_TYPES = /* @__PURE__ */ new Set(["button", "submit", "reset", "image"]);
|
|
149
|
+
var FIELD_TAGS = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
150
|
+
var FIELD_ROLES = /* @__PURE__ */ new Set(["textbox", "combobox", "searchbox", "spinbutton", "slider"]);
|
|
151
|
+
var MEDIA_TAGS = /* @__PURE__ */ new Set(["IMG", "SVG", "VIDEO", "PICTURE", "CANVAS", "IFRAME", "AUDIO"]);
|
|
152
|
+
var TEXT_TAGS = /* @__PURE__ */ new Set([
|
|
153
|
+
"H1",
|
|
154
|
+
"H2",
|
|
155
|
+
"H3",
|
|
156
|
+
"H4",
|
|
157
|
+
"H5",
|
|
158
|
+
"H6",
|
|
159
|
+
"P",
|
|
160
|
+
"SPAN",
|
|
161
|
+
"LABEL",
|
|
162
|
+
"LI",
|
|
163
|
+
"STRONG",
|
|
164
|
+
"EM",
|
|
165
|
+
"B",
|
|
166
|
+
"I",
|
|
167
|
+
"SMALL",
|
|
168
|
+
"BLOCKQUOTE",
|
|
169
|
+
"CODE",
|
|
170
|
+
"PRE",
|
|
171
|
+
"TD",
|
|
172
|
+
"TH",
|
|
173
|
+
"DT",
|
|
174
|
+
"DD",
|
|
175
|
+
"FIGCAPTION",
|
|
176
|
+
"LEGEND",
|
|
177
|
+
"CAPTION",
|
|
178
|
+
"Q",
|
|
179
|
+
"CITE",
|
|
180
|
+
"MARK",
|
|
181
|
+
"TIME"
|
|
182
|
+
]);
|
|
183
|
+
var PAGE_TAGS = /* @__PURE__ */ new Set(["HTML", "BODY", "MAIN"]);
|
|
184
|
+
var LANDMARK_TAGS = /* @__PURE__ */ new Set(["HEADER", "FOOTER", "NAV", "ASIDE"]);
|
|
185
|
+
var SECTION_AREA_RATIO = 0.6;
|
|
186
|
+
function role(el) {
|
|
187
|
+
return (_nullishCoalesce(el.getAttribute("role"), () => ( ""))).toLowerCase();
|
|
188
|
+
}
|
|
189
|
+
function isAction(el) {
|
|
190
|
+
if (ACTION_TAGS.has(el.tagName)) return el.tagName !== "A" || el.hasAttribute("href") || el.hasAttribute("role");
|
|
191
|
+
if (el.tagName === "INPUT" && BUTTON_INPUT_TYPES.has(el.type)) return true;
|
|
192
|
+
return ACTION_ROLES.has(role(el));
|
|
193
|
+
}
|
|
194
|
+
function isField(el) {
|
|
195
|
+
if (el.tagName === "INPUT") return !BUTTON_INPUT_TYPES.has(el.type);
|
|
196
|
+
if (FIELD_TAGS.has(el.tagName)) return true;
|
|
197
|
+
if (el.isContentEditable && el.getAttribute("contenteditable") !== null) return true;
|
|
198
|
+
return FIELD_ROLES.has(role(el));
|
|
199
|
+
}
|
|
200
|
+
function coversViewport(el) {
|
|
201
|
+
const rect = el.getBoundingClientRect();
|
|
202
|
+
const vw = window.innerWidth || document.documentElement.clientWidth;
|
|
203
|
+
const vh = window.innerHeight || document.documentElement.clientHeight;
|
|
204
|
+
if (!vw || !vh) return false;
|
|
205
|
+
const w = Math.max(0, Math.min(rect.right, vw) - Math.max(rect.left, 0));
|
|
206
|
+
const hgt = Math.max(0, Math.min(rect.bottom, vh) - Math.max(rect.top, 0));
|
|
207
|
+
return w * hgt / (vw * vh) >= SECTION_AREA_RATIO;
|
|
208
|
+
}
|
|
209
|
+
function hasElementChildren(el) {
|
|
210
|
+
return el.children.length > 0;
|
|
211
|
+
}
|
|
212
|
+
function detectKind(el) {
|
|
213
|
+
if (PAGE_TAGS.has(el.tagName)) return "section";
|
|
214
|
+
if (MEDIA_TAGS.has(el.tagName)) return "media";
|
|
215
|
+
if (isField(el)) return "field";
|
|
216
|
+
if (isAction(el)) return "action";
|
|
217
|
+
if (LANDMARK_TAGS.has(el.tagName) || role(el) === "main" || role(el) === "region") {
|
|
218
|
+
return coversViewport(el) ? "section" : "container";
|
|
219
|
+
}
|
|
220
|
+
if (TEXT_TAGS.has(el.tagName)) return "text";
|
|
221
|
+
if (!hasElementChildren(el) && (_nullishCoalesce(el.textContent, () => ( ""))).trim()) return "text";
|
|
222
|
+
if (coversViewport(el)) return "section";
|
|
223
|
+
return "container";
|
|
224
|
+
}
|
|
225
|
+
var PROMOTE_DEPTH = 3;
|
|
226
|
+
function promoteTarget(el) {
|
|
227
|
+
if (isAction(el) || isField(el)) return el;
|
|
228
|
+
let current = el.parentElement;
|
|
229
|
+
for (let depth = 0; current && depth < PROMOTE_DEPTH; depth++) {
|
|
230
|
+
if (isAction(current) || isField(current)) return current;
|
|
231
|
+
if (PAGE_TAGS.has(current.tagName)) break;
|
|
232
|
+
current = current.parentElement;
|
|
233
|
+
}
|
|
234
|
+
return el;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/core/capture/redact.ts
|
|
238
|
+
var EMAIL = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
|
|
239
|
+
var JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
240
|
+
var BEARER = /\b(Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi;
|
|
241
|
+
var LONG_NUMBER = /\b\d(?:[ -]?\d){8,}\b/g;
|
|
242
|
+
var OPAQUE_TOKEN = /\b[A-Za-z0-9_-]{32,}\b/g;
|
|
243
|
+
var SENSITIVE_PARAM = /([?&#](?:access_token|id_token|token|key|api_key|apikey|secret|password|pass|auth|code|session|sig|signature)=)[^&#\s]*/gi;
|
|
244
|
+
function redact(text, options = {}) {
|
|
245
|
+
if (!text) return text;
|
|
246
|
+
const scrubbed = text.replace(SENSITIVE_PARAM, "$1[redacted]").replace(JWT, "[token]").replace(BEARER, "$1 [token]");
|
|
247
|
+
return (options.keepEmails ? scrubbed : scrubbed.replace(EMAIL, "[email]")).replace(LONG_NUMBER, "[number]").replace(OPAQUE_TOKEN, (m) => /\d/.test(m) && /[A-Za-z]/.test(m) ? "[token]" : m);
|
|
248
|
+
}
|
|
249
|
+
function sanitizeRoute(loc, keepParams = []) {
|
|
250
|
+
let route = loc.pathname || "/";
|
|
251
|
+
if (keepParams.length > 0 && loc.search) {
|
|
252
|
+
const params = new URLSearchParams(loc.search);
|
|
253
|
+
const kept = new URLSearchParams();
|
|
254
|
+
for (const name of keepParams) {
|
|
255
|
+
const value = params.get(name);
|
|
256
|
+
if (value !== null) kept.set(name, value);
|
|
257
|
+
}
|
|
258
|
+
const qs = kept.toString();
|
|
259
|
+
if (qs) route += `?${qs}`;
|
|
260
|
+
}
|
|
261
|
+
if (loc.hash.startsWith("#/")) route += loc.hash.split("?")[0];
|
|
262
|
+
return redact(route);
|
|
263
|
+
}
|
|
264
|
+
function sanitizeUrl(raw, base = typeof location !== "undefined" ? location.href : "http://localhost/") {
|
|
265
|
+
try {
|
|
266
|
+
const url = new URL(raw, base);
|
|
267
|
+
if (url.protocol === "javascript:" || url.protocol === "data:" || url.protocol === "vbscript:") return `${url.protocol}\u2026`;
|
|
268
|
+
const baseUrl = new URL(base);
|
|
269
|
+
const path = url.pathname + (url.hash.startsWith("#/") ? url.hash : "");
|
|
270
|
+
return redact(url.origin === baseUrl.origin ? path : `${url.host}${path}`);
|
|
271
|
+
} catch (e3) {
|
|
272
|
+
return redact(raw.split(/[?#]/)[0]);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/core/capture/preview.ts
|
|
277
|
+
var MASK_ATTR = "data-grabby-mask";
|
|
278
|
+
var IGNORE_ATTR = "data-grabby-ignore";
|
|
279
|
+
var PRIORITY_ATTRS = [
|
|
280
|
+
"id",
|
|
281
|
+
"class",
|
|
282
|
+
"role",
|
|
283
|
+
"aria-label",
|
|
284
|
+
"data-testid",
|
|
285
|
+
"data-test",
|
|
286
|
+
"data-cy",
|
|
287
|
+
"name",
|
|
288
|
+
"type",
|
|
289
|
+
"href",
|
|
290
|
+
"src",
|
|
291
|
+
"alt",
|
|
292
|
+
"placeholder",
|
|
293
|
+
"title",
|
|
294
|
+
"for",
|
|
295
|
+
"aria-expanded",
|
|
296
|
+
"aria-selected",
|
|
297
|
+
"disabled"
|
|
298
|
+
];
|
|
299
|
+
var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src"]);
|
|
300
|
+
var MAX_ATTRS = 8;
|
|
301
|
+
var MAX_CLASS_CHARS = 60;
|
|
302
|
+
var MAX_ATTR_CHARS = 80;
|
|
303
|
+
var MAX_TEXT_CHARS = 80;
|
|
304
|
+
var MAX_PREVIEW_CHARS = 300;
|
|
305
|
+
function isNoiseAttr(name) {
|
|
306
|
+
return name.startsWith("_ng") || name.startsWith("ng-reflect-") || name.startsWith("data-v-") || name.startsWith("data-grabby-") || name.startsWith("data-svelte") || name === "style" || name === "value" || name.startsWith("on");
|
|
307
|
+
}
|
|
308
|
+
function isNoiseClass(name) {
|
|
309
|
+
return name.startsWith("ng-") || name.startsWith("_ng") || /^svelte-[a-z0-9]+$/i.test(name) || /^s-[A-Za-z0-9_-]{8,}$/.test(name);
|
|
310
|
+
}
|
|
311
|
+
function truncate(text, max) {
|
|
312
|
+
return text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}\u2026`;
|
|
313
|
+
}
|
|
314
|
+
function isMasked(el) {
|
|
315
|
+
return el.closest(`[${MASK_ATTR}]`) !== null;
|
|
316
|
+
}
|
|
317
|
+
function textOf(el, max) {
|
|
318
|
+
if (isMasked(el)) return "[masked]";
|
|
319
|
+
let raw = "";
|
|
320
|
+
const walker = el.ownerDocument.createTreeWalker(el, NodeFilter.SHOW_TEXT);
|
|
321
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
322
|
+
const parent = node.parentElement;
|
|
323
|
+
if (parent && /^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE)$/.test(parent.tagName)) continue;
|
|
324
|
+
if (_optionalChain([parent, 'optionalAccess', _7 => _7.closest, 'call', _8 => _8(`[${IGNORE_ATTR}], [${MASK_ATTR}]`)])) continue;
|
|
325
|
+
raw += ` ${_nullishCoalesce(node.nodeValue, () => ( ""))}`;
|
|
326
|
+
if (raw.length > max * 3) break;
|
|
327
|
+
}
|
|
328
|
+
return truncate(redact(raw.replace(/\s+/g, " ").trim()), max);
|
|
329
|
+
}
|
|
330
|
+
function ownText(el) {
|
|
331
|
+
let raw = "";
|
|
332
|
+
for (const node of Array.from(el.childNodes)) {
|
|
333
|
+
if (node.nodeType === Node.TEXT_NODE) raw += ` ${_nullishCoalesce(node.nodeValue, () => ( ""))}`;
|
|
334
|
+
}
|
|
335
|
+
return raw.replace(/\s+/g, " ").trim();
|
|
336
|
+
}
|
|
337
|
+
function attrValue(el, name, value, cleanClasses) {
|
|
338
|
+
if (name === "class") {
|
|
339
|
+
const classes = cleanClasses(value.split(/\s+/).filter(Boolean));
|
|
340
|
+
if (classes.length === 0) return null;
|
|
341
|
+
return truncate(classes.join(" "), MAX_CLASS_CHARS);
|
|
342
|
+
}
|
|
343
|
+
if (URL_ATTRS.has(name)) return truncate(sanitizeUrl(value), 120);
|
|
344
|
+
return truncate(redact(value, { keepEmails: name === "placeholder" }), MAX_ATTR_CHARS);
|
|
345
|
+
}
|
|
346
|
+
function openingTag(el, cleanClasses = (l) => l.filter((c) => !isNoiseClass(c))) {
|
|
347
|
+
const tag = el.tagName.toLowerCase();
|
|
348
|
+
const attrs = [];
|
|
349
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
350
|
+
const add = (name) => {
|
|
351
|
+
if (attrs.length >= MAX_ATTRS || seen2.has(name) || isNoiseAttr(name)) return;
|
|
352
|
+
const raw = el.getAttribute(name);
|
|
353
|
+
if (raw === null) return;
|
|
354
|
+
seen2.add(name);
|
|
355
|
+
if (raw === "") {
|
|
356
|
+
attrs.push(name);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const value = attrValue(el, name, raw, cleanClasses);
|
|
360
|
+
if (value !== null) attrs.push(`${name}="${value.replace(/"/g, """)}"`);
|
|
361
|
+
};
|
|
362
|
+
for (const name of PRIORITY_ATTRS) add(name);
|
|
363
|
+
for (const { name } of Array.from(el.attributes)) {
|
|
364
|
+
if (name.startsWith("aria-")) add(name);
|
|
365
|
+
}
|
|
366
|
+
return `<${tag}${attrs.length ? ` ${attrs.join(" ")}` : ""}>`;
|
|
367
|
+
}
|
|
368
|
+
function buildPreview(el, cleanClasses) {
|
|
369
|
+
const tag = el.tagName.toLowerCase();
|
|
370
|
+
const open = openingTag(el, cleanClasses);
|
|
371
|
+
if (/^(img|input|br|hr|meta|link|source|area|col|embed|wbr)$/.test(tag)) {
|
|
372
|
+
return truncate(open, MAX_PREVIEW_CHARS);
|
|
373
|
+
}
|
|
374
|
+
const children = Array.from(el.children).filter((c) => !c.hasAttribute(IGNORE_ATTR));
|
|
375
|
+
let inner;
|
|
376
|
+
if (isMasked(el)) {
|
|
377
|
+
inner = "[masked]";
|
|
378
|
+
} else if (children.length === 0) {
|
|
379
|
+
inner = truncate(redact(ownText(el)), MAX_TEXT_CHARS);
|
|
380
|
+
} else if (children.length <= 2) {
|
|
381
|
+
const text = truncate(redact(ownText(el)), 40);
|
|
382
|
+
const kids = children.map((c) => {
|
|
383
|
+
const t = textOf(c, 30);
|
|
384
|
+
return `<${c.tagName.toLowerCase()}${t ? `>${t}</${c.tagName.toLowerCase()}>` : " \u2026>"}`;
|
|
385
|
+
});
|
|
386
|
+
inner = [text, ...kids].filter(Boolean).join(" ");
|
|
387
|
+
} else {
|
|
388
|
+
inner = `(${children.length} elements)`;
|
|
389
|
+
}
|
|
390
|
+
return truncate(`${open}${inner}</${tag}>`, MAX_PREVIEW_CHARS);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// src/core/capture/describe.ts
|
|
394
|
+
var MAX_NAME = 40;
|
|
395
|
+
var HEADING = /^h[1-6]$/;
|
|
396
|
+
function role2(el) {
|
|
397
|
+
return (_nullishCoalesce(el.getAttribute("role"), () => ( ""))).toLowerCase();
|
|
398
|
+
}
|
|
399
|
+
function hasBox(el) {
|
|
400
|
+
try {
|
|
401
|
+
const s = getComputedStyle(el);
|
|
402
|
+
const bordered = s.borderStyle !== "none" && parseFloat(s.borderWidth) > 0;
|
|
403
|
+
const shadow = !!s.boxShadow && s.boxShadow !== "none";
|
|
404
|
+
return shadow || bordered && parseFloat(s.borderRadius) > 0;
|
|
405
|
+
} catch (e4) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function nounFor(tag, kind, r = "", inputType = "", boxed = false, titled = false) {
|
|
410
|
+
switch (kind) {
|
|
411
|
+
case "action":
|
|
412
|
+
if (r === "tab") return "Tab";
|
|
413
|
+
if (r.startsWith("menuitem")) return "Menu item";
|
|
414
|
+
if (r === "checkbox" || inputType === "checkbox") return "Checkbox";
|
|
415
|
+
if (r === "radio" || r === "option" || inputType === "radio") return "Option";
|
|
416
|
+
if (r === "switch") return "Switch";
|
|
417
|
+
if (tag === "a" || r === "link") return "Link";
|
|
418
|
+
return "Button";
|
|
419
|
+
case "field":
|
|
420
|
+
if (tag === "select" || r === "combobox") return "Dropdown";
|
|
421
|
+
if (tag === "textarea") return "Text area";
|
|
422
|
+
if (inputType === "checkbox") return "Checkbox";
|
|
423
|
+
if (inputType === "radio") return "Option";
|
|
424
|
+
if (inputType === "range" || r === "slider") return "Slider";
|
|
425
|
+
if (inputType === "file") return "File upload";
|
|
426
|
+
if (inputType === "search" || r === "searchbox") return "Search box";
|
|
427
|
+
if (/^(date|datetime-local|month|week|time)$/.test(inputType)) return "Date picker";
|
|
428
|
+
return "Text box";
|
|
429
|
+
case "media":
|
|
430
|
+
if (tag === "svg") return "Icon";
|
|
431
|
+
if (tag === "video") return "Video";
|
|
432
|
+
if (tag === "audio") return "Audio player";
|
|
433
|
+
if (tag === "iframe") return "Embedded content";
|
|
434
|
+
if (tag === "canvas") return "Chart or drawing";
|
|
435
|
+
return "Image";
|
|
436
|
+
case "text":
|
|
437
|
+
if (HEADING.test(tag) || r === "heading") return "Heading";
|
|
438
|
+
if (tag === "li") return "List item";
|
|
439
|
+
if (tag === "label") return "Label";
|
|
440
|
+
if (tag === "td" || tag === "th") return "Table cell";
|
|
441
|
+
if (tag === "blockquote" || tag === "q") return "Quote";
|
|
442
|
+
if (tag === "code" || tag === "pre") return "Code";
|
|
443
|
+
return "Text";
|
|
444
|
+
case "section":
|
|
445
|
+
if (tag === "html" || tag === "body") return "Whole page";
|
|
446
|
+
if (tag === "main" || r === "main") return "Main content";
|
|
447
|
+
if (tag === "header") return "Page header";
|
|
448
|
+
if (tag === "footer") return "Page footer";
|
|
449
|
+
if (tag === "nav") return "Navigation menu";
|
|
450
|
+
return "Page section";
|
|
451
|
+
default:
|
|
452
|
+
if (tag === "nav" || r === "navigation" || r === "menu" || r === "menubar") return "Menu";
|
|
453
|
+
if (tag === "header") return "Header";
|
|
454
|
+
if (tag === "footer") return "Footer";
|
|
455
|
+
if (tag === "aside") return "Sidebar";
|
|
456
|
+
if (tag === "form" || r === "form") return "Form";
|
|
457
|
+
if (tag === "table" || r === "table" || r === "grid") return "Table";
|
|
458
|
+
if (tag === "ul" || tag === "ol" || r === "list") return "List";
|
|
459
|
+
if (tag === "dialog" || r === "dialog" || r === "alertdialog") return "Pop-up";
|
|
460
|
+
if (boxed) return "Card";
|
|
461
|
+
if (titled) return "Section";
|
|
462
|
+
return "Area";
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
function fieldName(el) {
|
|
466
|
+
const labels = el.labels;
|
|
467
|
+
if (labels && labels.length) return textOf(labels[0], MAX_NAME);
|
|
468
|
+
return redact(_nullishCoalesce(el.getAttribute("aria-label"), () => ( ""))) || redact(_nullishCoalesce(el.getAttribute("placeholder"), () => ( "")));
|
|
469
|
+
}
|
|
470
|
+
function firstHeading(el) {
|
|
471
|
+
return el.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]');
|
|
472
|
+
}
|
|
473
|
+
function nameOf(el, kind) {
|
|
474
|
+
if (isMasked(el) || el.tagName === "BODY" || el.tagName === "HTML") return "";
|
|
475
|
+
const aria = redact(_nullishCoalesce(el.getAttribute("aria-label"), () => ( "")));
|
|
476
|
+
switch (kind) {
|
|
477
|
+
case "action":
|
|
478
|
+
return aria || textOf(el, MAX_NAME) || redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))) || redact(_nullishCoalesce(_optionalChain([el, 'access', _9 => _9.querySelector, 'call', _10 => _10("img[alt]"), 'optionalAccess', _11 => _11.getAttribute, 'call', _12 => _12("alt")]), () => ( "")));
|
|
479
|
+
case "field":
|
|
480
|
+
return fieldName(el);
|
|
481
|
+
case "media":
|
|
482
|
+
return redact(_nullishCoalesce(el.getAttribute("alt"), () => ( ""))) || aria || redact(_nullishCoalesce(el.getAttribute("title"), () => ( "")));
|
|
483
|
+
case "text":
|
|
484
|
+
return textOf(el, MAX_NAME);
|
|
485
|
+
default: {
|
|
486
|
+
const heading = firstHeading(el);
|
|
487
|
+
return aria || (heading ? textOf(heading, MAX_NAME) : "");
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function quoted(noun, name) {
|
|
492
|
+
const clean = truncate(name.replace(/\s+/g, " ").trim(), MAX_NAME);
|
|
493
|
+
return clean ? `${noun} \u201C${clean}\u201D` : noun;
|
|
494
|
+
}
|
|
495
|
+
function describeElement(el) {
|
|
496
|
+
const tag = el.tagName.toLowerCase();
|
|
497
|
+
const kind = tag === "svg" ? "media" : detectKind(el);
|
|
498
|
+
const r = role2(el);
|
|
499
|
+
const inputType = tag === "input" ? (el.type || "").toLowerCase() : "";
|
|
500
|
+
const container = kind === "container";
|
|
501
|
+
const noun = nounFor(tag, kind, r, inputType, container && hasBox(el), container && !!firstHeading(el));
|
|
502
|
+
return quoted(noun, nameOf(el, kind));
|
|
503
|
+
}
|
|
504
|
+
function describeTarget(target) {
|
|
505
|
+
const facts = _nullishCoalesce(target.facts, () => ( {}));
|
|
506
|
+
const noun = nounFor(target.tag, target.kind, "", (_nullishCoalesce(facts.type, () => ( ""))).toLowerCase(), false, !!facts.heading);
|
|
507
|
+
const name = facts.label || facts.heading || facts.text || facts.alt || "";
|
|
508
|
+
return quoted(noun, name);
|
|
509
|
+
}
|
|
510
|
+
|
|
145
511
|
// src/core/overlay/overlay-renderer.ts
|
|
146
512
|
var OVERLAY_ID = "__grabby-overlay__";
|
|
147
513
|
var LABEL_ID = "__grabby-label__";
|
|
148
514
|
var STYLE_ID = "__grabby-styles__";
|
|
149
515
|
var MAX_LABEL_CLASSES = 3;
|
|
150
|
-
function createOverlayRenderer() {
|
|
516
|
+
function createOverlayRenderer(options = {}) {
|
|
151
517
|
let overlay = null;
|
|
152
518
|
let label = null;
|
|
153
519
|
let rafId = null;
|
|
@@ -155,6 +521,7 @@ function createOverlayRenderer() {
|
|
|
155
521
|
let currentComponentName = null;
|
|
156
522
|
let currentSourcePath = null;
|
|
157
523
|
let currentCssClasses = [];
|
|
524
|
+
let currentPlainLabel = "";
|
|
158
525
|
function injectStyles2() {
|
|
159
526
|
if (hasStyles(STYLE_ID)) return;
|
|
160
527
|
addStyles(STYLE_ID, `
|
|
@@ -182,6 +549,11 @@ function createOverlayRenderer() {
|
|
|
182
549
|
overflow: hidden;
|
|
183
550
|
text-overflow: ellipsis;
|
|
184
551
|
}
|
|
552
|
+
#${LABEL_ID}.grabby-plain {
|
|
553
|
+
font: 600 12px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
554
|
+
padding: 3px 8px;
|
|
555
|
+
border-radius: 6px;
|
|
556
|
+
}
|
|
185
557
|
`);
|
|
186
558
|
}
|
|
187
559
|
function ensureElements() {
|
|
@@ -194,6 +566,7 @@ function createOverlayRenderer() {
|
|
|
194
566
|
if (!label) {
|
|
195
567
|
label = document.createElement("div");
|
|
196
568
|
label.id = LABEL_ID;
|
|
569
|
+
if (options.plainLabels) label.className = "grabby-plain";
|
|
197
570
|
getUiRoot().appendChild(label);
|
|
198
571
|
}
|
|
199
572
|
}
|
|
@@ -212,6 +585,11 @@ function createOverlayRenderer() {
|
|
|
212
585
|
overlay.style.display = "block";
|
|
213
586
|
const tag = currentElement.tagName.toLowerCase();
|
|
214
587
|
let labelText = `<${tag}>`;
|
|
588
|
+
if (options.plainLabels) {
|
|
589
|
+
label.textContent = `${currentPlainLabel} \xB7 Click to select`;
|
|
590
|
+
placeLabel(rect);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
215
593
|
if (currentCssClasses.length > 0) {
|
|
216
594
|
const shown = currentCssClasses.slice(0, MAX_LABEL_CLASSES);
|
|
217
595
|
labelText += ` .${shown.join(".")}${currentCssClasses.length > shown.length ? "\u2026" : ""}`;
|
|
@@ -223,6 +601,10 @@ function createOverlayRenderer() {
|
|
|
223
601
|
labelText += ` \u2014 ${currentSourcePath}`;
|
|
224
602
|
}
|
|
225
603
|
label.textContent = labelText;
|
|
604
|
+
placeLabel(rect);
|
|
605
|
+
}
|
|
606
|
+
function placeLabel(rect) {
|
|
607
|
+
if (!label) return;
|
|
226
608
|
const labelHeight = 20;
|
|
227
609
|
const gap = 4;
|
|
228
610
|
let labelTop = rect.top - labelHeight - gap;
|
|
@@ -255,6 +637,7 @@ function createOverlayRenderer() {
|
|
|
255
637
|
ensureElements();
|
|
256
638
|
currentElement = element;
|
|
257
639
|
currentComponentName = componentName;
|
|
640
|
+
if (options.plainLabels) currentPlainLabel = describeElement(element);
|
|
258
641
|
currentSourcePath = _nullishCoalesce(sourcePath, () => ( null));
|
|
259
642
|
currentCssClasses = _nullishCoalesce(cssClasses, () => ( []));
|
|
260
643
|
stopTracking();
|
|
@@ -278,8 +661,8 @@ function createOverlayRenderer() {
|
|
|
278
661
|
currentComponentName = null;
|
|
279
662
|
currentSourcePath = null;
|
|
280
663
|
currentCssClasses = [];
|
|
281
|
-
_optionalChain([overlay, 'optionalAccess',
|
|
282
|
-
_optionalChain([label, 'optionalAccess',
|
|
664
|
+
_optionalChain([overlay, 'optionalAccess', _13 => _13.remove, 'call', _14 => _14()]);
|
|
665
|
+
_optionalChain([label, 'optionalAccess', _15 => _15.remove, 'call', _16 => _16()]);
|
|
283
666
|
removeStyles(STYLE_ID);
|
|
284
667
|
overlay = null;
|
|
285
668
|
label = null;
|
|
@@ -364,8 +747,8 @@ function createCrosshair() {
|
|
|
364
747
|
},
|
|
365
748
|
dispose() {
|
|
366
749
|
this.deactivate();
|
|
367
|
-
_optionalChain([hLine, 'optionalAccess',
|
|
368
|
-
_optionalChain([vLine, 'optionalAccess',
|
|
750
|
+
_optionalChain([hLine, 'optionalAccess', _17 => _17.remove, 'call', _18 => _18()]);
|
|
751
|
+
_optionalChain([vLine, 'optionalAccess', _19 => _19.remove, 'call', _20 => _20()]);
|
|
369
752
|
removeStyles(CROSSHAIR_STYLE_ID);
|
|
370
753
|
removeStyles(CURSOR_STYLE_ID);
|
|
371
754
|
hLine = null;
|
|
@@ -582,7 +965,7 @@ function injectToastStyles() {
|
|
|
582
965
|
}
|
|
583
966
|
var toastEl = null;
|
|
584
967
|
function getOrCreateToast() {
|
|
585
|
-
if (_optionalChain([toastEl, 'optionalAccess',
|
|
968
|
+
if (_optionalChain([toastEl, 'optionalAccess', _21 => _21.isConnected])) return toastEl;
|
|
586
969
|
injectToastStyles();
|
|
587
970
|
toastEl = h("div", { id: TOAST_ID, role: "status", "aria-live": "polite" });
|
|
588
971
|
getUiRoot().appendChild(toastEl);
|
|
@@ -605,7 +988,7 @@ function row(label, value) {
|
|
|
605
988
|
function showToast(message, opts = {}) {
|
|
606
989
|
const toast = getOrCreateToast();
|
|
607
990
|
const { detail, actions } = opts;
|
|
608
|
-
const durationMs = _nullishCoalesce(opts.duration, () => ( (_optionalChain([actions, 'optionalAccess',
|
|
991
|
+
const durationMs = _nullishCoalesce(opts.duration, () => ( (_optionalChain([actions, 'optionalAccess', _22 => _22.length]) ? 8e3 : 3500)));
|
|
609
992
|
const children = [
|
|
610
993
|
h(
|
|
611
994
|
"div",
|
|
@@ -630,7 +1013,7 @@ function showToast(message, opts = {}) {
|
|
|
630
1013
|
}
|
|
631
1014
|
children.push(details);
|
|
632
1015
|
}
|
|
633
|
-
if (_optionalChain([actions, 'optionalAccess',
|
|
1016
|
+
if (_optionalChain([actions, 'optionalAccess', _23 => _23.length])) {
|
|
634
1017
|
children[0].appendChild(h(
|
|
635
1018
|
"span",
|
|
636
1019
|
{ class: "grabby-toast-actions" },
|
|
@@ -643,371 +1026,123 @@ function showToast(message, opts = {}) {
|
|
|
643
1026
|
a.onClick();
|
|
644
1027
|
}
|
|
645
1028
|
}, a.label))
|
|
646
|
-
));
|
|
647
|
-
}
|
|
648
|
-
toast.replaceChildren(...children);
|
|
649
|
-
if (activeTimer) {
|
|
650
|
-
clearTimeout(activeTimer);
|
|
651
|
-
activeTimer = null;
|
|
652
|
-
}
|
|
653
|
-
toast.classList.remove("grabby-toast-visible");
|
|
654
|
-
void toast.offsetHeight;
|
|
655
|
-
toast.classList.add("grabby-toast-visible");
|
|
656
|
-
activeTimer = setTimeout(() => {
|
|
657
|
-
toast.classList.remove("grabby-toast-visible");
|
|
658
|
-
activeTimer = null;
|
|
659
|
-
}, durationMs);
|
|
660
|
-
}
|
|
661
|
-
function hideToast() {
|
|
662
|
-
if (activeTimer) {
|
|
663
|
-
clearTimeout(activeTimer);
|
|
664
|
-
activeTimer = null;
|
|
665
|
-
}
|
|
666
|
-
_optionalChain([toastEl, 'optionalAccess', _18 => _18.classList, 'access', _19 => _19.remove, 'call', _20 => _20("grabby-toast-visible")]);
|
|
667
|
-
}
|
|
668
|
-
function disposeToast() {
|
|
669
|
-
if (activeTimer) {
|
|
670
|
-
clearTimeout(activeTimer);
|
|
671
|
-
activeTimer = null;
|
|
672
|
-
}
|
|
673
|
-
_optionalChain([toastEl, 'optionalAccess', _21 => _21.remove, 'call', _22 => _22()]);
|
|
674
|
-
toastEl = null;
|
|
675
|
-
removeStyles(TOAST_STYLE_ID);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// src/core/utils.ts
|
|
679
|
-
function filterAngularClasses(classList) {
|
|
680
|
-
return Array.from(classList).filter((c) => !c.startsWith("ng-") && !c.startsWith("_ng"));
|
|
681
|
-
}
|
|
682
|
-
function cssEscape(value) {
|
|
683
|
-
if (typeof CSS !== "undefined" && typeof CSS.escape === "function") return CSS.escape(value);
|
|
684
|
-
let out = "";
|
|
685
|
-
for (let i = 0; i < value.length; i++) {
|
|
686
|
-
const ch = value.charAt(i);
|
|
687
|
-
const code = value.charCodeAt(i);
|
|
688
|
-
if (code === 0) {
|
|
689
|
-
out += "\uFFFD";
|
|
690
|
-
continue;
|
|
691
|
-
}
|
|
692
|
-
if (code >= 1 && code <= 31 || code === 127 || i === 0 && code >= 48 && code <= 57 || i === 1 && code >= 48 && code <= 57 && value.charCodeAt(0) === 45) {
|
|
693
|
-
out += `\\${code.toString(16)} `;
|
|
694
|
-
continue;
|
|
695
|
-
}
|
|
696
|
-
if (i === 0 && value.length === 1 && code === 45) {
|
|
697
|
-
out += `\\${ch}`;
|
|
698
|
-
continue;
|
|
699
|
-
}
|
|
700
|
-
if (code >= 128 || code === 45 || code === 95 || code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
701
|
-
out += ch;
|
|
702
|
-
continue;
|
|
703
|
-
}
|
|
704
|
-
out += `\\${ch}`;
|
|
705
|
-
}
|
|
706
|
-
return out;
|
|
707
|
-
}
|
|
708
|
-
function safeQuery(selector, root2 = document) {
|
|
709
|
-
if (!selector) return null;
|
|
710
|
-
try {
|
|
711
|
-
return root2.querySelector(selector);
|
|
712
|
-
} catch (e3) {
|
|
713
|
-
return null;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
var TEST_ID_ATTRS = ["data-testid", "data-test", "data-cy", "data-qa"];
|
|
717
|
-
var MAX_SELECTOR_DEPTH = 8;
|
|
718
|
-
function isUnique(selector, el) {
|
|
719
|
-
try {
|
|
720
|
-
const matches = el.ownerDocument.querySelectorAll(selector);
|
|
721
|
-
return matches.length === 1 && matches[0] === el;
|
|
722
|
-
} catch (e4) {
|
|
723
|
-
return false;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
function stepFor(el) {
|
|
727
|
-
const tag = el.tagName.toLowerCase();
|
|
728
|
-
const parent = el.parentElement;
|
|
729
|
-
if (!parent) return tag;
|
|
730
|
-
const sameTag = Array.from(parent.children).filter((c) => c.tagName === el.tagName);
|
|
731
|
-
if (sameTag.length === 1) return tag;
|
|
732
|
-
return `${tag}:nth-of-type(${sameTag.indexOf(el) + 1})`;
|
|
733
|
-
}
|
|
734
|
-
function buildUniqueSelector(el) {
|
|
735
|
-
for (const attr of TEST_ID_ATTRS) {
|
|
736
|
-
const value = el.getAttribute(attr);
|
|
737
|
-
if (value) {
|
|
738
|
-
const sel = `[${attr}="${value.replace(/["\\]/g, "\\$&")}"]`;
|
|
739
|
-
if (isUnique(sel, el)) return sel;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
if (el.id) {
|
|
743
|
-
const sel = `#${cssEscape(el.id)}`;
|
|
744
|
-
if (isUnique(sel, el)) return sel;
|
|
745
|
-
}
|
|
746
|
-
const steps = [];
|
|
747
|
-
let current = el;
|
|
748
|
-
while (current && steps.length < MAX_SELECTOR_DEPTH) {
|
|
749
|
-
if (current !== el && current.id) {
|
|
750
|
-
const anchor = `#${cssEscape(current.id)}`;
|
|
751
|
-
if (isUnique(anchor, current)) {
|
|
752
|
-
steps.unshift(anchor);
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
steps.unshift(stepFor(current));
|
|
757
|
-
const sel = steps.join(" > ");
|
|
758
|
-
if (isUnique(sel, el)) return sel;
|
|
759
|
-
if (current.tagName === "BODY" || current.tagName === "HTML") break;
|
|
760
|
-
current = current.parentElement;
|
|
761
|
-
}
|
|
762
|
-
return steps.join(" > ");
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
// src/core/capture/kind.ts
|
|
766
|
-
var ACTION_TAGS = /* @__PURE__ */ new Set(["BUTTON", "A", "SUMMARY"]);
|
|
767
|
-
var ACTION_ROLES = /* @__PURE__ */ new Set(["button", "link", "tab", "menuitem", "menuitemcheckbox", "menuitemradio", "switch", "option", "checkbox", "radio"]);
|
|
768
|
-
var BUTTON_INPUT_TYPES = /* @__PURE__ */ new Set(["button", "submit", "reset", "image"]);
|
|
769
|
-
var FIELD_TAGS = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
770
|
-
var FIELD_ROLES = /* @__PURE__ */ new Set(["textbox", "combobox", "searchbox", "spinbutton", "slider"]);
|
|
771
|
-
var MEDIA_TAGS = /* @__PURE__ */ new Set(["IMG", "SVG", "VIDEO", "PICTURE", "CANVAS", "IFRAME", "AUDIO"]);
|
|
772
|
-
var TEXT_TAGS = /* @__PURE__ */ new Set([
|
|
773
|
-
"H1",
|
|
774
|
-
"H2",
|
|
775
|
-
"H3",
|
|
776
|
-
"H4",
|
|
777
|
-
"H5",
|
|
778
|
-
"H6",
|
|
779
|
-
"P",
|
|
780
|
-
"SPAN",
|
|
781
|
-
"LABEL",
|
|
782
|
-
"LI",
|
|
783
|
-
"STRONG",
|
|
784
|
-
"EM",
|
|
785
|
-
"B",
|
|
786
|
-
"I",
|
|
787
|
-
"SMALL",
|
|
788
|
-
"BLOCKQUOTE",
|
|
789
|
-
"CODE",
|
|
790
|
-
"PRE",
|
|
791
|
-
"TD",
|
|
792
|
-
"TH",
|
|
793
|
-
"DT",
|
|
794
|
-
"DD",
|
|
795
|
-
"FIGCAPTION",
|
|
796
|
-
"LEGEND",
|
|
797
|
-
"CAPTION",
|
|
798
|
-
"Q",
|
|
799
|
-
"CITE",
|
|
800
|
-
"MARK",
|
|
801
|
-
"TIME"
|
|
802
|
-
]);
|
|
803
|
-
var PAGE_TAGS = /* @__PURE__ */ new Set(["HTML", "BODY", "MAIN"]);
|
|
804
|
-
var LANDMARK_TAGS = /* @__PURE__ */ new Set(["HEADER", "FOOTER", "NAV", "ASIDE"]);
|
|
805
|
-
var SECTION_AREA_RATIO = 0.6;
|
|
806
|
-
function role(el) {
|
|
807
|
-
return (_nullishCoalesce(el.getAttribute("role"), () => ( ""))).toLowerCase();
|
|
808
|
-
}
|
|
809
|
-
function isAction(el) {
|
|
810
|
-
if (ACTION_TAGS.has(el.tagName)) return el.tagName !== "A" || el.hasAttribute("href") || el.hasAttribute("role");
|
|
811
|
-
if (el.tagName === "INPUT" && BUTTON_INPUT_TYPES.has(el.type)) return true;
|
|
812
|
-
return ACTION_ROLES.has(role(el));
|
|
813
|
-
}
|
|
814
|
-
function isField(el) {
|
|
815
|
-
if (el.tagName === "INPUT") return !BUTTON_INPUT_TYPES.has(el.type);
|
|
816
|
-
if (FIELD_TAGS.has(el.tagName)) return true;
|
|
817
|
-
if (el.isContentEditable && el.getAttribute("contenteditable") !== null) return true;
|
|
818
|
-
return FIELD_ROLES.has(role(el));
|
|
819
|
-
}
|
|
820
|
-
function coversViewport(el) {
|
|
821
|
-
const rect = el.getBoundingClientRect();
|
|
822
|
-
const vw = window.innerWidth || document.documentElement.clientWidth;
|
|
823
|
-
const vh = window.innerHeight || document.documentElement.clientHeight;
|
|
824
|
-
if (!vw || !vh) return false;
|
|
825
|
-
const w = Math.max(0, Math.min(rect.right, vw) - Math.max(rect.left, 0));
|
|
826
|
-
const hgt = Math.max(0, Math.min(rect.bottom, vh) - Math.max(rect.top, 0));
|
|
827
|
-
return w * hgt / (vw * vh) >= SECTION_AREA_RATIO;
|
|
828
|
-
}
|
|
829
|
-
function hasElementChildren(el) {
|
|
830
|
-
return el.children.length > 0;
|
|
831
|
-
}
|
|
832
|
-
function detectKind(el) {
|
|
833
|
-
if (PAGE_TAGS.has(el.tagName)) return "section";
|
|
834
|
-
if (MEDIA_TAGS.has(el.tagName)) return "media";
|
|
835
|
-
if (isField(el)) return "field";
|
|
836
|
-
if (isAction(el)) return "action";
|
|
837
|
-
if (LANDMARK_TAGS.has(el.tagName) || role(el) === "main" || role(el) === "region") {
|
|
838
|
-
return coversViewport(el) ? "section" : "container";
|
|
839
|
-
}
|
|
840
|
-
if (TEXT_TAGS.has(el.tagName)) return "text";
|
|
841
|
-
if (!hasElementChildren(el) && (_nullishCoalesce(el.textContent, () => ( ""))).trim()) return "text";
|
|
842
|
-
if (coversViewport(el)) return "section";
|
|
843
|
-
return "container";
|
|
844
|
-
}
|
|
845
|
-
var PROMOTE_DEPTH = 3;
|
|
846
|
-
function promoteTarget(el) {
|
|
847
|
-
if (isAction(el) || isField(el)) return el;
|
|
848
|
-
let current = el.parentElement;
|
|
849
|
-
for (let depth = 0; current && depth < PROMOTE_DEPTH; depth++) {
|
|
850
|
-
if (isAction(current) || isField(current)) return current;
|
|
851
|
-
if (PAGE_TAGS.has(current.tagName)) break;
|
|
852
|
-
current = current.parentElement;
|
|
853
|
-
}
|
|
854
|
-
return el;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
// src/core/capture/redact.ts
|
|
858
|
-
var EMAIL = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
|
|
859
|
-
var JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
860
|
-
var BEARER = /\b(Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi;
|
|
861
|
-
var LONG_NUMBER = /\b\d(?:[ -]?\d){8,}\b/g;
|
|
862
|
-
var OPAQUE_TOKEN = /\b[A-Za-z0-9_-]{32,}\b/g;
|
|
863
|
-
var SENSITIVE_PARAM = /([?&#](?:access_token|id_token|token|key|api_key|apikey|secret|password|pass|auth|code|session|sig|signature)=)[^&#\s]*/gi;
|
|
864
|
-
function redact(text, options = {}) {
|
|
865
|
-
if (!text) return text;
|
|
866
|
-
const scrubbed = text.replace(SENSITIVE_PARAM, "$1[redacted]").replace(JWT, "[token]").replace(BEARER, "$1 [token]");
|
|
867
|
-
return (options.keepEmails ? scrubbed : scrubbed.replace(EMAIL, "[email]")).replace(LONG_NUMBER, "[number]").replace(OPAQUE_TOKEN, (m) => /\d/.test(m) && /[A-Za-z]/.test(m) ? "[token]" : m);
|
|
1029
|
+
));
|
|
1030
|
+
}
|
|
1031
|
+
toast.replaceChildren(...children);
|
|
1032
|
+
if (activeTimer) {
|
|
1033
|
+
clearTimeout(activeTimer);
|
|
1034
|
+
activeTimer = null;
|
|
1035
|
+
}
|
|
1036
|
+
toast.classList.remove("grabby-toast-visible");
|
|
1037
|
+
void toast.offsetHeight;
|
|
1038
|
+
toast.classList.add("grabby-toast-visible");
|
|
1039
|
+
activeTimer = setTimeout(() => {
|
|
1040
|
+
toast.classList.remove("grabby-toast-visible");
|
|
1041
|
+
activeTimer = null;
|
|
1042
|
+
}, durationMs);
|
|
868
1043
|
}
|
|
869
|
-
function
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
const kept = new URLSearchParams();
|
|
874
|
-
for (const name of keepParams) {
|
|
875
|
-
const value = params.get(name);
|
|
876
|
-
if (value !== null) kept.set(name, value);
|
|
877
|
-
}
|
|
878
|
-
const qs = kept.toString();
|
|
879
|
-
if (qs) route += `?${qs}`;
|
|
1044
|
+
function hideToast() {
|
|
1045
|
+
if (activeTimer) {
|
|
1046
|
+
clearTimeout(activeTimer);
|
|
1047
|
+
activeTimer = null;
|
|
880
1048
|
}
|
|
881
|
-
|
|
882
|
-
return redact(route);
|
|
1049
|
+
_optionalChain([toastEl, 'optionalAccess', _24 => _24.classList, 'access', _25 => _25.remove, 'call', _26 => _26("grabby-toast-visible")]);
|
|
883
1050
|
}
|
|
884
|
-
function
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
const baseUrl = new URL(base);
|
|
889
|
-
const path = url.pathname + (url.hash.startsWith("#/") ? url.hash : "");
|
|
890
|
-
return redact(url.origin === baseUrl.origin ? path : `${url.host}${path}`);
|
|
891
|
-
} catch (e5) {
|
|
892
|
-
return redact(raw.split(/[?#]/)[0]);
|
|
1051
|
+
function disposeToast() {
|
|
1052
|
+
if (activeTimer) {
|
|
1053
|
+
clearTimeout(activeTimer);
|
|
1054
|
+
activeTimer = null;
|
|
893
1055
|
}
|
|
1056
|
+
_optionalChain([toastEl, 'optionalAccess', _27 => _27.remove, 'call', _28 => _28()]);
|
|
1057
|
+
toastEl = null;
|
|
1058
|
+
removeStyles(TOAST_STYLE_ID);
|
|
894
1059
|
}
|
|
895
1060
|
|
|
896
|
-
// src/core/
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
var PRIORITY_ATTRS = [
|
|
900
|
-
"id",
|
|
901
|
-
"class",
|
|
902
|
-
"role",
|
|
903
|
-
"aria-label",
|
|
904
|
-
"data-testid",
|
|
905
|
-
"data-test",
|
|
906
|
-
"data-cy",
|
|
907
|
-
"name",
|
|
908
|
-
"type",
|
|
909
|
-
"href",
|
|
910
|
-
"src",
|
|
911
|
-
"alt",
|
|
912
|
-
"placeholder",
|
|
913
|
-
"title",
|
|
914
|
-
"for",
|
|
915
|
-
"aria-expanded",
|
|
916
|
-
"aria-selected",
|
|
917
|
-
"disabled"
|
|
918
|
-
];
|
|
919
|
-
var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src"]);
|
|
920
|
-
var MAX_ATTRS = 8;
|
|
921
|
-
var MAX_CLASS_CHARS = 60;
|
|
922
|
-
var MAX_ATTR_CHARS = 80;
|
|
923
|
-
var MAX_TEXT_CHARS = 80;
|
|
924
|
-
var MAX_PREVIEW_CHARS = 300;
|
|
925
|
-
function isNoiseAttr(name) {
|
|
926
|
-
return name.startsWith("_ng") || name.startsWith("ng-reflect-") || name.startsWith("data-v-") || name.startsWith("data-grabby-") || name.startsWith("data-svelte") || name === "style" || name === "value" || name.startsWith("on");
|
|
927
|
-
}
|
|
928
|
-
function isNoiseClass(name) {
|
|
929
|
-
return name.startsWith("ng-") || name.startsWith("_ng") || /^svelte-[a-z0-9]+$/i.test(name) || /^s-[A-Za-z0-9_-]{8,}$/.test(name);
|
|
930
|
-
}
|
|
931
|
-
function truncate(text, max) {
|
|
932
|
-
return text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}\u2026`;
|
|
933
|
-
}
|
|
934
|
-
function isMasked(el) {
|
|
935
|
-
return el.closest(`[${MASK_ATTR}]`) !== null;
|
|
1061
|
+
// src/core/utils.ts
|
|
1062
|
+
function filterAngularClasses(classList) {
|
|
1063
|
+
return Array.from(classList).filter((c) => !c.startsWith("ng-") && !c.startsWith("_ng"));
|
|
936
1064
|
}
|
|
937
|
-
function
|
|
938
|
-
if (
|
|
939
|
-
let
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
if (
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1065
|
+
function cssEscape(value) {
|
|
1066
|
+
if (typeof CSS !== "undefined" && typeof CSS.escape === "function") return CSS.escape(value);
|
|
1067
|
+
let out = "";
|
|
1068
|
+
for (let i = 0; i < value.length; i++) {
|
|
1069
|
+
const ch = value.charAt(i);
|
|
1070
|
+
const code = value.charCodeAt(i);
|
|
1071
|
+
if (code === 0) {
|
|
1072
|
+
out += "\uFFFD";
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
if (code >= 1 && code <= 31 || code === 127 || i === 0 && code >= 48 && code <= 57 || i === 1 && code >= 48 && code <= 57 && value.charCodeAt(0) === 45) {
|
|
1076
|
+
out += `\\${code.toString(16)} `;
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
if (i === 0 && value.length === 1 && code === 45) {
|
|
1080
|
+
out += `\\${ch}`;
|
|
1081
|
+
continue;
|
|
1082
|
+
}
|
|
1083
|
+
if (code >= 128 || code === 45 || code === 95 || code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
1084
|
+
out += ch;
|
|
1085
|
+
continue;
|
|
1086
|
+
}
|
|
1087
|
+
out += `\\${ch}`;
|
|
947
1088
|
}
|
|
948
|
-
return
|
|
1089
|
+
return out;
|
|
949
1090
|
}
|
|
950
|
-
function
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1091
|
+
function safeQuery(selector, root2 = document) {
|
|
1092
|
+
if (!selector) return null;
|
|
1093
|
+
try {
|
|
1094
|
+
return root2.querySelector(selector);
|
|
1095
|
+
} catch (e5) {
|
|
1096
|
+
return null;
|
|
954
1097
|
}
|
|
955
|
-
return raw.replace(/\s+/g, " ").trim();
|
|
956
1098
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1099
|
+
var TEST_ID_ATTRS = ["data-testid", "data-test", "data-cy", "data-qa"];
|
|
1100
|
+
var MAX_SELECTOR_DEPTH = 8;
|
|
1101
|
+
function isUnique(selector, el) {
|
|
1102
|
+
try {
|
|
1103
|
+
const matches = el.ownerDocument.querySelectorAll(selector);
|
|
1104
|
+
return matches.length === 1 && matches[0] === el;
|
|
1105
|
+
} catch (e6) {
|
|
1106
|
+
return false;
|
|
962
1107
|
}
|
|
963
|
-
if (URL_ATTRS.has(name)) return truncate(sanitizeUrl(value), 120);
|
|
964
|
-
return truncate(redact(value, { keepEmails: name === "placeholder" }), MAX_ATTR_CHARS);
|
|
965
1108
|
}
|
|
966
|
-
function
|
|
1109
|
+
function stepFor(el) {
|
|
967
1110
|
const tag = el.tagName.toLowerCase();
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1111
|
+
const parent = el.parentElement;
|
|
1112
|
+
if (!parent) return tag;
|
|
1113
|
+
const sameTag = Array.from(parent.children).filter((c) => c.tagName === el.tagName);
|
|
1114
|
+
if (sameTag.length === 1) return tag;
|
|
1115
|
+
return `${tag}:nth-of-type(${sameTag.indexOf(el) + 1})`;
|
|
1116
|
+
}
|
|
1117
|
+
function buildUniqueSelector(el) {
|
|
1118
|
+
for (const attr of TEST_ID_ATTRS) {
|
|
1119
|
+
const value = el.getAttribute(attr);
|
|
1120
|
+
if (value) {
|
|
1121
|
+
const sel = `[${attr}="${value.replace(/["\\]/g, "\\$&")}"]`;
|
|
1122
|
+
if (isUnique(sel, el)) return sel;
|
|
978
1123
|
}
|
|
979
|
-
const value = attrValue(el, name, raw, cleanClasses);
|
|
980
|
-
if (value !== null) attrs.push(`${name}="${value.replace(/"/g, """)}"`);
|
|
981
|
-
};
|
|
982
|
-
for (const name of PRIORITY_ATTRS) add(name);
|
|
983
|
-
for (const { name } of Array.from(el.attributes)) {
|
|
984
|
-
if (name.startsWith("aria-")) add(name);
|
|
985
1124
|
}
|
|
986
|
-
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
const tag = el.tagName.toLowerCase();
|
|
990
|
-
const open = openingTag(el, cleanClasses);
|
|
991
|
-
if (/^(img|input|br|hr|meta|link|source|area|col|embed|wbr)$/.test(tag)) {
|
|
992
|
-
return truncate(open, MAX_PREVIEW_CHARS);
|
|
1125
|
+
if (el.id) {
|
|
1126
|
+
const sel = `#${cssEscape(el.id)}`;
|
|
1127
|
+
if (isUnique(sel, el)) return sel;
|
|
993
1128
|
}
|
|
994
|
-
const
|
|
995
|
-
let
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1129
|
+
const steps = [];
|
|
1130
|
+
let current = el;
|
|
1131
|
+
while (current && steps.length < MAX_SELECTOR_DEPTH) {
|
|
1132
|
+
if (current !== el && current.id) {
|
|
1133
|
+
const anchor = `#${cssEscape(current.id)}`;
|
|
1134
|
+
if (isUnique(anchor, current)) {
|
|
1135
|
+
steps.unshift(anchor);
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
steps.unshift(stepFor(current));
|
|
1140
|
+
const sel = steps.join(" > ");
|
|
1141
|
+
if (isUnique(sel, el)) return sel;
|
|
1142
|
+
if (current.tagName === "BODY" || current.tagName === "HTML") break;
|
|
1143
|
+
current = current.parentElement;
|
|
1009
1144
|
}
|
|
1010
|
-
return
|
|
1145
|
+
return steps.join(" > ");
|
|
1011
1146
|
}
|
|
1012
1147
|
|
|
1013
1148
|
// src/core/picker/element-picker.ts
|
|
@@ -1018,13 +1153,13 @@ function createElementPicker(deps) {
|
|
|
1018
1153
|
const resolver = deps.getComponentResolver();
|
|
1019
1154
|
if (!resolver) return null;
|
|
1020
1155
|
const result = resolver(el);
|
|
1021
|
-
return _nullishCoalesce(_optionalChain([result, 'optionalAccess',
|
|
1156
|
+
return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _29 => _29.name]), () => ( null));
|
|
1022
1157
|
}
|
|
1023
1158
|
function resolveSourcePath(el) {
|
|
1024
1159
|
const resolver = deps.getSourceResolver();
|
|
1025
1160
|
if (!resolver) return null;
|
|
1026
1161
|
const result = resolver(el);
|
|
1027
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
1162
|
+
if (!_optionalChain([result, 'optionalAccess', _30 => _30.filePath])) return null;
|
|
1028
1163
|
let path = result.filePath;
|
|
1029
1164
|
if (result.line != null) {
|
|
1030
1165
|
path += `:${result.line}`;
|
|
@@ -1032,7 +1167,7 @@ function createElementPicker(deps) {
|
|
|
1032
1167
|
return path;
|
|
1033
1168
|
}
|
|
1034
1169
|
function rawElementAtPoint(x, y) {
|
|
1035
|
-
const freezeEl = _optionalChain([deps, 'access',
|
|
1170
|
+
const freezeEl = _optionalChain([deps, 'access', _31 => _31.getFreezeElement, 'optionalCall', _32 => _32()]);
|
|
1036
1171
|
if (freezeEl) freezeEl.style.pointerEvents = "none";
|
|
1037
1172
|
const target = document.elementFromPoint(x, y);
|
|
1038
1173
|
if (freezeEl) freezeEl.style.pointerEvents = "auto";
|
|
@@ -1040,14 +1175,14 @@ function createElementPicker(deps) {
|
|
|
1040
1175
|
}
|
|
1041
1176
|
function elementAtPoint(x, y, exact) {
|
|
1042
1177
|
const raw = rawElementAtPoint(x, y);
|
|
1043
|
-
if (!raw || raw.closest(`[${IGNORE_ATTR}]`)) return raw && _optionalChain([deps, 'access',
|
|
1178
|
+
if (!raw || raw.closest(`[${IGNORE_ATTR}]`)) return raw && _optionalChain([deps, 'access', _33 => _33.isToolbarElement, 'optionalCall', _34 => _34(raw)]) ? raw : null;
|
|
1044
1179
|
return exact ? raw : promoteTarget(raw);
|
|
1045
1180
|
}
|
|
1046
1181
|
function handleMouseMove(e) {
|
|
1047
1182
|
const target = elementAtPoint(e.clientX, e.clientY, e.shiftKey);
|
|
1048
1183
|
if (!target || deps.overlay.isOverlayElement(target)) return;
|
|
1049
1184
|
if (deps.crosshair.isCrosshairElement(target)) return;
|
|
1050
|
-
if (_optionalChain([deps, 'access',
|
|
1185
|
+
if (_optionalChain([deps, 'access', _35 => _35.isToolbarElement, 'optionalCall', _36 => _36(target)])) return;
|
|
1051
1186
|
if (target === hoveredElement) return;
|
|
1052
1187
|
hoveredElement = target;
|
|
1053
1188
|
const componentName = resolveComponentName(target);
|
|
@@ -1058,9 +1193,9 @@ function createElementPicker(deps) {
|
|
|
1058
1193
|
}
|
|
1059
1194
|
function handleClick(e) {
|
|
1060
1195
|
const origin = eventTarget(e);
|
|
1061
|
-
if (origin && _optionalChain([deps, 'access',
|
|
1196
|
+
if (origin && _optionalChain([deps, 'access', _37 => _37.isToolbarElement, 'optionalCall', _38 => _38(origin)])) return;
|
|
1062
1197
|
const target = rawElementAtPoint(e.clientX, e.clientY);
|
|
1063
|
-
if (target && (_optionalChain([deps, 'access',
|
|
1198
|
+
if (target && (_optionalChain([deps, 'access', _39 => _39.isToolbarElement, 'optionalCall', _40 => _40(target)]) || deps.crosshair.isCrosshairElement(target))) return;
|
|
1064
1199
|
e.preventDefault();
|
|
1065
1200
|
e.stopPropagation();
|
|
1066
1201
|
if (hoveredElement) {
|
|
@@ -1137,6 +1272,7 @@ function matchesCombo(e, parsed) {
|
|
|
1137
1272
|
function createKeyboardHandler(deps) {
|
|
1138
1273
|
let holdTimer = null;
|
|
1139
1274
|
let holdActivated = false;
|
|
1275
|
+
let togglePending = false;
|
|
1140
1276
|
let listening = false;
|
|
1141
1277
|
function handleKeyDown(e) {
|
|
1142
1278
|
if (!deps.getEnableInInputs() && isEditableElement(eventTarget(e))) return;
|
|
@@ -1159,6 +1295,7 @@ function createKeyboardHandler(deps) {
|
|
|
1159
1295
|
}
|
|
1160
1296
|
} else {
|
|
1161
1297
|
e.preventDefault();
|
|
1298
|
+
togglePending = true;
|
|
1162
1299
|
}
|
|
1163
1300
|
}
|
|
1164
1301
|
function handleKeyUp(e) {
|
|
@@ -1175,6 +1312,8 @@ function createKeyboardHandler(deps) {
|
|
|
1175
1312
|
deps.onDeactivate();
|
|
1176
1313
|
}
|
|
1177
1314
|
} else {
|
|
1315
|
+
if (!togglePending) return;
|
|
1316
|
+
togglePending = false;
|
|
1178
1317
|
if (deps.isActive()) {
|
|
1179
1318
|
deps.onDeactivate();
|
|
1180
1319
|
} else {
|
|
@@ -1197,6 +1336,7 @@ function createKeyboardHandler(deps) {
|
|
|
1197
1336
|
holdTimer = null;
|
|
1198
1337
|
}
|
|
1199
1338
|
holdActivated = false;
|
|
1339
|
+
togglePending = false;
|
|
1200
1340
|
document.removeEventListener("keydown", handleKeyDown, true);
|
|
1201
1341
|
document.removeEventListener("keyup", handleKeyUp, true);
|
|
1202
1342
|
},
|
|
@@ -1233,7 +1373,7 @@ function createPluginRegistry() {
|
|
|
1233
1373
|
},
|
|
1234
1374
|
callHook(hookName, ...args) {
|
|
1235
1375
|
for (const plugin of plugins.values()) {
|
|
1236
|
-
const hook = _optionalChain([plugin, 'access',
|
|
1376
|
+
const hook = _optionalChain([plugin, 'access', _41 => _41.hooks, 'optionalAccess', _42 => _42[hookName]]);
|
|
1237
1377
|
if (hook) {
|
|
1238
1378
|
try {
|
|
1239
1379
|
hook(...args);
|
|
@@ -1246,7 +1386,7 @@ function createPluginRegistry() {
|
|
|
1246
1386
|
callTransformHook(text, comments) {
|
|
1247
1387
|
let result = text;
|
|
1248
1388
|
for (const plugin of plugins.values()) {
|
|
1249
|
-
const transform = _optionalChain([plugin, 'access',
|
|
1389
|
+
const transform = _optionalChain([plugin, 'access', _43 => _43.hooks, 'optionalAccess', _44 => _44.transformCopyContent]);
|
|
1250
1390
|
if (transform) {
|
|
1251
1391
|
try {
|
|
1252
1392
|
result = transform(result, comments);
|
|
@@ -1264,7 +1404,7 @@ function createPluginRegistry() {
|
|
|
1264
1404
|
for (const cleanup of cleanups.values()) {
|
|
1265
1405
|
try {
|
|
1266
1406
|
cleanup();
|
|
1267
|
-
} catch (
|
|
1407
|
+
} catch (e7) {
|
|
1268
1408
|
}
|
|
1269
1409
|
}
|
|
1270
1410
|
cleanups.clear();
|
|
@@ -1279,7 +1419,7 @@ function isAllowedWebhookUrl(raw) {
|
|
|
1279
1419
|
const url = new URL(raw, typeof location !== "undefined" ? location.href : void 0);
|
|
1280
1420
|
if (url.protocol === "https:") return true;
|
|
1281
1421
|
return url.protocol === "http:" && /^(localhost|127\.0\.0\.1|\[::1\])$/.test(url.hostname);
|
|
1282
|
-
} catch (
|
|
1422
|
+
} catch (e8) {
|
|
1283
1423
|
return false;
|
|
1284
1424
|
}
|
|
1285
1425
|
}
|
|
@@ -1589,7 +1729,7 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1589
1729
|
buttons.finish.addEventListener("click", (e) => {
|
|
1590
1730
|
e.preventDefault();
|
|
1591
1731
|
e.stopPropagation();
|
|
1592
|
-
_optionalChain([callbacks, 'access',
|
|
1732
|
+
_optionalChain([callbacks, 'access', _45 => _45.onFinish, 'optionalCall', _46 => _46()]);
|
|
1593
1733
|
});
|
|
1594
1734
|
container.appendChild(status);
|
|
1595
1735
|
container.appendChild(buttons.finish);
|
|
@@ -1632,16 +1772,16 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1632
1772
|
if (status && buttons.finish) {
|
|
1633
1773
|
const summary = syncSummary(state.toolbar.comments);
|
|
1634
1774
|
status.hidden = !summary;
|
|
1635
|
-
status.textContent = _nullishCoalesce(_optionalChain([summary, 'optionalAccess',
|
|
1636
|
-
status.dataset.tone = _nullishCoalesce(_optionalChain([summary, 'optionalAccess',
|
|
1775
|
+
status.textContent = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _47 => _47.text]), () => ( ""));
|
|
1776
|
+
status.dataset.tone = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _48 => _48.tone]), () => ( ""));
|
|
1637
1777
|
buttons.finish.hidden = count === 0;
|
|
1638
1778
|
}
|
|
1639
1779
|
if (state.options.enabled) {
|
|
1640
1780
|
buttons.enable.classList.add("grabby-btn-active");
|
|
1641
|
-
_optionalChain([leftGroup, 'optionalAccess',
|
|
1781
|
+
_optionalChain([leftGroup, 'optionalAccess', _49 => _49.classList, 'access', _50 => _50.remove, 'call', _51 => _51("grabby-toolbar-left-hidden")]);
|
|
1642
1782
|
} else {
|
|
1643
1783
|
buttons.enable.classList.remove("grabby-btn-active");
|
|
1644
|
-
_optionalChain([leftGroup, 'optionalAccess',
|
|
1784
|
+
_optionalChain([leftGroup, 'optionalAccess', _52 => _52.classList, 'access', _53 => _53.add, 'call', _54 => _54("grabby-toolbar-left-hidden")]);
|
|
1645
1785
|
}
|
|
1646
1786
|
},
|
|
1647
1787
|
isToolbarElement(el) {
|
|
@@ -1655,7 +1795,7 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1655
1795
|
return false;
|
|
1656
1796
|
},
|
|
1657
1797
|
dispose() {
|
|
1658
|
-
_optionalChain([container, 'optionalAccess',
|
|
1798
|
+
_optionalChain([container, 'optionalAccess', _55 => _55.remove, 'call', _56 => _56()]);
|
|
1659
1799
|
removeStyles(STYLE_ID3);
|
|
1660
1800
|
container = null;
|
|
1661
1801
|
leftGroup = null;
|
|
@@ -1705,7 +1845,7 @@ function header(comments, env, ctx) {
|
|
|
1705
1845
|
if (frameworks.length) meta.push(frameworks.join(", "));
|
|
1706
1846
|
const routes = uniq(comments.map((c) => c.page.route));
|
|
1707
1847
|
if (!ctx.showRoutes && routes.length === 1) meta.push(`page ${routes[0]}`);
|
|
1708
|
-
const vp = _optionalChain([comments, 'access',
|
|
1848
|
+
const vp = _optionalChain([comments, 'access', _57 => _57[0], 'optionalAccess', _58 => _58.page, 'access', _59 => _59.viewport]);
|
|
1709
1849
|
if (vp) meta.push(`${vp[0]}\xD7${vp[1]}`);
|
|
1710
1850
|
meta.push((_nullishCoalesce(env.now, () => ( /* @__PURE__ */ new Date()))).toISOString().slice(0, 10));
|
|
1711
1851
|
lines.push(meta.join(" \xB7 "));
|
|
@@ -1731,8 +1871,8 @@ function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
|
1731
1871
|
const b = (text) => lines.push(` - ${text}`);
|
|
1732
1872
|
const where = [`\`${t.preview}\``, `(${t.kind})`];
|
|
1733
1873
|
if (t.component && t.component !== headedComponent) {
|
|
1734
|
-
where.push(_optionalChain([t, 'access',
|
|
1735
|
-
} else if (_optionalChain([t, 'access',
|
|
1874
|
+
where.push(_optionalChain([t, 'access', _60 => _60.source, 'optionalAccess', _61 => _61.line]) != null && groupHasSource ? `${t.component} line ${t.source.line}` : t.component);
|
|
1875
|
+
} else if (_optionalChain([t, 'access', _62 => _62.source, 'optionalAccess', _63 => _63.line]) != null && groupHasSource) {
|
|
1736
1876
|
where.push(`line ${t.source.line}`);
|
|
1737
1877
|
}
|
|
1738
1878
|
b(where.join(" "));
|
|
@@ -1748,7 +1888,7 @@ function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
|
1748
1888
|
for (const [k, v] of Object.entries(t.extra)) b(`${k}: ${v}`);
|
|
1749
1889
|
b(`viewport: ${c.page.viewport[0]}\xD7${c.page.viewport[1]}`);
|
|
1750
1890
|
}
|
|
1751
|
-
if (_optionalChain([c, 'access',
|
|
1891
|
+
if (_optionalChain([c, 'access', _64 => _64.screenshot, 'optionalAccess', _65 => _65.url])) b(`screenshot: ${c.screenshot.url}`);
|
|
1752
1892
|
const meta = [];
|
|
1753
1893
|
if (ctx.showAuthors) meta.push(`by ${authorLabel(c.author)}`);
|
|
1754
1894
|
if (ctx.showRoutes) meta.push(`on ${c.page.route}`);
|
|
@@ -1774,7 +1914,7 @@ function formatExport(comments, level = "standard", env = {}) {
|
|
|
1774
1914
|
}
|
|
1775
1915
|
const groups = /* @__PURE__ */ new Map();
|
|
1776
1916
|
for (const c of ordered) {
|
|
1777
|
-
const key = _nullishCoalesce(_optionalChain([c, 'access',
|
|
1917
|
+
const key = _nullishCoalesce(_optionalChain([c, 'access', _66 => _66.target, 'access', _67 => _67.source, 'optionalAccess', _68 => _68.file]), () => ( ""));
|
|
1778
1918
|
const list = groups.get(key);
|
|
1779
1919
|
if (list) list.push(c);
|
|
1780
1920
|
else groups.set(key, [c]);
|
|
@@ -1784,7 +1924,7 @@ function formatExport(comments, level = "standard", env = {}) {
|
|
|
1784
1924
|
out.push("");
|
|
1785
1925
|
const components = uniq(list.map((c) => c.target.component));
|
|
1786
1926
|
const headed = file && components.length === 1 ? components[0] : null;
|
|
1787
|
-
const lines = uniq(list.map((c) => _nullishCoalesce(_optionalChain([c, 'access',
|
|
1927
|
+
const lines = uniq(list.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _69 => _69.target, 'access', _70 => _70.source, 'optionalAccess', _71 => _71.line]), () => ( null))));
|
|
1788
1928
|
if (file) {
|
|
1789
1929
|
const loc = lines.length === 1 ? location2(file, lines[0], true) : file;
|
|
1790
1930
|
out.push(`## ${loc}${headed ? ` \xB7 ${headed}` : ""}`);
|
|
@@ -1819,7 +1959,7 @@ function openDb() {
|
|
|
1819
1959
|
req.onsuccess = () => resolve(req.result);
|
|
1820
1960
|
req.onerror = () => resolve(null);
|
|
1821
1961
|
req.onblocked = () => resolve(null);
|
|
1822
|
-
} catch (
|
|
1962
|
+
} catch (e9) {
|
|
1823
1963
|
resolve(null);
|
|
1824
1964
|
}
|
|
1825
1965
|
});
|
|
@@ -1835,7 +1975,7 @@ async function run(mode, fn) {
|
|
|
1835
1975
|
tx.oncomplete = () => resolve(req ? req.result : null);
|
|
1836
1976
|
tx.onerror = () => resolve(null);
|
|
1837
1977
|
tx.onabort = () => resolve(null);
|
|
1838
|
-
} catch (
|
|
1978
|
+
} catch (e10) {
|
|
1839
1979
|
resolve(null);
|
|
1840
1980
|
}
|
|
1841
1981
|
});
|
|
@@ -1969,7 +2109,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
1969
2109
|
let visible = false;
|
|
1970
2110
|
let objectUrls = [];
|
|
1971
2111
|
function ensurePanel() {
|
|
1972
|
-
if (_optionalChain([panel, 'optionalAccess',
|
|
2112
|
+
if (_optionalChain([panel, 'optionalAccess', _72 => _72.isConnected])) return panel;
|
|
1973
2113
|
addStyles(STYLE_ID4, CSS2);
|
|
1974
2114
|
panel = h("div", { id: PANEL_ID, role: "dialog", "aria-label": "Comments" });
|
|
1975
2115
|
getUiRoot().appendChild(panel);
|
|
@@ -1980,7 +2120,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
1980
2120
|
objectUrls = [];
|
|
1981
2121
|
}
|
|
1982
2122
|
function thumbnail(comment) {
|
|
1983
|
-
const localId = _optionalChain([comment, 'access',
|
|
2123
|
+
const localId = _optionalChain([comment, 'access', _73 => _73.screenshot, 'optionalAccess', _74 => _74.localId]);
|
|
1984
2124
|
if (!localId) return null;
|
|
1985
2125
|
const img = h("img", { class: "grabby-thumb", alt: "", loading: "lazy" });
|
|
1986
2126
|
img.addEventListener("error", () => img.remove(), { once: true });
|
|
@@ -1997,16 +2137,18 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
1997
2137
|
}
|
|
1998
2138
|
function row2(comment, showAuthors) {
|
|
1999
2139
|
const t = comment.target;
|
|
2000
|
-
const meta = [h("span", { class: "grabby-kind" }, t.kind)];
|
|
2001
|
-
if (
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2140
|
+
const meta = live ? [document.createTextNode(`${describeTarget(t)} `)] : [h("span", { class: "grabby-kind" }, t.kind)];
|
|
2141
|
+
if (!live) {
|
|
2142
|
+
if (t.component) meta.push(document.createTextNode(`${t.component} `));
|
|
2143
|
+
if (t.source) {
|
|
2144
|
+
meta.push(h("a", {
|
|
2145
|
+
href: vsCodeUri2(t.source.file, t.source.line, t.source.column),
|
|
2146
|
+
title: `Open ${t.source.file} in VS Code`,
|
|
2147
|
+
onclick: (e) => e.stopPropagation()
|
|
2148
|
+
}, `${basename2(t.source.file)}${t.source.line != null ? `:${t.source.line}` : ""}`));
|
|
2149
|
+
} else if (!t.component) {
|
|
2150
|
+
meta.push(document.createTextNode(`<${t.tag}>`));
|
|
2151
|
+
}
|
|
2010
2152
|
}
|
|
2011
2153
|
const tail = [showAuthors && !live ? authorLabel(comment.author) : "", formatRelativeTime(comment.createdAt)].filter(Boolean);
|
|
2012
2154
|
meta.push(document.createTextNode(` \xB7 ${tail.join(" \xB7 ")}`));
|
|
@@ -2087,7 +2229,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2087
2229
|
h("strong", null, live ? "Nothing sent yet" : "No comments yet"),
|
|
2088
2230
|
live ? "Click Comment, then click the part of the page you want to talk about." : "Click the hand icon (or press Alt+G), then click anything on the page to comment on it."
|
|
2089
2231
|
) : h("div", { class: "grabby-panel-list" }, ...comments.map((c) => row2(c, showAuthors)));
|
|
2090
|
-
const who = _nullishCoalesce(_optionalChain([options, 'access',
|
|
2232
|
+
const who = _nullishCoalesce(_optionalChain([options, 'access', _75 => _75.identityLabel, 'optionalCall', _76 => _76()]), () => ( null));
|
|
2091
2233
|
let footer = null;
|
|
2092
2234
|
if (live && who) {
|
|
2093
2235
|
footer = h(
|
|
@@ -2100,7 +2242,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2100
2242
|
"data-grabby-change-identity": "",
|
|
2101
2243
|
onclick: (e) => {
|
|
2102
2244
|
e.stopPropagation();
|
|
2103
|
-
_optionalChain([callbacks, 'access',
|
|
2245
|
+
_optionalChain([callbacks, 'access', _77 => _77.onChangeIdentity, 'optionalCall', _78 => _78()]);
|
|
2104
2246
|
}
|
|
2105
2247
|
}, "Change")
|
|
2106
2248
|
);
|
|
@@ -2134,7 +2276,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2134
2276
|
},
|
|
2135
2277
|
hide() {
|
|
2136
2278
|
visible = false;
|
|
2137
|
-
_optionalChain([panel, 'optionalAccess',
|
|
2279
|
+
_optionalChain([panel, 'optionalAccess', _79 => _79.classList, 'access', _80 => _80.remove, 'call', _81 => _81("grabby-popover-visible")]);
|
|
2138
2280
|
},
|
|
2139
2281
|
isVisible() {
|
|
2140
2282
|
return visible;
|
|
@@ -2144,7 +2286,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2144
2286
|
},
|
|
2145
2287
|
dispose() {
|
|
2146
2288
|
revokeThumbs();
|
|
2147
|
-
_optionalChain([panel, 'optionalAccess',
|
|
2289
|
+
_optionalChain([panel, 'optionalAccess', _82 => _82.remove, 'call', _83 => _83()]);
|
|
2148
2290
|
removeStyles(STYLE_ID4);
|
|
2149
2291
|
panel = null;
|
|
2150
2292
|
visible = false;
|
|
@@ -2304,7 +2446,7 @@ function createCommentPopover(callbacks) {
|
|
|
2304
2446
|
autocomplete: "name",
|
|
2305
2447
|
"aria-label": "Your name"
|
|
2306
2448
|
});
|
|
2307
|
-
const post = () => finish({ name: _optionalChain([nameInput, 'optionalAccess',
|
|
2449
|
+
const post = () => finish({ name: _optionalChain([nameInput, 'optionalAccess', _84 => _84.value, 'access', _85 => _85.trim, 'call', _86 => _86()]) || null });
|
|
2308
2450
|
popover.replaceChildren(
|
|
2309
2451
|
h("div", { class: "grabby-cp-title" }, "Thanks! Who is this from?"),
|
|
2310
2452
|
h("div", { class: "grabby-cp-sub" }, "Your name helps the team follow up. It's remembered in this browser."),
|
|
@@ -2338,7 +2480,7 @@ function createCommentPopover(callbacks) {
|
|
|
2338
2480
|
} else if (e.key === "Enter" && deepActiveElement() === nameInput) {
|
|
2339
2481
|
e.preventDefault();
|
|
2340
2482
|
e.stopImmediatePropagation();
|
|
2341
|
-
finish({ name: _optionalChain([nameInput, 'optionalAccess',
|
|
2483
|
+
finish({ name: _optionalChain([nameInput, 'optionalAccess', _87 => _87.value, 'access', _88 => _88.trim, 'call', _89 => _89()]) || null });
|
|
2342
2484
|
}
|
|
2343
2485
|
return;
|
|
2344
2486
|
}
|
|
@@ -2373,7 +2515,7 @@ function createCommentPopover(callbacks) {
|
|
|
2373
2515
|
}
|
|
2374
2516
|
function doHide() {
|
|
2375
2517
|
visible = false;
|
|
2376
|
-
_optionalChain([popover, 'optionalAccess',
|
|
2518
|
+
_optionalChain([popover, 'optionalAccess', _90 => _90.remove, 'call', _91 => _91()]);
|
|
2377
2519
|
popover = null;
|
|
2378
2520
|
textarea = null;
|
|
2379
2521
|
nameInput = null;
|
|
@@ -2391,8 +2533,8 @@ function createCommentPopover(callbacks) {
|
|
|
2391
2533
|
visible = true;
|
|
2392
2534
|
position(el, opts.anchor);
|
|
2393
2535
|
attachKey();
|
|
2394
|
-
_optionalChain([textarea, 'optionalAccess',
|
|
2395
|
-
requestAnimationFrame(() => _optionalChain([textarea, 'optionalAccess',
|
|
2536
|
+
_optionalChain([textarea, 'optionalAccess', _92 => _92.focus, 'call', _93 => _93()]);
|
|
2537
|
+
requestAnimationFrame(() => _optionalChain([textarea, 'optionalAccess', _94 => _94.focus, 'call', _95 => _95()]));
|
|
2396
2538
|
},
|
|
2397
2539
|
hide() {
|
|
2398
2540
|
if (!visible) return;
|
|
@@ -2404,7 +2546,7 @@ function createCommentPopover(callbacks) {
|
|
|
2404
2546
|
hasDraft() {
|
|
2405
2547
|
if (!visible) return false;
|
|
2406
2548
|
if (stage === "identity") return true;
|
|
2407
|
-
const v = _nullishCoalesce(_optionalChain([textarea, 'optionalAccess',
|
|
2549
|
+
const v = _nullishCoalesce(_optionalChain([textarea, 'optionalAccess', _96 => _96.value, 'access', _97 => _97.trim, 'call', _98 => _98()]), () => ( ""));
|
|
2408
2550
|
return v !== "" && v !== initialValue.trim();
|
|
2409
2551
|
},
|
|
2410
2552
|
isPopoverElement(el) {
|
|
@@ -2493,7 +2635,7 @@ function createCopySheet(callbacks) {
|
|
|
2493
2635
|
document.removeEventListener("keydown", keyHandler, true);
|
|
2494
2636
|
keyHandler = null;
|
|
2495
2637
|
}
|
|
2496
|
-
_optionalChain([callbacks, 'access',
|
|
2638
|
+
_optionalChain([callbacks, 'access', _99 => _99.onClose, 'optionalCall', _100 => _100()]);
|
|
2497
2639
|
}
|
|
2498
2640
|
function open(options) {
|
|
2499
2641
|
close();
|
|
@@ -2515,12 +2657,12 @@ function createCopySheet(callbacks) {
|
|
|
2515
2657
|
level = next;
|
|
2516
2658
|
edited = false;
|
|
2517
2659
|
textarea.value = options.render(level);
|
|
2518
|
-
hint.textContent = _nullishCoalesce(_optionalChain([LEVELS, 'access',
|
|
2660
|
+
hint.textContent = _nullishCoalesce(_optionalChain([LEVELS, 'access', _101 => _101.find, 'call', _102 => _102((l) => l.id === level), 'optionalAccess', _103 => _103.hint]), () => ( ""));
|
|
2519
2661
|
for (const [id, btn] of segButtons) btn.setAttribute("aria-checked", String(id === level));
|
|
2520
2662
|
status.classList.remove("grabby-error");
|
|
2521
2663
|
status.textContent = discarded ? "Your edits were replaced by the new detail level." : "";
|
|
2522
2664
|
updateTokens();
|
|
2523
|
-
_optionalChain([callbacks, 'access',
|
|
2665
|
+
_optionalChain([callbacks, 'access', _104 => _104.onLevelChange, 'optionalCall', _105 => _105(level)]);
|
|
2524
2666
|
}
|
|
2525
2667
|
const seg = h(
|
|
2526
2668
|
"div",
|
|
@@ -2598,7 +2740,7 @@ function createCopySheet(callbacks) {
|
|
|
2598
2740
|
document.addEventListener("keydown", keyHandler, true);
|
|
2599
2741
|
getUiRoot().appendChild(sheet);
|
|
2600
2742
|
setLevel(level, true);
|
|
2601
|
-
_optionalChain([sheet, 'access',
|
|
2743
|
+
_optionalChain([sheet, 'access', _106 => _106.querySelector, 'call', _107 => _107("[data-grabby-copy-clear]"), 'optionalAccess', _108 => _108.focus, 'call', _109 => _109()]);
|
|
2602
2744
|
}
|
|
2603
2745
|
return {
|
|
2604
2746
|
open,
|
|
@@ -2746,7 +2888,7 @@ function createFinishSheet(callbacks) {
|
|
|
2746
2888
|
...note ? [h("div", { class: "grabby-finish-note" }, note)] : [],
|
|
2747
2889
|
h("div", { class: "grabby-finish-actions" }, ...actions)
|
|
2748
2890
|
);
|
|
2749
|
-
_optionalChain([sheet, 'access',
|
|
2891
|
+
_optionalChain([sheet, 'access', _110 => _110.querySelector, 'call', _111 => _111(".grabby-btn-primary:not([disabled])"), 'optionalAccess', _112 => _112.focus, 'call', _113 => _113()]);
|
|
2750
2892
|
}
|
|
2751
2893
|
return {
|
|
2752
2894
|
open(next) {
|
|
@@ -2816,21 +2958,21 @@ var CSS5 = `
|
|
|
2816
2958
|
function seen() {
|
|
2817
2959
|
try {
|
|
2818
2960
|
return localStorage.getItem(SEEN_KEY) === "1";
|
|
2819
|
-
} catch (
|
|
2961
|
+
} catch (e11) {
|
|
2820
2962
|
return false;
|
|
2821
2963
|
}
|
|
2822
2964
|
}
|
|
2823
2965
|
function markSeen() {
|
|
2824
2966
|
try {
|
|
2825
2967
|
localStorage.setItem(SEEN_KEY, "1");
|
|
2826
|
-
} catch (
|
|
2968
|
+
} catch (e12) {
|
|
2827
2969
|
}
|
|
2828
2970
|
}
|
|
2829
2971
|
function createCoachMark() {
|
|
2830
2972
|
let el = null;
|
|
2831
2973
|
function dismiss() {
|
|
2832
2974
|
markSeen();
|
|
2833
|
-
_optionalChain([el, 'optionalAccess',
|
|
2975
|
+
_optionalChain([el, 'optionalAccess', _114 => _114.remove, 'call', _115 => _115()]);
|
|
2834
2976
|
el = null;
|
|
2835
2977
|
}
|
|
2836
2978
|
return {
|
|
@@ -2862,7 +3004,7 @@ function createCoachMark() {
|
|
|
2862
3004
|
},
|
|
2863
3005
|
dismiss,
|
|
2864
3006
|
dispose() {
|
|
2865
|
-
_optionalChain([el, 'optionalAccess',
|
|
3007
|
+
_optionalChain([el, 'optionalAccess', _116 => _116.remove, 'call', _117 => _117()]);
|
|
2866
3008
|
el = null;
|
|
2867
3009
|
removeStyles(STYLE_ID8);
|
|
2868
3010
|
}
|
|
@@ -2879,8 +3021,8 @@ function loadJobs() {
|
|
|
2879
3021
|
const raw = localStorage.getItem(STORE_KEY);
|
|
2880
3022
|
const jobs = raw ? JSON.parse(raw) : [];
|
|
2881
3023
|
if (!Array.isArray(jobs)) return [];
|
|
2882
|
-
return jobs.filter((j) => typeof j.id === "string" && (j.kind === "comment" || j.kind === "shot")).map((j) => typeof j.created === "number" ? j : { ...j, created: Date.now() });
|
|
2883
|
-
} catch (
|
|
3024
|
+
return jobs.filter((j) => typeof j.id === "string" && (j.kind === "comment" || j.kind === "shot" || j.kind === "delete" && typeof j.session === "string")).map((j) => typeof j.created === "number" ? j : { ...j, created: Date.now() });
|
|
3025
|
+
} catch (e13) {
|
|
2884
3026
|
return [];
|
|
2885
3027
|
}
|
|
2886
3028
|
}
|
|
@@ -2899,7 +3041,7 @@ function createOutbox(deps) {
|
|
|
2899
3041
|
try {
|
|
2900
3042
|
if (jobs.length) localStorage.setItem(STORE_KEY, JSON.stringify(jobs));
|
|
2901
3043
|
else localStorage.removeItem(STORE_KEY);
|
|
2902
|
-
} catch (
|
|
3044
|
+
} catch (e14) {
|
|
2903
3045
|
}
|
|
2904
3046
|
}
|
|
2905
3047
|
function headers(extra = {}) {
|
|
@@ -2936,20 +3078,34 @@ function createOutbox(deps) {
|
|
|
2936
3078
|
body
|
|
2937
3079
|
});
|
|
2938
3080
|
}
|
|
3081
|
+
function deleteComment(id, session) {
|
|
3082
|
+
return fetch(`${base}/v1/comments/${encodeURIComponent(id)}`, {
|
|
3083
|
+
method: "DELETE",
|
|
3084
|
+
credentials: "omit",
|
|
3085
|
+
keepalive: true,
|
|
3086
|
+
headers: headers({ "X-Grabby-Session": session })
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
2939
3089
|
async function deliver(job) {
|
|
3090
|
+
if (job.kind === "delete") {
|
|
3091
|
+
const res2 = await deleteComment(job.id, job.session);
|
|
3092
|
+
if (res2.ok || res2.status === 404) return "done";
|
|
3093
|
+
if (res2.status === 429 || res2.status >= 500) return "retry";
|
|
3094
|
+
return "drop";
|
|
3095
|
+
}
|
|
2940
3096
|
const comment = deps.getComment(job.id);
|
|
2941
3097
|
if (!comment) return "drop";
|
|
2942
3098
|
if (job.kind === "comment") {
|
|
2943
3099
|
const res2 = await postComment(comment);
|
|
2944
3100
|
if (res2.ok) {
|
|
2945
|
-
if (_optionalChain([deps, 'access',
|
|
3101
|
+
if (_optionalChain([deps, 'access', _118 => _118.getComment, 'call', _119 => _119(job.id), 'optionalAccess', _120 => _120.screenshot, 'optionalAccess', _121 => _121.localId])) add(job.id, "shot");
|
|
2946
3102
|
return "done";
|
|
2947
3103
|
}
|
|
2948
3104
|
if (res2.status === 429 || res2.status >= 500) return "retry";
|
|
2949
3105
|
deps.onState(job.id, "failed", await res2.text().catch(() => String(res2.status)));
|
|
2950
3106
|
return "drop";
|
|
2951
3107
|
}
|
|
2952
|
-
const localId = _optionalChain([comment, 'access',
|
|
3108
|
+
const localId = _optionalChain([comment, 'access', _122 => _122.screenshot, 'optionalAccess', _123 => _123.localId]);
|
|
2953
3109
|
const blob = localId ? await deps.getScreenshot(localId) : null;
|
|
2954
3110
|
if (!blob) return "drop";
|
|
2955
3111
|
const { width, height } = comment.screenshot;
|
|
@@ -2973,7 +3129,7 @@ function createOutbox(deps) {
|
|
|
2973
3129
|
let outcome;
|
|
2974
3130
|
try {
|
|
2975
3131
|
outcome = await deliver(job);
|
|
2976
|
-
} catch (
|
|
3132
|
+
} catch (e15) {
|
|
2977
3133
|
outcome = "retry";
|
|
2978
3134
|
}
|
|
2979
3135
|
if (outcome === "retry" && Date.now() - job.created < GIVE_UP_AFTER_MS) {
|
|
@@ -3001,6 +3157,19 @@ function createOutbox(deps) {
|
|
|
3001
3157
|
if (jobs.length) schedule(500);
|
|
3002
3158
|
return {
|
|
3003
3159
|
send: (id) => add(id, "comment"),
|
|
3160
|
+
remove(id, sessionId, delayMs = 0) {
|
|
3161
|
+
jobs = jobs.filter((j) => j.id !== id);
|
|
3162
|
+
jobs.push({ id, kind: "delete", session: sessionId, attempts: 0, next: Date.now() + delayMs, created: Date.now() });
|
|
3163
|
+
save();
|
|
3164
|
+
schedule(0);
|
|
3165
|
+
},
|
|
3166
|
+
cancelRemove(id) {
|
|
3167
|
+
const job = jobs.find((j) => j.id === id && j.kind === "delete");
|
|
3168
|
+
if (!job) return false;
|
|
3169
|
+
jobs = jobs.filter((j) => j !== job);
|
|
3170
|
+
save();
|
|
3171
|
+
return job.attempts === 0;
|
|
3172
|
+
},
|
|
3004
3173
|
sendScreenshot: (id) => {
|
|
3005
3174
|
if (!jobs.some((j) => j.id === id && j.kind === "comment")) add(id, "shot");
|
|
3006
3175
|
},
|
|
@@ -3008,11 +3177,18 @@ function createOutbox(deps) {
|
|
|
3008
3177
|
flush: onOnline,
|
|
3009
3178
|
flushOnExit() {
|
|
3010
3179
|
for (const job of jobs) {
|
|
3180
|
+
if (job.kind === "delete") {
|
|
3181
|
+
job.attempts += 1;
|
|
3182
|
+
deleteComment(job.id, job.session).catch(() => {
|
|
3183
|
+
});
|
|
3184
|
+
continue;
|
|
3185
|
+
}
|
|
3011
3186
|
if (job.kind !== "comment") continue;
|
|
3012
3187
|
const comment = deps.getComment(job.id);
|
|
3013
3188
|
if (comment) postComment(comment).catch(() => {
|
|
3014
3189
|
});
|
|
3015
3190
|
}
|
|
3191
|
+
save();
|
|
3016
3192
|
},
|
|
3017
3193
|
dispose() {
|
|
3018
3194
|
disposed = true;
|
|
@@ -3113,7 +3289,7 @@ function createFreezeOverlay() {
|
|
|
3113
3289
|
let rules;
|
|
3114
3290
|
try {
|
|
3115
3291
|
rules = sheet.cssRules;
|
|
3116
|
-
} catch (
|
|
3292
|
+
} catch (e16) {
|
|
3117
3293
|
continue;
|
|
3118
3294
|
}
|
|
3119
3295
|
collectHoverRules(rules, cloned);
|
|
@@ -3190,7 +3366,7 @@ function createFreezeOverlay() {
|
|
|
3190
3366
|
removeHoverRules();
|
|
3191
3367
|
unfreezeAnimations();
|
|
3192
3368
|
unblockEvents();
|
|
3193
|
-
_optionalChain([overlay, 'optionalAccess',
|
|
3369
|
+
_optionalChain([overlay, 'optionalAccess', _124 => _124.remove, 'call', _125 => _125()]);
|
|
3194
3370
|
removeStyles(FREEZE_STYLE_ID);
|
|
3195
3371
|
overlay = null;
|
|
3196
3372
|
visible = false;
|
|
@@ -3301,10 +3477,10 @@ function loadHistory() {
|
|
|
3301
3477
|
return [];
|
|
3302
3478
|
}
|
|
3303
3479
|
return parsed.entries;
|
|
3304
|
-
} catch (
|
|
3480
|
+
} catch (e17) {
|
|
3305
3481
|
try {
|
|
3306
3482
|
localStorage.removeItem(STORAGE_KEY);
|
|
3307
|
-
} catch (
|
|
3483
|
+
} catch (e18) {
|
|
3308
3484
|
}
|
|
3309
3485
|
return [];
|
|
3310
3486
|
}
|
|
@@ -3338,7 +3514,7 @@ function writeWithQuotaFallback(entries) {
|
|
|
3338
3514
|
const half = entries.slice(0, Math.floor(entries.length / 2));
|
|
3339
3515
|
try {
|
|
3340
3516
|
localStorage.setItem(STORAGE_KEY, JSON.stringify({ v: SCHEMA_VERSION, entries: half }));
|
|
3341
|
-
} catch (
|
|
3517
|
+
} catch (e19) {
|
|
3342
3518
|
warnQuotaOnce();
|
|
3343
3519
|
}
|
|
3344
3520
|
} else {
|
|
@@ -3364,7 +3540,7 @@ function clearPersistedHistory() {
|
|
|
3364
3540
|
pendingEntries = null;
|
|
3365
3541
|
try {
|
|
3366
3542
|
localStorage.removeItem(STORAGE_KEY);
|
|
3367
|
-
} catch (
|
|
3543
|
+
} catch (e20) {
|
|
3368
3544
|
}
|
|
3369
3545
|
}
|
|
3370
3546
|
|
|
@@ -3372,7 +3548,7 @@ function clearPersistedHistory() {
|
|
|
3372
3548
|
var baselineFrame = null;
|
|
3373
3549
|
var baselineCache = /* @__PURE__ */ new Map();
|
|
3374
3550
|
function baselineDoc() {
|
|
3375
|
-
if (_optionalChain([baselineFrame, 'optionalAccess',
|
|
3551
|
+
if (_optionalChain([baselineFrame, 'optionalAccess', _126 => _126.isConnected]) && baselineFrame.contentDocument) return baselineFrame.contentDocument;
|
|
3376
3552
|
try {
|
|
3377
3553
|
baselineFrame = document.createElement("iframe");
|
|
3378
3554
|
baselineFrame.setAttribute("aria-hidden", "true");
|
|
@@ -3388,7 +3564,7 @@ function baselineDoc() {
|
|
|
3388
3564
|
});
|
|
3389
3565
|
document.documentElement.appendChild(baselineFrame);
|
|
3390
3566
|
return baselineFrame.contentDocument;
|
|
3391
|
-
} catch (
|
|
3567
|
+
} catch (e21) {
|
|
3392
3568
|
return null;
|
|
3393
3569
|
}
|
|
3394
3570
|
}
|
|
@@ -3402,8 +3578,8 @@ function baselineFor(tag, type, props) {
|
|
|
3402
3578
|
const missing = props.filter((p) => !cached.has(p));
|
|
3403
3579
|
if (missing.length > 0) {
|
|
3404
3580
|
const doc = baselineDoc();
|
|
3405
|
-
const view = _optionalChain([doc, 'optionalAccess',
|
|
3406
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
3581
|
+
const view = _optionalChain([doc, 'optionalAccess', _127 => _127.defaultView]);
|
|
3582
|
+
if (_optionalChain([doc, 'optionalAccess', _128 => _128.body]) && view) {
|
|
3407
3583
|
const probe = doc.createElement(tag);
|
|
3408
3584
|
if (type) probe.setAttribute("type", type);
|
|
3409
3585
|
doc.body.appendChild(probe);
|
|
@@ -3417,7 +3593,7 @@ function baselineFor(tag, type, props) {
|
|
|
3417
3593
|
return cached;
|
|
3418
3594
|
}
|
|
3419
3595
|
function disposeStyleBaseline() {
|
|
3420
|
-
_optionalChain([baselineFrame, 'optionalAccess',
|
|
3596
|
+
_optionalChain([baselineFrame, 'optionalAccess', _129 => _129.remove, 'call', _130 => _130()]);
|
|
3421
3597
|
baselineFrame = null;
|
|
3422
3598
|
baselineCache.clear();
|
|
3423
3599
|
}
|
|
@@ -3451,7 +3627,7 @@ function customStyles(el, props) {
|
|
|
3451
3627
|
let cs;
|
|
3452
3628
|
try {
|
|
3453
3629
|
cs = getComputedStyle(el);
|
|
3454
|
-
} catch (
|
|
3630
|
+
} catch (e22) {
|
|
3455
3631
|
return out;
|
|
3456
3632
|
}
|
|
3457
3633
|
const tag = el.tagName.toLowerCase();
|
|
@@ -3519,7 +3695,7 @@ function states(el) {
|
|
|
3519
3695
|
}
|
|
3520
3696
|
function actionFacts(el) {
|
|
3521
3697
|
const f = {};
|
|
3522
|
-
const imgAlt = _nullishCoalesce(_optionalChain([el, 'access',
|
|
3698
|
+
const imgAlt = _nullishCoalesce(_optionalChain([el, 'access', _131 => _131.querySelector, 'call', _132 => _132("img[alt]"), 'optionalAccess', _133 => _133.getAttribute, 'call', _134 => _134("alt")]), () => ( ""));
|
|
3523
3699
|
put(f, "label", accessibleLabel(el) || textOf(el, 80) || redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))) || redact(imgAlt));
|
|
3524
3700
|
if (el.tagName === "A") put(f, "href", sanitizeUrl(_nullishCoalesce(el.getAttribute("href"), () => ( ""))));
|
|
3525
3701
|
else if (el.tagName === "BUTTON" || el.tagName === "INPUT") put(f, "type", _nullishCoalesce(el.getAttribute("type"), () => ( (el.tagName === "BUTTON" ? "submit" : ""))));
|
|
@@ -3568,7 +3744,7 @@ function mediaFacts(el) {
|
|
|
3568
3744
|
put(f, "label", accessibleLabel(el) || textOf(_nullishCoalesce(el.querySelector("title"), () => ( el)), 40));
|
|
3569
3745
|
put(f, "viewBox", _nullishCoalesce(el.getAttribute("viewBox"), () => ( "")));
|
|
3570
3746
|
} else if (el.tagName === "VIDEO" || el.tagName === "AUDIO" || el.tagName === "IFRAME") {
|
|
3571
|
-
put(f, "src", basename3(_nullishCoalesce(_nullishCoalesce(el.getAttribute("src"), () => ( _optionalChain([el, 'access',
|
|
3747
|
+
put(f, "src", basename3(_nullishCoalesce(_nullishCoalesce(el.getAttribute("src"), () => ( _optionalChain([el, 'access', _135 => _135.querySelector, 'call', _136 => _136("source"), 'optionalAccess', _137 => _137.getAttribute, 'call', _138 => _138("src")]))), () => ( ""))));
|
|
3572
3748
|
put(f, "title", redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))));
|
|
3573
3749
|
}
|
|
3574
3750
|
put(f, "size", size(el));
|
|
@@ -3576,8 +3752,8 @@ function mediaFacts(el) {
|
|
|
3576
3752
|
return f;
|
|
3577
3753
|
}
|
|
3578
3754
|
function childLabel(child, resolver) {
|
|
3579
|
-
const resolved = _optionalChain([resolver, 'optionalCall',
|
|
3580
|
-
if (_optionalChain([resolved, 'optionalAccess',
|
|
3755
|
+
const resolved = _optionalChain([resolver, 'optionalCall', _139 => _139(child)]);
|
|
3756
|
+
if (_optionalChain([resolved, 'optionalAccess', _140 => _140.name]) && resolved.hostElement === child) return resolved.name;
|
|
3581
3757
|
const tag = child.tagName.toLowerCase();
|
|
3582
3758
|
if (/^h[1-6]$/.test(tag)) return "heading";
|
|
3583
3759
|
if (tag === "a") return "link";
|
|
@@ -3596,13 +3772,13 @@ function childSummary(el, resolver) {
|
|
|
3596
3772
|
if (counts.size > 6) parts.push("\u2026");
|
|
3597
3773
|
return parts.join(", ");
|
|
3598
3774
|
}
|
|
3599
|
-
function
|
|
3775
|
+
function firstHeading2(el) {
|
|
3600
3776
|
const heading = el.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]');
|
|
3601
3777
|
return heading ? textOf(heading, 60) : "";
|
|
3602
3778
|
}
|
|
3603
3779
|
function containerFacts(el, resolver) {
|
|
3604
3780
|
const f = {};
|
|
3605
|
-
put(f, "heading",
|
|
3781
|
+
put(f, "heading", firstHeading2(el));
|
|
3606
3782
|
put(f, "contains", childSummary(el, resolver));
|
|
3607
3783
|
put(f, "size", size(el));
|
|
3608
3784
|
put(f, "layout", formatStyles(customStyles(el, CONTAINER_STYLES)));
|
|
@@ -3612,8 +3788,8 @@ function sectionFacts(el, resolver) {
|
|
|
3612
3788
|
const f = {};
|
|
3613
3789
|
put(f, "title", redact(el.ownerDocument.title));
|
|
3614
3790
|
put(f, "viewport", `${window.innerWidth}\xD7${window.innerHeight}`);
|
|
3615
|
-
const regions = Array.from(el.querySelectorAll('header, nav, main, aside, footer, section, [role="region"]')).filter((r) => !_optionalChain([r, 'access',
|
|
3616
|
-
const heading =
|
|
3791
|
+
const regions = Array.from(el.querySelectorAll('header, nav, main, aside, footer, section, [role="region"]')).filter((r) => !_optionalChain([r, 'access', _141 => _141.parentElement, 'optionalAccess', _142 => _142.closest, 'call', _143 => _143('header, nav, main, aside, footer, section, [role="region"]')]) || r.parentElement === el).slice(0, 8).map((r) => {
|
|
3792
|
+
const heading = firstHeading2(r);
|
|
3617
3793
|
return heading ? `${r.tagName.toLowerCase()} "${truncate(heading, 30)}"` : r.tagName.toLowerCase();
|
|
3618
3794
|
});
|
|
3619
3795
|
put(f, "regions", regions.join(", "));
|
|
@@ -3669,22 +3845,22 @@ function isAppFile(file) {
|
|
|
3669
3845
|
return !!file && !/(^|[\\/])node_modules[\\/]/.test(file);
|
|
3670
3846
|
}
|
|
3671
3847
|
function resolveStack(el, deps) {
|
|
3672
|
-
const comp = _nullishCoalesce(_optionalChain([deps, 'access',
|
|
3848
|
+
const comp = _nullishCoalesce(_optionalChain([deps, 'access', _144 => _144.componentResolver, 'optionalCall', _145 => _145(el)]), () => ( null));
|
|
3673
3849
|
const frames = [];
|
|
3674
3850
|
const named = [];
|
|
3675
|
-
for (const entry of _nullishCoalesce(_optionalChain([comp, 'optionalAccess',
|
|
3851
|
+
for (const entry of _nullishCoalesce(_optionalChain([comp, 'optionalAccess', _146 => _146.stack]), () => ( []))) {
|
|
3676
3852
|
const src = entry.filePath !== void 0 ? { filePath: entry.filePath, line: _nullishCoalesce(entry.line, () => ( null)) } : entry.hostElement && deps.sourceResolver ? deps.sourceResolver(entry.hostElement) : null;
|
|
3677
|
-
const frame = { name: entry.name, file: _nullishCoalesce(_optionalChain([src, 'optionalAccess',
|
|
3853
|
+
const frame = { name: entry.name, file: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _147 => _147.filePath]), () => ( null)), line: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _148 => _148.line]), () => ( null)) };
|
|
3678
3854
|
named.push(frame);
|
|
3679
3855
|
if (isAppFile(frame.file) && frames.length < MAX_STACK) frames.push(frame);
|
|
3680
3856
|
}
|
|
3681
|
-
return { component: _nullishCoalesce(_optionalChain([comp, 'optionalAccess',
|
|
3857
|
+
return { component: _nullishCoalesce(_optionalChain([comp, 'optionalAccess', _149 => _149.name]), () => ( null)), frames: frames.length > 0 ? frames : named.slice(0, 2) };
|
|
3682
3858
|
}
|
|
3683
3859
|
function resolveSource(el, deps, frames) {
|
|
3684
|
-
const own = _optionalChain([deps, 'access',
|
|
3860
|
+
const own = _optionalChain([deps, 'access', _150 => _150.sourceResolver, 'optionalCall', _151 => _151(el)]);
|
|
3685
3861
|
if (own && isAppFile(own.filePath)) return { file: own.filePath, line: own.line, column: own.column };
|
|
3686
3862
|
const first = frames.find((f) => isAppFile(f.file));
|
|
3687
|
-
return _optionalChain([first, 'optionalAccess',
|
|
3863
|
+
return _optionalChain([first, 'optionalAccess', _152 => _152.file]) ? { file: first.file, line: first.line, column: null } : null;
|
|
3688
3864
|
}
|
|
3689
3865
|
function captureTarget(el, deps) {
|
|
3690
3866
|
const cleanClasses = _nullishCoalesce(deps.cleanClasses, () => ( ((list) => list.filter((c) => !isNoiseClass(c)))));
|
|
@@ -3728,14 +3904,14 @@ function sandboxHtml() {
|
|
|
3728
3904
|
if (policy === void 0) {
|
|
3729
3905
|
try {
|
|
3730
3906
|
policy = tt.createPolicy("grabby", { createHTML: (html) => html === SANDBOX_HTML ? html : "" });
|
|
3731
|
-
} catch (
|
|
3907
|
+
} catch (e23) {
|
|
3732
3908
|
policy = null;
|
|
3733
3909
|
}
|
|
3734
3910
|
}
|
|
3735
3911
|
return policy ? policy.createHTML(SANDBOX_HTML) : null;
|
|
3736
3912
|
}
|
|
3737
3913
|
async function getSandbox() {
|
|
3738
|
-
if (_optionalChain([sandbox, 'optionalAccess',
|
|
3914
|
+
if (_optionalChain([sandbox, 'optionalAccess', _153 => _153.isConnected])) return sandbox;
|
|
3739
3915
|
const frame = document.createElement("iframe");
|
|
3740
3916
|
frame.setAttribute("aria-hidden", "true");
|
|
3741
3917
|
frame.setAttribute("tabindex", "-1");
|
|
@@ -3750,7 +3926,7 @@ async function getSandbox() {
|
|
|
3750
3926
|
setTimeout(done, 1e3);
|
|
3751
3927
|
try {
|
|
3752
3928
|
frame.srcdoc = html;
|
|
3753
|
-
} catch (
|
|
3929
|
+
} catch (e24) {
|
|
3754
3930
|
done();
|
|
3755
3931
|
}
|
|
3756
3932
|
});
|
|
@@ -3759,7 +3935,7 @@ async function getSandbox() {
|
|
|
3759
3935
|
return frame;
|
|
3760
3936
|
}
|
|
3761
3937
|
function disposeScreenshotSandbox() {
|
|
3762
|
-
_optionalChain([sandbox, 'optionalAccess',
|
|
3938
|
+
_optionalChain([sandbox, 'optionalAccess', _154 => _154.remove, 'call', _155 => _155()]);
|
|
3763
3939
|
sandbox = null;
|
|
3764
3940
|
}
|
|
3765
3941
|
function withTimeout(promise, ms) {
|
|
@@ -3822,7 +3998,7 @@ function randomId() {
|
|
|
3822
3998
|
if (c && typeof c.randomUUID === "function") {
|
|
3823
3999
|
try {
|
|
3824
4000
|
return c.randomUUID();
|
|
3825
|
-
} catch (
|
|
4001
|
+
} catch (e25) {
|
|
3826
4002
|
}
|
|
3827
4003
|
}
|
|
3828
4004
|
const bytes = new Uint8Array(16);
|
|
@@ -3841,7 +4017,7 @@ function getSessionId() {
|
|
|
3841
4017
|
const id = randomId();
|
|
3842
4018
|
localStorage.setItem(SESSION_KEY, id);
|
|
3843
4019
|
return id;
|
|
3844
|
-
} catch (
|
|
4020
|
+
} catch (e26) {
|
|
3845
4021
|
memorySession ??= randomId();
|
|
3846
4022
|
return memorySession;
|
|
3847
4023
|
}
|
|
@@ -3853,20 +4029,20 @@ function loadIdentity() {
|
|
|
3853
4029
|
const parsed = JSON.parse(raw);
|
|
3854
4030
|
if (typeof parsed !== "object" || parsed === null || typeof parsed.anonymous !== "boolean") return null;
|
|
3855
4031
|
return { name: typeof parsed.name === "string" ? parsed.name.slice(0, 80) : null, anonymous: parsed.anonymous };
|
|
3856
|
-
} catch (
|
|
4032
|
+
} catch (e27) {
|
|
3857
4033
|
return null;
|
|
3858
4034
|
}
|
|
3859
4035
|
}
|
|
3860
4036
|
function saveIdentity(identity) {
|
|
3861
4037
|
try {
|
|
3862
4038
|
localStorage.setItem(AUTHOR_KEY, JSON.stringify(identity));
|
|
3863
|
-
} catch (
|
|
4039
|
+
} catch (e28) {
|
|
3864
4040
|
}
|
|
3865
4041
|
}
|
|
3866
4042
|
function clearIdentity() {
|
|
3867
4043
|
try {
|
|
3868
4044
|
localStorage.removeItem(AUTHOR_KEY);
|
|
3869
|
-
} catch (
|
|
4045
|
+
} catch (e29) {
|
|
3870
4046
|
}
|
|
3871
4047
|
}
|
|
3872
4048
|
function currentAuthor(identity) {
|
|
@@ -3919,7 +4095,7 @@ function resolveComponent(element) {
|
|
|
3919
4095
|
name: cleanComponentName(owning.constructor.name),
|
|
3920
4096
|
hostElement: _nullishCoalesce(host2, () => ( walk.parentElement))
|
|
3921
4097
|
});
|
|
3922
|
-
current = _nullishCoalesce(_nullishCoalesce(_optionalChain([host2, 'optionalAccess',
|
|
4098
|
+
current = _nullishCoalesce(_nullishCoalesce(_optionalChain([host2, 'optionalAccess', _156 => _156.parentElement]), () => ( _optionalChain([walk, 'access', _157 => _157.parentElement, 'optionalAccess', _158 => _158.parentElement]))), () => ( null));
|
|
3923
4099
|
while (current) {
|
|
3924
4100
|
const comp = ng.getComponent(current);
|
|
3925
4101
|
if (comp && !seen2.has(comp)) {
|
|
@@ -4053,14 +4229,14 @@ function resolveComponent2(element) {
|
|
|
4053
4229
|
let current = fiber;
|
|
4054
4230
|
while (current && stack.length < MAX_STACK2) {
|
|
4055
4231
|
const name = getComponentName(current.type);
|
|
4056
|
-
if (name && !isNoise(name) && _optionalChain([stack, 'access',
|
|
4232
|
+
if (name && !isNoise(name) && _optionalChain([stack, 'access', _159 => _159[stack.length - 1], 'optionalAccess', _160 => _160.name]) !== name) {
|
|
4057
4233
|
stack.push({ name, hostElement: findHostElement(current) });
|
|
4058
4234
|
}
|
|
4059
4235
|
current = current.return;
|
|
4060
4236
|
}
|
|
4061
4237
|
return {
|
|
4062
|
-
name: _nullishCoalesce(_optionalChain([stack, 'access',
|
|
4063
|
-
hostElement: _nullishCoalesce(_optionalChain([stack, 'access',
|
|
4238
|
+
name: _nullishCoalesce(_optionalChain([stack, 'access', _161 => _161[0], 'optionalAccess', _162 => _162.name]), () => ( null)),
|
|
4239
|
+
hostElement: _nullishCoalesce(_optionalChain([stack, 'access', _163 => _163[0], 'optionalAccess', _164 => _164.hostElement]), () => ( null)),
|
|
4064
4240
|
stack
|
|
4065
4241
|
};
|
|
4066
4242
|
}
|
|
@@ -4071,7 +4247,7 @@ var LOCATION = /^(.*?):(\d+):(\d+)(?::([A-Za-z_$][\w$.]*))?$/;
|
|
|
4071
4247
|
function resolveSource3(element) {
|
|
4072
4248
|
let current = element;
|
|
4073
4249
|
while (current) {
|
|
4074
|
-
const raw = _optionalChain([current, 'access',
|
|
4250
|
+
const raw = _optionalChain([current, 'access', _165 => _165.getAttribute, 'optionalCall', _166 => _166(SOURCE_ATTRIBUTE)]);
|
|
4075
4251
|
if (raw) return parseLocation(raw);
|
|
4076
4252
|
current = current.parentElement;
|
|
4077
4253
|
}
|
|
@@ -4083,7 +4259,7 @@ function parseLocation(raw) {
|
|
|
4083
4259
|
return { filePath: match[1], line: Number(match[2]), column: Number(match[3]) };
|
|
4084
4260
|
}
|
|
4085
4261
|
function ownStamp(element) {
|
|
4086
|
-
const raw = _optionalChain([element, 'optionalAccess',
|
|
4262
|
+
const raw = _optionalChain([element, 'optionalAccess', _167 => _167.getAttribute, 'optionalCall', _168 => _168(SOURCE_ATTRIBUTE)]);
|
|
4087
4263
|
if (!raw) return null;
|
|
4088
4264
|
const match = LOCATION.exec(raw);
|
|
4089
4265
|
if (!match) return { file: raw, line: null, column: null, name: null };
|
|
@@ -4098,8 +4274,8 @@ function nameFromStamps(result) {
|
|
|
4098
4274
|
const stack = [];
|
|
4099
4275
|
for (const entry of result.stack) {
|
|
4100
4276
|
const stamp = ownStamp(entry.hostElement);
|
|
4101
|
-
const name = _nullishCoalesce(_optionalChain([stamp, 'optionalAccess',
|
|
4102
|
-
if (name && _optionalChain([stack, 'access',
|
|
4277
|
+
const name = _nullishCoalesce(_optionalChain([stamp, 'optionalAccess', _169 => _169.name]), () => ( (stamp ? baseName(stamp.file) : null)));
|
|
4278
|
+
if (name && _optionalChain([stack, 'access', _170 => _170[stack.length - 1], 'optionalAccess', _171 => _171.name]) !== name) stack.push({ name, hostElement: entry.hostElement });
|
|
4103
4279
|
}
|
|
4104
4280
|
return stack[0] ? { name: stack[0].name, hostElement: stack[0].hostElement, stack } : null;
|
|
4105
4281
|
}
|
|
@@ -4135,7 +4311,7 @@ function vue3Name(inst) {
|
|
|
4135
4311
|
return t.__name || t.name || t.displayName || (t.__file ? baseName(t.__file) : null);
|
|
4136
4312
|
}
|
|
4137
4313
|
function vue3Host(inst) {
|
|
4138
|
-
return firstElement(_nullishCoalesce(_optionalChain([inst, 'access',
|
|
4314
|
+
return firstElement(_nullishCoalesce(_optionalChain([inst, 'access', _172 => _172.subTree, 'optionalAccess', _173 => _173.el]), () => ( _optionalChain([inst, 'access', _174 => _174.vnode, 'optionalAccess', _175 => _175.el]))));
|
|
4139
4315
|
}
|
|
4140
4316
|
function vue2Owner(el) {
|
|
4141
4317
|
let current = el;
|
|
@@ -4175,7 +4351,7 @@ function resolveVueComponent(el) {
|
|
|
4175
4351
|
}
|
|
4176
4352
|
function resolveVueSource(el) {
|
|
4177
4353
|
const inst3 = vue3Owner(el);
|
|
4178
|
-
const file = _nullishCoalesce(_optionalChain([inst3, 'optionalAccess',
|
|
4354
|
+
const file = _nullishCoalesce(_optionalChain([inst3, 'optionalAccess', _176 => _176.type, 'optionalAccess', _177 => _177.__file]), () => ( _optionalChain([vue2Owner, 'call', _178 => _178(el), 'optionalAccess', _179 => _179.$options, 'optionalAccess', _180 => _180.__file])));
|
|
4179
4355
|
return file ? { filePath: relativizePath(file), line: null, column: null } : NO_SOURCE;
|
|
4180
4356
|
}
|
|
4181
4357
|
var vueAdapter = {
|
|
@@ -4191,19 +4367,19 @@ function metaOf(el) {
|
|
|
4191
4367
|
let current = el;
|
|
4192
4368
|
while (current) {
|
|
4193
4369
|
const meta = current.__svelte_meta;
|
|
4194
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
4370
|
+
if (_optionalChain([meta, 'optionalAccess', _181 => _181.loc])) return { meta, el: current };
|
|
4195
4371
|
current = current.parentElement;
|
|
4196
4372
|
}
|
|
4197
4373
|
return null;
|
|
4198
4374
|
}
|
|
4199
4375
|
function lineOf(meta) {
|
|
4200
|
-
const line = _optionalChain([meta, 'access',
|
|
4376
|
+
const line = _optionalChain([meta, 'access', _182 => _182.loc, 'optionalAccess', _183 => _183.line]);
|
|
4201
4377
|
if (typeof line !== "number") return null;
|
|
4202
4378
|
return "parent" in meta ? line : line + 1;
|
|
4203
4379
|
}
|
|
4204
4380
|
function resolveSvelteComponent(el) {
|
|
4205
4381
|
const found = metaOf(el);
|
|
4206
|
-
if (!_optionalChain([found, 'optionalAccess',
|
|
4382
|
+
if (!_optionalChain([found, 'optionalAccess', _184 => _184.meta, 'access', _185 => _185.loc, 'optionalAccess', _186 => _186.file])) return null;
|
|
4207
4383
|
const { meta } = found;
|
|
4208
4384
|
const own = baseName(meta.loc.file);
|
|
4209
4385
|
const stack = [{ name: own, hostElement: found.el }];
|
|
@@ -4217,9 +4393,9 @@ function resolveSvelteComponent(el) {
|
|
|
4217
4393
|
}
|
|
4218
4394
|
function resolveSvelteSource(el) {
|
|
4219
4395
|
const found = metaOf(el);
|
|
4220
|
-
const file = _optionalChain([found, 'optionalAccess',
|
|
4396
|
+
const file = _optionalChain([found, 'optionalAccess', _187 => _187.meta, 'access', _188 => _188.loc, 'optionalAccess', _189 => _189.file]);
|
|
4221
4397
|
if (!found || !file) return NO_SOURCE;
|
|
4222
|
-
const column = _optionalChain([found, 'access',
|
|
4398
|
+
const column = _optionalChain([found, 'access', _190 => _190.meta, 'access', _191 => _191.loc, 'optionalAccess', _192 => _192.column]);
|
|
4223
4399
|
return {
|
|
4224
4400
|
filePath: relativizePath(file),
|
|
4225
4401
|
line: lineOf(found.meta),
|
|
@@ -4239,10 +4415,10 @@ var domAdapter = {
|
|
|
4239
4415
|
name: "HTML",
|
|
4240
4416
|
resolveComponent: (el) => {
|
|
4241
4417
|
const host2 = el.closest("[data-component]");
|
|
4242
|
-
const name = _optionalChain([host2, 'optionalAccess',
|
|
4418
|
+
const name = _optionalChain([host2, 'optionalAccess', _193 => _193.getAttribute, 'call', _194 => _194("data-component")]);
|
|
4243
4419
|
if (!host2 || !name) return null;
|
|
4244
4420
|
const stack = [];
|
|
4245
|
-
for (let h2 = host2; h2; h2 = _nullishCoalesce(_optionalChain([h2, 'access',
|
|
4421
|
+
for (let h2 = host2; h2; h2 = _nullishCoalesce(_optionalChain([h2, 'access', _195 => _195.parentElement, 'optionalAccess', _196 => _196.closest, 'call', _197 => _197("[data-component]")]), () => ( null))) {
|
|
4246
4422
|
const n = h2.getAttribute("data-component");
|
|
4247
4423
|
if (n) stack.push({ name: n, hostElement: h2 });
|
|
4248
4424
|
if (stack.length >= 12) break;
|
|
@@ -4264,15 +4440,15 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4264
4440
|
for (const adapter of adapters) {
|
|
4265
4441
|
try {
|
|
4266
4442
|
const result = adapter.resolveComponent(el);
|
|
4267
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
4268
|
-
} catch (
|
|
4443
|
+
if (_optionalChain([result, 'optionalAccess', _198 => _198.name])) return { adapter, result };
|
|
4444
|
+
} catch (e30) {
|
|
4269
4445
|
}
|
|
4270
4446
|
}
|
|
4271
4447
|
return null;
|
|
4272
4448
|
}
|
|
4273
4449
|
return {
|
|
4274
4450
|
resolveComponent(el) {
|
|
4275
|
-
return _nullishCoalesce(_optionalChain([owner, 'call',
|
|
4451
|
+
return _nullishCoalesce(_optionalChain([owner, 'call', _199 => _199(el), 'optionalAccess', _200 => _200.result]), () => ( null));
|
|
4276
4452
|
},
|
|
4277
4453
|
resolveSource(el) {
|
|
4278
4454
|
const stamped = resolveSource3(el);
|
|
@@ -4281,15 +4457,15 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4281
4457
|
const ordered = found ? [found.adapter, ...adapters.filter((a) => a !== found.adapter)] : adapters;
|
|
4282
4458
|
for (const adapter of ordered) {
|
|
4283
4459
|
try {
|
|
4284
|
-
const src = _optionalChain([adapter, 'access',
|
|
4285
|
-
if (_optionalChain([src, 'optionalAccess',
|
|
4286
|
-
} catch (
|
|
4460
|
+
const src = _optionalChain([adapter, 'access', _201 => _201.resolveSource, 'optionalCall', _202 => _202(el)]);
|
|
4461
|
+
if (_optionalChain([src, 'optionalAccess', _203 => _203.filePath])) return src;
|
|
4462
|
+
} catch (e31) {
|
|
4287
4463
|
}
|
|
4288
4464
|
}
|
|
4289
4465
|
return null;
|
|
4290
4466
|
},
|
|
4291
4467
|
frameworkFor(el) {
|
|
4292
|
-
return _nullishCoalesce(_optionalChain([owner, 'call',
|
|
4468
|
+
return _nullishCoalesce(_optionalChain([owner, 'call', _204 => _204(el), 'optionalAccess', _205 => _205.adapter, 'access', _206 => _206.name]), () => ( "HTML"));
|
|
4293
4469
|
},
|
|
4294
4470
|
cleanClasses(classes) {
|
|
4295
4471
|
return adapters.reduce((list, a) => a.cleanClasses ? a.cleanClasses(list) : list, classes);
|
|
@@ -4321,7 +4497,7 @@ function getDefaultOptions() {
|
|
|
4321
4497
|
};
|
|
4322
4498
|
}
|
|
4323
4499
|
function init(options) {
|
|
4324
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4500
|
+
if (_optionalChain([options, 'optionalAccess', _207 => _207.mode]) === "live" && !_chunk6CBIOKZVcjs.consumeFeedbackLink.call(void 0, options.projectKey)) {
|
|
4325
4501
|
return createDormantApi(options);
|
|
4326
4502
|
}
|
|
4327
4503
|
return createGrabInstance(options);
|
|
@@ -4347,7 +4523,7 @@ function createDormantApi(options) {
|
|
|
4347
4523
|
real.show();
|
|
4348
4524
|
return;
|
|
4349
4525
|
}
|
|
4350
|
-
_optionalChain([flusher, 'optionalAccess',
|
|
4526
|
+
_optionalChain([flusher, 'optionalAccess', _208 => _208.dispose, 'call', _209 => _209()]);
|
|
4351
4527
|
_chunk6CBIOKZVcjs.startFeedbackSession.call(void 0, );
|
|
4352
4528
|
real = createGrabInstance(options);
|
|
4353
4529
|
for (const fn of queued.splice(0)) fn(real);
|
|
@@ -4359,7 +4535,7 @@ function createDormantApi(options) {
|
|
|
4359
4535
|
function flushLeftovers(options) {
|
|
4360
4536
|
try {
|
|
4361
4537
|
if (!localStorage.getItem("grabby:v1:outbox")) return null;
|
|
4362
|
-
} catch (
|
|
4538
|
+
} catch (e32) {
|
|
4363
4539
|
return null;
|
|
4364
4540
|
}
|
|
4365
4541
|
let comments = loadHistory();
|
|
@@ -4377,11 +4553,11 @@ function flushLeftovers(options) {
|
|
|
4377
4553
|
function isDevMode() {
|
|
4378
4554
|
try {
|
|
4379
4555
|
if (typeof ngDevMode !== "undefined" && ngDevMode === false) return false;
|
|
4380
|
-
} catch (
|
|
4556
|
+
} catch (e33) {
|
|
4381
4557
|
}
|
|
4382
4558
|
try {
|
|
4383
4559
|
if (process.env.NODE_ENV === "production") return false;
|
|
4384
|
-
} catch (
|
|
4560
|
+
} catch (e34) {
|
|
4385
4561
|
}
|
|
4386
4562
|
return true;
|
|
4387
4563
|
}
|
|
@@ -4389,14 +4565,14 @@ function loadLevel(fallback) {
|
|
|
4389
4565
|
try {
|
|
4390
4566
|
const v = localStorage.getItem(LEVEL_KEY);
|
|
4391
4567
|
if (v === "compact" || v === "standard" || v === "detailed") return v;
|
|
4392
|
-
} catch (
|
|
4568
|
+
} catch (e35) {
|
|
4393
4569
|
}
|
|
4394
4570
|
return fallback;
|
|
4395
4571
|
}
|
|
4396
4572
|
function saveLevel(level) {
|
|
4397
4573
|
try {
|
|
4398
4574
|
localStorage.setItem(LEVEL_KEY, level);
|
|
4399
|
-
} catch (
|
|
4575
|
+
} catch (e36) {
|
|
4400
4576
|
}
|
|
4401
4577
|
}
|
|
4402
4578
|
function createNoopApi() {
|
|
@@ -4442,7 +4618,7 @@ function createGrabInstance(options) {
|
|
|
4442
4618
|
store.state.toolbar = { ...store.state.toolbar, comments: persisted };
|
|
4443
4619
|
}
|
|
4444
4620
|
}
|
|
4445
|
-
const overlay = createOverlayRenderer();
|
|
4621
|
+
const overlay = createOverlayRenderer({ plainLabels: live });
|
|
4446
4622
|
const crosshair = createCrosshair();
|
|
4447
4623
|
const freezeOverlay = createFreezeOverlay();
|
|
4448
4624
|
const pluginRegistry = createPluginRegistry();
|
|
@@ -4507,9 +4683,9 @@ function createGrabInstance(options) {
|
|
|
4507
4683
|
function toastDetail(c) {
|
|
4508
4684
|
return {
|
|
4509
4685
|
componentName: c.target.component,
|
|
4510
|
-
filePath: _nullishCoalesce(_optionalChain([c, 'access',
|
|
4511
|
-
line: _nullishCoalesce(_optionalChain([c, 'access',
|
|
4512
|
-
column: _nullishCoalesce(_optionalChain([c, 'access',
|
|
4686
|
+
filePath: _nullishCoalesce(_optionalChain([c, 'access', _210 => _210.target, 'access', _211 => _211.source, 'optionalAccess', _212 => _212.file]), () => ( null)),
|
|
4687
|
+
line: _nullishCoalesce(_optionalChain([c, 'access', _213 => _213.target, 'access', _214 => _214.source, 'optionalAccess', _215 => _215.line]), () => ( null)),
|
|
4688
|
+
column: _nullishCoalesce(_optionalChain([c, 'access', _216 => _216.target, 'access', _217 => _217.source, 'optionalAccess', _218 => _218.column]), () => ( null))
|
|
4513
4689
|
};
|
|
4514
4690
|
}
|
|
4515
4691
|
function saveComment(element, text, shot) {
|
|
@@ -4533,7 +4709,7 @@ function createGrabInstance(options) {
|
|
|
4533
4709
|
};
|
|
4534
4710
|
setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
|
|
4535
4711
|
pluginRegistry.callHook("onComment", comment, element);
|
|
4536
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
4712
|
+
_optionalChain([outbox, 'optionalAccess', _219 => _219.send, 'call', _220 => _220(comment.id)]);
|
|
4537
4713
|
if (shot) void attachScreenshot(comment.id, shot);
|
|
4538
4714
|
const count = comments().length;
|
|
4539
4715
|
if (live) {
|
|
@@ -4568,15 +4744,18 @@ function createGrabInstance(options) {
|
|
|
4568
4744
|
const updated = { ...current, screenshot: { localId: id, width: result.width, height: result.height } };
|
|
4569
4745
|
setComments(comments().map((c) => c.id === id ? updated : c));
|
|
4570
4746
|
pluginRegistry.callHook("onScreenshot", updated, result.blob);
|
|
4571
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
4747
|
+
_optionalChain([outbox, 'optionalAccess', _221 => _221.sendScreenshot, 'call', _222 => _222(id)]);
|
|
4572
4748
|
}
|
|
4573
|
-
function removeComments(ids, message) {
|
|
4749
|
+
function removeComments(ids, message, withdraw = false) {
|
|
4574
4750
|
if (ids.length === 0) return;
|
|
4575
4751
|
const idSet = new Set(ids);
|
|
4576
4752
|
const before = comments();
|
|
4577
4753
|
const removed = before.filter((c) => idSet.has(c.id));
|
|
4578
4754
|
setComments(before.filter((c) => !idSet.has(c.id)));
|
|
4579
|
-
const
|
|
4755
|
+
const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
|
|
4756
|
+
const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
|
|
4757
|
+
for (const c of withdrawn) outbox.remove(c.id, c.author.sessionId, message ? UNDO_MS + 500 : 0);
|
|
4758
|
+
const shotIds = removed.flatMap((c) => _optionalChain([c, 'access', _223 => _223.screenshot, 'optionalAccess', _224 => _224.localId]) ? [c.screenshot.localId] : []);
|
|
4580
4759
|
const key = randomId();
|
|
4581
4760
|
pendingShotDeletes.set(key, setTimeout(() => {
|
|
4582
4761
|
pendingShotDeletes.delete(key);
|
|
@@ -4591,8 +4770,11 @@ function createGrabInstance(options) {
|
|
|
4591
4770
|
clearTimeout(pendingShotDeletes.get(key));
|
|
4592
4771
|
pendingShotDeletes.delete(key);
|
|
4593
4772
|
const present = new Set(comments().map((c) => c.id));
|
|
4594
|
-
const
|
|
4773
|
+
const resend = new Set(withdrawn.filter((c) => !present.has(c.id) && (!outbox.cancelRemove(c.id) || c.sync !== "sent" || hadQueued.has(c.id))).map((c) => c.id));
|
|
4774
|
+
const back = removed.filter((c) => !present.has(c.id)).map((c) => resend.has(c.id) ? { ...c, sync: "pending" } : c);
|
|
4775
|
+
const restored = [...back, ...comments()].sort((a, b) => b.createdAt - a.createdAt);
|
|
4595
4776
|
setComments(restored);
|
|
4777
|
+
for (const id of resend) _optionalChain([outbox, 'optionalAccess', _225 => _225.send, 'call', _226 => _226(id)]);
|
|
4596
4778
|
showToast(`Restored ${removed.length} comment${removed.length === 1 ? "" : "s"}`);
|
|
4597
4779
|
}
|
|
4598
4780
|
}]
|
|
@@ -4758,7 +4940,7 @@ function createGrabInstance(options) {
|
|
|
4758
4940
|
},
|
|
4759
4941
|
onDelete(comment) {
|
|
4760
4942
|
overlay.hide();
|
|
4761
|
-
removeComments([comment.id], "Comment deleted");
|
|
4943
|
+
removeComments([comment.id], "Comment deleted", true);
|
|
4762
4944
|
},
|
|
4763
4945
|
onCopyAll() {
|
|
4764
4946
|
overlay.hide();
|
|
@@ -4767,7 +4949,7 @@ function createGrabInstance(options) {
|
|
|
4767
4949
|
onClearAll() {
|
|
4768
4950
|
overlay.hide();
|
|
4769
4951
|
const n = comments().length;
|
|
4770
|
-
removeComments(comments().map((c) => c.id), `Cleared ${n} comment${n === 1 ? "" : "s"}
|
|
4952
|
+
removeComments(comments().map((c) => c.id), `Cleared ${n} comment${n === 1 ? "" : "s"}`, true);
|
|
4771
4953
|
commentsPanel.hide();
|
|
4772
4954
|
},
|
|
4773
4955
|
onChangeIdentity() {
|
|
@@ -4797,7 +4979,7 @@ function createGrabInstance(options) {
|
|
|
4797
4979
|
});
|
|
4798
4980
|
const finishSheet = createFinishSheet({
|
|
4799
4981
|
onDone() {
|
|
4800
|
-
const done = comments().filter((c) => c.sync === "sent" && !_optionalChain([outbox, 'optionalAccess',
|
|
4982
|
+
const done = comments().filter((c) => c.sync === "sent" && !_optionalChain([outbox, 'optionalAccess', _227 => _227.isQueued, 'call', _228 => _228(c.id)])).map((c) => c.id);
|
|
4801
4983
|
if (!comments().length) {
|
|
4802
4984
|
exitFeedbackMode();
|
|
4803
4985
|
return;
|
|
@@ -4811,9 +4993,9 @@ function createGrabInstance(options) {
|
|
|
4811
4993
|
if (failed.length) {
|
|
4812
4994
|
const ids = new Set(failed.map((c) => c.id));
|
|
4813
4995
|
setComments(comments().map((c) => ids.has(c.id) ? { ...c, sync: "pending" } : c));
|
|
4814
|
-
for (const id of ids) _optionalChain([outbox, 'optionalAccess',
|
|
4996
|
+
for (const id of ids) _optionalChain([outbox, 'optionalAccess', _229 => _229.send, 'call', _230 => _230(id)]);
|
|
4815
4997
|
}
|
|
4816
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
4998
|
+
_optionalChain([outbox, 'optionalAccess', _231 => _231.flush, 'call', _232 => _232()]);
|
|
4817
4999
|
}
|
|
4818
5000
|
});
|
|
4819
5001
|
const commentPopover = createCommentPopover({
|
|
@@ -4833,7 +5015,7 @@ function createGrabInstance(options) {
|
|
|
4833
5015
|
(c) => c.id === ctx.entryId ? { ...c, comment: value, updatedAt: Date.now(), ...outbox ? { sync: "pending" } : {} } : c
|
|
4834
5016
|
);
|
|
4835
5017
|
setComments(updated);
|
|
4836
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5018
|
+
_optionalChain([outbox, 'optionalAccess', _233 => _233.send, 'call', _234 => _234(ctx.entryId)]);
|
|
4837
5019
|
showToast("Comment updated");
|
|
4838
5020
|
commentsPanel.show([...updated]);
|
|
4839
5021
|
},
|
|
@@ -4858,7 +5040,7 @@ function createGrabInstance(options) {
|
|
|
4858
5040
|
document.addEventListener("click", handleDocumentClick);
|
|
4859
5041
|
function handlePageHide() {
|
|
4860
5042
|
flushPendingWrite();
|
|
4861
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5043
|
+
_optionalChain([outbox, 'optionalAccess', _235 => _235.flushOnExit, 'call', _236 => _236()]);
|
|
4862
5044
|
}
|
|
4863
5045
|
function handleVisibilityChange() {
|
|
4864
5046
|
if (document.visibilityState === "hidden") flushPendingWrite();
|
|
@@ -4969,7 +5151,7 @@ function createGrabInstance(options) {
|
|
|
4969
5151
|
return exportText(list, _nullishCoalesce(opts.level, () => ( level)));
|
|
4970
5152
|
},
|
|
4971
5153
|
deleteComment(id) {
|
|
4972
|
-
removeComments([id], null);
|
|
5154
|
+
removeComments([id], null, true);
|
|
4973
5155
|
},
|
|
4974
5156
|
clearComments() {
|
|
4975
5157
|
removeComments(comments().map((c) => c.id), null);
|
|
@@ -5010,7 +5192,7 @@ function createGrabInstance(options) {
|
|
|
5010
5192
|
copySheet.dispose();
|
|
5011
5193
|
finishSheet.dispose();
|
|
5012
5194
|
coachMark.dispose();
|
|
5013
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5195
|
+
_optionalChain([outbox, 'optionalAccess', _237 => _237.dispose, 'call', _238 => _238()]);
|
|
5014
5196
|
themeManager.dispose();
|
|
5015
5197
|
disposeStyleBaseline();
|
|
5016
5198
|
disposeScreenshotSandbox();
|