@githumbi/grabby 0.4.0 → 0.5.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 +10 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/index.js +519 -41
- package/dist/angular/index.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/core/index.cjs +586 -108
- 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 +519 -41
- package/dist/core/index.js.map +1 -1
- package/dist/export/index.d.cts +8 -0
- package/dist/export/index.d.ts +8 -0
- package/dist/grabby.global.js +217 -91
- package/dist/live/index.d.cts +1 -1
- package/dist/live/index.d.ts +1 -1
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.js +519 -41
- package/dist/react/index.js.map +1 -1
- package/dist/{types-DjpIHekd.d.cts → types-BQDEG-Gl.d.cts} +8 -0
- package/dist/{types-DjpIHekd.d.ts → types-BQDEG-Gl.d.ts} +8 -0
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1217,7 +1217,7 @@ function createElementPicker(deps) {
|
|
|
1217
1217
|
e.stopPropagation();
|
|
1218
1218
|
if (heldElement) return;
|
|
1219
1219
|
if (hoveredElement) {
|
|
1220
|
-
deps.onSelect(hoveredElement);
|
|
1220
|
+
deps.onSelect(hoveredElement, { x: e.clientX, y: e.clientY });
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
return {
|
|
@@ -1475,7 +1475,8 @@ function createWebhookPlugin(url) {
|
|
|
1475
1475
|
type: "grabby.comment",
|
|
1476
1476
|
version: 1,
|
|
1477
1477
|
origin: typeof location !== "undefined" ? location.origin : null,
|
|
1478
|
-
|
|
1478
|
+
// The marker position is browser-only.
|
|
1479
|
+
comment: { ...comment, pin: void 0 }
|
|
1479
1480
|
})
|
|
1480
1481
|
}).catch(() => {
|
|
1481
1482
|
});
|
|
@@ -1567,6 +1568,9 @@ ${vars.join("\n")}
|
|
|
1567
1568
|
|
|
1568
1569
|
// src/core/toolbar/toolbar-renderer.ts
|
|
1569
1570
|
var TOOLBAR_ID = "__grabby-toolbar__";
|
|
1571
|
+
var COLLAPSED_SIZE = 42;
|
|
1572
|
+
var EASE_OUT_EXPO = "cubic-bezier(0.19, 1, 0.22, 1)";
|
|
1573
|
+
var MORPH_MS = 360;
|
|
1570
1574
|
var STYLE_ID3 = "__grabby-toolbar-styles__";
|
|
1571
1575
|
function syncSummary(comments) {
|
|
1572
1576
|
if (comments.length === 0) return null;
|
|
@@ -1588,7 +1592,13 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1588
1592
|
let badge = null;
|
|
1589
1593
|
let status = null;
|
|
1590
1594
|
let expandBadge = null;
|
|
1595
|
+
let content = null;
|
|
1591
1596
|
let collapsed = false;
|
|
1597
|
+
let morphTimer = null;
|
|
1598
|
+
function clearMorph() {
|
|
1599
|
+
if (morphTimer) clearTimeout(morphTimer);
|
|
1600
|
+
morphTimer = null;
|
|
1601
|
+
}
|
|
1592
1602
|
function injectStyles2() {
|
|
1593
1603
|
if (hasStyles(STYLE_ID3)) return;
|
|
1594
1604
|
addStyles(STYLE_ID3, `
|
|
@@ -1608,7 +1618,21 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1608
1618
|
box-shadow: 0 4px 16px var(--grabby-toolbar-shadow, rgba(0, 0, 0, 0.12));
|
|
1609
1619
|
pointer-events: auto;
|
|
1610
1620
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
1611
|
-
|
|
1621
|
+
box-sizing: border-box;
|
|
1622
|
+
height: ${COLLAPSED_SIZE}px;
|
|
1623
|
+
overflow: hidden;
|
|
1624
|
+
justify-content: flex-end;
|
|
1625
|
+
transition: opacity 0.2s ease, transform 0.2s ease,
|
|
1626
|
+
left ${MORPH_MS}ms ${EASE_OUT_EXPO}, width ${MORPH_MS}ms ${EASE_OUT_EXPO};
|
|
1627
|
+
}
|
|
1628
|
+
#${TOOLBAR_ID} .grabby-toolbar-content {
|
|
1629
|
+
display: flex;
|
|
1630
|
+
align-items: center;
|
|
1631
|
+
gap: 2px;
|
|
1632
|
+
flex-shrink: 0;
|
|
1633
|
+
transform-origin: right center;
|
|
1634
|
+
transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
1635
|
+
transform 0.42s ${EASE_OUT_EXPO}, visibility 0s;
|
|
1612
1636
|
}
|
|
1613
1637
|
#${TOOLBAR_ID}.grabby-toolbar-hidden {
|
|
1614
1638
|
opacity: 0;
|
|
@@ -1704,23 +1728,44 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1704
1728
|
background: var(--grabby-accent-hover, #1d4ed8);
|
|
1705
1729
|
color: #fff;
|
|
1706
1730
|
}
|
|
1707
|
-
#${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1731
|
+
#${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1732
|
+
position: absolute;
|
|
1733
|
+
left: 50%;
|
|
1734
|
+
top: 50%;
|
|
1735
|
+
translate: -50% -50%;
|
|
1736
|
+
color: var(--grabby-accent, #2563eb);
|
|
1737
|
+
opacity: 0;
|
|
1738
|
+
scale: 0.6;
|
|
1739
|
+
visibility: hidden;
|
|
1740
|
+
pointer-events: none;
|
|
1741
|
+
transition: opacity 0.2s ease-out, scale 0.3s ${EASE_OUT_EXPO}, visibility 0s 0.2s;
|
|
1742
|
+
}
|
|
1743
|
+
#${TOOLBAR_ID} button.grabby-btn-expand .grabby-badge { top: -3px; right: -5px; }
|
|
1708
1744
|
#${TOOLBAR_ID}.grabby-toolbar-collapsed {
|
|
1709
|
-
left:
|
|
1710
|
-
right: 20px;
|
|
1711
|
-
transform: none;
|
|
1745
|
+
left: calc(100% - 20px - ${COLLAPSED_SIZE / 2}px);
|
|
1712
1746
|
padding: 4px;
|
|
1713
1747
|
}
|
|
1714
|
-
#${TOOLBAR_ID}.grabby-toolbar-collapsed.grabby-toolbar-
|
|
1715
|
-
|
|
1748
|
+
#${TOOLBAR_ID}.grabby-toolbar-collapsed .grabby-toolbar-content {
|
|
1749
|
+
opacity: 0;
|
|
1750
|
+
filter: blur(6px);
|
|
1751
|
+
transform: scale(0.4);
|
|
1752
|
+
pointer-events: none;
|
|
1753
|
+
visibility: hidden;
|
|
1754
|
+
transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
1755
|
+
transform 0.42s ${EASE_OUT_EXPO}, visibility 0s 0.3s;
|
|
1716
1756
|
}
|
|
1717
|
-
#${TOOLBAR_ID}.grabby-toolbar-collapsed
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1757
|
+
#${TOOLBAR_ID}.grabby-toolbar-collapsed button.grabby-btn-expand {
|
|
1758
|
+
opacity: 1;
|
|
1759
|
+
scale: 1;
|
|
1760
|
+
visibility: visible;
|
|
1761
|
+
pointer-events: auto;
|
|
1762
|
+
transition: opacity 0.24s ease-out 0.08s, scale 0.36s ${EASE_OUT_EXPO} 0.08s, visibility 0s;
|
|
1763
|
+
}
|
|
1764
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1765
|
+
#${TOOLBAR_ID}, #${TOOLBAR_ID} .grabby-toolbar-content, #${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1766
|
+
transition-duration: 0s !important;
|
|
1767
|
+
transition-delay: 0s !important;
|
|
1768
|
+
}
|
|
1724
1769
|
}
|
|
1725
1770
|
#${TOOLBAR_ID} .grabby-toolbar-left.grabby-toolbar-left-hidden {
|
|
1726
1771
|
max-width: 0;
|
|
@@ -1775,7 +1820,9 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1775
1820
|
leftGroup.appendChild(buttons.selection);
|
|
1776
1821
|
leftGroup.appendChild(buttons.history);
|
|
1777
1822
|
leftGroup.appendChild(divider);
|
|
1778
|
-
|
|
1823
|
+
content = document.createElement("div");
|
|
1824
|
+
content.className = "grabby-toolbar-content";
|
|
1825
|
+
content.appendChild(leftGroup);
|
|
1779
1826
|
if (options.review) {
|
|
1780
1827
|
status = document.createElement("span");
|
|
1781
1828
|
status.className = "grabby-toolbar-status";
|
|
@@ -1792,18 +1839,22 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1792
1839
|
e.stopPropagation();
|
|
1793
1840
|
callbacks.onFinish?.();
|
|
1794
1841
|
});
|
|
1795
|
-
|
|
1796
|
-
|
|
1842
|
+
content.appendChild(status);
|
|
1843
|
+
content.appendChild(buttons.finish);
|
|
1797
1844
|
allElements.add(status);
|
|
1798
1845
|
}
|
|
1799
|
-
if (!options.hideEnable)
|
|
1800
|
-
|
|
1801
|
-
container.
|
|
1802
|
-
|
|
1846
|
+
if (!options.hideEnable) content.appendChild(buttons.enable);
|
|
1847
|
+
content.appendChild(buttons.dismiss);
|
|
1848
|
+
container.append(content, buttons.expand);
|
|
1849
|
+
if (collapsed) {
|
|
1850
|
+
container.classList.add("grabby-toolbar-collapsed");
|
|
1851
|
+
container.style.width = `${COLLAPSED_SIZE}px`;
|
|
1852
|
+
}
|
|
1803
1853
|
getUiRoot().appendChild(container);
|
|
1804
1854
|
allElements.clear();
|
|
1805
1855
|
allElements.add(container);
|
|
1806
1856
|
allElements.add(leftGroup);
|
|
1857
|
+
allElements.add(content);
|
|
1807
1858
|
allElements.add(divider);
|
|
1808
1859
|
for (const btn of Object.values(buttons)) {
|
|
1809
1860
|
allElements.add(btn);
|
|
@@ -1849,12 +1900,28 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1849
1900
|
}
|
|
1850
1901
|
},
|
|
1851
1902
|
collapse() {
|
|
1903
|
+
if (collapsed) return;
|
|
1852
1904
|
collapsed = true;
|
|
1853
|
-
container
|
|
1905
|
+
if (!container) return;
|
|
1906
|
+
clearMorph();
|
|
1907
|
+
container.style.width = `${container.offsetWidth}px`;
|
|
1908
|
+
void container.offsetWidth;
|
|
1909
|
+
container.classList.add("grabby-toolbar-collapsed");
|
|
1910
|
+
container.style.width = `${COLLAPSED_SIZE}px`;
|
|
1854
1911
|
},
|
|
1855
1912
|
expand() {
|
|
1913
|
+
if (!collapsed) return;
|
|
1856
1914
|
collapsed = false;
|
|
1857
|
-
container
|
|
1915
|
+
if (!container) return;
|
|
1916
|
+
clearMorph();
|
|
1917
|
+
container.classList.remove("grabby-toolbar-collapsed");
|
|
1918
|
+
const cs = getComputedStyle(container);
|
|
1919
|
+
const chrome = ["paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"].reduce((sum, k) => sum + (parseFloat(cs[k]) || 0), 0);
|
|
1920
|
+
container.style.width = `${(content?.offsetWidth ?? 0) + chrome}px`;
|
|
1921
|
+
morphTimer = setTimeout(() => {
|
|
1922
|
+
morphTimer = null;
|
|
1923
|
+
if (!collapsed && container) container.style.width = "";
|
|
1924
|
+
}, MORPH_MS + 40);
|
|
1858
1925
|
},
|
|
1859
1926
|
isCollapsed() {
|
|
1860
1927
|
return collapsed;
|
|
@@ -1870,10 +1937,12 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1870
1937
|
return false;
|
|
1871
1938
|
},
|
|
1872
1939
|
dispose() {
|
|
1940
|
+
clearMorph();
|
|
1873
1941
|
container?.remove();
|
|
1874
1942
|
removeStyles(STYLE_ID3);
|
|
1875
1943
|
container = null;
|
|
1876
1944
|
leftGroup = null;
|
|
1945
|
+
content = null;
|
|
1877
1946
|
buttons = {};
|
|
1878
1947
|
badge = null;
|
|
1879
1948
|
expandBadge = null;
|
|
@@ -2443,6 +2512,18 @@ function createCommentPopover(callbacks) {
|
|
|
2443
2512
|
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 4px; border: none;
|
|
2444
2513
|
background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer; text-decoration: underline;
|
|
2445
2514
|
}
|
|
2515
|
+
#${POPOVER_ID} .grabby-cp-edit-actions { display: flex; align-items: center; gap: 6px; }
|
|
2516
|
+
#${POPOVER_ID} .grabby-cp-edit-actions .grabby-cp-spacer { flex: 1; }
|
|
2517
|
+
#${POPOVER_ID} .grabby-cp-delete {
|
|
2518
|
+
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 6px; border: none;
|
|
2519
|
+
border-radius: 8px; background: transparent; color: #b91c1c; cursor: pointer;
|
|
2520
|
+
}
|
|
2521
|
+
#${POPOVER_ID} .grabby-cp-delete:hover { background: rgba(185, 28, 28, 0.08); }
|
|
2522
|
+
#${POPOVER_ID} .grabby-cp-cancel {
|
|
2523
|
+
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 10px; border: none;
|
|
2524
|
+
border-radius: 8px; background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer;
|
|
2525
|
+
}
|
|
2526
|
+
#${POPOVER_ID} .grabby-cp-cancel:hover { background: var(--grabby-surface, #f1f5f9); }
|
|
2446
2527
|
#${POPOVER_ID} .grabby-cp-hint {
|
|
2447
2528
|
font-size: 11px;
|
|
2448
2529
|
color: var(--grabby-text-muted, #94a3b8);
|
|
@@ -2504,6 +2585,37 @@ function createCommentPopover(callbacks) {
|
|
|
2504
2585
|
function isEditable(el) {
|
|
2505
2586
|
return !!el && el !== textarea && el !== nameInput && isEditableElement(el);
|
|
2506
2587
|
}
|
|
2588
|
+
function save() {
|
|
2589
|
+
const v = textarea?.value.trim();
|
|
2590
|
+
if (!v) return;
|
|
2591
|
+
pendingValue = v;
|
|
2592
|
+
if (askIdentity) showIdentityStep();
|
|
2593
|
+
else finish();
|
|
2594
|
+
}
|
|
2595
|
+
function editActions() {
|
|
2596
|
+
const act = (fn) => (e) => {
|
|
2597
|
+
e.stopPropagation();
|
|
2598
|
+
fn();
|
|
2599
|
+
};
|
|
2600
|
+
const cancel = () => {
|
|
2601
|
+
const ctx = currentCtx;
|
|
2602
|
+
doHide();
|
|
2603
|
+
callbacks.onCancel(ctx);
|
|
2604
|
+
};
|
|
2605
|
+
const del = () => {
|
|
2606
|
+
const ctx = currentCtx;
|
|
2607
|
+
doHide();
|
|
2608
|
+
callbacks.onDelete?.(ctx);
|
|
2609
|
+
};
|
|
2610
|
+
return h(
|
|
2611
|
+
"div",
|
|
2612
|
+
{ class: "grabby-cp-edit-actions" },
|
|
2613
|
+
callbacks.onDelete ? h("button", { type: "button", class: "grabby-cp-delete", "data-grabby-delete": "", onclick: act(del) }, "Delete") : null,
|
|
2614
|
+
h("span", { class: "grabby-cp-spacer" }),
|
|
2615
|
+
h("button", { type: "button", class: "grabby-cp-cancel", "data-grabby-cancel": "", onclick: act(cancel) }, "Cancel"),
|
|
2616
|
+
h("button", { type: "button", class: "grabby-cp-post", "data-grabby-save": "", onclick: act(save) }, "Save")
|
|
2617
|
+
);
|
|
2618
|
+
}
|
|
2507
2619
|
function finish(identity) {
|
|
2508
2620
|
const ctx = currentCtx;
|
|
2509
2621
|
const value = pendingValue;
|
|
@@ -2569,11 +2681,7 @@ function createCommentPopover(callbacks) {
|
|
|
2569
2681
|
e.stopImmediatePropagation();
|
|
2570
2682
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2571
2683
|
e.preventDefault();
|
|
2572
|
-
|
|
2573
|
-
if (!v) return;
|
|
2574
|
-
pendingValue = v;
|
|
2575
|
-
if (askIdentity) showIdentityStep();
|
|
2576
|
-
else finish();
|
|
2684
|
+
save();
|
|
2577
2685
|
} else if (e.key === "Escape") {
|
|
2578
2686
|
e.preventDefault();
|
|
2579
2687
|
const ctx = currentCtx;
|
|
@@ -2607,6 +2715,7 @@ function createCommentPopover(callbacks) {
|
|
|
2607
2715
|
currentCtx = { mode: opts.mode, entryId: opts.entryId };
|
|
2608
2716
|
askIdentity = opts.askIdentity === true && opts.mode === "new";
|
|
2609
2717
|
visible = true;
|
|
2718
|
+
if (opts.mode === "edit") el.appendChild(editActions());
|
|
2610
2719
|
position(el, opts.anchor);
|
|
2611
2720
|
attachKey();
|
|
2612
2721
|
textarea?.focus();
|
|
@@ -3138,9 +3247,10 @@ function createOutbox(deps) {
|
|
|
3138
3247
|
}, delay);
|
|
3139
3248
|
}
|
|
3140
3249
|
function wireShape(c) {
|
|
3141
|
-
const { screenshot: _shot, sync: _sync, ...rest } = c;
|
|
3250
|
+
const { screenshot: _shot, sync: _sync, pin: _pin, ...rest } = c;
|
|
3142
3251
|
void _shot;
|
|
3143
3252
|
void _sync;
|
|
3253
|
+
void _pin;
|
|
3144
3254
|
return rest;
|
|
3145
3255
|
}
|
|
3146
3256
|
function postComment(comment) {
|
|
@@ -3450,11 +3560,314 @@ function createFreezeOverlay() {
|
|
|
3450
3560
|
};
|
|
3451
3561
|
}
|
|
3452
3562
|
|
|
3563
|
+
// src/core/overlay/markers.ts
|
|
3564
|
+
var LAYER_ID = "__grabby-markers__";
|
|
3565
|
+
var TIP_ID = "__grabby-marker-tip__";
|
|
3566
|
+
var STYLE_ID9 = "__grabby-marker-styles__";
|
|
3567
|
+
var SIZE = 22;
|
|
3568
|
+
var ROUTE_CHECK_MS = 250;
|
|
3569
|
+
var LOOKUP_RETRY_MS = 500;
|
|
3570
|
+
var STAGGER_MS = 30;
|
|
3571
|
+
var TIP_MAX = 140;
|
|
3572
|
+
var ICON_EDIT = {
|
|
3573
|
+
size: 12,
|
|
3574
|
+
shapes: paths("M10.5 2.5l3 3L6 13H3v-3z", "M9 4l3 3")
|
|
3575
|
+
};
|
|
3576
|
+
function createMarkers(deps) {
|
|
3577
|
+
let layer = null;
|
|
3578
|
+
let tip = null;
|
|
3579
|
+
let visible = false;
|
|
3580
|
+
let route = "";
|
|
3581
|
+
let rafId = null;
|
|
3582
|
+
let lastRouteCheck = 0;
|
|
3583
|
+
let hovered = null;
|
|
3584
|
+
const entries = /* @__PURE__ */ new Map();
|
|
3585
|
+
function injectStyles2() {
|
|
3586
|
+
if (hasStyles(STYLE_ID9)) return;
|
|
3587
|
+
addStyles(STYLE_ID9, `
|
|
3588
|
+
#${LAYER_ID} {
|
|
3589
|
+
position: fixed;
|
|
3590
|
+
inset: 0;
|
|
3591
|
+
pointer-events: none;
|
|
3592
|
+
z-index: ${Z_INDEX_CROSSHAIR};
|
|
3593
|
+
}
|
|
3594
|
+
#${LAYER_ID} .grabby-marker {
|
|
3595
|
+
position: absolute;
|
|
3596
|
+
left: 0;
|
|
3597
|
+
top: 0;
|
|
3598
|
+
width: ${SIZE}px;
|
|
3599
|
+
height: ${SIZE}px;
|
|
3600
|
+
margin: 0;
|
|
3601
|
+
padding: 0;
|
|
3602
|
+
border: none;
|
|
3603
|
+
border-radius: 50%;
|
|
3604
|
+
background: var(--grabby-accent, #2563eb);
|
|
3605
|
+
color: #fff;
|
|
3606
|
+
box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
3607
|
+
font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3608
|
+
display: flex;
|
|
3609
|
+
align-items: center;
|
|
3610
|
+
justify-content: center;
|
|
3611
|
+
cursor: pointer;
|
|
3612
|
+
pointer-events: auto;
|
|
3613
|
+
transition: transform 0.12s ease, box-shadow 0.15s ease;
|
|
3614
|
+
}
|
|
3615
|
+
#${LAYER_ID} .grabby-marker[hidden] { display: none; }
|
|
3616
|
+
#${LAYER_ID} .grabby-marker:hover,
|
|
3617
|
+
#${LAYER_ID} .grabby-marker:focus-visible {
|
|
3618
|
+
z-index: 1;
|
|
3619
|
+
outline: none;
|
|
3620
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px color-mix(in srgb, var(--grabby-accent, #2563eb) 35%, transparent), 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
3621
|
+
}
|
|
3622
|
+
#${LAYER_ID} .grabby-marker-edit { display: none; }
|
|
3623
|
+
#${LAYER_ID} .grabby-marker:hover .grabby-marker-num,
|
|
3624
|
+
#${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-num { display: none; }
|
|
3625
|
+
#${LAYER_ID} .grabby-marker:hover .grabby-marker-edit,
|
|
3626
|
+
#${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-edit { display: block; }
|
|
3627
|
+
#${LAYER_ID} .grabby-marker-in {
|
|
3628
|
+
animation: grabby-marker-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
|
|
3629
|
+
}
|
|
3630
|
+
#${LAYER_ID} .grabby-marker-out {
|
|
3631
|
+
animation: grabby-marker-out 0.2s ease-out both;
|
|
3632
|
+
pointer-events: none;
|
|
3633
|
+
}
|
|
3634
|
+
@keyframes grabby-marker-in {
|
|
3635
|
+
from { opacity: 0; scale: 0.3; }
|
|
3636
|
+
to { opacity: 1; scale: 1; }
|
|
3637
|
+
}
|
|
3638
|
+
@keyframes grabby-marker-out {
|
|
3639
|
+
from { opacity: 1; scale: 1; }
|
|
3640
|
+
to { opacity: 0; scale: 0.3; }
|
|
3641
|
+
}
|
|
3642
|
+
#${TIP_ID} {
|
|
3643
|
+
position: fixed;
|
|
3644
|
+
z-index: ${Z_INDEX_CROSSHAIR};
|
|
3645
|
+
max-width: 260px;
|
|
3646
|
+
padding: 8px 10px;
|
|
3647
|
+
border-radius: 10px;
|
|
3648
|
+
background: var(--grabby-label-bg, #1e293b);
|
|
3649
|
+
color: #fff;
|
|
3650
|
+
font: 12px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3651
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
|
|
3652
|
+
pointer-events: none;
|
|
3653
|
+
white-space: pre-wrap;
|
|
3654
|
+
overflow-wrap: anywhere;
|
|
3655
|
+
animation: grabby-marker-tip-in 0.12s ease both;
|
|
3656
|
+
}
|
|
3657
|
+
#${TIP_ID}[hidden] { display: none; }
|
|
3658
|
+
#${TIP_ID} .grabby-marker-tip-hint { display: block; margin-top: 4px; opacity: 0.6; font-size: 11px; }
|
|
3659
|
+
@keyframes grabby-marker-tip-in {
|
|
3660
|
+
from { opacity: 0; transform: translateY(-2px); }
|
|
3661
|
+
to { opacity: 1; transform: none; }
|
|
3662
|
+
}
|
|
3663
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3664
|
+
#${LAYER_ID} .grabby-marker-in, #${LAYER_ID} .grabby-marker-out, #${TIP_ID} { animation: none; }
|
|
3665
|
+
}
|
|
3666
|
+
`);
|
|
3667
|
+
}
|
|
3668
|
+
function ensureLayer() {
|
|
3669
|
+
if (layer) return layer;
|
|
3670
|
+
injectStyles2();
|
|
3671
|
+
layer = document.createElement("div");
|
|
3672
|
+
layer.id = LAYER_ID;
|
|
3673
|
+
tip = document.createElement("div");
|
|
3674
|
+
tip.id = TIP_ID;
|
|
3675
|
+
tip.hidden = true;
|
|
3676
|
+
tip.setAttribute("role", "tooltip");
|
|
3677
|
+
getUiRoot().append(layer, tip);
|
|
3678
|
+
return layer;
|
|
3679
|
+
}
|
|
3680
|
+
function pageComments() {
|
|
3681
|
+
return deps.getComments().filter((c) => c.page.route === route).reverse();
|
|
3682
|
+
}
|
|
3683
|
+
function preview(text) {
|
|
3684
|
+
const flat = text.trim();
|
|
3685
|
+
return flat.length > TIP_MAX ? `${flat.slice(0, TIP_MAX - 1)}\u2026` : flat;
|
|
3686
|
+
}
|
|
3687
|
+
function createEntry(comment) {
|
|
3688
|
+
const number = document.createElement("span");
|
|
3689
|
+
number.className = "grabby-marker-num";
|
|
3690
|
+
const button = document.createElement("button");
|
|
3691
|
+
button.type = "button";
|
|
3692
|
+
button.className = "grabby-marker";
|
|
3693
|
+
button.dataset.grabbyMarker = comment.id;
|
|
3694
|
+
button.append(number, svgIcon(ICON_EDIT, "grabby-marker-edit"));
|
|
3695
|
+
const entry = { comment, button, number, element: null, lastLookup: 0 };
|
|
3696
|
+
button.addEventListener("click", (e) => {
|
|
3697
|
+
e.preventDefault();
|
|
3698
|
+
e.stopPropagation();
|
|
3699
|
+
hideTip();
|
|
3700
|
+
deps.onOpen(entry.comment, entry.element, button);
|
|
3701
|
+
});
|
|
3702
|
+
button.addEventListener("mouseenter", () => startHover(entry));
|
|
3703
|
+
button.addEventListener("focus", () => startHover(entry));
|
|
3704
|
+
button.addEventListener("mouseleave", () => endHover(entry));
|
|
3705
|
+
button.addEventListener("blur", () => endHover(entry));
|
|
3706
|
+
return entry;
|
|
3707
|
+
}
|
|
3708
|
+
function startHover(entry) {
|
|
3709
|
+
hovered = entry;
|
|
3710
|
+
showTip(entry);
|
|
3711
|
+
deps.onHover(entry.comment, entry.element);
|
|
3712
|
+
}
|
|
3713
|
+
function endHover(entry) {
|
|
3714
|
+
if (hovered !== entry) return;
|
|
3715
|
+
hovered = null;
|
|
3716
|
+
hideTip();
|
|
3717
|
+
deps.onHover(null, null);
|
|
3718
|
+
}
|
|
3719
|
+
function showTip(entry) {
|
|
3720
|
+
if (!tip) return;
|
|
3721
|
+
const hint = document.createElement("span");
|
|
3722
|
+
hint.className = "grabby-marker-tip-hint";
|
|
3723
|
+
hint.textContent = "Click to edit";
|
|
3724
|
+
tip.replaceChildren(document.createTextNode(preview(entry.comment.comment)), hint);
|
|
3725
|
+
tip.hidden = false;
|
|
3726
|
+
placeTip(entry);
|
|
3727
|
+
}
|
|
3728
|
+
function placeTip(entry) {
|
|
3729
|
+
if (!tip || tip.hidden) return;
|
|
3730
|
+
const m = entry.button.getBoundingClientRect();
|
|
3731
|
+
const t = tip.getBoundingClientRect();
|
|
3732
|
+
const left = Math.max(8, Math.min(m.left + m.width / 2 - t.width / 2, window.innerWidth - t.width - 8));
|
|
3733
|
+
const below = m.bottom + 8;
|
|
3734
|
+
const top = below + t.height > window.innerHeight - 8 ? m.top - 8 - t.height : below;
|
|
3735
|
+
tip.style.left = `${left}px`;
|
|
3736
|
+
tip.style.top = `${Math.max(8, top)}px`;
|
|
3737
|
+
}
|
|
3738
|
+
function hideTip() {
|
|
3739
|
+
if (tip) tip.hidden = true;
|
|
3740
|
+
}
|
|
3741
|
+
function animateIn(button, delay) {
|
|
3742
|
+
button.classList.remove("grabby-marker-out", "grabby-marker-in");
|
|
3743
|
+
button.style.animationDelay = `${delay}ms`;
|
|
3744
|
+
void button.offsetWidth;
|
|
3745
|
+
button.classList.add("grabby-marker-in");
|
|
3746
|
+
}
|
|
3747
|
+
function removeEntry(id, animate) {
|
|
3748
|
+
const entry = entries.get(id);
|
|
3749
|
+
if (!entry) return;
|
|
3750
|
+
entries.delete(id);
|
|
3751
|
+
if (hovered === entry) endHover(entry);
|
|
3752
|
+
if (!animate) {
|
|
3753
|
+
entry.button.remove();
|
|
3754
|
+
return;
|
|
3755
|
+
}
|
|
3756
|
+
entry.button.style.animationDelay = "0ms";
|
|
3757
|
+
entry.button.classList.remove("grabby-marker-in");
|
|
3758
|
+
entry.button.classList.add("grabby-marker-out");
|
|
3759
|
+
setTimeout(() => entry.button.remove(), 220);
|
|
3760
|
+
}
|
|
3761
|
+
function sync(fresh) {
|
|
3762
|
+
if (!visible) return;
|
|
3763
|
+
const host2 = ensureLayer();
|
|
3764
|
+
const list = pageComments();
|
|
3765
|
+
const ids = new Set(list.map((c) => c.id));
|
|
3766
|
+
for (const id of [...entries.keys()]) if (!ids.has(id)) removeEntry(id, !fresh);
|
|
3767
|
+
list.forEach((comment, i) => {
|
|
3768
|
+
let entry = entries.get(comment.id);
|
|
3769
|
+
const isNew = !entry;
|
|
3770
|
+
if (!entry) {
|
|
3771
|
+
entry = createEntry(comment);
|
|
3772
|
+
entries.set(comment.id, entry);
|
|
3773
|
+
host2.appendChild(entry.button);
|
|
3774
|
+
}
|
|
3775
|
+
entry.comment = comment;
|
|
3776
|
+
const n = String(i + 1);
|
|
3777
|
+
entry.number.textContent = n;
|
|
3778
|
+
entry.button.setAttribute("aria-label", `Comment ${n}: ${preview(comment.comment)}. Click to edit.`);
|
|
3779
|
+
if (fresh || isNew) animateIn(entry.button, fresh ? i * STAGGER_MS : 0);
|
|
3780
|
+
});
|
|
3781
|
+
if (hovered && entries.get(hovered.comment.id) === hovered) showTip(hovered);
|
|
3782
|
+
position(performance.now());
|
|
3783
|
+
schedule();
|
|
3784
|
+
}
|
|
3785
|
+
function position(now) {
|
|
3786
|
+
for (const entry of entries.values()) {
|
|
3787
|
+
if (!entry.element?.isConnected) {
|
|
3788
|
+
entry.element = null;
|
|
3789
|
+
if (now - entry.lastLookup >= LOOKUP_RETRY_MS) {
|
|
3790
|
+
entry.lastLookup = now;
|
|
3791
|
+
entry.element = deps.findElement(entry.comment);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
const rect = entry.element?.getBoundingClientRect();
|
|
3795
|
+
if (!rect || rect.width === 0 && rect.height === 0) {
|
|
3796
|
+
entry.button.hidden = true;
|
|
3797
|
+
continue;
|
|
3798
|
+
}
|
|
3799
|
+
const pin = entry.comment.pin ?? { x: 1, y: 0 };
|
|
3800
|
+
const x = rect.left + pin.x * rect.width - SIZE / 2;
|
|
3801
|
+
const y = rect.top + pin.y * rect.height - SIZE / 2;
|
|
3802
|
+
entry.button.hidden = false;
|
|
3803
|
+
entry.button.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
3804
|
+
}
|
|
3805
|
+
if (hovered) placeTip(hovered);
|
|
3806
|
+
}
|
|
3807
|
+
function frame() {
|
|
3808
|
+
rafId = null;
|
|
3809
|
+
const now = performance.now();
|
|
3810
|
+
if (!visible) return;
|
|
3811
|
+
if (now - lastRouteCheck >= ROUTE_CHECK_MS) {
|
|
3812
|
+
lastRouteCheck = now;
|
|
3813
|
+
const next = deps.currentRoute();
|
|
3814
|
+
if (next !== route) {
|
|
3815
|
+
route = next;
|
|
3816
|
+
for (const id of [...entries.keys()]) removeEntry(id, false);
|
|
3817
|
+
sync(true);
|
|
3818
|
+
return;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
position(now);
|
|
3822
|
+
schedule();
|
|
3823
|
+
}
|
|
3824
|
+
function schedule() {
|
|
3825
|
+
if (rafId === null && visible) rafId = requestAnimationFrame(frame);
|
|
3826
|
+
}
|
|
3827
|
+
function stop() {
|
|
3828
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
3829
|
+
rafId = null;
|
|
3830
|
+
}
|
|
3831
|
+
return {
|
|
3832
|
+
setVisible(next) {
|
|
3833
|
+
if (next === visible) return;
|
|
3834
|
+
visible = next;
|
|
3835
|
+
if (next) {
|
|
3836
|
+
route = deps.currentRoute();
|
|
3837
|
+
lastRouteCheck = performance.now();
|
|
3838
|
+
sync(true);
|
|
3839
|
+
} else {
|
|
3840
|
+
stop();
|
|
3841
|
+
hideTip();
|
|
3842
|
+
if (hovered) endHover(hovered);
|
|
3843
|
+
for (const id of [...entries.keys()]) removeEntry(id, true);
|
|
3844
|
+
}
|
|
3845
|
+
},
|
|
3846
|
+
refresh() {
|
|
3847
|
+
sync(false);
|
|
3848
|
+
},
|
|
3849
|
+
isMarkerElement(el) {
|
|
3850
|
+
return !!layer && (layer === el || layer.contains(el));
|
|
3851
|
+
},
|
|
3852
|
+
dispose() {
|
|
3853
|
+
stop();
|
|
3854
|
+
entries.clear();
|
|
3855
|
+
layer?.remove();
|
|
3856
|
+
tip?.remove();
|
|
3857
|
+
layer = null;
|
|
3858
|
+
tip = null;
|
|
3859
|
+
hovered = null;
|
|
3860
|
+
visible = false;
|
|
3861
|
+
removeStyles(STYLE_ID9);
|
|
3862
|
+
}
|
|
3863
|
+
};
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3453
3866
|
// src/core/overlay/select-feedback.ts
|
|
3454
|
-
var
|
|
3867
|
+
var STYLE_ID10 = "__grabby-feedback-styles__";
|
|
3455
3868
|
function injectStyles() {
|
|
3456
|
-
if (hasStyles(
|
|
3457
|
-
addStyles(
|
|
3869
|
+
if (hasStyles(STYLE_ID10)) return;
|
|
3870
|
+
addStyles(STYLE_ID10, `
|
|
3458
3871
|
@keyframes grabby-flash {
|
|
3459
3872
|
0% { opacity: 1; }
|
|
3460
3873
|
100% { opacity: 0; transform: scale(1.02); }
|
|
@@ -3533,7 +3946,7 @@ function showSelectFeedback(element, label = "Selected") {
|
|
|
3533
3946
|
setTimeout(cleanup, 1200);
|
|
3534
3947
|
}
|
|
3535
3948
|
function disposeFeedbackStyles() {
|
|
3536
|
-
removeStyles(
|
|
3949
|
+
removeStyles(STYLE_ID10);
|
|
3537
3950
|
}
|
|
3538
3951
|
|
|
3539
3952
|
// src/core/storage/history-persistence.ts
|
|
@@ -4721,7 +5134,10 @@ function createGrabInstance(options) {
|
|
|
4721
5134
|
let sourceResolver = adapters.resolveSource;
|
|
4722
5135
|
const cleanClasses = (list) => adapters.cleanClasses(list.filter((c) => !isNoiseClass(c)));
|
|
4723
5136
|
let selectedElement = null;
|
|
5137
|
+
let selectedPin;
|
|
4724
5138
|
let pendingShot = null;
|
|
5139
|
+
const commentedElements = /* @__PURE__ */ new Map();
|
|
5140
|
+
let editingFromMarker = false;
|
|
4725
5141
|
let level = loadLevel(merged.detailLevel);
|
|
4726
5142
|
let collapsed = loadCollapsed();
|
|
4727
5143
|
const pendingShotDeletes = /* @__PURE__ */ new Map();
|
|
@@ -4780,7 +5196,7 @@ function createGrabInstance(options) {
|
|
|
4780
5196
|
column: c.target.source?.column ?? null
|
|
4781
5197
|
};
|
|
4782
5198
|
}
|
|
4783
|
-
function saveComment(element, text, shot) {
|
|
5199
|
+
function saveComment(element, text, shot, pin) {
|
|
4784
5200
|
const now = Date.now();
|
|
4785
5201
|
const comment = {
|
|
4786
5202
|
id: randomId(),
|
|
@@ -4797,8 +5213,10 @@ function createGrabInstance(options) {
|
|
|
4797
5213
|
target: captureTarget(element, { componentResolver, sourceResolver, cleanClasses }),
|
|
4798
5214
|
screenshot: null,
|
|
4799
5215
|
framework: adapters.frameworkFor(element),
|
|
4800
|
-
...outbox ? { sync: "pending" } : {}
|
|
5216
|
+
...outbox ? { sync: "pending" } : {},
|
|
5217
|
+
...pin ? { pin } : {}
|
|
4801
5218
|
};
|
|
5219
|
+
commentedElements.set(comment.id, element);
|
|
4802
5220
|
setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
|
|
4803
5221
|
pluginRegistry.callHook("onComment", comment, element);
|
|
4804
5222
|
outbox?.send(comment.id);
|
|
@@ -4843,6 +5261,7 @@ function createGrabInstance(options) {
|
|
|
4843
5261
|
const idSet = new Set(ids);
|
|
4844
5262
|
const before = comments();
|
|
4845
5263
|
const removed = before.filter((c) => idSet.has(c.id));
|
|
5264
|
+
for (const id of ids) commentedElements.delete(id);
|
|
4846
5265
|
setComments(before.filter((c) => !idSet.has(c.id)));
|
|
4847
5266
|
const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
|
|
4848
5267
|
const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
|
|
@@ -4899,12 +5318,19 @@ function createGrabInstance(options) {
|
|
|
4899
5318
|
}
|
|
4900
5319
|
function hideCommentPopover() {
|
|
4901
5320
|
commentPopover.hide();
|
|
5321
|
+
endMarkerEdit();
|
|
4902
5322
|
if (picker.isHolding()) {
|
|
4903
5323
|
selectedElement = null;
|
|
5324
|
+
selectedPin = void 0;
|
|
4904
5325
|
pendingShot = null;
|
|
4905
5326
|
picker.release();
|
|
4906
5327
|
}
|
|
4907
5328
|
}
|
|
5329
|
+
function endMarkerEdit() {
|
|
5330
|
+
if (!editingFromMarker) return;
|
|
5331
|
+
editingFromMarker = false;
|
|
5332
|
+
overlay.hide();
|
|
5333
|
+
}
|
|
4908
5334
|
function closeAllPopovers() {
|
|
4909
5335
|
commentsPanel.hide();
|
|
4910
5336
|
hideCommentPopover();
|
|
@@ -4941,8 +5367,14 @@ function createGrabInstance(options) {
|
|
|
4941
5367
|
pluginRegistry.callHook("onElementHover", element);
|
|
4942
5368
|
}
|
|
4943
5369
|
},
|
|
4944
|
-
onSelect(element) {
|
|
5370
|
+
onSelect(element, point) {
|
|
4945
5371
|
selectedElement = element;
|
|
5372
|
+
const rect = element.getBoundingClientRect();
|
|
5373
|
+
const frac = (v, start, size2) => size2 > 0 ? Math.min(1, Math.max(0, (v - start) / size2)) : 0.5;
|
|
5374
|
+
selectedPin = {
|
|
5375
|
+
x: Math.round(frac(point.x, rect.left, rect.width) * 1e3) / 1e3,
|
|
5376
|
+
y: Math.round(frac(point.y, rect.top, rect.height) * 1e3) / 1e3
|
|
5377
|
+
};
|
|
4946
5378
|
pendingShot = store.state.options.screenshots ? captureScreenshot(element) : null;
|
|
4947
5379
|
pluginRegistry.callHook("onElementSelect", element);
|
|
4948
5380
|
coachMark.dismiss();
|
|
@@ -4951,6 +5383,36 @@ function createGrabInstance(options) {
|
|
|
4951
5383
|
commentPopover.show({ anchor: element, mode: "new", askIdentity: shouldAskIdentity() });
|
|
4952
5384
|
}
|
|
4953
5385
|
});
|
|
5386
|
+
const markers = createMarkers({
|
|
5387
|
+
getComments: comments,
|
|
5388
|
+
currentRoute: () => sanitizeRoute(location, store.state.options.captureQueryParams),
|
|
5389
|
+
findElement(comment) {
|
|
5390
|
+
const known = commentedElements.get(comment.id);
|
|
5391
|
+
if (known?.isConnected) return known;
|
|
5392
|
+
return safeQuery(comment.target.selector);
|
|
5393
|
+
},
|
|
5394
|
+
onHover(comment, element) {
|
|
5395
|
+
if (picker.isHolding() || editingFromMarker || commentPopover.isVisible()) return;
|
|
5396
|
+
if (comment && element) overlay.show(element, comment.target.component, null, []);
|
|
5397
|
+
else overlay.hide();
|
|
5398
|
+
},
|
|
5399
|
+
onOpen(comment, element, marker) {
|
|
5400
|
+
if (picker.isHolding()) return;
|
|
5401
|
+
closeAllPopovers();
|
|
5402
|
+
doDeactivate(true);
|
|
5403
|
+
editingFromMarker = true;
|
|
5404
|
+
if (element) overlay.show(element, comment.target.component, null, []);
|
|
5405
|
+
commentPopover.show({
|
|
5406
|
+
anchor: element ?? marker,
|
|
5407
|
+
initialValue: comment.comment,
|
|
5408
|
+
mode: "edit",
|
|
5409
|
+
entryId: comment.id
|
|
5410
|
+
});
|
|
5411
|
+
}
|
|
5412
|
+
});
|
|
5413
|
+
function updateMarkers() {
|
|
5414
|
+
markers.setVisible(store.state.toolbar.visible && !collapsed && store.state.options.enabled);
|
|
5415
|
+
}
|
|
4954
5416
|
function doActivate() {
|
|
4955
5417
|
if (!store.state.options.enabled) return;
|
|
4956
5418
|
if (store.state.active) return;
|
|
@@ -5025,12 +5487,14 @@ function createGrabInstance(options) {
|
|
|
5025
5487
|
toolbar.collapse();
|
|
5026
5488
|
saveCollapsed(true);
|
|
5027
5489
|
updateToastOffset();
|
|
5490
|
+
updateMarkers();
|
|
5028
5491
|
}
|
|
5029
5492
|
function expandToolbar() {
|
|
5030
5493
|
collapsed = false;
|
|
5031
5494
|
toolbar.expand();
|
|
5032
5495
|
saveCollapsed(false);
|
|
5033
5496
|
updateToastOffset();
|
|
5497
|
+
updateMarkers();
|
|
5034
5498
|
}
|
|
5035
5499
|
const commentsPanel = createCommentsPanel({
|
|
5036
5500
|
onHover(comment) {
|
|
@@ -5118,9 +5582,11 @@ function createGrabInstance(options) {
|
|
|
5118
5582
|
if (ctx.mode === "new") {
|
|
5119
5583
|
const element = selectedElement;
|
|
5120
5584
|
const shot = pendingShot;
|
|
5585
|
+
const pin = selectedPin;
|
|
5121
5586
|
selectedElement = null;
|
|
5587
|
+
selectedPin = void 0;
|
|
5122
5588
|
pendingShot = null;
|
|
5123
|
-
if (element) saveComment(element, value, shot);
|
|
5589
|
+
if (element) saveComment(element, value, shot, pin);
|
|
5124
5590
|
doDeactivate(true);
|
|
5125
5591
|
return;
|
|
5126
5592
|
}
|
|
@@ -5131,16 +5597,23 @@ function createGrabInstance(options) {
|
|
|
5131
5597
|
setComments(updated);
|
|
5132
5598
|
outbox?.send(ctx.entryId);
|
|
5133
5599
|
showToast("Comment updated");
|
|
5134
|
-
|
|
5600
|
+
if (editingFromMarker) endMarkerEdit();
|
|
5601
|
+
else commentsPanel.show([...updated]);
|
|
5135
5602
|
},
|
|
5136
5603
|
onCancel(ctx) {
|
|
5137
5604
|
if (ctx.mode === "new") {
|
|
5138
5605
|
selectedElement = null;
|
|
5606
|
+
selectedPin = void 0;
|
|
5139
5607
|
pendingShot = null;
|
|
5140
5608
|
doDeactivate(true);
|
|
5141
5609
|
return;
|
|
5142
5610
|
}
|
|
5143
|
-
|
|
5611
|
+
if (editingFromMarker) endMarkerEdit();
|
|
5612
|
+
else commentsPanel.show([...comments()]);
|
|
5613
|
+
},
|
|
5614
|
+
onDelete(ctx) {
|
|
5615
|
+
endMarkerEdit();
|
|
5616
|
+
if (ctx.entryId) removeComments([ctx.entryId], "Comment deleted", true);
|
|
5144
5617
|
}
|
|
5145
5618
|
});
|
|
5146
5619
|
function handleDocumentClick(e) {
|
|
@@ -5296,6 +5769,7 @@ function createGrabInstance(options) {
|
|
|
5296
5769
|
overlay.dispose();
|
|
5297
5770
|
crosshair.dispose();
|
|
5298
5771
|
freezeOverlay.dispose();
|
|
5772
|
+
markers.dispose();
|
|
5299
5773
|
disposeToast();
|
|
5300
5774
|
disposeFeedbackStyles();
|
|
5301
5775
|
pluginRegistry.dispose();
|
|
@@ -5332,8 +5806,11 @@ function createGrabInstance(options) {
|
|
|
5332
5806
|
doDeactivate(true);
|
|
5333
5807
|
}
|
|
5334
5808
|
}
|
|
5809
|
+
if (key === "options") updateMarkers();
|
|
5335
5810
|
if (key === "toolbar") {
|
|
5336
5811
|
updateToastOffset();
|
|
5812
|
+
updateMarkers();
|
|
5813
|
+
markers.refresh();
|
|
5337
5814
|
if (state.options.persistHistory) {
|
|
5338
5815
|
if (state.toolbar.comments.length > 0) {
|
|
5339
5816
|
saveHistory(state.toolbar.comments);
|
|
@@ -5355,6 +5832,7 @@ function createGrabInstance(options) {
|
|
|
5355
5832
|
if (merged.webhookUrl) {
|
|
5356
5833
|
api.registerPlugin(createWebhookPlugin(merged.webhookUrl));
|
|
5357
5834
|
}
|
|
5835
|
+
updateMarkers();
|
|
5358
5836
|
return api;
|
|
5359
5837
|
}
|
|
5360
5838
|
export {
|