@githumbi/grabby 0.5.1 → 0.6.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 +13 -0
- package/dist/angular/index.d.ts +22 -1
- package/dist/angular/index.js +542 -46
- package/dist/angular/index.js.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/core/index.cjs +658 -162
- 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 +542 -46
- package/dist/core/index.js.map +1 -1
- package/dist/export/index.cjs +19 -1
- package/dist/export/index.cjs.map +1 -1
- package/dist/export/index.d.cts +23 -2
- package/dist/export/index.d.ts +23 -2
- package/dist/export/index.js +19 -1
- package/dist/export/index.js.map +1 -1
- package/dist/grabby.global.js +146 -120
- package/dist/live/index.d.cts +1 -1
- package/dist/live/index.d.ts +1 -1
- package/dist/react/index.d.ts +22 -1
- package/dist/react/index.js +542 -46
- package/dist/react/index.js.map +1 -1
- package/dist/{types-BQDEG-Gl.d.cts → types-DOAcZ0U6.d.cts} +23 -2
- package/dist/{types-BQDEG-Gl.d.ts → types-DOAcZ0U6.d.ts} +23 -2
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -507,6 +507,20 @@ function describeTarget(target) {
|
|
|
507
507
|
const name = facts.label || facts.heading || facts.text || facts.alt || "";
|
|
508
508
|
return quoted(noun, name);
|
|
509
509
|
}
|
|
510
|
+
var GROUP_NAMED = 3;
|
|
511
|
+
function describeGroup(labels) {
|
|
512
|
+
const named = labels.slice(0, GROUP_NAMED).join(", ");
|
|
513
|
+
const more = labels.length > GROUP_NAMED ? ` and ${labels.length - GROUP_NAMED} more` : "";
|
|
514
|
+
return `${labels.length} elements: ${named}${more}`;
|
|
515
|
+
}
|
|
516
|
+
function describeArea(around) {
|
|
517
|
+
return `Area in ${around}`;
|
|
518
|
+
}
|
|
519
|
+
function describeComment(c) {
|
|
520
|
+
if (_optionalChain([c, 'access', _13 => _13.members, 'optionalAccess', _14 => _14.length])) return describeGroup(c.members.map((m) => m.label));
|
|
521
|
+
if (c.area) return describeArea(describeTarget(c.target));
|
|
522
|
+
return describeTarget(c.target);
|
|
523
|
+
}
|
|
510
524
|
|
|
511
525
|
// src/core/overlay/overlay-renderer.ts
|
|
512
526
|
var OVERLAY_ID = "__grabby-overlay__";
|
|
@@ -661,8 +675,8 @@ function createOverlayRenderer(options = {}) {
|
|
|
661
675
|
currentComponentName = null;
|
|
662
676
|
currentSourcePath = null;
|
|
663
677
|
currentCssClasses = [];
|
|
664
|
-
_optionalChain([overlay, 'optionalAccess',
|
|
665
|
-
_optionalChain([label, 'optionalAccess',
|
|
678
|
+
_optionalChain([overlay, 'optionalAccess', _15 => _15.remove, 'call', _16 => _16()]);
|
|
679
|
+
_optionalChain([label, 'optionalAccess', _17 => _17.remove, 'call', _18 => _18()]);
|
|
666
680
|
removeStyles(STYLE_ID);
|
|
667
681
|
overlay = null;
|
|
668
682
|
label = null;
|
|
@@ -759,8 +773,8 @@ function createCrosshair() {
|
|
|
759
773
|
dispose() {
|
|
760
774
|
this.hold(false);
|
|
761
775
|
this.deactivate();
|
|
762
|
-
_optionalChain([hLine, 'optionalAccess',
|
|
763
|
-
_optionalChain([vLine, 'optionalAccess',
|
|
776
|
+
_optionalChain([hLine, 'optionalAccess', _19 => _19.remove, 'call', _20 => _20()]);
|
|
777
|
+
_optionalChain([vLine, 'optionalAccess', _21 => _21.remove, 'call', _22 => _22()]);
|
|
764
778
|
removeStyles(CROSSHAIR_STYLE_ID);
|
|
765
779
|
removeStyles(CURSOR_STYLE_ID);
|
|
766
780
|
hLine = null;
|
|
@@ -977,7 +991,7 @@ function injectToastStyles() {
|
|
|
977
991
|
}
|
|
978
992
|
var toastEl = null;
|
|
979
993
|
function getOrCreateToast() {
|
|
980
|
-
if (_optionalChain([toastEl, 'optionalAccess',
|
|
994
|
+
if (_optionalChain([toastEl, 'optionalAccess', _23 => _23.isConnected])) return toastEl;
|
|
981
995
|
injectToastStyles();
|
|
982
996
|
toastEl = h("div", { id: TOAST_ID, role: "status", "aria-live": "polite" });
|
|
983
997
|
getUiRoot().appendChild(toastEl);
|
|
@@ -1000,7 +1014,7 @@ function row(label, value) {
|
|
|
1000
1014
|
function showToast(message, opts = {}) {
|
|
1001
1015
|
const toast = getOrCreateToast();
|
|
1002
1016
|
const { detail, actions } = opts;
|
|
1003
|
-
const durationMs = _nullishCoalesce(opts.duration, () => ( (_optionalChain([actions, 'optionalAccess',
|
|
1017
|
+
const durationMs = _nullishCoalesce(opts.duration, () => ( (_optionalChain([actions, 'optionalAccess', _24 => _24.length]) ? 8e3 : 3500)));
|
|
1004
1018
|
const children = [
|
|
1005
1019
|
h(
|
|
1006
1020
|
"div",
|
|
@@ -1025,7 +1039,7 @@ function showToast(message, opts = {}) {
|
|
|
1025
1039
|
}
|
|
1026
1040
|
children.push(details);
|
|
1027
1041
|
}
|
|
1028
|
-
if (_optionalChain([actions, 'optionalAccess',
|
|
1042
|
+
if (_optionalChain([actions, 'optionalAccess', _25 => _25.length])) {
|
|
1029
1043
|
children[0].appendChild(h(
|
|
1030
1044
|
"span",
|
|
1031
1045
|
{ class: "grabby-toast-actions" },
|
|
@@ -1058,14 +1072,14 @@ function hideToast() {
|
|
|
1058
1072
|
clearTimeout(activeTimer);
|
|
1059
1073
|
activeTimer = null;
|
|
1060
1074
|
}
|
|
1061
|
-
_optionalChain([toastEl, 'optionalAccess',
|
|
1075
|
+
_optionalChain([toastEl, 'optionalAccess', _26 => _26.classList, 'access', _27 => _27.remove, 'call', _28 => _28("grabby-toast-visible")]);
|
|
1062
1076
|
}
|
|
1063
1077
|
function disposeToast() {
|
|
1064
1078
|
if (activeTimer) {
|
|
1065
1079
|
clearTimeout(activeTimer);
|
|
1066
1080
|
activeTimer = null;
|
|
1067
1081
|
}
|
|
1068
|
-
_optionalChain([toastEl, 'optionalAccess',
|
|
1082
|
+
_optionalChain([toastEl, 'optionalAccess', _29 => _29.remove, 'call', _30 => _30()]);
|
|
1069
1083
|
toastEl = null;
|
|
1070
1084
|
removeStyles(TOAST_STYLE_ID);
|
|
1071
1085
|
}
|
|
@@ -1157,22 +1171,125 @@ function buildUniqueSelector(el) {
|
|
|
1157
1171
|
return steps.join(" > ");
|
|
1158
1172
|
}
|
|
1159
1173
|
|
|
1174
|
+
// src/core/picker/region.ts
|
|
1175
|
+
var MAX_MEMBERS = 20;
|
|
1176
|
+
var INSIDE_RATIO = 0.85;
|
|
1177
|
+
var MIN_SIDE = 4;
|
|
1178
|
+
var MAX_VISITS = 4e3;
|
|
1179
|
+
var SKIP_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "TEMPLATE", "NOSCRIPT", "HEAD", "META", "LINK", "BR", "WBR"]);
|
|
1180
|
+
function boxFromPoints(a, b) {
|
|
1181
|
+
return { left: Math.min(a.x, b.x), top: Math.min(a.y, b.y), right: Math.max(a.x, b.x), bottom: Math.max(a.y, b.y) };
|
|
1182
|
+
}
|
|
1183
|
+
function overlapArea(r, box) {
|
|
1184
|
+
const w = Math.min(r.right, box.right) - Math.max(r.left, box.left);
|
|
1185
|
+
const h2 = Math.min(r.bottom, box.bottom) - Math.max(r.top, box.top);
|
|
1186
|
+
return w > 0 && h2 > 0 ? w * h2 : 0;
|
|
1187
|
+
}
|
|
1188
|
+
function contains(r, box) {
|
|
1189
|
+
return r.left <= box.left && r.top <= box.top && r.right >= box.right && r.bottom >= box.bottom;
|
|
1190
|
+
}
|
|
1191
|
+
function isHidden(el) {
|
|
1192
|
+
const style = getComputedStyle(el);
|
|
1193
|
+
return style.visibility === "hidden" || style.opacity === "0";
|
|
1194
|
+
}
|
|
1195
|
+
function elementsInBox(box, isUiNode2, root2 = document.body) {
|
|
1196
|
+
const found = [];
|
|
1197
|
+
let visits = 0;
|
|
1198
|
+
const visit = (el) => {
|
|
1199
|
+
if (found.length >= MAX_MEMBERS || ++visits > MAX_VISITS) return;
|
|
1200
|
+
if (SKIP_TAGS.has(el.tagName) || isUiNode2(el) || el.hasAttribute(IGNORE_ATTR)) return;
|
|
1201
|
+
const r = el.getBoundingClientRect();
|
|
1202
|
+
const boxless = r.width === 0 && r.height === 0;
|
|
1203
|
+
if (!boxless && overlapArea(r, box) === 0) return;
|
|
1204
|
+
if (!boxless && r.width >= MIN_SIDE && r.height >= MIN_SIDE) {
|
|
1205
|
+
const inside = overlapArea(r, box) / (r.width * r.height);
|
|
1206
|
+
if (inside >= INSIDE_RATIO && detectKind(el) !== "section" && !isHidden(el)) {
|
|
1207
|
+
found.push(el);
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
for (const child of Array.from(el.children)) visit(child);
|
|
1212
|
+
};
|
|
1213
|
+
for (const child of Array.from(root2.children)) visit(child);
|
|
1214
|
+
return found;
|
|
1215
|
+
}
|
|
1216
|
+
function commonContainer(elements) {
|
|
1217
|
+
if (elements.length === 0) return document.body;
|
|
1218
|
+
let candidate = _nullishCoalesce(elements[0].parentElement, () => ( document.body));
|
|
1219
|
+
while (candidate && !elements.every((el) => candidate.contains(el))) candidate = candidate.parentElement;
|
|
1220
|
+
return _nullishCoalesce(candidate, () => ( document.body));
|
|
1221
|
+
}
|
|
1222
|
+
function containerForBox(box, isUiNode2) {
|
|
1223
|
+
const cx = (box.left + box.right) / 2;
|
|
1224
|
+
const cy = (box.top + box.bottom) / 2;
|
|
1225
|
+
const stack = typeof document.elementsFromPoint === "function" ? document.elementsFromPoint(cx, cy) : [];
|
|
1226
|
+
for (const el of stack) {
|
|
1227
|
+
if (isUiNode2(el) || el.closest(`[${IGNORE_ATTR}]`)) continue;
|
|
1228
|
+
for (let cur = el; cur; cur = cur.parentElement) {
|
|
1229
|
+
if (contains(cur.getBoundingClientRect(), box)) return cur;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return document.body;
|
|
1233
|
+
}
|
|
1234
|
+
var frac = (v) => Math.round(Math.min(1, Math.max(0, v)) * 1e3) / 1e3;
|
|
1235
|
+
function areaWithin(el, box) {
|
|
1236
|
+
const r = el.getBoundingClientRect();
|
|
1237
|
+
const w = r.width || 1;
|
|
1238
|
+
const h2 = r.height || 1;
|
|
1239
|
+
return {
|
|
1240
|
+
x: frac((box.left - r.left) / w),
|
|
1241
|
+
y: frac((box.top - r.top) / h2),
|
|
1242
|
+
w: frac((box.right - box.left) / w),
|
|
1243
|
+
h: frac((box.bottom - box.top) / h2)
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
function areaToBox(el, area) {
|
|
1247
|
+
const r = el.getBoundingClientRect();
|
|
1248
|
+
return {
|
|
1249
|
+
left: r.left + area.x * r.width,
|
|
1250
|
+
top: r.top + area.y * r.height,
|
|
1251
|
+
right: r.left + (area.x + area.w) * r.width,
|
|
1252
|
+
bottom: r.top + (area.y + area.h) * r.height
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function unionBox(elements) {
|
|
1256
|
+
let out = null;
|
|
1257
|
+
for (const el of elements) {
|
|
1258
|
+
const r = el.getBoundingClientRect();
|
|
1259
|
+
if (r.width === 0 && r.height === 0) continue;
|
|
1260
|
+
out = out ? { left: Math.min(out.left, r.left), top: Math.min(out.top, r.top), right: Math.max(out.right, r.right), bottom: Math.max(out.bottom, r.bottom) } : { left: r.left, top: r.top, right: r.right, bottom: r.bottom };
|
|
1261
|
+
}
|
|
1262
|
+
return out;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1160
1265
|
// src/core/picker/element-picker.ts
|
|
1266
|
+
var DRAG_PX = 6;
|
|
1267
|
+
var IS_MAC = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
1268
|
+
var PRESS_EVENTS = ["pointerdown", "mousedown", "pointerup", "mouseup", "touchstart"];
|
|
1269
|
+
function addKey(e) {
|
|
1270
|
+
return IS_MAC ? e.metaKey : e.ctrlKey;
|
|
1271
|
+
}
|
|
1161
1272
|
function createElementPicker(deps) {
|
|
1162
1273
|
let hoveredElement = null;
|
|
1163
1274
|
let heldElement = null;
|
|
1164
1275
|
let listening = false;
|
|
1276
|
+
let press = null;
|
|
1277
|
+
let dragBox = null;
|
|
1278
|
+
let dragFrame = null;
|
|
1279
|
+
let lastPoint = { x: 0, y: 0 };
|
|
1280
|
+
let swallowNextClick = false;
|
|
1281
|
+
let collected = [];
|
|
1165
1282
|
function resolveComponentName(el) {
|
|
1166
1283
|
const resolver = deps.getComponentResolver();
|
|
1167
1284
|
if (!resolver) return null;
|
|
1168
1285
|
const result = resolver(el);
|
|
1169
|
-
return _nullishCoalesce(_optionalChain([result, 'optionalAccess',
|
|
1286
|
+
return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _31 => _31.name]), () => ( null));
|
|
1170
1287
|
}
|
|
1171
1288
|
function resolveSourcePath(el) {
|
|
1172
1289
|
const resolver = deps.getSourceResolver();
|
|
1173
1290
|
if (!resolver) return null;
|
|
1174
1291
|
const result = resolver(el);
|
|
1175
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
1292
|
+
if (!_optionalChain([result, 'optionalAccess', _32 => _32.filePath])) return null;
|
|
1176
1293
|
let path = result.filePath;
|
|
1177
1294
|
if (result.line != null) {
|
|
1178
1295
|
path += `:${result.line}`;
|
|
@@ -1180,7 +1297,7 @@ function createElementPicker(deps) {
|
|
|
1180
1297
|
return path;
|
|
1181
1298
|
}
|
|
1182
1299
|
function rawElementAtPoint(x, y) {
|
|
1183
|
-
const freezeEl = _optionalChain([deps, 'access',
|
|
1300
|
+
const freezeEl = _optionalChain([deps, 'access', _33 => _33.getFreezeElement, 'optionalCall', _34 => _34()]);
|
|
1184
1301
|
if (freezeEl) freezeEl.style.pointerEvents = "none";
|
|
1185
1302
|
const target = document.elementFromPoint(x, y);
|
|
1186
1303
|
if (freezeEl) freezeEl.style.pointerEvents = "auto";
|
|
@@ -1188,21 +1305,100 @@ function createElementPicker(deps) {
|
|
|
1188
1305
|
}
|
|
1189
1306
|
function elementAtPoint(x, y, exact) {
|
|
1190
1307
|
const raw = rawElementAtPoint(x, y);
|
|
1191
|
-
if (!raw || raw.closest(`[${IGNORE_ATTR}]`)) return raw && _optionalChain([deps, 'access',
|
|
1308
|
+
if (!raw || raw.closest(`[${IGNORE_ATTR}]`)) return raw && _optionalChain([deps, 'access', _35 => _35.isToolbarElement, 'optionalCall', _36 => _36(raw)]) ? raw : null;
|
|
1192
1309
|
return exact ? raw : promoteTarget(raw);
|
|
1193
1310
|
}
|
|
1311
|
+
function isOurs(el) {
|
|
1312
|
+
return !!_optionalChain([deps, 'access', _37 => _37.isToolbarElement, 'optionalCall', _38 => _38(el)]) || deps.overlay.isOverlayElement(el) || deps.crosshair.isCrosshairElement(el);
|
|
1313
|
+
}
|
|
1194
1314
|
function showOverlay(target) {
|
|
1195
1315
|
const componentName = resolveComponentName(target);
|
|
1196
1316
|
const sourcePath = resolveSourcePath(target);
|
|
1197
1317
|
const cssClasses = filterAngularClasses(target.classList);
|
|
1198
1318
|
deps.overlay.show(target, componentName, sourcePath, cssClasses);
|
|
1199
1319
|
}
|
|
1320
|
+
const countLabel = (n) => `${n} element${n === 1 ? "" : "s"}`;
|
|
1321
|
+
function showCollected() {
|
|
1322
|
+
if (collected.length) {
|
|
1323
|
+
deps.groupOutline.show({ elements: collected }, `${countLabel(collected.length)} \xB7 release ${IS_MAC ? "\u2318" : "Ctrl"} to comment`);
|
|
1324
|
+
} else {
|
|
1325
|
+
deps.groupOutline.hide();
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
function clearCollected() {
|
|
1329
|
+
if (!collected.length) return;
|
|
1330
|
+
collected = [];
|
|
1331
|
+
deps.groupOutline.hide();
|
|
1332
|
+
}
|
|
1333
|
+
function previewDrag() {
|
|
1334
|
+
dragFrame = null;
|
|
1335
|
+
if (!dragBox) return;
|
|
1336
|
+
deps.groupOutline.marquee(dragBox);
|
|
1337
|
+
const found = elementsInBox(dragBox, isOurs);
|
|
1338
|
+
if (found.length) deps.groupOutline.show({ elements: found }, countLabel(found.length));
|
|
1339
|
+
else deps.groupOutline.hide();
|
|
1340
|
+
}
|
|
1341
|
+
function endDrag() {
|
|
1342
|
+
dragBox = null;
|
|
1343
|
+
if (dragFrame !== null) cancelAnimationFrame(dragFrame);
|
|
1344
|
+
dragFrame = null;
|
|
1345
|
+
deps.groupOutline.marquee(null);
|
|
1346
|
+
deps.groupOutline.hide();
|
|
1347
|
+
}
|
|
1348
|
+
function finishDrag(point) {
|
|
1349
|
+
const box = dragBox;
|
|
1350
|
+
endDrag();
|
|
1351
|
+
const found = elementsInBox(box, isOurs);
|
|
1352
|
+
if (found.length === 1) {
|
|
1353
|
+
hoveredElement = found[0];
|
|
1354
|
+
deps.onSelect(found[0], point);
|
|
1355
|
+
} else if (found.length > 1) {
|
|
1356
|
+
deps.onSelectGroup(found, point);
|
|
1357
|
+
} else {
|
|
1358
|
+
const container = containerForBox(box, isOurs);
|
|
1359
|
+
deps.onSelectArea(container, areaWithin(container, box), point);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
function handlePress(e) {
|
|
1363
|
+
const origin = eventTarget(e);
|
|
1364
|
+
if (origin && _optionalChain([deps, 'access', _39 => _39.isToolbarElement, 'optionalCall', _40 => _40(origin)])) return;
|
|
1365
|
+
e.stopPropagation();
|
|
1366
|
+
if (e.type === "mousedown" || e.type === "touchstart") e.preventDefault();
|
|
1367
|
+
if (heldElement) return;
|
|
1368
|
+
const m = e;
|
|
1369
|
+
const down = e.type === "pointerdown" || e.type === "mousedown";
|
|
1370
|
+
if (down && m.button === 0 && !press) {
|
|
1371
|
+
press = { x: m.clientX, y: m.clientY };
|
|
1372
|
+
swallowNextClick = false;
|
|
1373
|
+
} else if (!down && e.type !== "touchstart" && press) {
|
|
1374
|
+
const point = { x: m.clientX, y: m.clientY };
|
|
1375
|
+
const start = press;
|
|
1376
|
+
press = null;
|
|
1377
|
+
if (dragBox) {
|
|
1378
|
+
dragBox = boxFromPoints(start, point);
|
|
1379
|
+
swallowNextClick = true;
|
|
1380
|
+
finishDrag(point);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1200
1384
|
function handleMouseMove(e) {
|
|
1201
1385
|
if (heldElement) return;
|
|
1386
|
+
lastPoint = { x: e.clientX, y: e.clientY };
|
|
1387
|
+
if (press) {
|
|
1388
|
+
if (!dragBox && Math.hypot(e.clientX - press.x, e.clientY - press.y) < DRAG_PX) return;
|
|
1389
|
+
if (!dragBox) {
|
|
1390
|
+
clearCollected();
|
|
1391
|
+
deps.overlay.hide();
|
|
1392
|
+
hoveredElement = null;
|
|
1393
|
+
}
|
|
1394
|
+
dragBox = boxFromPoints(press, lastPoint);
|
|
1395
|
+
if (dragFrame === null) dragFrame = requestAnimationFrame(previewDrag);
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1202
1398
|
const target = elementAtPoint(e.clientX, e.clientY, e.shiftKey);
|
|
1203
1399
|
if (!target || deps.overlay.isOverlayElement(target)) return;
|
|
1204
1400
|
if (deps.crosshair.isCrosshairElement(target)) return;
|
|
1205
|
-
if (_optionalChain([deps, 'access',
|
|
1401
|
+
if (_optionalChain([deps, 'access', _41 => _41.isToolbarElement, 'optionalCall', _42 => _42(target)])) return;
|
|
1206
1402
|
if (target === hoveredElement) return;
|
|
1207
1403
|
hoveredElement = target;
|
|
1208
1404
|
showOverlay(target);
|
|
@@ -1210,14 +1406,38 @@ function createElementPicker(deps) {
|
|
|
1210
1406
|
}
|
|
1211
1407
|
function handleClick(e) {
|
|
1212
1408
|
const origin = eventTarget(e);
|
|
1213
|
-
if (origin && _optionalChain([deps, 'access',
|
|
1409
|
+
if (origin && _optionalChain([deps, 'access', _43 => _43.isToolbarElement, 'optionalCall', _44 => _44(origin)])) return;
|
|
1214
1410
|
const target = rawElementAtPoint(e.clientX, e.clientY);
|
|
1215
|
-
if (target && (_optionalChain([deps, 'access',
|
|
1411
|
+
if (target && (_optionalChain([deps, 'access', _45 => _45.isToolbarElement, 'optionalCall', _46 => _46(target)]) || deps.crosshair.isCrosshairElement(target))) return;
|
|
1216
1412
|
e.preventDefault();
|
|
1217
1413
|
e.stopPropagation();
|
|
1218
1414
|
if (heldElement) return;
|
|
1219
|
-
if (
|
|
1220
|
-
|
|
1415
|
+
if (swallowNextClick) {
|
|
1416
|
+
swallowNextClick = false;
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
if (!hoveredElement) return;
|
|
1420
|
+
lastPoint = { x: e.clientX, y: e.clientY };
|
|
1421
|
+
if (addKey(e)) {
|
|
1422
|
+
const at = collected.indexOf(hoveredElement);
|
|
1423
|
+
if (at >= 0) collected.splice(at, 1);
|
|
1424
|
+
else if (collected.length < MAX_MEMBERS) collected.push(hoveredElement);
|
|
1425
|
+
showCollected();
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
clearCollected();
|
|
1429
|
+
deps.onSelect(hoveredElement, lastPoint);
|
|
1430
|
+
}
|
|
1431
|
+
function handleKeyUp(e) {
|
|
1432
|
+
if (e.key !== (IS_MAC ? "Meta" : "Control") || !collected.length || heldElement) return;
|
|
1433
|
+
const elements = collected;
|
|
1434
|
+
collected = [];
|
|
1435
|
+
deps.groupOutline.hide();
|
|
1436
|
+
if (elements.length === 1) {
|
|
1437
|
+
hoveredElement = elements[0];
|
|
1438
|
+
deps.onSelect(elements[0], lastPoint);
|
|
1439
|
+
} else {
|
|
1440
|
+
deps.onSelectGroup(elements, lastPoint);
|
|
1221
1441
|
}
|
|
1222
1442
|
}
|
|
1223
1443
|
return {
|
|
@@ -1225,31 +1445,46 @@ function createElementPicker(deps) {
|
|
|
1225
1445
|
if (listening) return;
|
|
1226
1446
|
listening = true;
|
|
1227
1447
|
deps.crosshair.activate();
|
|
1448
|
+
for (const type of PRESS_EVENTS) window.addEventListener(type, handlePress, { capture: true, passive: false });
|
|
1228
1449
|
document.addEventListener("mousemove", handleMouseMove, true);
|
|
1229
1450
|
document.addEventListener("click", handleClick, true);
|
|
1451
|
+
window.addEventListener("keyup", handleKeyUp, true);
|
|
1230
1452
|
},
|
|
1231
1453
|
deactivate() {
|
|
1232
1454
|
if (!listening) return;
|
|
1233
1455
|
listening = false;
|
|
1234
1456
|
hoveredElement = null;
|
|
1235
1457
|
heldElement = null;
|
|
1458
|
+
press = null;
|
|
1459
|
+
swallowNextClick = false;
|
|
1460
|
+
collected = [];
|
|
1461
|
+
endDrag();
|
|
1236
1462
|
deps.crosshair.hold(false);
|
|
1237
1463
|
deps.crosshair.deactivate();
|
|
1464
|
+
for (const type of PRESS_EVENTS) window.removeEventListener(type, handlePress, true);
|
|
1238
1465
|
document.removeEventListener("mousemove", handleMouseMove, true);
|
|
1239
1466
|
document.removeEventListener("click", handleClick, true);
|
|
1467
|
+
window.removeEventListener("keyup", handleKeyUp, true);
|
|
1240
1468
|
deps.overlay.hide();
|
|
1241
1469
|
deps.onHover(null);
|
|
1242
1470
|
},
|
|
1243
|
-
hold(element) {
|
|
1471
|
+
hold(element, group) {
|
|
1244
1472
|
if (!listening) return;
|
|
1245
1473
|
heldElement = element;
|
|
1246
1474
|
hoveredElement = element;
|
|
1475
|
+
press = null;
|
|
1247
1476
|
deps.crosshair.hold(true);
|
|
1248
|
-
|
|
1477
|
+
if (group) {
|
|
1478
|
+
deps.overlay.hide();
|
|
1479
|
+
deps.groupOutline.show(group.spec, group.label);
|
|
1480
|
+
} else {
|
|
1481
|
+
showOverlay(element);
|
|
1482
|
+
}
|
|
1249
1483
|
},
|
|
1250
1484
|
release() {
|
|
1251
1485
|
if (!heldElement) return;
|
|
1252
1486
|
heldElement = null;
|
|
1487
|
+
deps.groupOutline.hide();
|
|
1253
1488
|
deps.crosshair.hold(false);
|
|
1254
1489
|
},
|
|
1255
1490
|
isHolding() {
|
|
@@ -1408,7 +1643,7 @@ function createPluginRegistry() {
|
|
|
1408
1643
|
},
|
|
1409
1644
|
callHook(hookName, ...args) {
|
|
1410
1645
|
for (const plugin of plugins.values()) {
|
|
1411
|
-
const hook = _optionalChain([plugin, 'access',
|
|
1646
|
+
const hook = _optionalChain([plugin, 'access', _47 => _47.hooks, 'optionalAccess', _48 => _48[hookName]]);
|
|
1412
1647
|
if (hook) {
|
|
1413
1648
|
try {
|
|
1414
1649
|
hook(...args);
|
|
@@ -1421,7 +1656,7 @@ function createPluginRegistry() {
|
|
|
1421
1656
|
callTransformHook(text, comments) {
|
|
1422
1657
|
let result = text;
|
|
1423
1658
|
for (const plugin of plugins.values()) {
|
|
1424
|
-
const transform = _optionalChain([plugin, 'access',
|
|
1659
|
+
const transform = _optionalChain([plugin, 'access', _49 => _49.hooks, 'optionalAccess', _50 => _50.transformCopyContent]);
|
|
1425
1660
|
if (transform) {
|
|
1426
1661
|
try {
|
|
1427
1662
|
result = transform(result, comments);
|
|
@@ -1807,7 +2042,7 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1807
2042
|
buttons.history.appendChild(badge);
|
|
1808
2043
|
buttons.enable = createButton("enable", ICON_POWER, "Enable/Disable", callbacks.onEnableToggle);
|
|
1809
2044
|
buttons.dismiss = createButton("dismiss", ICON_DISMISS, _nullishCoalesce(options.dismissLabel, () => ( "Dismiss toolbar")), callbacks.onDismiss);
|
|
1810
|
-
buttons.expand = createButton("expand", ICON_GRAB, _nullishCoalesce(options.expandLabel, () => ( "Open Grabby toolbar")), () => _optionalChain([callbacks, 'access',
|
|
2045
|
+
buttons.expand = createButton("expand", ICON_GRAB, _nullishCoalesce(options.expandLabel, () => ( "Open Grabby toolbar")), () => _optionalChain([callbacks, 'access', _51 => _51.onExpand, 'optionalCall', _52 => _52()]));
|
|
1811
2046
|
buttons.expand.classList.add("grabby-btn-expand");
|
|
1812
2047
|
expandBadge = document.createElement("span");
|
|
1813
2048
|
expandBadge.className = "grabby-badge";
|
|
@@ -1837,7 +2072,7 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1837
2072
|
buttons.finish.addEventListener("click", (e) => {
|
|
1838
2073
|
e.preventDefault();
|
|
1839
2074
|
e.stopPropagation();
|
|
1840
|
-
_optionalChain([callbacks, 'access',
|
|
2075
|
+
_optionalChain([callbacks, 'access', _53 => _53.onFinish, 'optionalCall', _54 => _54()]);
|
|
1841
2076
|
});
|
|
1842
2077
|
content.appendChild(status);
|
|
1843
2078
|
content.appendChild(buttons.finish);
|
|
@@ -1887,16 +2122,16 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1887
2122
|
if (status && buttons.finish) {
|
|
1888
2123
|
const summary = syncSummary(state.toolbar.comments);
|
|
1889
2124
|
status.hidden = !summary;
|
|
1890
|
-
status.textContent = _nullishCoalesce(_optionalChain([summary, 'optionalAccess',
|
|
1891
|
-
status.dataset.tone = _nullishCoalesce(_optionalChain([summary, 'optionalAccess',
|
|
2125
|
+
status.textContent = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _55 => _55.text]), () => ( ""));
|
|
2126
|
+
status.dataset.tone = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _56 => _56.tone]), () => ( ""));
|
|
1892
2127
|
buttons.finish.hidden = count === 0;
|
|
1893
2128
|
}
|
|
1894
2129
|
if (state.options.enabled) {
|
|
1895
2130
|
buttons.enable.classList.add("grabby-btn-active");
|
|
1896
|
-
_optionalChain([leftGroup, 'optionalAccess',
|
|
2131
|
+
_optionalChain([leftGroup, 'optionalAccess', _57 => _57.classList, 'access', _58 => _58.remove, 'call', _59 => _59("grabby-toolbar-left-hidden")]);
|
|
1897
2132
|
} else {
|
|
1898
2133
|
buttons.enable.classList.remove("grabby-btn-active");
|
|
1899
|
-
_optionalChain([leftGroup, 'optionalAccess',
|
|
2134
|
+
_optionalChain([leftGroup, 'optionalAccess', _60 => _60.classList, 'access', _61 => _61.add, 'call', _62 => _62("grabby-toolbar-left-hidden")]);
|
|
1900
2135
|
}
|
|
1901
2136
|
},
|
|
1902
2137
|
collapse() {
|
|
@@ -1917,7 +2152,7 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1917
2152
|
container.classList.remove("grabby-toolbar-collapsed");
|
|
1918
2153
|
const cs = getComputedStyle(container);
|
|
1919
2154
|
const chrome = ["paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"].reduce((sum, k) => sum + (parseFloat(cs[k]) || 0), 0);
|
|
1920
|
-
container.style.width = `${(_nullishCoalesce(_optionalChain([content, 'optionalAccess',
|
|
2155
|
+
container.style.width = `${(_nullishCoalesce(_optionalChain([content, 'optionalAccess', _63 => _63.offsetWidth]), () => ( 0))) + chrome}px`;
|
|
1921
2156
|
morphTimer = setTimeout(() => {
|
|
1922
2157
|
morphTimer = null;
|
|
1923
2158
|
if (!collapsed && container) container.style.width = "";
|
|
@@ -1938,7 +2173,7 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1938
2173
|
},
|
|
1939
2174
|
dispose() {
|
|
1940
2175
|
clearMorph();
|
|
1941
|
-
_optionalChain([container, 'optionalAccess',
|
|
2176
|
+
_optionalChain([container, 'optionalAccess', _64 => _64.remove, 'call', _65 => _65()]);
|
|
1942
2177
|
removeStyles(STYLE_ID3);
|
|
1943
2178
|
container = null;
|
|
1944
2179
|
leftGroup = null;
|
|
@@ -1990,7 +2225,7 @@ function header(comments, env, ctx) {
|
|
|
1990
2225
|
if (frameworks.length) meta.push(frameworks.join(", "));
|
|
1991
2226
|
const routes = uniq(comments.map((c) => c.page.route));
|
|
1992
2227
|
if (!ctx.showRoutes && routes.length === 1) meta.push(`page ${routes[0]}`);
|
|
1993
|
-
const vp = _optionalChain([comments, 'access',
|
|
2228
|
+
const vp = _optionalChain([comments, 'access', _66 => _66[0], 'optionalAccess', _67 => _67.page, 'access', _68 => _68.viewport]);
|
|
1994
2229
|
if (vp) meta.push(`${vp[0]}\xD7${vp[1]}`);
|
|
1995
2230
|
meta.push((_nullishCoalesce(env.now, () => ( /* @__PURE__ */ new Date()))).toISOString().slice(0, 10));
|
|
1996
2231
|
lines.push(meta.join(" \xB7 "));
|
|
@@ -2000,10 +2235,15 @@ function header(comments, env, ctx) {
|
|
|
2000
2235
|
}
|
|
2001
2236
|
return lines;
|
|
2002
2237
|
}
|
|
2238
|
+
var pct = (v) => `${Math.round(v * 100)}%`;
|
|
2239
|
+
function memberRefs(c, full) {
|
|
2240
|
+
return (_nullishCoalesce(c.members, () => ( []))).map((m) => m.source ? location2(m.source.file, m.source.line, full) : m.selector).join(", ");
|
|
2241
|
+
}
|
|
2003
2242
|
function compactLine(c, i, ctx) {
|
|
2004
2243
|
const t = c.target;
|
|
2005
2244
|
const where = t.source ? location2(t.source.file, t.source.line, true) : t.selector;
|
|
2006
|
-
const
|
|
2245
|
+
const own = [where, t.component, `<${t.tag}>`].filter(Boolean).join(" ");
|
|
2246
|
+
const parts = _optionalChain([c, 'access', _69 => _69.members, 'optionalAccess', _70 => _70.length]) ? `[${c.members.length} elements] ${memberRefs(c, true)}` : c.area ? `[area] in ${own}` : own;
|
|
2007
2247
|
const who = ctx.showAuthors ? ` (${authorLabel(c.author)})` : "";
|
|
2008
2248
|
const route = ctx.showRoutes ? ` [${c.page.route}]` : "";
|
|
2009
2249
|
const id = ctx.showIds ? ` [id ${c.id}]` : "";
|
|
@@ -2016,11 +2256,24 @@ function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
|
2016
2256
|
const b = (text) => lines.push(` - ${text}`);
|
|
2017
2257
|
const where = [`\`${t.preview}\``, `(${t.kind})`];
|
|
2018
2258
|
if (t.component && t.component !== headedComponent) {
|
|
2019
|
-
where.push(_optionalChain([t, 'access',
|
|
2020
|
-
} else if (_optionalChain([t, 'access',
|
|
2259
|
+
where.push(_optionalChain([t, 'access', _71 => _71.source, 'optionalAccess', _72 => _72.line]) != null && groupHasSource ? `${t.component} line ${t.source.line}` : t.component);
|
|
2260
|
+
} else if (_optionalChain([t, 'access', _73 => _73.source, 'optionalAccess', _74 => _74.line]) != null && groupHasSource) {
|
|
2021
2261
|
where.push(`line ${t.source.line}`);
|
|
2022
2262
|
}
|
|
2263
|
+
if (_optionalChain([c, 'access', _75 => _75.members, 'optionalAccess', _76 => _76.length])) where.unshift("in");
|
|
2264
|
+
if (c.area) where.unshift("area in");
|
|
2023
2265
|
b(where.join(" "));
|
|
2266
|
+
if (c.area) {
|
|
2267
|
+
const a = c.area;
|
|
2268
|
+
b(`region: ${pct(a.x)} from left, ${pct(a.y)} from top, ${pct(a.w)} wide, ${pct(a.h)} tall`);
|
|
2269
|
+
}
|
|
2270
|
+
if (_optionalChain([c, 'access', _77 => _77.members, 'optionalAccess', _78 => _78.length])) {
|
|
2271
|
+
b(`${c.members.length} elements:`);
|
|
2272
|
+
for (const m of c.members) {
|
|
2273
|
+
const at = m.source ? location2(m.source.file, m.source.line, full) : `selector \`${m.selector}\``;
|
|
2274
|
+
lines.push(` - \`${m.preview}\` (${m.kind})${m.component && m.component !== t.component ? ` ${m.component}` : ""} ${at}`);
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2024
2277
|
if (!t.source || full) b(`selector: \`${t.selector}\``);
|
|
2025
2278
|
const plain = Object.entries(t.facts).filter(([k, v]) => !STYLE_FACTS.has(k) && !(PREVIEW_FACTS.has(k) && !full && inPreview(t.preview, v)));
|
|
2026
2279
|
if (plain.length) b(plain.map(([k, v]) => `${k}: ${v}`).join(" \xB7 "));
|
|
@@ -2033,7 +2286,7 @@ function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
|
2033
2286
|
for (const [k, v] of Object.entries(t.extra)) b(`${k}: ${v}`);
|
|
2034
2287
|
b(`viewport: ${c.page.viewport[0]}\xD7${c.page.viewport[1]}`);
|
|
2035
2288
|
}
|
|
2036
|
-
if (_optionalChain([c, 'access',
|
|
2289
|
+
if (_optionalChain([c, 'access', _79 => _79.screenshot, 'optionalAccess', _80 => _80.url])) b(`screenshot: ${c.screenshot.url}`);
|
|
2037
2290
|
const meta = [];
|
|
2038
2291
|
if (ctx.showAuthors) meta.push(`by ${authorLabel(c.author)}`);
|
|
2039
2292
|
if (ctx.showRoutes) meta.push(`on ${c.page.route}`);
|
|
@@ -2059,7 +2312,7 @@ function formatExport(comments, level = "standard", env = {}) {
|
|
|
2059
2312
|
}
|
|
2060
2313
|
const groups = /* @__PURE__ */ new Map();
|
|
2061
2314
|
for (const c of ordered) {
|
|
2062
|
-
const key = _nullishCoalesce(_optionalChain([c, 'access',
|
|
2315
|
+
const key = _nullishCoalesce(_optionalChain([c, 'access', _81 => _81.target, 'access', _82 => _82.source, 'optionalAccess', _83 => _83.file]), () => ( ""));
|
|
2063
2316
|
const list = groups.get(key);
|
|
2064
2317
|
if (list) list.push(c);
|
|
2065
2318
|
else groups.set(key, [c]);
|
|
@@ -2069,7 +2322,7 @@ function formatExport(comments, level = "standard", env = {}) {
|
|
|
2069
2322
|
out.push("");
|
|
2070
2323
|
const components = uniq(list.map((c) => c.target.component));
|
|
2071
2324
|
const headed = file && components.length === 1 ? components[0] : null;
|
|
2072
|
-
const lines = uniq(list.map((c) => _nullishCoalesce(_optionalChain([c, 'access',
|
|
2325
|
+
const lines = uniq(list.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _84 => _84.target, 'access', _85 => _85.source, 'optionalAccess', _86 => _86.line]), () => ( null))));
|
|
2073
2326
|
if (file) {
|
|
2074
2327
|
const loc = lines.length === 1 ? location2(file, lines[0], true) : file;
|
|
2075
2328
|
out.push(`## ${loc}${headed ? ` \xB7 ${headed}` : ""}`);
|
|
@@ -2254,7 +2507,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2254
2507
|
let visible = false;
|
|
2255
2508
|
let objectUrls = [];
|
|
2256
2509
|
function ensurePanel() {
|
|
2257
|
-
if (_optionalChain([panel, 'optionalAccess',
|
|
2510
|
+
if (_optionalChain([panel, 'optionalAccess', _87 => _87.isConnected])) return panel;
|
|
2258
2511
|
addStyles(STYLE_ID4, CSS2);
|
|
2259
2512
|
panel = h("div", { id: PANEL_ID, role: "dialog", "aria-label": "Comments" });
|
|
2260
2513
|
getUiRoot().appendChild(panel);
|
|
@@ -2265,7 +2518,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2265
2518
|
objectUrls = [];
|
|
2266
2519
|
}
|
|
2267
2520
|
function thumbnail(comment) {
|
|
2268
|
-
const localId = _optionalChain([comment, 'access',
|
|
2521
|
+
const localId = _optionalChain([comment, 'access', _88 => _88.screenshot, 'optionalAccess', _89 => _89.localId]);
|
|
2269
2522
|
if (!localId) return null;
|
|
2270
2523
|
const img = h("img", { class: "grabby-thumb", alt: "", loading: "lazy" });
|
|
2271
2524
|
img.addEventListener("error", () => img.remove(), { once: true });
|
|
@@ -2282,7 +2535,8 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2282
2535
|
}
|
|
2283
2536
|
function row2(comment, showAuthors) {
|
|
2284
2537
|
const t = comment.target;
|
|
2285
|
-
const
|
|
2538
|
+
const group = _optionalChain([comment, 'access', _90 => _90.members, 'optionalAccess', _91 => _91.length]) ? `${comment.members.length} elements` : comment.area ? "area" : null;
|
|
2539
|
+
const meta = live ? [document.createTextNode(`${describeComment(comment)} `)] : [h("span", { class: "grabby-kind" }, _nullishCoalesce(group, () => ( t.kind)))];
|
|
2286
2540
|
if (!live) {
|
|
2287
2541
|
if (t.component) meta.push(document.createTextNode(`${t.component} `));
|
|
2288
2542
|
if (t.source) {
|
|
@@ -2374,7 +2628,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2374
2628
|
h("strong", null, live ? "Nothing sent yet" : "No comments yet"),
|
|
2375
2629
|
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."
|
|
2376
2630
|
) : h("div", { class: "grabby-panel-list" }, ...comments.map((c) => row2(c, showAuthors)));
|
|
2377
|
-
const who = _nullishCoalesce(_optionalChain([options, 'access',
|
|
2631
|
+
const who = _nullishCoalesce(_optionalChain([options, 'access', _92 => _92.identityLabel, 'optionalCall', _93 => _93()]), () => ( null));
|
|
2378
2632
|
let footer = null;
|
|
2379
2633
|
if (live && who) {
|
|
2380
2634
|
footer = h(
|
|
@@ -2387,7 +2641,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2387
2641
|
"data-grabby-change-identity": "",
|
|
2388
2642
|
onclick: (e) => {
|
|
2389
2643
|
e.stopPropagation();
|
|
2390
|
-
_optionalChain([callbacks, 'access',
|
|
2644
|
+
_optionalChain([callbacks, 'access', _94 => _94.onChangeIdentity, 'optionalCall', _95 => _95()]);
|
|
2391
2645
|
}
|
|
2392
2646
|
}, "Change")
|
|
2393
2647
|
);
|
|
@@ -2421,7 +2675,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2421
2675
|
},
|
|
2422
2676
|
hide() {
|
|
2423
2677
|
visible = false;
|
|
2424
|
-
_optionalChain([panel, 'optionalAccess',
|
|
2678
|
+
_optionalChain([panel, 'optionalAccess', _96 => _96.classList, 'access', _97 => _97.remove, 'call', _98 => _98("grabby-popover-visible")]);
|
|
2425
2679
|
},
|
|
2426
2680
|
isVisible() {
|
|
2427
2681
|
return visible;
|
|
@@ -2431,7 +2685,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2431
2685
|
},
|
|
2432
2686
|
dispose() {
|
|
2433
2687
|
revokeThumbs();
|
|
2434
|
-
_optionalChain([panel, 'optionalAccess',
|
|
2688
|
+
_optionalChain([panel, 'optionalAccess', _99 => _99.remove, 'call', _100 => _100()]);
|
|
2435
2689
|
removeStyles(STYLE_ID4);
|
|
2436
2690
|
panel = null;
|
|
2437
2691
|
visible = false;
|
|
@@ -2512,6 +2766,13 @@ function createCommentPopover(callbacks) {
|
|
|
2512
2766
|
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 4px; border: none;
|
|
2513
2767
|
background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer; text-decoration: underline;
|
|
2514
2768
|
}
|
|
2769
|
+
#${POPOVER_ID} .grabby-cp-heading {
|
|
2770
|
+
font: 600 12px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
2771
|
+
color: #15803d;
|
|
2772
|
+
overflow: hidden;
|
|
2773
|
+
text-overflow: ellipsis;
|
|
2774
|
+
white-space: nowrap;
|
|
2775
|
+
}
|
|
2515
2776
|
#${POPOVER_ID} .grabby-cp-edit-actions { display: flex; align-items: center; gap: 6px; }
|
|
2516
2777
|
#${POPOVER_ID} .grabby-cp-edit-actions .grabby-cp-spacer { flex: 1; }
|
|
2517
2778
|
#${POPOVER_ID} .grabby-cp-delete {
|
|
@@ -2550,18 +2811,18 @@ function createCommentPopover(callbacks) {
|
|
|
2550
2811
|
getUiRoot().appendChild(popover);
|
|
2551
2812
|
return popover;
|
|
2552
2813
|
}
|
|
2553
|
-
function position(el, anchor) {
|
|
2814
|
+
function position(el, anchor, box) {
|
|
2554
2815
|
const vw = window.innerWidth;
|
|
2555
2816
|
const vh = window.innerHeight;
|
|
2556
2817
|
const fW = 300;
|
|
2557
2818
|
const fH = 120;
|
|
2558
|
-
if (!anchor) {
|
|
2819
|
+
if (!anchor && !box) {
|
|
2559
2820
|
el.style.left = "50%";
|
|
2560
2821
|
el.style.top = "24px";
|
|
2561
2822
|
el.style.transform = "translateX(-50%)";
|
|
2562
2823
|
return;
|
|
2563
2824
|
}
|
|
2564
|
-
const rect = anchor.getBoundingClientRect();
|
|
2825
|
+
const rect = box ? { ...box, width: box.right - box.left, height: box.bottom - box.top } : anchor.getBoundingClientRect();
|
|
2565
2826
|
let left;
|
|
2566
2827
|
let top;
|
|
2567
2828
|
if (rect.right + 16 + fW <= vw) {
|
|
@@ -2586,7 +2847,7 @@ function createCommentPopover(callbacks) {
|
|
|
2586
2847
|
return !!el && el !== textarea && el !== nameInput && isEditableElement(el);
|
|
2587
2848
|
}
|
|
2588
2849
|
function save() {
|
|
2589
|
-
const v = _optionalChain([textarea, 'optionalAccess',
|
|
2850
|
+
const v = _optionalChain([textarea, 'optionalAccess', _101 => _101.value, 'access', _102 => _102.trim, 'call', _103 => _103()]);
|
|
2590
2851
|
if (!v) return;
|
|
2591
2852
|
pendingValue = v;
|
|
2592
2853
|
if (askIdentity) showIdentityStep();
|
|
@@ -2605,7 +2866,7 @@ function createCommentPopover(callbacks) {
|
|
|
2605
2866
|
const del = () => {
|
|
2606
2867
|
const ctx = currentCtx;
|
|
2607
2868
|
doHide();
|
|
2608
|
-
_optionalChain([callbacks, 'access',
|
|
2869
|
+
_optionalChain([callbacks, 'access', _104 => _104.onDelete, 'optionalCall', _105 => _105(ctx)]);
|
|
2609
2870
|
};
|
|
2610
2871
|
return h(
|
|
2611
2872
|
"div",
|
|
@@ -2634,7 +2895,7 @@ function createCommentPopover(callbacks) {
|
|
|
2634
2895
|
autocomplete: "name",
|
|
2635
2896
|
"aria-label": "Your name"
|
|
2636
2897
|
});
|
|
2637
|
-
const post = () => finish({ name: _optionalChain([nameInput, 'optionalAccess',
|
|
2898
|
+
const post = () => finish({ name: _optionalChain([nameInput, 'optionalAccess', _106 => _106.value, 'access', _107 => _107.trim, 'call', _108 => _108()]) || null });
|
|
2638
2899
|
popover.replaceChildren(
|
|
2639
2900
|
h("div", { class: "grabby-cp-title" }, "Thanks! Who is this from?"),
|
|
2640
2901
|
h("div", { class: "grabby-cp-sub" }, "Your name helps the team follow up. It's remembered in this browser."),
|
|
@@ -2668,7 +2929,7 @@ function createCommentPopover(callbacks) {
|
|
|
2668
2929
|
} else if (e.key === "Enter" && deepActiveElement() === nameInput) {
|
|
2669
2930
|
e.preventDefault();
|
|
2670
2931
|
e.stopImmediatePropagation();
|
|
2671
|
-
finish({ name: _optionalChain([nameInput, 'optionalAccess',
|
|
2932
|
+
finish({ name: _optionalChain([nameInput, 'optionalAccess', _109 => _109.value, 'access', _110 => _110.trim, 'call', _111 => _111()]) || null });
|
|
2672
2933
|
}
|
|
2673
2934
|
return;
|
|
2674
2935
|
}
|
|
@@ -2699,7 +2960,7 @@ function createCommentPopover(callbacks) {
|
|
|
2699
2960
|
}
|
|
2700
2961
|
function doHide() {
|
|
2701
2962
|
visible = false;
|
|
2702
|
-
_optionalChain([popover, 'optionalAccess',
|
|
2963
|
+
_optionalChain([popover, 'optionalAccess', _112 => _112.remove, 'call', _113 => _113()]);
|
|
2703
2964
|
popover = null;
|
|
2704
2965
|
textarea = null;
|
|
2705
2966
|
nameInput = null;
|
|
@@ -2715,11 +2976,15 @@ function createCommentPopover(callbacks) {
|
|
|
2715
2976
|
currentCtx = { mode: opts.mode, entryId: opts.entryId };
|
|
2716
2977
|
askIdentity = opts.askIdentity === true && opts.mode === "new";
|
|
2717
2978
|
visible = true;
|
|
2979
|
+
textarea.placeholder = _nullishCoalesce(opts.placeholder, () => ( "What should change here?"));
|
|
2980
|
+
if (opts.heading) {
|
|
2981
|
+
el.prepend(h("div", { class: "grabby-cp-heading", title: opts.heading }, opts.heading));
|
|
2982
|
+
}
|
|
2718
2983
|
if (opts.mode === "edit") el.appendChild(editActions());
|
|
2719
|
-
position(el, opts.anchor);
|
|
2984
|
+
position(el, opts.anchor, opts.anchorBox);
|
|
2720
2985
|
attachKey();
|
|
2721
|
-
_optionalChain([textarea, 'optionalAccess',
|
|
2722
|
-
requestAnimationFrame(() => _optionalChain([textarea, 'optionalAccess',
|
|
2986
|
+
_optionalChain([textarea, 'optionalAccess', _114 => _114.focus, 'call', _115 => _115()]);
|
|
2987
|
+
requestAnimationFrame(() => _optionalChain([textarea, 'optionalAccess', _116 => _116.focus, 'call', _117 => _117()]));
|
|
2723
2988
|
},
|
|
2724
2989
|
hide() {
|
|
2725
2990
|
if (!visible) return;
|
|
@@ -2731,7 +2996,7 @@ function createCommentPopover(callbacks) {
|
|
|
2731
2996
|
hasDraft() {
|
|
2732
2997
|
if (!visible) return false;
|
|
2733
2998
|
if (stage === "identity") return true;
|
|
2734
|
-
const v = _nullishCoalesce(_optionalChain([textarea, 'optionalAccess',
|
|
2999
|
+
const v = _nullishCoalesce(_optionalChain([textarea, 'optionalAccess', _118 => _118.value, 'access', _119 => _119.trim, 'call', _120 => _120()]), () => ( ""));
|
|
2735
3000
|
return v !== "" && v !== initialValue.trim();
|
|
2736
3001
|
},
|
|
2737
3002
|
isPopoverElement(el) {
|
|
@@ -2820,7 +3085,7 @@ function createCopySheet(callbacks) {
|
|
|
2820
3085
|
document.removeEventListener("keydown", keyHandler, true);
|
|
2821
3086
|
keyHandler = null;
|
|
2822
3087
|
}
|
|
2823
|
-
_optionalChain([callbacks, 'access',
|
|
3088
|
+
_optionalChain([callbacks, 'access', _121 => _121.onClose, 'optionalCall', _122 => _122()]);
|
|
2824
3089
|
}
|
|
2825
3090
|
function open(options) {
|
|
2826
3091
|
close();
|
|
@@ -2842,12 +3107,12 @@ function createCopySheet(callbacks) {
|
|
|
2842
3107
|
level = next;
|
|
2843
3108
|
edited = false;
|
|
2844
3109
|
textarea.value = options.render(level);
|
|
2845
|
-
hint.textContent = _nullishCoalesce(_optionalChain([LEVELS, 'access',
|
|
3110
|
+
hint.textContent = _nullishCoalesce(_optionalChain([LEVELS, 'access', _123 => _123.find, 'call', _124 => _124((l) => l.id === level), 'optionalAccess', _125 => _125.hint]), () => ( ""));
|
|
2846
3111
|
for (const [id, btn] of segButtons) btn.setAttribute("aria-checked", String(id === level));
|
|
2847
3112
|
status.classList.remove("grabby-error");
|
|
2848
3113
|
status.textContent = discarded ? "Your edits were replaced by the new detail level." : "";
|
|
2849
3114
|
updateTokens();
|
|
2850
|
-
_optionalChain([callbacks, 'access',
|
|
3115
|
+
_optionalChain([callbacks, 'access', _126 => _126.onLevelChange, 'optionalCall', _127 => _127(level)]);
|
|
2851
3116
|
}
|
|
2852
3117
|
const seg = h(
|
|
2853
3118
|
"div",
|
|
@@ -2925,7 +3190,7 @@ function createCopySheet(callbacks) {
|
|
|
2925
3190
|
document.addEventListener("keydown", keyHandler, true);
|
|
2926
3191
|
getUiRoot().appendChild(sheet);
|
|
2927
3192
|
setLevel(level, true);
|
|
2928
|
-
_optionalChain([sheet, 'access',
|
|
3193
|
+
_optionalChain([sheet, 'access', _128 => _128.querySelector, 'call', _129 => _129("[data-grabby-copy-clear]"), 'optionalAccess', _130 => _130.focus, 'call', _131 => _131()]);
|
|
2929
3194
|
}
|
|
2930
3195
|
return {
|
|
2931
3196
|
open,
|
|
@@ -3073,7 +3338,7 @@ function createFinishSheet(callbacks) {
|
|
|
3073
3338
|
...note ? [h("div", { class: "grabby-finish-note" }, note)] : [],
|
|
3074
3339
|
h("div", { class: "grabby-finish-actions" }, ...actions)
|
|
3075
3340
|
);
|
|
3076
|
-
_optionalChain([sheet, 'access',
|
|
3341
|
+
_optionalChain([sheet, 'access', _132 => _132.querySelector, 'call', _133 => _133(".grabby-btn-primary:not([disabled])"), 'optionalAccess', _134 => _134.focus, 'call', _135 => _135()]);
|
|
3077
3342
|
}
|
|
3078
3343
|
return {
|
|
3079
3344
|
open(next) {
|
|
@@ -3157,7 +3422,7 @@ function createCoachMark() {
|
|
|
3157
3422
|
let el = null;
|
|
3158
3423
|
function dismiss() {
|
|
3159
3424
|
markSeen();
|
|
3160
|
-
_optionalChain([el, 'optionalAccess',
|
|
3425
|
+
_optionalChain([el, 'optionalAccess', _136 => _136.remove, 'call', _137 => _137()]);
|
|
3161
3426
|
el = null;
|
|
3162
3427
|
}
|
|
3163
3428
|
return {
|
|
@@ -3189,7 +3454,7 @@ function createCoachMark() {
|
|
|
3189
3454
|
},
|
|
3190
3455
|
dismiss,
|
|
3191
3456
|
dispose() {
|
|
3192
|
-
_optionalChain([el, 'optionalAccess',
|
|
3457
|
+
_optionalChain([el, 'optionalAccess', _138 => _138.remove, 'call', _139 => _139()]);
|
|
3193
3458
|
el = null;
|
|
3194
3459
|
removeStyles(STYLE_ID8);
|
|
3195
3460
|
}
|
|
@@ -3284,14 +3549,14 @@ function createOutbox(deps) {
|
|
|
3284
3549
|
if (job.kind === "comment") {
|
|
3285
3550
|
const res2 = await postComment(comment);
|
|
3286
3551
|
if (res2.ok) {
|
|
3287
|
-
if (_optionalChain([deps, 'access',
|
|
3552
|
+
if (_optionalChain([deps, 'access', _140 => _140.getComment, 'call', _141 => _141(job.id), 'optionalAccess', _142 => _142.screenshot, 'optionalAccess', _143 => _143.localId])) add(job.id, "shot");
|
|
3288
3553
|
return "done";
|
|
3289
3554
|
}
|
|
3290
3555
|
if (res2.status === 429 || res2.status >= 500) return "retry";
|
|
3291
3556
|
deps.onState(job.id, "failed", await res2.text().catch(() => String(res2.status)));
|
|
3292
3557
|
return "drop";
|
|
3293
3558
|
}
|
|
3294
|
-
const localId = _optionalChain([comment, 'access',
|
|
3559
|
+
const localId = _optionalChain([comment, 'access', _144 => _144.screenshot, 'optionalAccess', _145 => _145.localId]);
|
|
3295
3560
|
const blob = localId ? await deps.getScreenshot(localId) : null;
|
|
3296
3561
|
if (!blob) return "drop";
|
|
3297
3562
|
const { width, height } = comment.screenshot;
|
|
@@ -3552,7 +3817,7 @@ function createFreezeOverlay() {
|
|
|
3552
3817
|
removeHoverRules();
|
|
3553
3818
|
unfreezeAnimations();
|
|
3554
3819
|
unblockEvents();
|
|
3555
|
-
_optionalChain([overlay, 'optionalAccess',
|
|
3820
|
+
_optionalChain([overlay, 'optionalAccess', _146 => _146.remove, 'call', _147 => _147()]);
|
|
3556
3821
|
removeStyles(FREEZE_STYLE_ID);
|
|
3557
3822
|
overlay = null;
|
|
3558
3823
|
visible = false;
|
|
@@ -3639,6 +3904,8 @@ function createMarkers(deps) {
|
|
|
3639
3904
|
transition: transform 0.12s ease, box-shadow 0.15s ease;
|
|
3640
3905
|
}
|
|
3641
3906
|
.grabby-markers-layer .grabby-marker[hidden] { display: none; }
|
|
3907
|
+
/* Several elements or an area: a green square, like the outline it shows. */
|
|
3908
|
+
.grabby-markers-layer .grabby-marker.grabby-marker-group { border-radius: 6px; background: #16a34a; }
|
|
3642
3909
|
.grabby-markers-layer .grabby-marker:hover,
|
|
3643
3910
|
.grabby-markers-layer .grabby-marker:focus-visible {
|
|
3644
3911
|
z-index: 1;
|
|
@@ -3803,6 +4070,7 @@ function createMarkers(deps) {
|
|
|
3803
4070
|
host2.appendChild(entry.button);
|
|
3804
4071
|
}
|
|
3805
4072
|
entry.comment = comment;
|
|
4073
|
+
entry.button.classList.toggle("grabby-marker-group", !!(_optionalChain([comment, 'access', _148 => _148.members, 'optionalAccess', _149 => _149.length]) || comment.area));
|
|
3806
4074
|
const n = String(i + 1);
|
|
3807
4075
|
entry.number.textContent = n;
|
|
3808
4076
|
entry.button.setAttribute("aria-label", `Comment ${n}: ${preview(comment.comment)}. Click to edit.`);
|
|
@@ -3814,14 +4082,14 @@ function createMarkers(deps) {
|
|
|
3814
4082
|
}
|
|
3815
4083
|
function position(now) {
|
|
3816
4084
|
for (const entry of entries.values()) {
|
|
3817
|
-
if (!_optionalChain([entry, 'access',
|
|
4085
|
+
if (!_optionalChain([entry, 'access', _150 => _150.element, 'optionalAccess', _151 => _151.isConnected])) {
|
|
3818
4086
|
entry.element = null;
|
|
3819
4087
|
if (now - entry.lastLookup >= LOOKUP_RETRY_MS) {
|
|
3820
4088
|
entry.lastLookup = now;
|
|
3821
4089
|
entry.element = deps.findElement(entry.comment);
|
|
3822
4090
|
}
|
|
3823
4091
|
}
|
|
3824
|
-
const rect = _optionalChain([entry, 'access',
|
|
4092
|
+
const rect = _optionalChain([entry, 'access', _152 => _152.element, 'optionalAccess', _153 => _153.getBoundingClientRect, 'call', _154 => _154()]);
|
|
3825
4093
|
if (!rect || rect.width === 0 && rect.height === 0) {
|
|
3826
4094
|
entry.button.hidden = true;
|
|
3827
4095
|
continue;
|
|
@@ -3899,10 +4167,10 @@ function createMarkers(deps) {
|
|
|
3899
4167
|
stop();
|
|
3900
4168
|
document.removeEventListener("scroll", handleScroll, true);
|
|
3901
4169
|
entries.clear();
|
|
3902
|
-
_optionalChain([layer, 'optionalAccess',
|
|
3903
|
-
_optionalChain([docLayer, 'optionalAccess',
|
|
4170
|
+
_optionalChain([layer, 'optionalAccess', _155 => _155.remove, 'call', _156 => _156()]);
|
|
4171
|
+
_optionalChain([docLayer, 'optionalAccess', _157 => _157.remove, 'call', _158 => _158()]);
|
|
3904
4172
|
docLayer = null;
|
|
3905
|
-
_optionalChain([tip, 'optionalAccess',
|
|
4173
|
+
_optionalChain([tip, 'optionalAccess', _159 => _159.remove, 'call', _160 => _160()]);
|
|
3906
4174
|
layer = null;
|
|
3907
4175
|
tip = null;
|
|
3908
4176
|
hovered = null;
|
|
@@ -3912,11 +4180,141 @@ function createMarkers(deps) {
|
|
|
3912
4180
|
};
|
|
3913
4181
|
}
|
|
3914
4182
|
|
|
4183
|
+
// src/core/overlay/group-outline.ts
|
|
4184
|
+
var LAYER_ID2 = "__grabby-group__";
|
|
4185
|
+
var STYLE_ID10 = "__grabby-group-styles__";
|
|
4186
|
+
var GREEN = "#16a34a";
|
|
4187
|
+
function createGroupOutline() {
|
|
4188
|
+
let layer = null;
|
|
4189
|
+
let marqueeEl = null;
|
|
4190
|
+
let labelEl = null;
|
|
4191
|
+
let boxes = [];
|
|
4192
|
+
let spec = null;
|
|
4193
|
+
let rafId = null;
|
|
4194
|
+
function ensureLayer() {
|
|
4195
|
+
if (layer) return layer;
|
|
4196
|
+
if (!hasStyles(STYLE_ID10)) {
|
|
4197
|
+
addStyles(STYLE_ID10, `
|
|
4198
|
+
#${LAYER_ID2} { position: fixed; inset: 0; pointer-events: none; z-index: ${Z_INDEX_OVERLAY}; }
|
|
4199
|
+
#${LAYER_ID2} .grabby-group-box {
|
|
4200
|
+
position: absolute; left: 0; top: 0; box-sizing: border-box;
|
|
4201
|
+
border: 2px dashed ${GREEN}; border-radius: 4px; background: rgba(22, 163, 74, 0.08);
|
|
4202
|
+
}
|
|
4203
|
+
#${LAYER_ID2} .grabby-group-marquee {
|
|
4204
|
+
position: absolute; left: 0; top: 0; box-sizing: border-box;
|
|
4205
|
+
border: 1px solid var(--grabby-accent, #2563eb); border-radius: 2px;
|
|
4206
|
+
background: color-mix(in srgb, var(--grabby-accent, #2563eb) 8%, transparent);
|
|
4207
|
+
}
|
|
4208
|
+
#${LAYER_ID2} .grabby-group-label {
|
|
4209
|
+
position: absolute; left: 0; top: 0; padding: 2px 6px; border-radius: 3px;
|
|
4210
|
+
background: ${GREEN}; color: #fff; white-space: nowrap;
|
|
4211
|
+
font: 600 11px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
4212
|
+
}
|
|
4213
|
+
#${LAYER_ID2} [hidden] { display: none; }
|
|
4214
|
+
`);
|
|
4215
|
+
}
|
|
4216
|
+
layer = document.createElement("div");
|
|
4217
|
+
layer.id = LAYER_ID2;
|
|
4218
|
+
getUiRoot().appendChild(layer);
|
|
4219
|
+
return layer;
|
|
4220
|
+
}
|
|
4221
|
+
function place(el, b) {
|
|
4222
|
+
el.style.transform = `translate(${Math.round(b.left)}px, ${Math.round(b.top)}px)`;
|
|
4223
|
+
el.style.width = `${Math.max(0, Math.round(b.right - b.left))}px`;
|
|
4224
|
+
el.style.height = `${Math.max(0, Math.round(b.bottom - b.top))}px`;
|
|
4225
|
+
}
|
|
4226
|
+
function currentBoxes() {
|
|
4227
|
+
if (!spec) return [];
|
|
4228
|
+
if ("area" in spec) return spec.element.isConnected ? [areaToBox(spec.element, spec.area)] : [];
|
|
4229
|
+
return spec.elements.flatMap((el) => {
|
|
4230
|
+
if (!el.isConnected) return [];
|
|
4231
|
+
const r = el.getBoundingClientRect();
|
|
4232
|
+
return r.width === 0 && r.height === 0 ? [] : [{ left: r.left, top: r.top, right: r.right, bottom: r.bottom }];
|
|
4233
|
+
});
|
|
4234
|
+
}
|
|
4235
|
+
function render() {
|
|
4236
|
+
const host2 = ensureLayer();
|
|
4237
|
+
const list = currentBoxes();
|
|
4238
|
+
while (boxes.length < list.length) {
|
|
4239
|
+
const b = document.createElement("div");
|
|
4240
|
+
b.className = "grabby-group-box";
|
|
4241
|
+
host2.insertBefore(b, labelEl);
|
|
4242
|
+
boxes.push(b);
|
|
4243
|
+
}
|
|
4244
|
+
boxes.forEach((b, i) => {
|
|
4245
|
+
b.hidden = i >= list.length;
|
|
4246
|
+
if (i < list.length) place(b, list[i]);
|
|
4247
|
+
});
|
|
4248
|
+
if (labelEl && !labelEl.hidden) {
|
|
4249
|
+
const u = spec && "elements" in spec ? unionBox(spec.elements) : _nullishCoalesce(list[0], () => ( null));
|
|
4250
|
+
if (u) labelEl.style.transform = `translate(${Math.round(u.left)}px, ${Math.round(Math.max(0, u.top - 20))}px)`;
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
function track() {
|
|
4254
|
+
rafId = null;
|
|
4255
|
+
if (!spec) return;
|
|
4256
|
+
render();
|
|
4257
|
+
rafId = requestAnimationFrame(track);
|
|
4258
|
+
}
|
|
4259
|
+
function stop() {
|
|
4260
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
4261
|
+
rafId = null;
|
|
4262
|
+
}
|
|
4263
|
+
return {
|
|
4264
|
+
marquee(box) {
|
|
4265
|
+
if (!box) {
|
|
4266
|
+
if (marqueeEl) marqueeEl.hidden = true;
|
|
4267
|
+
return;
|
|
4268
|
+
}
|
|
4269
|
+
const host2 = ensureLayer();
|
|
4270
|
+
if (!marqueeEl) {
|
|
4271
|
+
marqueeEl = document.createElement("div");
|
|
4272
|
+
marqueeEl.className = "grabby-group-marquee";
|
|
4273
|
+
host2.appendChild(marqueeEl);
|
|
4274
|
+
}
|
|
4275
|
+
marqueeEl.hidden = false;
|
|
4276
|
+
place(marqueeEl, box);
|
|
4277
|
+
},
|
|
4278
|
+
show(next, label) {
|
|
4279
|
+
spec = next;
|
|
4280
|
+
const host2 = ensureLayer();
|
|
4281
|
+
if (!labelEl) {
|
|
4282
|
+
labelEl = document.createElement("div");
|
|
4283
|
+
labelEl.className = "grabby-group-label";
|
|
4284
|
+
host2.appendChild(labelEl);
|
|
4285
|
+
}
|
|
4286
|
+
labelEl.hidden = !label;
|
|
4287
|
+
labelEl.textContent = _nullishCoalesce(label, () => ( ""));
|
|
4288
|
+
stop();
|
|
4289
|
+
track();
|
|
4290
|
+
},
|
|
4291
|
+
hide() {
|
|
4292
|
+
spec = null;
|
|
4293
|
+
stop();
|
|
4294
|
+
for (const b of boxes) b.hidden = true;
|
|
4295
|
+
if (labelEl) labelEl.hidden = true;
|
|
4296
|
+
},
|
|
4297
|
+
isVisible() {
|
|
4298
|
+
return spec !== null;
|
|
4299
|
+
},
|
|
4300
|
+
dispose() {
|
|
4301
|
+
stop();
|
|
4302
|
+
_optionalChain([layer, 'optionalAccess', _161 => _161.remove, 'call', _162 => _162()]);
|
|
4303
|
+
layer = null;
|
|
4304
|
+
marqueeEl = null;
|
|
4305
|
+
labelEl = null;
|
|
4306
|
+
boxes = [];
|
|
4307
|
+
spec = null;
|
|
4308
|
+
removeStyles(STYLE_ID10);
|
|
4309
|
+
}
|
|
4310
|
+
};
|
|
4311
|
+
}
|
|
4312
|
+
|
|
3915
4313
|
// src/core/overlay/select-feedback.ts
|
|
3916
|
-
var
|
|
4314
|
+
var STYLE_ID11 = "__grabby-feedback-styles__";
|
|
3917
4315
|
function injectStyles() {
|
|
3918
|
-
if (hasStyles(
|
|
3919
|
-
addStyles(
|
|
4316
|
+
if (hasStyles(STYLE_ID11)) return;
|
|
4317
|
+
addStyles(STYLE_ID11, `
|
|
3920
4318
|
@keyframes grabby-flash {
|
|
3921
4319
|
0% { opacity: 1; }
|
|
3922
4320
|
100% { opacity: 0; transform: scale(1.02); }
|
|
@@ -3995,7 +4393,7 @@ function showSelectFeedback(element, label = "Selected") {
|
|
|
3995
4393
|
setTimeout(cleanup, 1200);
|
|
3996
4394
|
}
|
|
3997
4395
|
function disposeFeedbackStyles() {
|
|
3998
|
-
removeStyles(
|
|
4396
|
+
removeStyles(STYLE_ID11);
|
|
3999
4397
|
}
|
|
4000
4398
|
|
|
4001
4399
|
// src/core/storage/history-persistence.ts
|
|
@@ -4086,7 +4484,7 @@ function clearPersistedHistory() {
|
|
|
4086
4484
|
var baselineFrame = null;
|
|
4087
4485
|
var baselineCache = /* @__PURE__ */ new Map();
|
|
4088
4486
|
function baselineDoc() {
|
|
4089
|
-
if (_optionalChain([baselineFrame, 'optionalAccess',
|
|
4487
|
+
if (_optionalChain([baselineFrame, 'optionalAccess', _163 => _163.isConnected]) && baselineFrame.contentDocument) return baselineFrame.contentDocument;
|
|
4090
4488
|
try {
|
|
4091
4489
|
baselineFrame = document.createElement("iframe");
|
|
4092
4490
|
baselineFrame.setAttribute("aria-hidden", "true");
|
|
@@ -4116,8 +4514,8 @@ function baselineFor(tag, type, props) {
|
|
|
4116
4514
|
const missing = props.filter((p) => !cached.has(p));
|
|
4117
4515
|
if (missing.length > 0) {
|
|
4118
4516
|
const doc = baselineDoc();
|
|
4119
|
-
const view = _optionalChain([doc, 'optionalAccess',
|
|
4120
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
4517
|
+
const view = _optionalChain([doc, 'optionalAccess', _164 => _164.defaultView]);
|
|
4518
|
+
if (_optionalChain([doc, 'optionalAccess', _165 => _165.body]) && view) {
|
|
4121
4519
|
const probe = doc.createElement(tag);
|
|
4122
4520
|
if (type) probe.setAttribute("type", type);
|
|
4123
4521
|
doc.body.appendChild(probe);
|
|
@@ -4131,7 +4529,7 @@ function baselineFor(tag, type, props) {
|
|
|
4131
4529
|
return cached;
|
|
4132
4530
|
}
|
|
4133
4531
|
function disposeStyleBaseline() {
|
|
4134
|
-
_optionalChain([baselineFrame, 'optionalAccess',
|
|
4532
|
+
_optionalChain([baselineFrame, 'optionalAccess', _166 => _166.remove, 'call', _167 => _167()]);
|
|
4135
4533
|
baselineFrame = null;
|
|
4136
4534
|
baselineCache.clear();
|
|
4137
4535
|
}
|
|
@@ -4233,7 +4631,7 @@ function states(el) {
|
|
|
4233
4631
|
}
|
|
4234
4632
|
function actionFacts(el) {
|
|
4235
4633
|
const f = {};
|
|
4236
|
-
const imgAlt = _nullishCoalesce(_optionalChain([el, 'access',
|
|
4634
|
+
const imgAlt = _nullishCoalesce(_optionalChain([el, 'access', _168 => _168.querySelector, 'call', _169 => _169("img[alt]"), 'optionalAccess', _170 => _170.getAttribute, 'call', _171 => _171("alt")]), () => ( ""));
|
|
4237
4635
|
put(f, "label", accessibleLabel(el) || textOf(el, 80) || redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))) || redact(imgAlt));
|
|
4238
4636
|
if (el.tagName === "A") put(f, "href", sanitizeUrl(_nullishCoalesce(el.getAttribute("href"), () => ( ""))));
|
|
4239
4637
|
else if (el.tagName === "BUTTON" || el.tagName === "INPUT") put(f, "type", _nullishCoalesce(el.getAttribute("type"), () => ( (el.tagName === "BUTTON" ? "submit" : ""))));
|
|
@@ -4282,7 +4680,7 @@ function mediaFacts(el) {
|
|
|
4282
4680
|
put(f, "label", accessibleLabel(el) || textOf(_nullishCoalesce(el.querySelector("title"), () => ( el)), 40));
|
|
4283
4681
|
put(f, "viewBox", _nullishCoalesce(el.getAttribute("viewBox"), () => ( "")));
|
|
4284
4682
|
} else if (el.tagName === "VIDEO" || el.tagName === "AUDIO" || el.tagName === "IFRAME") {
|
|
4285
|
-
put(f, "src", basename3(_nullishCoalesce(_nullishCoalesce(el.getAttribute("src"), () => ( _optionalChain([el, 'access',
|
|
4683
|
+
put(f, "src", basename3(_nullishCoalesce(_nullishCoalesce(el.getAttribute("src"), () => ( _optionalChain([el, 'access', _172 => _172.querySelector, 'call', _173 => _173("source"), 'optionalAccess', _174 => _174.getAttribute, 'call', _175 => _175("src")]))), () => ( ""))));
|
|
4286
4684
|
put(f, "title", redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))));
|
|
4287
4685
|
}
|
|
4288
4686
|
put(f, "size", size(el));
|
|
@@ -4290,8 +4688,8 @@ function mediaFacts(el) {
|
|
|
4290
4688
|
return f;
|
|
4291
4689
|
}
|
|
4292
4690
|
function childLabel(child, resolver) {
|
|
4293
|
-
const resolved = _optionalChain([resolver, 'optionalCall',
|
|
4294
|
-
if (_optionalChain([resolved, 'optionalAccess',
|
|
4691
|
+
const resolved = _optionalChain([resolver, 'optionalCall', _176 => _176(child)]);
|
|
4692
|
+
if (_optionalChain([resolved, 'optionalAccess', _177 => _177.name]) && resolved.hostElement === child) return resolved.name;
|
|
4295
4693
|
const tag = child.tagName.toLowerCase();
|
|
4296
4694
|
if (/^h[1-6]$/.test(tag)) return "heading";
|
|
4297
4695
|
if (tag === "a") return "link";
|
|
@@ -4326,7 +4724,7 @@ function sectionFacts(el, resolver) {
|
|
|
4326
4724
|
const f = {};
|
|
4327
4725
|
put(f, "title", redact(el.ownerDocument.title));
|
|
4328
4726
|
put(f, "viewport", `${window.innerWidth}\xD7${window.innerHeight}`);
|
|
4329
|
-
const regions = Array.from(el.querySelectorAll('header, nav, main, aside, footer, section, [role="region"]')).filter((r) => !_optionalChain([r, 'access',
|
|
4727
|
+
const regions = Array.from(el.querySelectorAll('header, nav, main, aside, footer, section, [role="region"]')).filter((r) => !_optionalChain([r, 'access', _178 => _178.parentElement, 'optionalAccess', _179 => _179.closest, 'call', _180 => _180('header, nav, main, aside, footer, section, [role="region"]')]) || r.parentElement === el).slice(0, 8).map((r) => {
|
|
4330
4728
|
const heading = firstHeading2(r);
|
|
4331
4729
|
return heading ? `${r.tagName.toLowerCase()} "${truncate(heading, 30)}"` : r.tagName.toLowerCase();
|
|
4332
4730
|
});
|
|
@@ -4383,22 +4781,22 @@ function isAppFile(file) {
|
|
|
4383
4781
|
return !!file && !/(^|[\\/])node_modules[\\/]/.test(file);
|
|
4384
4782
|
}
|
|
4385
4783
|
function resolveStack(el, deps) {
|
|
4386
|
-
const comp = _nullishCoalesce(_optionalChain([deps, 'access',
|
|
4784
|
+
const comp = _nullishCoalesce(_optionalChain([deps, 'access', _181 => _181.componentResolver, 'optionalCall', _182 => _182(el)]), () => ( null));
|
|
4387
4785
|
const frames = [];
|
|
4388
4786
|
const named = [];
|
|
4389
|
-
for (const entry of _nullishCoalesce(_optionalChain([comp, 'optionalAccess',
|
|
4787
|
+
for (const entry of _nullishCoalesce(_optionalChain([comp, 'optionalAccess', _183 => _183.stack]), () => ( []))) {
|
|
4390
4788
|
const src = entry.filePath !== void 0 ? { filePath: entry.filePath, line: _nullishCoalesce(entry.line, () => ( null)) } : entry.hostElement && deps.sourceResolver ? deps.sourceResolver(entry.hostElement) : null;
|
|
4391
|
-
const frame = { name: entry.name, file: _nullishCoalesce(_optionalChain([src, 'optionalAccess',
|
|
4789
|
+
const frame = { name: entry.name, file: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _184 => _184.filePath]), () => ( null)), line: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _185 => _185.line]), () => ( null)) };
|
|
4392
4790
|
named.push(frame);
|
|
4393
4791
|
if (isAppFile(frame.file) && frames.length < MAX_STACK) frames.push(frame);
|
|
4394
4792
|
}
|
|
4395
|
-
return { component: _nullishCoalesce(_optionalChain([comp, 'optionalAccess',
|
|
4793
|
+
return { component: _nullishCoalesce(_optionalChain([comp, 'optionalAccess', _186 => _186.name]), () => ( null)), frames: frames.length > 0 ? frames : named.slice(0, 2) };
|
|
4396
4794
|
}
|
|
4397
4795
|
function resolveSource(el, deps, frames) {
|
|
4398
|
-
const own = _optionalChain([deps, 'access',
|
|
4796
|
+
const own = _optionalChain([deps, 'access', _187 => _187.sourceResolver, 'optionalCall', _188 => _188(el)]);
|
|
4399
4797
|
if (own && isAppFile(own.filePath)) return { file: own.filePath, line: own.line, column: own.column };
|
|
4400
4798
|
const first = frames.find((f) => isAppFile(f.file));
|
|
4401
|
-
return _optionalChain([first, 'optionalAccess',
|
|
4799
|
+
return _optionalChain([first, 'optionalAccess', _189 => _189.file]) ? { file: first.file, line: first.line, column: null } : null;
|
|
4402
4800
|
}
|
|
4403
4801
|
function captureTarget(el, deps) {
|
|
4404
4802
|
const cleanClasses = _nullishCoalesce(deps.cleanClasses, () => ( ((list) => list.filter((c) => !isNoiseClass(c)))));
|
|
@@ -4418,6 +4816,21 @@ function captureTarget(el, deps) {
|
|
|
4418
4816
|
extra
|
|
4419
4817
|
};
|
|
4420
4818
|
}
|
|
4819
|
+
var MEMBER_PREVIEW = 120;
|
|
4820
|
+
function captureMember(el, deps) {
|
|
4821
|
+
const cleanClasses = _nullishCoalesce(deps.cleanClasses, () => ( ((list) => list.filter((c) => !isNoiseClass(c)))));
|
|
4822
|
+
const kind = detectKind(el);
|
|
4823
|
+
const { component, frames } = resolveStack(el, deps);
|
|
4824
|
+
return {
|
|
4825
|
+
kind,
|
|
4826
|
+
tag: el.tagName.toLowerCase(),
|
|
4827
|
+
component,
|
|
4828
|
+
source: resolveSource(el, deps, frames),
|
|
4829
|
+
selector: buildUniqueSelector(el),
|
|
4830
|
+
preview: kind === "section" ? `<${el.tagName.toLowerCase()}>` : truncate(buildPreview(el, cleanClasses), MEMBER_PREVIEW),
|
|
4831
|
+
label: describeElement(el)
|
|
4832
|
+
};
|
|
4833
|
+
}
|
|
4421
4834
|
|
|
4422
4835
|
// src/core/capture/screenshot.ts
|
|
4423
4836
|
var MAX_SIDE = 1200;
|
|
@@ -4449,7 +4862,7 @@ function sandboxHtml() {
|
|
|
4449
4862
|
return policy ? policy.createHTML(SANDBOX_HTML) : null;
|
|
4450
4863
|
}
|
|
4451
4864
|
async function getSandbox() {
|
|
4452
|
-
if (_optionalChain([sandbox, 'optionalAccess',
|
|
4865
|
+
if (_optionalChain([sandbox, 'optionalAccess', _190 => _190.isConnected])) return sandbox;
|
|
4453
4866
|
const frame = document.createElement("iframe");
|
|
4454
4867
|
frame.setAttribute("aria-hidden", "true");
|
|
4455
4868
|
frame.setAttribute("tabindex", "-1");
|
|
@@ -4473,7 +4886,7 @@ async function getSandbox() {
|
|
|
4473
4886
|
return frame;
|
|
4474
4887
|
}
|
|
4475
4888
|
function disposeScreenshotSandbox() {
|
|
4476
|
-
_optionalChain([sandbox, 'optionalAccess',
|
|
4889
|
+
_optionalChain([sandbox, 'optionalAccess', _191 => _191.remove, 'call', _192 => _192()]);
|
|
4477
4890
|
sandbox = null;
|
|
4478
4891
|
}
|
|
4479
4892
|
function withTimeout(promise, ms) {
|
|
@@ -4491,16 +4904,28 @@ function withTimeout(promise, ms) {
|
|
|
4491
4904
|
);
|
|
4492
4905
|
});
|
|
4493
4906
|
}
|
|
4494
|
-
|
|
4907
|
+
var MAX_CLIP_DEPTH = 4e3;
|
|
4908
|
+
var clamp = (v, max) => Math.min(Math.max(v, 0), max);
|
|
4909
|
+
async function captureScreenshot(el, clip) {
|
|
4495
4910
|
if (typeof window === "undefined" || !el.isConnected) return null;
|
|
4496
4911
|
const rect = el.getBoundingClientRect();
|
|
4497
4912
|
if (rect.width < 1 || rect.height < 1) return null;
|
|
4498
|
-
const
|
|
4499
|
-
const
|
|
4913
|
+
const fullWidth = Math.min(rect.width, document.documentElement.scrollWidth || rect.width);
|
|
4914
|
+
const region = clip ? {
|
|
4915
|
+
x: clamp(clip.left - rect.left, fullWidth),
|
|
4916
|
+
y: clamp(clip.top - rect.top, rect.height),
|
|
4917
|
+
right: clamp(clip.right - rect.left, fullWidth),
|
|
4918
|
+
bottom: clamp(clip.bottom - rect.top, rect.height)
|
|
4919
|
+
} : null;
|
|
4920
|
+
if (region && (region.right - region.x < 1 || region.bottom - region.y < 1 || region.bottom > MAX_CLIP_DEPTH)) return null;
|
|
4921
|
+
const cssWidth = fullWidth;
|
|
4922
|
+
const cssHeight = region ? region.bottom : Math.min(rect.height, MAX_CSS_HEIGHT);
|
|
4923
|
+
const outWidth = region ? region.right - region.x : cssWidth;
|
|
4924
|
+
const outHeight = region ? Math.min(region.bottom - region.y, MAX_CSS_HEIGHT) : cssHeight;
|
|
4500
4925
|
const dpr = window.devicePixelRatio || 1;
|
|
4501
|
-
const scale = Math.min(dpr, MAX_SIDE / Math.max(
|
|
4926
|
+
const scale = Math.min(dpr, MAX_SIDE / Math.max(outWidth, outHeight));
|
|
4502
4927
|
const render = async () => {
|
|
4503
|
-
const { createContext, destroyContext, domToBlob } = await Promise.resolve().then(() => _interopRequireWildcard(require("modern-screenshot")));
|
|
4928
|
+
const { createContext, destroyContext, domToBlob, domToCanvas } = await Promise.resolve().then(() => _interopRequireWildcard(require("modern-screenshot")));
|
|
4504
4929
|
const context = await createContext(el, {
|
|
4505
4930
|
width: cssWidth,
|
|
4506
4931
|
height: cssHeight,
|
|
@@ -4517,13 +4942,22 @@ async function captureScreenshot(el) {
|
|
|
4517
4942
|
context.sandbox = await getSandbox();
|
|
4518
4943
|
let blob;
|
|
4519
4944
|
try {
|
|
4520
|
-
|
|
4945
|
+
if (region) {
|
|
4946
|
+
const full = await domToCanvas(context);
|
|
4947
|
+
const crop = document.createElement("canvas");
|
|
4948
|
+
crop.width = Math.max(1, Math.round(outWidth * scale));
|
|
4949
|
+
crop.height = Math.max(1, Math.round(outHeight * scale));
|
|
4950
|
+
_optionalChain([crop, 'access', _193 => _193.getContext, 'call', _194 => _194("2d"), 'optionalAccess', _195 => _195.drawImage, 'call', _196 => _196(full, region.x * scale, region.y * scale, outWidth * scale, outHeight * scale, 0, 0, crop.width, crop.height)]);
|
|
4951
|
+
blob = await new Promise((resolve) => crop.toBlob(resolve, "image/webp", 0.8));
|
|
4952
|
+
} else {
|
|
4953
|
+
blob = await domToBlob(context);
|
|
4954
|
+
}
|
|
4521
4955
|
} finally {
|
|
4522
4956
|
context.sandbox = void 0;
|
|
4523
4957
|
destroyContext(context);
|
|
4524
4958
|
}
|
|
4525
4959
|
if (!blob) return null;
|
|
4526
|
-
return { blob, width: Math.round(
|
|
4960
|
+
return { blob, width: Math.round(outWidth * scale), height: Math.round(outHeight * scale) };
|
|
4527
4961
|
};
|
|
4528
4962
|
return withTimeout(render(), TIMEOUT_MS + 1e3);
|
|
4529
4963
|
}
|
|
@@ -4633,7 +5067,7 @@ function resolveComponent(element) {
|
|
|
4633
5067
|
name: cleanComponentName(owning.constructor.name),
|
|
4634
5068
|
hostElement: _nullishCoalesce(host2, () => ( walk.parentElement))
|
|
4635
5069
|
});
|
|
4636
|
-
current = _nullishCoalesce(_nullishCoalesce(_optionalChain([host2, 'optionalAccess',
|
|
5070
|
+
current = _nullishCoalesce(_nullishCoalesce(_optionalChain([host2, 'optionalAccess', _197 => _197.parentElement]), () => ( _optionalChain([walk, 'access', _198 => _198.parentElement, 'optionalAccess', _199 => _199.parentElement]))), () => ( null));
|
|
4637
5071
|
while (current) {
|
|
4638
5072
|
const comp = ng.getComponent(current);
|
|
4639
5073
|
if (comp && !seen2.has(comp)) {
|
|
@@ -4767,14 +5201,14 @@ function resolveComponent2(element) {
|
|
|
4767
5201
|
let current = fiber;
|
|
4768
5202
|
while (current && stack.length < MAX_STACK2) {
|
|
4769
5203
|
const name = getComponentName(current.type);
|
|
4770
|
-
if (name && !isNoise(name) && _optionalChain([stack, 'access',
|
|
5204
|
+
if (name && !isNoise(name) && _optionalChain([stack, 'access', _200 => _200[stack.length - 1], 'optionalAccess', _201 => _201.name]) !== name) {
|
|
4771
5205
|
stack.push({ name, hostElement: findHostElement(current) });
|
|
4772
5206
|
}
|
|
4773
5207
|
current = current.return;
|
|
4774
5208
|
}
|
|
4775
5209
|
return {
|
|
4776
|
-
name: _nullishCoalesce(_optionalChain([stack, 'access',
|
|
4777
|
-
hostElement: _nullishCoalesce(_optionalChain([stack, 'access',
|
|
5210
|
+
name: _nullishCoalesce(_optionalChain([stack, 'access', _202 => _202[0], 'optionalAccess', _203 => _203.name]), () => ( null)),
|
|
5211
|
+
hostElement: _nullishCoalesce(_optionalChain([stack, 'access', _204 => _204[0], 'optionalAccess', _205 => _205.hostElement]), () => ( null)),
|
|
4778
5212
|
stack
|
|
4779
5213
|
};
|
|
4780
5214
|
}
|
|
@@ -4785,7 +5219,7 @@ var LOCATION = /^(.*?):(\d+):(\d+)(?::([A-Za-z_$][\w$.]*))?$/;
|
|
|
4785
5219
|
function resolveSource3(element) {
|
|
4786
5220
|
let current = element;
|
|
4787
5221
|
while (current) {
|
|
4788
|
-
const raw = _optionalChain([current, 'access',
|
|
5222
|
+
const raw = _optionalChain([current, 'access', _206 => _206.getAttribute, 'optionalCall', _207 => _207(SOURCE_ATTRIBUTE)]);
|
|
4789
5223
|
if (raw) return parseLocation(raw);
|
|
4790
5224
|
current = current.parentElement;
|
|
4791
5225
|
}
|
|
@@ -4797,7 +5231,7 @@ function parseLocation(raw) {
|
|
|
4797
5231
|
return { filePath: match[1], line: Number(match[2]), column: Number(match[3]) };
|
|
4798
5232
|
}
|
|
4799
5233
|
function ownStamp(element) {
|
|
4800
|
-
const raw = _optionalChain([element, 'optionalAccess',
|
|
5234
|
+
const raw = _optionalChain([element, 'optionalAccess', _208 => _208.getAttribute, 'optionalCall', _209 => _209(SOURCE_ATTRIBUTE)]);
|
|
4801
5235
|
if (!raw) return null;
|
|
4802
5236
|
const match = LOCATION.exec(raw);
|
|
4803
5237
|
if (!match) return { file: raw, line: null, column: null, name: null };
|
|
@@ -4812,8 +5246,8 @@ function nameFromStamps(result) {
|
|
|
4812
5246
|
const stack = [];
|
|
4813
5247
|
for (const entry of result.stack) {
|
|
4814
5248
|
const stamp = ownStamp(entry.hostElement);
|
|
4815
|
-
const name = _nullishCoalesce(_optionalChain([stamp, 'optionalAccess',
|
|
4816
|
-
if (name && _optionalChain([stack, 'access',
|
|
5249
|
+
const name = _nullishCoalesce(_optionalChain([stamp, 'optionalAccess', _210 => _210.name]), () => ( (stamp ? baseName(stamp.file) : null)));
|
|
5250
|
+
if (name && _optionalChain([stack, 'access', _211 => _211[stack.length - 1], 'optionalAccess', _212 => _212.name]) !== name) stack.push({ name, hostElement: entry.hostElement });
|
|
4817
5251
|
}
|
|
4818
5252
|
return stack[0] ? { name: stack[0].name, hostElement: stack[0].hostElement, stack } : null;
|
|
4819
5253
|
}
|
|
@@ -4849,7 +5283,7 @@ function vue3Name(inst) {
|
|
|
4849
5283
|
return t.__name || t.name || t.displayName || (t.__file ? baseName(t.__file) : null);
|
|
4850
5284
|
}
|
|
4851
5285
|
function vue3Host(inst) {
|
|
4852
|
-
return firstElement(_nullishCoalesce(_optionalChain([inst, 'access',
|
|
5286
|
+
return firstElement(_nullishCoalesce(_optionalChain([inst, 'access', _213 => _213.subTree, 'optionalAccess', _214 => _214.el]), () => ( _optionalChain([inst, 'access', _215 => _215.vnode, 'optionalAccess', _216 => _216.el]))));
|
|
4853
5287
|
}
|
|
4854
5288
|
function vue2Owner(el) {
|
|
4855
5289
|
let current = el;
|
|
@@ -4889,7 +5323,7 @@ function resolveVueComponent(el) {
|
|
|
4889
5323
|
}
|
|
4890
5324
|
function resolveVueSource(el) {
|
|
4891
5325
|
const inst3 = vue3Owner(el);
|
|
4892
|
-
const file = _nullishCoalesce(_optionalChain([inst3, 'optionalAccess',
|
|
5326
|
+
const file = _nullishCoalesce(_optionalChain([inst3, 'optionalAccess', _217 => _217.type, 'optionalAccess', _218 => _218.__file]), () => ( _optionalChain([vue2Owner, 'call', _219 => _219(el), 'optionalAccess', _220 => _220.$options, 'optionalAccess', _221 => _221.__file])));
|
|
4893
5327
|
return file ? { filePath: relativizePath(file), line: null, column: null } : NO_SOURCE;
|
|
4894
5328
|
}
|
|
4895
5329
|
var vueAdapter = {
|
|
@@ -4905,19 +5339,19 @@ function metaOf(el) {
|
|
|
4905
5339
|
let current = el;
|
|
4906
5340
|
while (current) {
|
|
4907
5341
|
const meta = current.__svelte_meta;
|
|
4908
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
5342
|
+
if (_optionalChain([meta, 'optionalAccess', _222 => _222.loc])) return { meta, el: current };
|
|
4909
5343
|
current = current.parentElement;
|
|
4910
5344
|
}
|
|
4911
5345
|
return null;
|
|
4912
5346
|
}
|
|
4913
5347
|
function lineOf(meta) {
|
|
4914
|
-
const line = _optionalChain([meta, 'access',
|
|
5348
|
+
const line = _optionalChain([meta, 'access', _223 => _223.loc, 'optionalAccess', _224 => _224.line]);
|
|
4915
5349
|
if (typeof line !== "number") return null;
|
|
4916
5350
|
return "parent" in meta ? line : line + 1;
|
|
4917
5351
|
}
|
|
4918
5352
|
function resolveSvelteComponent(el) {
|
|
4919
5353
|
const found = metaOf(el);
|
|
4920
|
-
if (!_optionalChain([found, 'optionalAccess',
|
|
5354
|
+
if (!_optionalChain([found, 'optionalAccess', _225 => _225.meta, 'access', _226 => _226.loc, 'optionalAccess', _227 => _227.file])) return null;
|
|
4921
5355
|
const { meta } = found;
|
|
4922
5356
|
const own = baseName(meta.loc.file);
|
|
4923
5357
|
const stack = [{ name: own, hostElement: found.el }];
|
|
@@ -4931,9 +5365,9 @@ function resolveSvelteComponent(el) {
|
|
|
4931
5365
|
}
|
|
4932
5366
|
function resolveSvelteSource(el) {
|
|
4933
5367
|
const found = metaOf(el);
|
|
4934
|
-
const file = _optionalChain([found, 'optionalAccess',
|
|
5368
|
+
const file = _optionalChain([found, 'optionalAccess', _228 => _228.meta, 'access', _229 => _229.loc, 'optionalAccess', _230 => _230.file]);
|
|
4935
5369
|
if (!found || !file) return NO_SOURCE;
|
|
4936
|
-
const column = _optionalChain([found, 'access',
|
|
5370
|
+
const column = _optionalChain([found, 'access', _231 => _231.meta, 'access', _232 => _232.loc, 'optionalAccess', _233 => _233.column]);
|
|
4937
5371
|
return {
|
|
4938
5372
|
filePath: relativizePath(file),
|
|
4939
5373
|
line: lineOf(found.meta),
|
|
@@ -4953,10 +5387,10 @@ var domAdapter = {
|
|
|
4953
5387
|
name: "HTML",
|
|
4954
5388
|
resolveComponent: (el) => {
|
|
4955
5389
|
const host2 = el.closest("[data-component]");
|
|
4956
|
-
const name = _optionalChain([host2, 'optionalAccess',
|
|
5390
|
+
const name = _optionalChain([host2, 'optionalAccess', _234 => _234.getAttribute, 'call', _235 => _235("data-component")]);
|
|
4957
5391
|
if (!host2 || !name) return null;
|
|
4958
5392
|
const stack = [];
|
|
4959
|
-
for (let h2 = host2; h2; h2 = _nullishCoalesce(_optionalChain([h2, 'access',
|
|
5393
|
+
for (let h2 = host2; h2; h2 = _nullishCoalesce(_optionalChain([h2, 'access', _236 => _236.parentElement, 'optionalAccess', _237 => _237.closest, 'call', _238 => _238("[data-component]")]), () => ( null))) {
|
|
4960
5394
|
const n = h2.getAttribute("data-component");
|
|
4961
5395
|
if (n) stack.push({ name: n, hostElement: h2 });
|
|
4962
5396
|
if (stack.length >= 12) break;
|
|
@@ -4978,7 +5412,7 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4978
5412
|
for (const adapter of adapters) {
|
|
4979
5413
|
try {
|
|
4980
5414
|
const result = adapter.resolveComponent(el);
|
|
4981
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
5415
|
+
if (_optionalChain([result, 'optionalAccess', _239 => _239.name])) return { adapter, result };
|
|
4982
5416
|
} catch (e30) {
|
|
4983
5417
|
}
|
|
4984
5418
|
}
|
|
@@ -4986,7 +5420,7 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4986
5420
|
}
|
|
4987
5421
|
return {
|
|
4988
5422
|
resolveComponent(el) {
|
|
4989
|
-
return _nullishCoalesce(_optionalChain([owner, 'call',
|
|
5423
|
+
return _nullishCoalesce(_optionalChain([owner, 'call', _240 => _240(el), 'optionalAccess', _241 => _241.result]), () => ( null));
|
|
4990
5424
|
},
|
|
4991
5425
|
resolveSource(el) {
|
|
4992
5426
|
const stamped = resolveSource3(el);
|
|
@@ -4995,15 +5429,15 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4995
5429
|
const ordered = found ? [found.adapter, ...adapters.filter((a) => a !== found.adapter)] : adapters;
|
|
4996
5430
|
for (const adapter of ordered) {
|
|
4997
5431
|
try {
|
|
4998
|
-
const src = _optionalChain([adapter, 'access',
|
|
4999
|
-
if (_optionalChain([src, 'optionalAccess',
|
|
5432
|
+
const src = _optionalChain([adapter, 'access', _242 => _242.resolveSource, 'optionalCall', _243 => _243(el)]);
|
|
5433
|
+
if (_optionalChain([src, 'optionalAccess', _244 => _244.filePath])) return src;
|
|
5000
5434
|
} catch (e31) {
|
|
5001
5435
|
}
|
|
5002
5436
|
}
|
|
5003
5437
|
return null;
|
|
5004
5438
|
},
|
|
5005
5439
|
frameworkFor(el) {
|
|
5006
|
-
return _nullishCoalesce(_optionalChain([owner, 'call',
|
|
5440
|
+
return _nullishCoalesce(_optionalChain([owner, 'call', _245 => _245(el), 'optionalAccess', _246 => _246.adapter, 'access', _247 => _247.name]), () => ( "HTML"));
|
|
5007
5441
|
},
|
|
5008
5442
|
cleanClasses(classes) {
|
|
5009
5443
|
return adapters.reduce((list, a) => a.cleanClasses ? a.cleanClasses(list) : list, classes);
|
|
@@ -5035,7 +5469,7 @@ function getDefaultOptions() {
|
|
|
5035
5469
|
};
|
|
5036
5470
|
}
|
|
5037
5471
|
function init(options) {
|
|
5038
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5472
|
+
if (_optionalChain([options, 'optionalAccess', _248 => _248.mode]) === "live" && !_chunk6CBIOKZVcjs.consumeFeedbackLink.call(void 0, options.projectKey)) {
|
|
5039
5473
|
return createDormantApi(options);
|
|
5040
5474
|
}
|
|
5041
5475
|
return createGrabInstance(options);
|
|
@@ -5061,7 +5495,7 @@ function createDormantApi(options) {
|
|
|
5061
5495
|
real.show();
|
|
5062
5496
|
return;
|
|
5063
5497
|
}
|
|
5064
|
-
_optionalChain([flusher, 'optionalAccess',
|
|
5498
|
+
_optionalChain([flusher, 'optionalAccess', _249 => _249.dispose, 'call', _250 => _250()]);
|
|
5065
5499
|
_chunk6CBIOKZVcjs.startFeedbackSession.call(void 0, );
|
|
5066
5500
|
real = createGrabInstance(options);
|
|
5067
5501
|
for (const fn of queued.splice(0)) fn(real);
|
|
@@ -5172,6 +5606,7 @@ function createGrabInstance(options) {
|
|
|
5172
5606
|
}
|
|
5173
5607
|
}
|
|
5174
5608
|
const overlay = createOverlayRenderer({ plainLabels: live });
|
|
5609
|
+
const groupOutline = createGroupOutline();
|
|
5175
5610
|
const crosshair = createCrosshair();
|
|
5176
5611
|
const freezeOverlay = createFreezeOverlay();
|
|
5177
5612
|
const pluginRegistry = createPluginRegistry();
|
|
@@ -5184,6 +5619,9 @@ function createGrabInstance(options) {
|
|
|
5184
5619
|
const cleanClasses = (list) => adapters.cleanClasses(list.filter((c) => !isNoiseClass(c)));
|
|
5185
5620
|
let selectedElement = null;
|
|
5186
5621
|
let selectedPin;
|
|
5622
|
+
let selectedMembers = null;
|
|
5623
|
+
let selectedArea = null;
|
|
5624
|
+
const commentedMembers = /* @__PURE__ */ new Map();
|
|
5187
5625
|
let pendingShot = null;
|
|
5188
5626
|
const commentedElements = /* @__PURE__ */ new Map();
|
|
5189
5627
|
let editingFromMarker = false;
|
|
@@ -5240,12 +5678,14 @@ function createGrabInstance(options) {
|
|
|
5240
5678
|
function toastDetail(c) {
|
|
5241
5679
|
return {
|
|
5242
5680
|
componentName: c.target.component,
|
|
5243
|
-
filePath: _nullishCoalesce(_optionalChain([c, 'access',
|
|
5244
|
-
line: _nullishCoalesce(_optionalChain([c, 'access',
|
|
5245
|
-
column: _nullishCoalesce(_optionalChain([c, 'access',
|
|
5681
|
+
filePath: _nullishCoalesce(_optionalChain([c, 'access', _251 => _251.target, 'access', _252 => _252.source, 'optionalAccess', _253 => _253.file]), () => ( null)),
|
|
5682
|
+
line: _nullishCoalesce(_optionalChain([c, 'access', _254 => _254.target, 'access', _255 => _255.source, 'optionalAccess', _256 => _256.line]), () => ( null)),
|
|
5683
|
+
column: _nullishCoalesce(_optionalChain([c, 'access', _257 => _257.target, 'access', _258 => _258.source, 'optionalAccess', _259 => _259.column]), () => ( null))
|
|
5246
5684
|
};
|
|
5247
5685
|
}
|
|
5248
|
-
function saveComment(element, text, shot,
|
|
5686
|
+
function saveComment(element, text, shot, extras = {}) {
|
|
5687
|
+
const { pin, members, area } = extras;
|
|
5688
|
+
const deps = { componentResolver, sourceResolver, cleanClasses };
|
|
5249
5689
|
const now = Date.now();
|
|
5250
5690
|
const comment = {
|
|
5251
5691
|
id: randomId(),
|
|
@@ -5259,16 +5699,19 @@ function createGrabInstance(options) {
|
|
|
5259
5699
|
title: document.title,
|
|
5260
5700
|
viewport: [window.innerWidth, window.innerHeight]
|
|
5261
5701
|
},
|
|
5262
|
-
target: captureTarget(element,
|
|
5702
|
+
target: captureTarget(element, deps),
|
|
5263
5703
|
screenshot: null,
|
|
5264
5704
|
framework: adapters.frameworkFor(element),
|
|
5265
5705
|
...outbox ? { sync: "pending" } : {},
|
|
5266
|
-
...pin ? { pin } : {}
|
|
5706
|
+
...pin ? { pin } : {},
|
|
5707
|
+
..._optionalChain([members, 'optionalAccess', _260 => _260.length]) ? { members: members.map((el) => captureMember(el, deps)) } : {},
|
|
5708
|
+
...area ? { area } : {}
|
|
5267
5709
|
};
|
|
5268
5710
|
commentedElements.set(comment.id, element);
|
|
5711
|
+
if (_optionalChain([members, 'optionalAccess', _261 => _261.length])) commentedMembers.set(comment.id, members);
|
|
5269
5712
|
setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
|
|
5270
5713
|
pluginRegistry.callHook("onComment", comment, element);
|
|
5271
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5714
|
+
_optionalChain([outbox, 'optionalAccess', _262 => _262.send, 'call', _263 => _263(comment.id)]);
|
|
5272
5715
|
if (shot) void attachScreenshot(comment.id, shot);
|
|
5273
5716
|
const count = comments().length;
|
|
5274
5717
|
if (live) {
|
|
@@ -5303,19 +5746,22 @@ function createGrabInstance(options) {
|
|
|
5303
5746
|
const updated = { ...current, screenshot: { localId: id, width: result.width, height: result.height } };
|
|
5304
5747
|
setComments(comments().map((c) => c.id === id ? updated : c));
|
|
5305
5748
|
pluginRegistry.callHook("onScreenshot", updated, result.blob);
|
|
5306
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5749
|
+
_optionalChain([outbox, 'optionalAccess', _264 => _264.sendScreenshot, 'call', _265 => _265(id)]);
|
|
5307
5750
|
}
|
|
5308
5751
|
function removeComments(ids, message, withdraw = false) {
|
|
5309
5752
|
if (ids.length === 0) return;
|
|
5310
5753
|
const idSet = new Set(ids);
|
|
5311
5754
|
const before = comments();
|
|
5312
5755
|
const removed = before.filter((c) => idSet.has(c.id));
|
|
5313
|
-
for (const id of ids)
|
|
5756
|
+
for (const id of ids) {
|
|
5757
|
+
commentedElements.delete(id);
|
|
5758
|
+
commentedMembers.delete(id);
|
|
5759
|
+
}
|
|
5314
5760
|
setComments(before.filter((c) => !idSet.has(c.id)));
|
|
5315
5761
|
const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
|
|
5316
5762
|
const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
|
|
5317
5763
|
for (const c of withdrawn) outbox.remove(c.id, c.author.sessionId, message ? UNDO_MS + 500 : 0);
|
|
5318
|
-
const shotIds = removed.flatMap((c) => _optionalChain([c, 'access',
|
|
5764
|
+
const shotIds = removed.flatMap((c) => _optionalChain([c, 'access', _266 => _266.screenshot, 'optionalAccess', _267 => _267.localId]) ? [c.screenshot.localId] : []);
|
|
5319
5765
|
const key = randomId();
|
|
5320
5766
|
pendingShotDeletes.set(key, setTimeout(() => {
|
|
5321
5767
|
pendingShotDeletes.delete(key);
|
|
@@ -5334,7 +5780,7 @@ function createGrabInstance(options) {
|
|
|
5334
5780
|
const back = removed.filter((c) => !present.has(c.id)).map((c) => resend.has(c.id) ? { ...c, sync: "pending" } : c);
|
|
5335
5781
|
const restored = [...back, ...comments()].sort((a, b) => b.createdAt - a.createdAt);
|
|
5336
5782
|
setComments(restored);
|
|
5337
|
-
for (const id of resend) _optionalChain([outbox, 'optionalAccess',
|
|
5783
|
+
for (const id of resend) _optionalChain([outbox, 'optionalAccess', _268 => _268.send, 'call', _269 => _269(id)]);
|
|
5338
5784
|
showToast(`Restored ${removed.length} comment${removed.length === 1 ? "" : "s"}`);
|
|
5339
5785
|
}
|
|
5340
5786
|
}]
|
|
@@ -5369,16 +5815,52 @@ function createGrabInstance(options) {
|
|
|
5369
5815
|
commentPopover.hide();
|
|
5370
5816
|
endMarkerEdit();
|
|
5371
5817
|
if (picker.isHolding()) {
|
|
5372
|
-
|
|
5373
|
-
selectedPin = void 0;
|
|
5374
|
-
pendingShot = null;
|
|
5818
|
+
clearSelection();
|
|
5375
5819
|
picker.release();
|
|
5376
5820
|
}
|
|
5377
5821
|
}
|
|
5822
|
+
function clearSelection() {
|
|
5823
|
+
selectedElement = null;
|
|
5824
|
+
selectedPin = void 0;
|
|
5825
|
+
selectedMembers = null;
|
|
5826
|
+
selectedArea = null;
|
|
5827
|
+
pendingShot = null;
|
|
5828
|
+
}
|
|
5378
5829
|
function endMarkerEdit() {
|
|
5379
5830
|
if (!editingFromMarker) return;
|
|
5380
5831
|
editingFromMarker = false;
|
|
5381
5832
|
overlay.hide();
|
|
5833
|
+
groupOutline.hide();
|
|
5834
|
+
}
|
|
5835
|
+
function pinIn(el, point) {
|
|
5836
|
+
const rect = el.getBoundingClientRect();
|
|
5837
|
+
const frac2 = (v, start, size2) => size2 > 0 ? Math.min(1, Math.max(0, (v - start) / size2)) : 0.5;
|
|
5838
|
+
return {
|
|
5839
|
+
x: Math.round(frac2(point.x, rect.left, rect.width) * 1e3) / 1e3,
|
|
5840
|
+
y: Math.round(frac2(point.y, rect.top, rect.height) * 1e3) / 1e3
|
|
5841
|
+
};
|
|
5842
|
+
}
|
|
5843
|
+
function groupSpecFor(comment, element) {
|
|
5844
|
+
if (comment.area && element) return { spec: { element, area: comment.area }, label: "Area" };
|
|
5845
|
+
if (!_optionalChain([comment, 'access', _270 => _270.members, 'optionalAccess', _271 => _271.length])) return null;
|
|
5846
|
+
const known = _optionalChain([commentedMembers, 'access', _272 => _272.get, 'call', _273 => _273(comment.id), 'optionalAccess', _274 => _274.filter, 'call', _275 => _275((el) => el.isConnected)]);
|
|
5847
|
+
const elements = _optionalChain([known, 'optionalAccess', _276 => _276.length]) ? known : comment.members.flatMap((m) => _nullishCoalesce(safeQuery(m.selector), () => ( [])));
|
|
5848
|
+
return elements.length ? { spec: { elements }, label: `${comment.members.length} elements` } : null;
|
|
5849
|
+
}
|
|
5850
|
+
function beginGroupComment(container, point, spec, heading, label, clip) {
|
|
5851
|
+
selectedElement = container;
|
|
5852
|
+
selectedPin = pinIn(container, point);
|
|
5853
|
+
pendingShot = store.state.options.screenshots ? captureScreenshot(container, _nullishCoalesce(clip, () => ( void 0))) : null;
|
|
5854
|
+
coachMark.dismiss();
|
|
5855
|
+
picker.hold(container, { spec, label });
|
|
5856
|
+
commentPopover.show({
|
|
5857
|
+
anchor: container,
|
|
5858
|
+
anchorBox: clip,
|
|
5859
|
+
mode: "new",
|
|
5860
|
+
askIdentity: shouldAskIdentity(),
|
|
5861
|
+
heading,
|
|
5862
|
+
placeholder: "What should change here?"
|
|
5863
|
+
});
|
|
5382
5864
|
}
|
|
5383
5865
|
function closeAllPopovers() {
|
|
5384
5866
|
commentsPanel.hide();
|
|
@@ -5406,6 +5888,7 @@ function createGrabInstance(options) {
|
|
|
5406
5888
|
const picker = createElementPicker({
|
|
5407
5889
|
overlay,
|
|
5408
5890
|
crosshair,
|
|
5891
|
+
groupOutline,
|
|
5409
5892
|
getComponentResolver: () => componentResolver,
|
|
5410
5893
|
getSourceResolver: () => sourceResolver,
|
|
5411
5894
|
isToolbarElement: isAnyToolbarElement,
|
|
@@ -5418,18 +5901,24 @@ function createGrabInstance(options) {
|
|
|
5418
5901
|
},
|
|
5419
5902
|
onSelect(element, point) {
|
|
5420
5903
|
selectedElement = element;
|
|
5421
|
-
|
|
5422
|
-
const frac = (v, start, size2) => size2 > 0 ? Math.min(1, Math.max(0, (v - start) / size2)) : 0.5;
|
|
5423
|
-
selectedPin = {
|
|
5424
|
-
x: Math.round(frac(point.x, rect.left, rect.width) * 1e3) / 1e3,
|
|
5425
|
-
y: Math.round(frac(point.y, rect.top, rect.height) * 1e3) / 1e3
|
|
5426
|
-
};
|
|
5904
|
+
selectedPin = pinIn(element, point);
|
|
5427
5905
|
pendingShot = store.state.options.screenshots ? captureScreenshot(element) : null;
|
|
5428
5906
|
pluginRegistry.callHook("onElementSelect", element);
|
|
5429
5907
|
coachMark.dismiss();
|
|
5430
5908
|
showSelectFeedback(element);
|
|
5431
5909
|
picker.hold(element);
|
|
5432
5910
|
commentPopover.show({ anchor: element, mode: "new", askIdentity: shouldAskIdentity() });
|
|
5911
|
+
},
|
|
5912
|
+
onSelectGroup(elements, point) {
|
|
5913
|
+
selectedMembers = elements;
|
|
5914
|
+
const heading = describeGroup(elements.map(describeElement));
|
|
5915
|
+
for (const el of elements) pluginRegistry.callHook("onElementSelect", el);
|
|
5916
|
+
beginGroupComment(commonContainer(elements), point, { elements }, heading, `${elements.length} elements`, unionBox(elements));
|
|
5917
|
+
},
|
|
5918
|
+
onSelectArea(container, area, point) {
|
|
5919
|
+
selectedArea = area;
|
|
5920
|
+
pluginRegistry.callHook("onElementSelect", container);
|
|
5921
|
+
beginGroupComment(container, point, { element: container, area }, describeArea(describeElement(container)), "Area", areaToBox(container, area));
|
|
5433
5922
|
}
|
|
5434
5923
|
});
|
|
5435
5924
|
const markers = createMarkers({
|
|
@@ -5437,25 +5926,35 @@ function createGrabInstance(options) {
|
|
|
5437
5926
|
currentRoute: () => sanitizeRoute(location, store.state.options.captureQueryParams),
|
|
5438
5927
|
findElement(comment) {
|
|
5439
5928
|
const known = commentedElements.get(comment.id);
|
|
5440
|
-
if (_optionalChain([known, 'optionalAccess',
|
|
5929
|
+
if (_optionalChain([known, 'optionalAccess', _277 => _277.isConnected])) return known;
|
|
5441
5930
|
return safeQuery(comment.target.selector);
|
|
5442
5931
|
},
|
|
5443
5932
|
onHover(comment, element) {
|
|
5444
5933
|
if (picker.isHolding() || editingFromMarker || commentPopover.isVisible()) return;
|
|
5445
|
-
|
|
5446
|
-
|
|
5934
|
+
const group = comment ? groupSpecFor(comment, element) : null;
|
|
5935
|
+
if (group) groupOutline.show(group.spec, group.label);
|
|
5936
|
+
else if (comment && element) overlay.show(element, comment.target.component, null, []);
|
|
5937
|
+
else {
|
|
5938
|
+
overlay.hide();
|
|
5939
|
+
groupOutline.hide();
|
|
5940
|
+
}
|
|
5447
5941
|
},
|
|
5448
5942
|
onOpen(comment, element, marker) {
|
|
5449
5943
|
if (picker.isHolding()) return;
|
|
5450
5944
|
closeAllPopovers();
|
|
5451
5945
|
doDeactivate(true);
|
|
5452
5946
|
editingFromMarker = true;
|
|
5453
|
-
|
|
5947
|
+
const group = groupSpecFor(comment, element);
|
|
5948
|
+
if (group) groupOutline.show(group.spec, group.label);
|
|
5949
|
+
else if (element) overlay.show(element, comment.target.component, null, []);
|
|
5950
|
+
const spec = _optionalChain([group, 'optionalAccess', _278 => _278.spec]);
|
|
5454
5951
|
commentPopover.show({
|
|
5455
5952
|
anchor: _nullishCoalesce(element, () => ( marker)),
|
|
5953
|
+
anchorBox: spec ? "area" in spec ? areaToBox(spec.element, spec.area) : unionBox(spec.elements) : null,
|
|
5456
5954
|
initialValue: comment.comment,
|
|
5457
5955
|
mode: "edit",
|
|
5458
|
-
entryId: comment.id
|
|
5956
|
+
entryId: comment.id,
|
|
5957
|
+
heading: _optionalChain([comment, 'access', _279 => _279.members, 'optionalAccess', _280 => _280.length]) || comment.area ? describeComment(comment) : void 0
|
|
5459
5958
|
});
|
|
5460
5959
|
}
|
|
5461
5960
|
});
|
|
@@ -5606,7 +6105,7 @@ function createGrabInstance(options) {
|
|
|
5606
6105
|
});
|
|
5607
6106
|
const finishSheet = createFinishSheet({
|
|
5608
6107
|
onDone() {
|
|
5609
|
-
const done = comments().filter((c) => c.sync === "sent" && !_optionalChain([outbox, 'optionalAccess',
|
|
6108
|
+
const done = comments().filter((c) => c.sync === "sent" && !_optionalChain([outbox, 'optionalAccess', _281 => _281.isQueued, 'call', _282 => _282(c.id)])).map((c) => c.id);
|
|
5610
6109
|
if (!comments().length) {
|
|
5611
6110
|
exitFeedbackMode();
|
|
5612
6111
|
return;
|
|
@@ -5620,9 +6119,9 @@ function createGrabInstance(options) {
|
|
|
5620
6119
|
if (failed.length) {
|
|
5621
6120
|
const ids = new Set(failed.map((c) => c.id));
|
|
5622
6121
|
setComments(comments().map((c) => ids.has(c.id) ? { ...c, sync: "pending" } : c));
|
|
5623
|
-
for (const id of ids) _optionalChain([outbox, 'optionalAccess',
|
|
6122
|
+
for (const id of ids) _optionalChain([outbox, 'optionalAccess', _283 => _283.send, 'call', _284 => _284(id)]);
|
|
5624
6123
|
}
|
|
5625
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
6124
|
+
_optionalChain([outbox, 'optionalAccess', _285 => _285.flush, 'call', _286 => _286()]);
|
|
5626
6125
|
}
|
|
5627
6126
|
});
|
|
5628
6127
|
const commentPopover = createCommentPopover({
|
|
@@ -5630,12 +6129,10 @@ function createGrabInstance(options) {
|
|
|
5630
6129
|
if (identity) saveIdentity({ name: identity.name, anonymous: !identity.name });
|
|
5631
6130
|
if (ctx.mode === "new") {
|
|
5632
6131
|
const element = selectedElement;
|
|
6132
|
+
const extras = { pin: selectedPin, members: selectedMembers, area: selectedArea };
|
|
5633
6133
|
const shot = pendingShot;
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
selectedPin = void 0;
|
|
5637
|
-
pendingShot = null;
|
|
5638
|
-
if (element) saveComment(element, value, shot, pin);
|
|
6134
|
+
clearSelection();
|
|
6135
|
+
if (element) saveComment(element, value, shot, extras);
|
|
5639
6136
|
doDeactivate(true);
|
|
5640
6137
|
return;
|
|
5641
6138
|
}
|
|
@@ -5644,16 +6141,14 @@ function createGrabInstance(options) {
|
|
|
5644
6141
|
(c) => c.id === ctx.entryId ? { ...c, comment: value, updatedAt: Date.now(), ...outbox ? { sync: "pending" } : {} } : c
|
|
5645
6142
|
);
|
|
5646
6143
|
setComments(updated);
|
|
5647
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
6144
|
+
_optionalChain([outbox, 'optionalAccess', _287 => _287.send, 'call', _288 => _288(ctx.entryId)]);
|
|
5648
6145
|
showToast("Comment updated");
|
|
5649
6146
|
if (editingFromMarker) endMarkerEdit();
|
|
5650
6147
|
else commentsPanel.show([...updated]);
|
|
5651
6148
|
},
|
|
5652
6149
|
onCancel(ctx) {
|
|
5653
6150
|
if (ctx.mode === "new") {
|
|
5654
|
-
|
|
5655
|
-
selectedPin = void 0;
|
|
5656
|
-
pendingShot = null;
|
|
6151
|
+
clearSelection();
|
|
5657
6152
|
doDeactivate(true);
|
|
5658
6153
|
return;
|
|
5659
6154
|
}
|
|
@@ -5676,7 +6171,7 @@ function createGrabInstance(options) {
|
|
|
5676
6171
|
document.addEventListener("click", handleDocumentClick);
|
|
5677
6172
|
function handlePageHide() {
|
|
5678
6173
|
flushPendingWrite();
|
|
5679
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
6174
|
+
_optionalChain([outbox, 'optionalAccess', _289 => _289.flushOnExit, 'call', _290 => _290()]);
|
|
5680
6175
|
}
|
|
5681
6176
|
function handleVisibilityChange() {
|
|
5682
6177
|
if (document.visibilityState === "hidden") flushPendingWrite();
|
|
@@ -5819,6 +6314,7 @@ function createGrabInstance(options) {
|
|
|
5819
6314
|
crosshair.dispose();
|
|
5820
6315
|
freezeOverlay.dispose();
|
|
5821
6316
|
markers.dispose();
|
|
6317
|
+
groupOutline.dispose();
|
|
5822
6318
|
disposeToast();
|
|
5823
6319
|
disposeFeedbackStyles();
|
|
5824
6320
|
pluginRegistry.dispose();
|
|
@@ -5829,7 +6325,7 @@ function createGrabInstance(options) {
|
|
|
5829
6325
|
copySheet.dispose();
|
|
5830
6326
|
finishSheet.dispose();
|
|
5831
6327
|
coachMark.dispose();
|
|
5832
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
6328
|
+
_optionalChain([outbox, 'optionalAccess', _291 => _291.dispose, 'call', _292 => _292()]);
|
|
5833
6329
|
themeManager.dispose();
|
|
5834
6330
|
disposeStyleBaseline();
|
|
5835
6331
|
disposeScreenshotSandbox();
|