@githumbi/grabby 0.3.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.
@@ -673,6 +673,7 @@ function createCrosshair() {
673
673
  let hLine = null;
674
674
  let vLine = null;
675
675
  let listening = false;
676
+ let held = false;
676
677
  function injectStyles2() {
677
678
  if (hasStyles(CROSSHAIR_STYLE_ID)) return;
678
679
  addStyles(CROSSHAIR_STYLE_ID, `
@@ -695,7 +696,7 @@ function createCrosshair() {
695
696
  width: 1px;
696
697
  }
697
698
  `);
698
- addStyles(CURSOR_STYLE_ID, "body.grabby-crosshair-active { cursor: crosshair !important; }", "document");
699
+ addStyles(CURSOR_STYLE_ID, "body.grabby-crosshair-active:not(.grabby-crosshair-held) { cursor: crosshair !important; }", "document");
699
700
  }
700
701
  function ensureElements() {
701
702
  if (!hLine) {
@@ -712,7 +713,12 @@ function createCrosshair() {
712
713
  getUiRoot().appendChild(vLine);
713
714
  }
714
715
  }
716
+ function hideLines() {
717
+ if (hLine) hLine.style.top = "-10px";
718
+ if (vLine) vLine.style.left = "-10px";
719
+ }
715
720
  function handleMouseMove(e) {
721
+ if (held) return;
716
722
  if (hLine) {
717
723
  hLine.style.top = `${e.clientY}px`;
718
724
  }
@@ -733,13 +739,19 @@ function createCrosshair() {
733
739
  listening = false;
734
740
  document.body.classList.remove("grabby-crosshair-active");
735
741
  document.removeEventListener("mousemove", handleMouseMove, true);
736
- if (hLine) hLine.style.top = "-10px";
737
- if (vLine) vLine.style.left = "-10px";
742
+ hideLines();
743
+ },
744
+ hold(on) {
745
+ if (held === on) return;
746
+ held = on;
747
+ document.body.classList.toggle("grabby-crosshair-held", on);
748
+ if (on) hideLines();
738
749
  },
739
750
  isCrosshairElement(el) {
740
751
  return el === hLine || el === vLine || el.id === H_LINE_ID || el.id === V_LINE_ID;
741
752
  },
742
753
  dispose() {
754
+ this.hold(false);
743
755
  this.deactivate();
744
756
  hLine?.remove();
745
757
  vLine?.remove();
@@ -1142,6 +1154,7 @@ function buildUniqueSelector(el) {
1142
1154
  // src/core/picker/element-picker.ts
1143
1155
  function createElementPicker(deps) {
1144
1156
  let hoveredElement = null;
1157
+ let heldElement = null;
1145
1158
  let listening = false;
1146
1159
  function resolveComponentName(el) {
1147
1160
  const resolver = deps.getComponentResolver();
@@ -1172,17 +1185,21 @@ function createElementPicker(deps) {
1172
1185
  if (!raw || raw.closest(`[${IGNORE_ATTR}]`)) return raw && deps.isToolbarElement?.(raw) ? raw : null;
1173
1186
  return exact ? raw : promoteTarget(raw);
1174
1187
  }
1188
+ function showOverlay(target) {
1189
+ const componentName = resolveComponentName(target);
1190
+ const sourcePath = resolveSourcePath(target);
1191
+ const cssClasses = filterAngularClasses(target.classList);
1192
+ deps.overlay.show(target, componentName, sourcePath, cssClasses);
1193
+ }
1175
1194
  function handleMouseMove(e) {
1195
+ if (heldElement) return;
1176
1196
  const target = elementAtPoint(e.clientX, e.clientY, e.shiftKey);
1177
1197
  if (!target || deps.overlay.isOverlayElement(target)) return;
1178
1198
  if (deps.crosshair.isCrosshairElement(target)) return;
1179
1199
  if (deps.isToolbarElement?.(target)) return;
1180
1200
  if (target === hoveredElement) return;
1181
1201
  hoveredElement = target;
1182
- const componentName = resolveComponentName(target);
1183
- const sourcePath = resolveSourcePath(target);
1184
- const cssClasses = filterAngularClasses(target.classList);
1185
- deps.overlay.show(target, componentName, sourcePath, cssClasses);
1202
+ showOverlay(target);
1186
1203
  deps.onHover(target);
1187
1204
  }
1188
1205
  function handleClick(e) {
@@ -1192,8 +1209,9 @@ function createElementPicker(deps) {
1192
1209
  if (target && (deps.isToolbarElement?.(target) || deps.crosshair.isCrosshairElement(target))) return;
1193
1210
  e.preventDefault();
1194
1211
  e.stopPropagation();
1212
+ if (heldElement) return;
1195
1213
  if (hoveredElement) {
1196
- deps.onSelect(hoveredElement);
1214
+ deps.onSelect(hoveredElement, { x: e.clientX, y: e.clientY });
1197
1215
  }
1198
1216
  }
1199
1217
  return {
@@ -1208,12 +1226,29 @@ function createElementPicker(deps) {
1208
1226
  if (!listening) return;
1209
1227
  listening = false;
1210
1228
  hoveredElement = null;
1229
+ heldElement = null;
1230
+ deps.crosshair.hold(false);
1211
1231
  deps.crosshair.deactivate();
1212
1232
  document.removeEventListener("mousemove", handleMouseMove, true);
1213
1233
  document.removeEventListener("click", handleClick, true);
1214
1234
  deps.overlay.hide();
1215
1235
  deps.onHover(null);
1216
1236
  },
1237
+ hold(element) {
1238
+ if (!listening) return;
1239
+ heldElement = element;
1240
+ hoveredElement = element;
1241
+ deps.crosshair.hold(true);
1242
+ showOverlay(element);
1243
+ },
1244
+ release() {
1245
+ if (!heldElement) return;
1246
+ heldElement = null;
1247
+ deps.crosshair.hold(false);
1248
+ },
1249
+ isHolding() {
1250
+ return heldElement !== null;
1251
+ },
1217
1252
  getHoveredElement() {
1218
1253
  return hoveredElement;
1219
1254
  },
@@ -1434,7 +1469,8 @@ function createWebhookPlugin(url) {
1434
1469
  type: "grabby.comment",
1435
1470
  version: 1,
1436
1471
  origin: typeof location !== "undefined" ? location.origin : null,
1437
- comment
1472
+ // The marker position is browser-only.
1473
+ comment: { ...comment, pin: void 0 }
1438
1474
  })
1439
1475
  }).catch(() => {
1440
1476
  });
@@ -1526,6 +1562,9 @@ ${vars.join("\n")}
1526
1562
 
1527
1563
  // src/core/toolbar/toolbar-renderer.ts
1528
1564
  var TOOLBAR_ID = "__grabby-toolbar__";
1565
+ var COLLAPSED_SIZE = 42;
1566
+ var EASE_OUT_EXPO = "cubic-bezier(0.19, 1, 0.22, 1)";
1567
+ var MORPH_MS = 360;
1529
1568
  var STYLE_ID3 = "__grabby-toolbar-styles__";
1530
1569
  function syncSummary(comments) {
1531
1570
  if (comments.length === 0) return null;
@@ -1546,6 +1585,14 @@ function createToolbarRenderer(callbacks, options = {}) {
1546
1585
  let allElements = /* @__PURE__ */ new Set();
1547
1586
  let badge = null;
1548
1587
  let status = null;
1588
+ let expandBadge = null;
1589
+ let content = null;
1590
+ let collapsed = false;
1591
+ let morphTimer = null;
1592
+ function clearMorph() {
1593
+ if (morphTimer) clearTimeout(morphTimer);
1594
+ morphTimer = null;
1595
+ }
1549
1596
  function injectStyles2() {
1550
1597
  if (hasStyles(STYLE_ID3)) return;
1551
1598
  addStyles(STYLE_ID3, `
@@ -1565,7 +1612,21 @@ function createToolbarRenderer(callbacks, options = {}) {
1565
1612
  box-shadow: 0 4px 16px var(--grabby-toolbar-shadow, rgba(0, 0, 0, 0.12));
1566
1613
  pointer-events: auto;
1567
1614
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
1568
- transition: opacity 0.2s ease, transform 0.2s ease;
1615
+ box-sizing: border-box;
1616
+ height: ${COLLAPSED_SIZE}px;
1617
+ overflow: hidden;
1618
+ justify-content: flex-end;
1619
+ transition: opacity 0.2s ease, transform 0.2s ease,
1620
+ left ${MORPH_MS}ms ${EASE_OUT_EXPO}, width ${MORPH_MS}ms ${EASE_OUT_EXPO};
1621
+ }
1622
+ #${TOOLBAR_ID} .grabby-toolbar-content {
1623
+ display: flex;
1624
+ align-items: center;
1625
+ gap: 2px;
1626
+ flex-shrink: 0;
1627
+ transform-origin: right center;
1628
+ transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
1629
+ transform 0.42s ${EASE_OUT_EXPO}, visibility 0s;
1569
1630
  }
1570
1631
  #${TOOLBAR_ID}.grabby-toolbar-hidden {
1571
1632
  opacity: 0;
@@ -1661,6 +1722,45 @@ function createToolbarRenderer(callbacks, options = {}) {
1661
1722
  background: var(--grabby-accent-hover, #1d4ed8);
1662
1723
  color: #fff;
1663
1724
  }
1725
+ #${TOOLBAR_ID} button.grabby-btn-expand {
1726
+ position: absolute;
1727
+ left: 50%;
1728
+ top: 50%;
1729
+ translate: -50% -50%;
1730
+ color: var(--grabby-accent, #2563eb);
1731
+ opacity: 0;
1732
+ scale: 0.6;
1733
+ visibility: hidden;
1734
+ pointer-events: none;
1735
+ transition: opacity 0.2s ease-out, scale 0.3s ${EASE_OUT_EXPO}, visibility 0s 0.2s;
1736
+ }
1737
+ #${TOOLBAR_ID} button.grabby-btn-expand .grabby-badge { top: -3px; right: -5px; }
1738
+ #${TOOLBAR_ID}.grabby-toolbar-collapsed {
1739
+ left: calc(100% - 20px - ${COLLAPSED_SIZE / 2}px);
1740
+ padding: 4px;
1741
+ }
1742
+ #${TOOLBAR_ID}.grabby-toolbar-collapsed .grabby-toolbar-content {
1743
+ opacity: 0;
1744
+ filter: blur(6px);
1745
+ transform: scale(0.4);
1746
+ pointer-events: none;
1747
+ visibility: hidden;
1748
+ transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
1749
+ transform 0.42s ${EASE_OUT_EXPO}, visibility 0s 0.3s;
1750
+ }
1751
+ #${TOOLBAR_ID}.grabby-toolbar-collapsed button.grabby-btn-expand {
1752
+ opacity: 1;
1753
+ scale: 1;
1754
+ visibility: visible;
1755
+ pointer-events: auto;
1756
+ transition: opacity 0.24s ease-out 0.08s, scale 0.36s ${EASE_OUT_EXPO} 0.08s, visibility 0s;
1757
+ }
1758
+ @media (prefers-reduced-motion: reduce) {
1759
+ #${TOOLBAR_ID}, #${TOOLBAR_ID} .grabby-toolbar-content, #${TOOLBAR_ID} button.grabby-btn-expand {
1760
+ transition-duration: 0s !important;
1761
+ transition-delay: 0s !important;
1762
+ }
1763
+ }
1664
1764
  #${TOOLBAR_ID} .grabby-toolbar-left.grabby-toolbar-left-hidden {
1665
1765
  max-width: 0;
1666
1766
  opacity: 0;
@@ -1701,6 +1801,12 @@ function createToolbarRenderer(callbacks, options = {}) {
1701
1801
  buttons.history.appendChild(badge);
1702
1802
  buttons.enable = createButton("enable", ICON_POWER, "Enable/Disable", callbacks.onEnableToggle);
1703
1803
  buttons.dismiss = createButton("dismiss", ICON_DISMISS, options.dismissLabel ?? "Dismiss toolbar", callbacks.onDismiss);
1804
+ buttons.expand = createButton("expand", ICON_GRAB, options.expandLabel ?? "Open Grabby toolbar", () => callbacks.onExpand?.());
1805
+ buttons.expand.classList.add("grabby-btn-expand");
1806
+ expandBadge = document.createElement("span");
1807
+ expandBadge.className = "grabby-badge";
1808
+ expandBadge.hidden = true;
1809
+ buttons.expand.appendChild(expandBadge);
1704
1810
  const divider = document.createElement("span");
1705
1811
  divider.className = "grabby-toolbar-divider";
1706
1812
  leftGroup = document.createElement("div");
@@ -1708,7 +1814,9 @@ function createToolbarRenderer(callbacks, options = {}) {
1708
1814
  leftGroup.appendChild(buttons.selection);
1709
1815
  leftGroup.appendChild(buttons.history);
1710
1816
  leftGroup.appendChild(divider);
1711
- container.appendChild(leftGroup);
1817
+ content = document.createElement("div");
1818
+ content.className = "grabby-toolbar-content";
1819
+ content.appendChild(leftGroup);
1712
1820
  if (options.review) {
1713
1821
  status = document.createElement("span");
1714
1822
  status.className = "grabby-toolbar-status";
@@ -1725,16 +1833,22 @@ function createToolbarRenderer(callbacks, options = {}) {
1725
1833
  e.stopPropagation();
1726
1834
  callbacks.onFinish?.();
1727
1835
  });
1728
- container.appendChild(status);
1729
- container.appendChild(buttons.finish);
1836
+ content.appendChild(status);
1837
+ content.appendChild(buttons.finish);
1730
1838
  allElements.add(status);
1731
1839
  }
1732
- if (!options.hideEnable) container.appendChild(buttons.enable);
1733
- container.appendChild(buttons.dismiss);
1840
+ if (!options.hideEnable) content.appendChild(buttons.enable);
1841
+ content.appendChild(buttons.dismiss);
1842
+ container.append(content, buttons.expand);
1843
+ if (collapsed) {
1844
+ container.classList.add("grabby-toolbar-collapsed");
1845
+ container.style.width = `${COLLAPSED_SIZE}px`;
1846
+ }
1734
1847
  getUiRoot().appendChild(container);
1735
1848
  allElements.clear();
1736
1849
  allElements.add(container);
1737
1850
  allElements.add(leftGroup);
1851
+ allElements.add(content);
1738
1852
  allElements.add(divider);
1739
1853
  for (const btn of Object.values(buttons)) {
1740
1854
  allElements.add(btn);
@@ -1758,9 +1872,10 @@ function createToolbarRenderer(callbacks, options = {}) {
1758
1872
  buttons.selection.classList.remove("grabby-btn-active");
1759
1873
  }
1760
1874
  const count = state.toolbar.comments.length;
1761
- if (badge) {
1762
- badge.hidden = count === 0;
1763
- badge.textContent = count > 99 ? "99+" : String(count);
1875
+ for (const b of [badge, expandBadge]) {
1876
+ if (!b) continue;
1877
+ b.hidden = count === 0;
1878
+ b.textContent = count > 99 ? "99+" : String(count);
1764
1879
  }
1765
1880
  buttons.history.setAttribute("aria-label", count ? `Comments (${count})` : "Comments");
1766
1881
  if (status && buttons.finish) {
@@ -1778,6 +1893,33 @@ function createToolbarRenderer(callbacks, options = {}) {
1778
1893
  leftGroup?.classList.add("grabby-toolbar-left-hidden");
1779
1894
  }
1780
1895
  },
1896
+ collapse() {
1897
+ if (collapsed) return;
1898
+ collapsed = true;
1899
+ if (!container) return;
1900
+ clearMorph();
1901
+ container.style.width = `${container.offsetWidth}px`;
1902
+ void container.offsetWidth;
1903
+ container.classList.add("grabby-toolbar-collapsed");
1904
+ container.style.width = `${COLLAPSED_SIZE}px`;
1905
+ },
1906
+ expand() {
1907
+ if (!collapsed) return;
1908
+ collapsed = false;
1909
+ if (!container) return;
1910
+ clearMorph();
1911
+ container.classList.remove("grabby-toolbar-collapsed");
1912
+ const cs = getComputedStyle(container);
1913
+ const chrome = ["paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"].reduce((sum, k) => sum + (parseFloat(cs[k]) || 0), 0);
1914
+ container.style.width = `${(content?.offsetWidth ?? 0) + chrome}px`;
1915
+ morphTimer = setTimeout(() => {
1916
+ morphTimer = null;
1917
+ if (!collapsed && container) container.style.width = "";
1918
+ }, MORPH_MS + 40);
1919
+ },
1920
+ isCollapsed() {
1921
+ return collapsed;
1922
+ },
1781
1923
  isToolbarElement(el) {
1782
1924
  if (allElements.has(el)) return true;
1783
1925
  let current = el;
@@ -1789,12 +1931,15 @@ function createToolbarRenderer(callbacks, options = {}) {
1789
1931
  return false;
1790
1932
  },
1791
1933
  dispose() {
1934
+ clearMorph();
1792
1935
  container?.remove();
1793
1936
  removeStyles(STYLE_ID3);
1794
1937
  container = null;
1795
1938
  leftGroup = null;
1939
+ content = null;
1796
1940
  buttons = {};
1797
1941
  badge = null;
1942
+ expandBadge = null;
1798
1943
  status = null;
1799
1944
  allElements.clear();
1800
1945
  }
@@ -2361,6 +2506,18 @@ function createCommentPopover(callbacks) {
2361
2506
  font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 4px; border: none;
2362
2507
  background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer; text-decoration: underline;
2363
2508
  }
2509
+ #${POPOVER_ID} .grabby-cp-edit-actions { display: flex; align-items: center; gap: 6px; }
2510
+ #${POPOVER_ID} .grabby-cp-edit-actions .grabby-cp-spacer { flex: 1; }
2511
+ #${POPOVER_ID} .grabby-cp-delete {
2512
+ font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 6px; border: none;
2513
+ border-radius: 8px; background: transparent; color: #b91c1c; cursor: pointer;
2514
+ }
2515
+ #${POPOVER_ID} .grabby-cp-delete:hover { background: rgba(185, 28, 28, 0.08); }
2516
+ #${POPOVER_ID} .grabby-cp-cancel {
2517
+ font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 10px; border: none;
2518
+ border-radius: 8px; background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer;
2519
+ }
2520
+ #${POPOVER_ID} .grabby-cp-cancel:hover { background: var(--grabby-surface, #f1f5f9); }
2364
2521
  #${POPOVER_ID} .grabby-cp-hint {
2365
2522
  font-size: 11px;
2366
2523
  color: var(--grabby-text-muted, #94a3b8);
@@ -2422,6 +2579,37 @@ function createCommentPopover(callbacks) {
2422
2579
  function isEditable(el) {
2423
2580
  return !!el && el !== textarea && el !== nameInput && isEditableElement(el);
2424
2581
  }
2582
+ function save() {
2583
+ const v = textarea?.value.trim();
2584
+ if (!v) return;
2585
+ pendingValue = v;
2586
+ if (askIdentity) showIdentityStep();
2587
+ else finish();
2588
+ }
2589
+ function editActions() {
2590
+ const act = (fn) => (e) => {
2591
+ e.stopPropagation();
2592
+ fn();
2593
+ };
2594
+ const cancel = () => {
2595
+ const ctx = currentCtx;
2596
+ doHide();
2597
+ callbacks.onCancel(ctx);
2598
+ };
2599
+ const del = () => {
2600
+ const ctx = currentCtx;
2601
+ doHide();
2602
+ callbacks.onDelete?.(ctx);
2603
+ };
2604
+ return h(
2605
+ "div",
2606
+ { class: "grabby-cp-edit-actions" },
2607
+ callbacks.onDelete ? h("button", { type: "button", class: "grabby-cp-delete", "data-grabby-delete": "", onclick: act(del) }, "Delete") : null,
2608
+ h("span", { class: "grabby-cp-spacer" }),
2609
+ h("button", { type: "button", class: "grabby-cp-cancel", "data-grabby-cancel": "", onclick: act(cancel) }, "Cancel"),
2610
+ h("button", { type: "button", class: "grabby-cp-post", "data-grabby-save": "", onclick: act(save) }, "Save")
2611
+ );
2612
+ }
2425
2613
  function finish(identity) {
2426
2614
  const ctx = currentCtx;
2427
2615
  const value = pendingValue;
@@ -2487,11 +2675,7 @@ function createCommentPopover(callbacks) {
2487
2675
  e.stopImmediatePropagation();
2488
2676
  if (e.key === "Enter" && !e.shiftKey) {
2489
2677
  e.preventDefault();
2490
- const v = textarea.value.trim();
2491
- if (!v) return;
2492
- pendingValue = v;
2493
- if (askIdentity) showIdentityStep();
2494
- else finish();
2678
+ save();
2495
2679
  } else if (e.key === "Escape") {
2496
2680
  e.preventDefault();
2497
2681
  const ctx = currentCtx;
@@ -2525,6 +2709,7 @@ function createCommentPopover(callbacks) {
2525
2709
  currentCtx = { mode: opts.mode, entryId: opts.entryId };
2526
2710
  askIdentity = opts.askIdentity === true && opts.mode === "new";
2527
2711
  visible = true;
2712
+ if (opts.mode === "edit") el.appendChild(editActions());
2528
2713
  position(el, opts.anchor);
2529
2714
  attachKey();
2530
2715
  textarea?.focus();
@@ -3056,9 +3241,10 @@ function createOutbox(deps) {
3056
3241
  }, delay);
3057
3242
  }
3058
3243
  function wireShape(c) {
3059
- const { screenshot: _shot, sync: _sync, ...rest } = c;
3244
+ const { screenshot: _shot, sync: _sync, pin: _pin, ...rest } = c;
3060
3245
  void _shot;
3061
3246
  void _sync;
3247
+ void _pin;
3062
3248
  return rest;
3063
3249
  }
3064
3250
  function postComment(comment) {
@@ -3407,11 +3593,314 @@ function createFreezeOverlay() {
3407
3593
  };
3408
3594
  }
3409
3595
 
3596
+ // src/core/overlay/markers.ts
3597
+ var LAYER_ID = "__grabby-markers__";
3598
+ var TIP_ID = "__grabby-marker-tip__";
3599
+ var STYLE_ID9 = "__grabby-marker-styles__";
3600
+ var SIZE = 22;
3601
+ var ROUTE_CHECK_MS = 250;
3602
+ var LOOKUP_RETRY_MS = 500;
3603
+ var STAGGER_MS = 30;
3604
+ var TIP_MAX = 140;
3605
+ var ICON_EDIT = {
3606
+ size: 12,
3607
+ shapes: paths("M10.5 2.5l3 3L6 13H3v-3z", "M9 4l3 3")
3608
+ };
3609
+ function createMarkers(deps) {
3610
+ let layer = null;
3611
+ let tip = null;
3612
+ let visible = false;
3613
+ let route = "";
3614
+ let rafId = null;
3615
+ let lastRouteCheck = 0;
3616
+ let hovered = null;
3617
+ const entries = /* @__PURE__ */ new Map();
3618
+ function injectStyles2() {
3619
+ if (hasStyles(STYLE_ID9)) return;
3620
+ addStyles(STYLE_ID9, `
3621
+ #${LAYER_ID} {
3622
+ position: fixed;
3623
+ inset: 0;
3624
+ pointer-events: none;
3625
+ z-index: ${Z_INDEX_CROSSHAIR};
3626
+ }
3627
+ #${LAYER_ID} .grabby-marker {
3628
+ position: absolute;
3629
+ left: 0;
3630
+ top: 0;
3631
+ width: ${SIZE}px;
3632
+ height: ${SIZE}px;
3633
+ margin: 0;
3634
+ padding: 0;
3635
+ border: none;
3636
+ border-radius: 50%;
3637
+ background: var(--grabby-accent, #2563eb);
3638
+ color: #fff;
3639
+ box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.25);
3640
+ font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3641
+ display: flex;
3642
+ align-items: center;
3643
+ justify-content: center;
3644
+ cursor: pointer;
3645
+ pointer-events: auto;
3646
+ transition: transform 0.12s ease, box-shadow 0.15s ease;
3647
+ }
3648
+ #${LAYER_ID} .grabby-marker[hidden] { display: none; }
3649
+ #${LAYER_ID} .grabby-marker:hover,
3650
+ #${LAYER_ID} .grabby-marker:focus-visible {
3651
+ z-index: 1;
3652
+ outline: none;
3653
+ 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);
3654
+ }
3655
+ #${LAYER_ID} .grabby-marker-edit { display: none; }
3656
+ #${LAYER_ID} .grabby-marker:hover .grabby-marker-num,
3657
+ #${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-num { display: none; }
3658
+ #${LAYER_ID} .grabby-marker:hover .grabby-marker-edit,
3659
+ #${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-edit { display: block; }
3660
+ #${LAYER_ID} .grabby-marker-in {
3661
+ animation: grabby-marker-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
3662
+ }
3663
+ #${LAYER_ID} .grabby-marker-out {
3664
+ animation: grabby-marker-out 0.2s ease-out both;
3665
+ pointer-events: none;
3666
+ }
3667
+ @keyframes grabby-marker-in {
3668
+ from { opacity: 0; scale: 0.3; }
3669
+ to { opacity: 1; scale: 1; }
3670
+ }
3671
+ @keyframes grabby-marker-out {
3672
+ from { opacity: 1; scale: 1; }
3673
+ to { opacity: 0; scale: 0.3; }
3674
+ }
3675
+ #${TIP_ID} {
3676
+ position: fixed;
3677
+ z-index: ${Z_INDEX_CROSSHAIR};
3678
+ max-width: 260px;
3679
+ padding: 8px 10px;
3680
+ border-radius: 10px;
3681
+ background: var(--grabby-label-bg, #1e293b);
3682
+ color: #fff;
3683
+ font: 12px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3684
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
3685
+ pointer-events: none;
3686
+ white-space: pre-wrap;
3687
+ overflow-wrap: anywhere;
3688
+ animation: grabby-marker-tip-in 0.12s ease both;
3689
+ }
3690
+ #${TIP_ID}[hidden] { display: none; }
3691
+ #${TIP_ID} .grabby-marker-tip-hint { display: block; margin-top: 4px; opacity: 0.6; font-size: 11px; }
3692
+ @keyframes grabby-marker-tip-in {
3693
+ from { opacity: 0; transform: translateY(-2px); }
3694
+ to { opacity: 1; transform: none; }
3695
+ }
3696
+ @media (prefers-reduced-motion: reduce) {
3697
+ #${LAYER_ID} .grabby-marker-in, #${LAYER_ID} .grabby-marker-out, #${TIP_ID} { animation: none; }
3698
+ }
3699
+ `);
3700
+ }
3701
+ function ensureLayer() {
3702
+ if (layer) return layer;
3703
+ injectStyles2();
3704
+ layer = document.createElement("div");
3705
+ layer.id = LAYER_ID;
3706
+ tip = document.createElement("div");
3707
+ tip.id = TIP_ID;
3708
+ tip.hidden = true;
3709
+ tip.setAttribute("role", "tooltip");
3710
+ getUiRoot().append(layer, tip);
3711
+ return layer;
3712
+ }
3713
+ function pageComments() {
3714
+ return deps.getComments().filter((c) => c.page.route === route).reverse();
3715
+ }
3716
+ function preview(text) {
3717
+ const flat = text.trim();
3718
+ return flat.length > TIP_MAX ? `${flat.slice(0, TIP_MAX - 1)}\u2026` : flat;
3719
+ }
3720
+ function createEntry(comment) {
3721
+ const number = document.createElement("span");
3722
+ number.className = "grabby-marker-num";
3723
+ const button = document.createElement("button");
3724
+ button.type = "button";
3725
+ button.className = "grabby-marker";
3726
+ button.dataset.grabbyMarker = comment.id;
3727
+ button.append(number, svgIcon(ICON_EDIT, "grabby-marker-edit"));
3728
+ const entry = { comment, button, number, element: null, lastLookup: 0 };
3729
+ button.addEventListener("click", (e) => {
3730
+ e.preventDefault();
3731
+ e.stopPropagation();
3732
+ hideTip();
3733
+ deps.onOpen(entry.comment, entry.element, button);
3734
+ });
3735
+ button.addEventListener("mouseenter", () => startHover(entry));
3736
+ button.addEventListener("focus", () => startHover(entry));
3737
+ button.addEventListener("mouseleave", () => endHover(entry));
3738
+ button.addEventListener("blur", () => endHover(entry));
3739
+ return entry;
3740
+ }
3741
+ function startHover(entry) {
3742
+ hovered = entry;
3743
+ showTip(entry);
3744
+ deps.onHover(entry.comment, entry.element);
3745
+ }
3746
+ function endHover(entry) {
3747
+ if (hovered !== entry) return;
3748
+ hovered = null;
3749
+ hideTip();
3750
+ deps.onHover(null, null);
3751
+ }
3752
+ function showTip(entry) {
3753
+ if (!tip) return;
3754
+ const hint = document.createElement("span");
3755
+ hint.className = "grabby-marker-tip-hint";
3756
+ hint.textContent = "Click to edit";
3757
+ tip.replaceChildren(document.createTextNode(preview(entry.comment.comment)), hint);
3758
+ tip.hidden = false;
3759
+ placeTip(entry);
3760
+ }
3761
+ function placeTip(entry) {
3762
+ if (!tip || tip.hidden) return;
3763
+ const m = entry.button.getBoundingClientRect();
3764
+ const t = tip.getBoundingClientRect();
3765
+ const left = Math.max(8, Math.min(m.left + m.width / 2 - t.width / 2, window.innerWidth - t.width - 8));
3766
+ const below = m.bottom + 8;
3767
+ const top = below + t.height > window.innerHeight - 8 ? m.top - 8 - t.height : below;
3768
+ tip.style.left = `${left}px`;
3769
+ tip.style.top = `${Math.max(8, top)}px`;
3770
+ }
3771
+ function hideTip() {
3772
+ if (tip) tip.hidden = true;
3773
+ }
3774
+ function animateIn(button, delay) {
3775
+ button.classList.remove("grabby-marker-out", "grabby-marker-in");
3776
+ button.style.animationDelay = `${delay}ms`;
3777
+ void button.offsetWidth;
3778
+ button.classList.add("grabby-marker-in");
3779
+ }
3780
+ function removeEntry(id, animate) {
3781
+ const entry = entries.get(id);
3782
+ if (!entry) return;
3783
+ entries.delete(id);
3784
+ if (hovered === entry) endHover(entry);
3785
+ if (!animate) {
3786
+ entry.button.remove();
3787
+ return;
3788
+ }
3789
+ entry.button.style.animationDelay = "0ms";
3790
+ entry.button.classList.remove("grabby-marker-in");
3791
+ entry.button.classList.add("grabby-marker-out");
3792
+ setTimeout(() => entry.button.remove(), 220);
3793
+ }
3794
+ function sync(fresh) {
3795
+ if (!visible) return;
3796
+ const host2 = ensureLayer();
3797
+ const list = pageComments();
3798
+ const ids = new Set(list.map((c) => c.id));
3799
+ for (const id of [...entries.keys()]) if (!ids.has(id)) removeEntry(id, !fresh);
3800
+ list.forEach((comment, i) => {
3801
+ let entry = entries.get(comment.id);
3802
+ const isNew = !entry;
3803
+ if (!entry) {
3804
+ entry = createEntry(comment);
3805
+ entries.set(comment.id, entry);
3806
+ host2.appendChild(entry.button);
3807
+ }
3808
+ entry.comment = comment;
3809
+ const n = String(i + 1);
3810
+ entry.number.textContent = n;
3811
+ entry.button.setAttribute("aria-label", `Comment ${n}: ${preview(comment.comment)}. Click to edit.`);
3812
+ if (fresh || isNew) animateIn(entry.button, fresh ? i * STAGGER_MS : 0);
3813
+ });
3814
+ if (hovered && entries.get(hovered.comment.id) === hovered) showTip(hovered);
3815
+ position(performance.now());
3816
+ schedule();
3817
+ }
3818
+ function position(now) {
3819
+ for (const entry of entries.values()) {
3820
+ if (!entry.element?.isConnected) {
3821
+ entry.element = null;
3822
+ if (now - entry.lastLookup >= LOOKUP_RETRY_MS) {
3823
+ entry.lastLookup = now;
3824
+ entry.element = deps.findElement(entry.comment);
3825
+ }
3826
+ }
3827
+ const rect = entry.element?.getBoundingClientRect();
3828
+ if (!rect || rect.width === 0 && rect.height === 0) {
3829
+ entry.button.hidden = true;
3830
+ continue;
3831
+ }
3832
+ const pin = entry.comment.pin ?? { x: 1, y: 0 };
3833
+ const x = rect.left + pin.x * rect.width - SIZE / 2;
3834
+ const y = rect.top + pin.y * rect.height - SIZE / 2;
3835
+ entry.button.hidden = false;
3836
+ entry.button.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
3837
+ }
3838
+ if (hovered) placeTip(hovered);
3839
+ }
3840
+ function frame() {
3841
+ rafId = null;
3842
+ const now = performance.now();
3843
+ if (!visible) return;
3844
+ if (now - lastRouteCheck >= ROUTE_CHECK_MS) {
3845
+ lastRouteCheck = now;
3846
+ const next = deps.currentRoute();
3847
+ if (next !== route) {
3848
+ route = next;
3849
+ for (const id of [...entries.keys()]) removeEntry(id, false);
3850
+ sync(true);
3851
+ return;
3852
+ }
3853
+ }
3854
+ position(now);
3855
+ schedule();
3856
+ }
3857
+ function schedule() {
3858
+ if (rafId === null && visible) rafId = requestAnimationFrame(frame);
3859
+ }
3860
+ function stop() {
3861
+ if (rafId !== null) cancelAnimationFrame(rafId);
3862
+ rafId = null;
3863
+ }
3864
+ return {
3865
+ setVisible(next) {
3866
+ if (next === visible) return;
3867
+ visible = next;
3868
+ if (next) {
3869
+ route = deps.currentRoute();
3870
+ lastRouteCheck = performance.now();
3871
+ sync(true);
3872
+ } else {
3873
+ stop();
3874
+ hideTip();
3875
+ if (hovered) endHover(hovered);
3876
+ for (const id of [...entries.keys()]) removeEntry(id, true);
3877
+ }
3878
+ },
3879
+ refresh() {
3880
+ sync(false);
3881
+ },
3882
+ isMarkerElement(el) {
3883
+ return !!layer && (layer === el || layer.contains(el));
3884
+ },
3885
+ dispose() {
3886
+ stop();
3887
+ entries.clear();
3888
+ layer?.remove();
3889
+ tip?.remove();
3890
+ layer = null;
3891
+ tip = null;
3892
+ hovered = null;
3893
+ visible = false;
3894
+ removeStyles(STYLE_ID9);
3895
+ }
3896
+ };
3897
+ }
3898
+
3410
3899
  // src/core/overlay/select-feedback.ts
3411
- var STYLE_ID9 = "__grabby-feedback-styles__";
3900
+ var STYLE_ID10 = "__grabby-feedback-styles__";
3412
3901
  function injectStyles() {
3413
- if (hasStyles(STYLE_ID9)) return;
3414
- addStyles(STYLE_ID9, `
3902
+ if (hasStyles(STYLE_ID10)) return;
3903
+ addStyles(STYLE_ID10, `
3415
3904
  @keyframes grabby-flash {
3416
3905
  0% { opacity: 1; }
3417
3906
  100% { opacity: 0; transform: scale(1.02); }
@@ -3490,7 +3979,7 @@ function showSelectFeedback(element, label = "Selected") {
3490
3979
  setTimeout(cleanup, 1200);
3491
3980
  }
3492
3981
  function disposeFeedbackStyles() {
3493
- removeStyles(STYLE_ID9);
3982
+ removeStyles(STYLE_ID10);
3494
3983
  }
3495
3984
 
3496
3985
  // src/core/storage/history-persistence.ts
@@ -4583,6 +5072,21 @@ function flushLeftovers(options) {
4583
5072
  }
4584
5073
  });
4585
5074
  }
5075
+ var COLLAPSED_KEY = "grabby:v1:collapsed";
5076
+ function loadCollapsed() {
5077
+ try {
5078
+ return sessionStorage.getItem(COLLAPSED_KEY) === "1";
5079
+ } catch {
5080
+ return false;
5081
+ }
5082
+ }
5083
+ function saveCollapsed(on) {
5084
+ try {
5085
+ if (on) sessionStorage.setItem(COLLAPSED_KEY, "1");
5086
+ else sessionStorage.removeItem(COLLAPSED_KEY);
5087
+ } catch {
5088
+ }
5089
+ }
4586
5090
  function isDevMode() {
4587
5091
  try {
4588
5092
  if (typeof ngDevMode !== "undefined" && ngDevMode === false) return false;
@@ -4663,8 +5167,12 @@ function createGrabInstance(options) {
4663
5167
  let sourceResolver = adapters.resolveSource;
4664
5168
  const cleanClasses = (list) => adapters.cleanClasses(list.filter((c) => !isNoiseClass(c)));
4665
5169
  let selectedElement = null;
5170
+ let selectedPin;
4666
5171
  let pendingShot = null;
5172
+ const commentedElements = /* @__PURE__ */ new Map();
5173
+ let editingFromMarker = false;
4667
5174
  let level = loadLevel(merged.detailLevel);
5175
+ let collapsed = loadCollapsed();
4668
5176
  const pendingShotDeletes = /* @__PURE__ */ new Map();
4669
5177
  themeManager.apply(store.state.toolbar.themeMode);
4670
5178
  updateToastOffset();
@@ -4721,7 +5229,7 @@ function createGrabInstance(options) {
4721
5229
  column: c.target.source?.column ?? null
4722
5230
  };
4723
5231
  }
4724
- function saveComment(element, text, shot) {
5232
+ function saveComment(element, text, shot, pin) {
4725
5233
  const now = Date.now();
4726
5234
  const comment = {
4727
5235
  id: randomId(),
@@ -4738,8 +5246,10 @@ function createGrabInstance(options) {
4738
5246
  target: captureTarget(element, { componentResolver, sourceResolver, cleanClasses }),
4739
5247
  screenshot: null,
4740
5248
  framework: adapters.frameworkFor(element),
4741
- ...outbox ? { sync: "pending" } : {}
5249
+ ...outbox ? { sync: "pending" } : {},
5250
+ ...pin ? { pin } : {}
4742
5251
  };
5252
+ commentedElements.set(comment.id, element);
4743
5253
  setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
4744
5254
  pluginRegistry.callHook("onComment", comment, element);
4745
5255
  outbox?.send(comment.id);
@@ -4784,6 +5294,7 @@ function createGrabInstance(options) {
4784
5294
  const idSet = new Set(ids);
4785
5295
  const before = comments();
4786
5296
  const removed = before.filter((c) => idSet.has(c.id));
5297
+ for (const id of ids) commentedElements.delete(id);
4787
5298
  setComments(before.filter((c) => !idSet.has(c.id)));
4788
5299
  const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
4789
5300
  const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
@@ -4838,9 +5349,24 @@ function createGrabInstance(options) {
4838
5349
  function isAnyToolbarElement(el) {
4839
5350
  return isUiNode(el) || freezeOverlay.isFreezeElement(el);
4840
5351
  }
5352
+ function hideCommentPopover() {
5353
+ commentPopover.hide();
5354
+ endMarkerEdit();
5355
+ if (picker.isHolding()) {
5356
+ selectedElement = null;
5357
+ selectedPin = void 0;
5358
+ pendingShot = null;
5359
+ picker.release();
5360
+ }
5361
+ }
5362
+ function endMarkerEdit() {
5363
+ if (!editingFromMarker) return;
5364
+ editingFromMarker = false;
5365
+ overlay.hide();
5366
+ }
4841
5367
  function closeAllPopovers() {
4842
5368
  commentsPanel.hide();
4843
- commentPopover.hide();
5369
+ hideCommentPopover();
4844
5370
  copySheet.close();
4845
5371
  finishSheet.close();
4846
5372
  }
@@ -4874,15 +5400,52 @@ function createGrabInstance(options) {
4874
5400
  pluginRegistry.callHook("onElementHover", element);
4875
5401
  }
4876
5402
  },
4877
- onSelect(element) {
5403
+ onSelect(element, point) {
4878
5404
  selectedElement = element;
5405
+ const rect = element.getBoundingClientRect();
5406
+ const frac = (v, start, size2) => size2 > 0 ? Math.min(1, Math.max(0, (v - start) / size2)) : 0.5;
5407
+ selectedPin = {
5408
+ x: Math.round(frac(point.x, rect.left, rect.width) * 1e3) / 1e3,
5409
+ y: Math.round(frac(point.y, rect.top, rect.height) * 1e3) / 1e3
5410
+ };
4879
5411
  pendingShot = store.state.options.screenshots ? captureScreenshot(element) : null;
4880
5412
  pluginRegistry.callHook("onElementSelect", element);
4881
5413
  coachMark.dismiss();
4882
5414
  showSelectFeedback(element);
5415
+ picker.hold(element);
4883
5416
  commentPopover.show({ anchor: element, mode: "new", askIdentity: shouldAskIdentity() });
4884
5417
  }
4885
5418
  });
5419
+ const markers = createMarkers({
5420
+ getComments: comments,
5421
+ currentRoute: () => sanitizeRoute(location, store.state.options.captureQueryParams),
5422
+ findElement(comment) {
5423
+ const known = commentedElements.get(comment.id);
5424
+ if (known?.isConnected) return known;
5425
+ return safeQuery(comment.target.selector);
5426
+ },
5427
+ onHover(comment, element) {
5428
+ if (picker.isHolding() || editingFromMarker || commentPopover.isVisible()) return;
5429
+ if (comment && element) overlay.show(element, comment.target.component, null, []);
5430
+ else overlay.hide();
5431
+ },
5432
+ onOpen(comment, element, marker) {
5433
+ if (picker.isHolding()) return;
5434
+ closeAllPopovers();
5435
+ doDeactivate(true);
5436
+ editingFromMarker = true;
5437
+ if (element) overlay.show(element, comment.target.component, null, []);
5438
+ commentPopover.show({
5439
+ anchor: element ?? marker,
5440
+ initialValue: comment.comment,
5441
+ mode: "edit",
5442
+ entryId: comment.id
5443
+ });
5444
+ }
5445
+ });
5446
+ function updateMarkers() {
5447
+ markers.setVisible(store.state.toolbar.visible && !collapsed && store.state.options.enabled);
5448
+ }
4886
5449
  function doActivate() {
4887
5450
  if (!store.state.options.enabled) return;
4888
5451
  if (store.state.active) return;
@@ -4890,6 +5453,7 @@ function createGrabInstance(options) {
4890
5453
  store.state.toolbar = { ...store.state.toolbar, visible: true };
4891
5454
  toolbar.show();
4892
5455
  }
5456
+ if (collapsed) expandToolbar();
4893
5457
  closeAllPopovers();
4894
5458
  store.state.active = true;
4895
5459
  picker.activate();
@@ -4924,7 +5488,7 @@ function createGrabInstance(options) {
4924
5488
  }
4925
5489
  },
4926
5490
  onHistory() {
4927
- commentPopover.hide();
5491
+ hideCommentPopover();
4928
5492
  copySheet.close();
4929
5493
  if (commentsPanel.isVisible()) {
4930
5494
  commentsPanel.hide();
@@ -4941,16 +5505,30 @@ function createGrabInstance(options) {
4941
5505
  }
4942
5506
  toolbar.update(store.state);
4943
5507
  },
4944
- onDismiss() {
4945
- const { pending, failed } = reviewCounts();
4946
- if (live && outbox && (pending || failed)) {
4947
- openFinishSheet();
4948
- return;
4949
- }
4950
- exitFeedbackMode();
4951
- },
5508
+ // Close collapses the toolbar into a round button in the bottom-right
5509
+ // corner instead of removing it, so nothing is lost and it's one click
5510
+ // back. Comments keep sending while it's collapsed.
5511
+ onDismiss: collapseToolbar,
5512
+ onExpand: expandToolbar,
4952
5513
  onFinish: openFinishSheet
4953
- }, live ? { label: "Comment", dismissLabel: "Exit feedback mode", hideEnable: true, review: !!merged.server } : {});
5514
+ }, live ? { label: "Comment", dismissLabel: "Hide toolbar", expandLabel: "Leave feedback", hideEnable: true, review: !!merged.server } : { dismissLabel: "Hide toolbar", expandLabel: "Open Grabby toolbar" });
5515
+ function collapseToolbar() {
5516
+ closeAllPopovers();
5517
+ coachMark.dismiss();
5518
+ doDeactivate(true);
5519
+ collapsed = true;
5520
+ toolbar.collapse();
5521
+ saveCollapsed(true);
5522
+ updateToastOffset();
5523
+ updateMarkers();
5524
+ }
5525
+ function expandToolbar() {
5526
+ collapsed = false;
5527
+ toolbar.expand();
5528
+ saveCollapsed(false);
5529
+ updateToastOffset();
5530
+ updateMarkers();
5531
+ }
4954
5532
  const commentsPanel = createCommentsPanel({
4955
5533
  onHover(comment) {
4956
5534
  const el = comment ? safeQuery(comment.target.selector) : null;
@@ -5037,9 +5615,11 @@ function createGrabInstance(options) {
5037
5615
  if (ctx.mode === "new") {
5038
5616
  const element = selectedElement;
5039
5617
  const shot = pendingShot;
5618
+ const pin = selectedPin;
5040
5619
  selectedElement = null;
5620
+ selectedPin = void 0;
5041
5621
  pendingShot = null;
5042
- if (element) saveComment(element, value, shot);
5622
+ if (element) saveComment(element, value, shot, pin);
5043
5623
  doDeactivate(true);
5044
5624
  return;
5045
5625
  }
@@ -5050,16 +5630,23 @@ function createGrabInstance(options) {
5050
5630
  setComments(updated);
5051
5631
  outbox?.send(ctx.entryId);
5052
5632
  showToast("Comment updated");
5053
- commentsPanel.show([...updated]);
5633
+ if (editingFromMarker) endMarkerEdit();
5634
+ else commentsPanel.show([...updated]);
5054
5635
  },
5055
5636
  onCancel(ctx) {
5056
5637
  if (ctx.mode === "new") {
5057
5638
  selectedElement = null;
5639
+ selectedPin = void 0;
5058
5640
  pendingShot = null;
5059
5641
  doDeactivate(true);
5060
5642
  return;
5061
5643
  }
5062
- commentsPanel.show([...comments()]);
5644
+ if (editingFromMarker) endMarkerEdit();
5645
+ else commentsPanel.show([...comments()]);
5646
+ },
5647
+ onDelete(ctx) {
5648
+ endMarkerEdit();
5649
+ if (ctx.entryId) removeComments([ctx.entryId], "Comment deleted", true);
5063
5650
  }
5064
5651
  });
5065
5652
  function handleDocumentClick(e) {
@@ -5087,7 +5674,7 @@ function createGrabInstance(options) {
5087
5674
  }
5088
5675
  window.addEventListener("beforeunload", handleBeforeUnload);
5089
5676
  function updateToastOffset() {
5090
- if (store.state.toolbar.visible) {
5677
+ if (store.state.toolbar.visible && !collapsed) {
5091
5678
  document.documentElement.style.setProperty("--grabby-toast-bottom", TOOLBAR_TOAST_OFFSET);
5092
5679
  } else {
5093
5680
  document.documentElement.style.removeProperty("--grabby-toast-bottom");
@@ -5215,6 +5802,7 @@ function createGrabInstance(options) {
5215
5802
  overlay.dispose();
5216
5803
  crosshair.dispose();
5217
5804
  freezeOverlay.dispose();
5805
+ markers.dispose();
5218
5806
  disposeToast();
5219
5807
  disposeFeedbackStyles();
5220
5808
  pluginRegistry.dispose();
@@ -5237,9 +5825,10 @@ function createGrabInstance(options) {
5237
5825
  keyboard.start();
5238
5826
  }
5239
5827
  store.state.toolbar = { ...store.state.toolbar, visible: false };
5828
+ if (collapsed) toolbar.collapse();
5240
5829
  if (live && merged.showToolbar) {
5241
5830
  api.showToolbar();
5242
- coachMark.maybeShow();
5831
+ if (!collapsed) coachMark.maybeShow();
5243
5832
  }
5244
5833
  store.subscribe((state, key) => {
5245
5834
  if (key === "options") {
@@ -5250,8 +5839,11 @@ function createGrabInstance(options) {
5250
5839
  doDeactivate(true);
5251
5840
  }
5252
5841
  }
5842
+ if (key === "options") updateMarkers();
5253
5843
  if (key === "toolbar") {
5254
5844
  updateToastOffset();
5845
+ updateMarkers();
5846
+ markers.refresh();
5255
5847
  if (state.options.persistHistory) {
5256
5848
  if (state.toolbar.comments.length > 0) {
5257
5849
  saveHistory(state.toolbar.comments);
@@ -5273,6 +5865,7 @@ function createGrabInstance(options) {
5273
5865
  if (merged.webhookUrl) {
5274
5866
  api.registerPlugin(createWebhookPlugin(merged.webhookUrl));
5275
5867
  }
5868
+ updateMarkers();
5276
5869
  return api;
5277
5870
  }
5278
5871