@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.
@@ -679,6 +679,7 @@ function createCrosshair() {
679
679
  let hLine = null;
680
680
  let vLine = null;
681
681
  let listening = false;
682
+ let held = false;
682
683
  function injectStyles2() {
683
684
  if (hasStyles(CROSSHAIR_STYLE_ID)) return;
684
685
  addStyles(CROSSHAIR_STYLE_ID, `
@@ -701,7 +702,7 @@ function createCrosshair() {
701
702
  width: 1px;
702
703
  }
703
704
  `);
704
- addStyles(CURSOR_STYLE_ID, "body.grabby-crosshair-active { cursor: crosshair !important; }", "document");
705
+ addStyles(CURSOR_STYLE_ID, "body.grabby-crosshair-active:not(.grabby-crosshair-held) { cursor: crosshair !important; }", "document");
705
706
  }
706
707
  function ensureElements() {
707
708
  if (!hLine) {
@@ -718,7 +719,12 @@ function createCrosshair() {
718
719
  getUiRoot().appendChild(vLine);
719
720
  }
720
721
  }
722
+ function hideLines() {
723
+ if (hLine) hLine.style.top = "-10px";
724
+ if (vLine) vLine.style.left = "-10px";
725
+ }
721
726
  function handleMouseMove(e) {
727
+ if (held) return;
722
728
  if (hLine) {
723
729
  hLine.style.top = `${e.clientY}px`;
724
730
  }
@@ -739,13 +745,19 @@ function createCrosshair() {
739
745
  listening = false;
740
746
  document.body.classList.remove("grabby-crosshair-active");
741
747
  document.removeEventListener("mousemove", handleMouseMove, true);
742
- if (hLine) hLine.style.top = "-10px";
743
- if (vLine) vLine.style.left = "-10px";
748
+ hideLines();
749
+ },
750
+ hold(on) {
751
+ if (held === on) return;
752
+ held = on;
753
+ document.body.classList.toggle("grabby-crosshair-held", on);
754
+ if (on) hideLines();
744
755
  },
745
756
  isCrosshairElement(el) {
746
757
  return el === hLine || el === vLine || el.id === H_LINE_ID || el.id === V_LINE_ID;
747
758
  },
748
759
  dispose() {
760
+ this.hold(false);
749
761
  this.deactivate();
750
762
  hLine?.remove();
751
763
  vLine?.remove();
@@ -1148,6 +1160,7 @@ function buildUniqueSelector(el) {
1148
1160
  // src/core/picker/element-picker.ts
1149
1161
  function createElementPicker(deps) {
1150
1162
  let hoveredElement = null;
1163
+ let heldElement = null;
1151
1164
  let listening = false;
1152
1165
  function resolveComponentName(el) {
1153
1166
  const resolver = deps.getComponentResolver();
@@ -1178,17 +1191,21 @@ function createElementPicker(deps) {
1178
1191
  if (!raw || raw.closest(`[${IGNORE_ATTR}]`)) return raw && deps.isToolbarElement?.(raw) ? raw : null;
1179
1192
  return exact ? raw : promoteTarget(raw);
1180
1193
  }
1194
+ function showOverlay(target) {
1195
+ const componentName = resolveComponentName(target);
1196
+ const sourcePath = resolveSourcePath(target);
1197
+ const cssClasses = filterAngularClasses(target.classList);
1198
+ deps.overlay.show(target, componentName, sourcePath, cssClasses);
1199
+ }
1181
1200
  function handleMouseMove(e) {
1201
+ if (heldElement) return;
1182
1202
  const target = elementAtPoint(e.clientX, e.clientY, e.shiftKey);
1183
1203
  if (!target || deps.overlay.isOverlayElement(target)) return;
1184
1204
  if (deps.crosshair.isCrosshairElement(target)) return;
1185
1205
  if (deps.isToolbarElement?.(target)) return;
1186
1206
  if (target === hoveredElement) return;
1187
1207
  hoveredElement = target;
1188
- const componentName = resolveComponentName(target);
1189
- const sourcePath = resolveSourcePath(target);
1190
- const cssClasses = filterAngularClasses(target.classList);
1191
- deps.overlay.show(target, componentName, sourcePath, cssClasses);
1208
+ showOverlay(target);
1192
1209
  deps.onHover(target);
1193
1210
  }
1194
1211
  function handleClick(e) {
@@ -1198,8 +1215,9 @@ function createElementPicker(deps) {
1198
1215
  if (target && (deps.isToolbarElement?.(target) || deps.crosshair.isCrosshairElement(target))) return;
1199
1216
  e.preventDefault();
1200
1217
  e.stopPropagation();
1218
+ if (heldElement) return;
1201
1219
  if (hoveredElement) {
1202
- deps.onSelect(hoveredElement);
1220
+ deps.onSelect(hoveredElement, { x: e.clientX, y: e.clientY });
1203
1221
  }
1204
1222
  }
1205
1223
  return {
@@ -1214,12 +1232,29 @@ function createElementPicker(deps) {
1214
1232
  if (!listening) return;
1215
1233
  listening = false;
1216
1234
  hoveredElement = null;
1235
+ heldElement = null;
1236
+ deps.crosshair.hold(false);
1217
1237
  deps.crosshair.deactivate();
1218
1238
  document.removeEventListener("mousemove", handleMouseMove, true);
1219
1239
  document.removeEventListener("click", handleClick, true);
1220
1240
  deps.overlay.hide();
1221
1241
  deps.onHover(null);
1222
1242
  },
1243
+ hold(element) {
1244
+ if (!listening) return;
1245
+ heldElement = element;
1246
+ hoveredElement = element;
1247
+ deps.crosshair.hold(true);
1248
+ showOverlay(element);
1249
+ },
1250
+ release() {
1251
+ if (!heldElement) return;
1252
+ heldElement = null;
1253
+ deps.crosshair.hold(false);
1254
+ },
1255
+ isHolding() {
1256
+ return heldElement !== null;
1257
+ },
1223
1258
  getHoveredElement() {
1224
1259
  return hoveredElement;
1225
1260
  },
@@ -1440,7 +1475,8 @@ function createWebhookPlugin(url) {
1440
1475
  type: "grabby.comment",
1441
1476
  version: 1,
1442
1477
  origin: typeof location !== "undefined" ? location.origin : null,
1443
- comment
1478
+ // The marker position is browser-only.
1479
+ comment: { ...comment, pin: void 0 }
1444
1480
  })
1445
1481
  }).catch(() => {
1446
1482
  });
@@ -1532,6 +1568,9 @@ ${vars.join("\n")}
1532
1568
 
1533
1569
  // src/core/toolbar/toolbar-renderer.ts
1534
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;
1535
1574
  var STYLE_ID3 = "__grabby-toolbar-styles__";
1536
1575
  function syncSummary(comments) {
1537
1576
  if (comments.length === 0) return null;
@@ -1552,6 +1591,14 @@ function createToolbarRenderer(callbacks, options = {}) {
1552
1591
  let allElements = /* @__PURE__ */ new Set();
1553
1592
  let badge = null;
1554
1593
  let status = null;
1594
+ let expandBadge = null;
1595
+ let content = null;
1596
+ let collapsed = false;
1597
+ let morphTimer = null;
1598
+ function clearMorph() {
1599
+ if (morphTimer) clearTimeout(morphTimer);
1600
+ morphTimer = null;
1601
+ }
1555
1602
  function injectStyles2() {
1556
1603
  if (hasStyles(STYLE_ID3)) return;
1557
1604
  addStyles(STYLE_ID3, `
@@ -1571,7 +1618,21 @@ function createToolbarRenderer(callbacks, options = {}) {
1571
1618
  box-shadow: 0 4px 16px var(--grabby-toolbar-shadow, rgba(0, 0, 0, 0.12));
1572
1619
  pointer-events: auto;
1573
1620
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
1574
- transition: opacity 0.2s ease, transform 0.2s ease;
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;
1575
1636
  }
1576
1637
  #${TOOLBAR_ID}.grabby-toolbar-hidden {
1577
1638
  opacity: 0;
@@ -1667,6 +1728,45 @@ function createToolbarRenderer(callbacks, options = {}) {
1667
1728
  background: var(--grabby-accent-hover, #1d4ed8);
1668
1729
  color: #fff;
1669
1730
  }
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; }
1744
+ #${TOOLBAR_ID}.grabby-toolbar-collapsed {
1745
+ left: calc(100% - 20px - ${COLLAPSED_SIZE / 2}px);
1746
+ padding: 4px;
1747
+ }
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;
1756
+ }
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
+ }
1769
+ }
1670
1770
  #${TOOLBAR_ID} .grabby-toolbar-left.grabby-toolbar-left-hidden {
1671
1771
  max-width: 0;
1672
1772
  opacity: 0;
@@ -1707,6 +1807,12 @@ function createToolbarRenderer(callbacks, options = {}) {
1707
1807
  buttons.history.appendChild(badge);
1708
1808
  buttons.enable = createButton("enable", ICON_POWER, "Enable/Disable", callbacks.onEnableToggle);
1709
1809
  buttons.dismiss = createButton("dismiss", ICON_DISMISS, options.dismissLabel ?? "Dismiss toolbar", callbacks.onDismiss);
1810
+ buttons.expand = createButton("expand", ICON_GRAB, options.expandLabel ?? "Open Grabby toolbar", () => callbacks.onExpand?.());
1811
+ buttons.expand.classList.add("grabby-btn-expand");
1812
+ expandBadge = document.createElement("span");
1813
+ expandBadge.className = "grabby-badge";
1814
+ expandBadge.hidden = true;
1815
+ buttons.expand.appendChild(expandBadge);
1710
1816
  const divider = document.createElement("span");
1711
1817
  divider.className = "grabby-toolbar-divider";
1712
1818
  leftGroup = document.createElement("div");
@@ -1714,7 +1820,9 @@ function createToolbarRenderer(callbacks, options = {}) {
1714
1820
  leftGroup.appendChild(buttons.selection);
1715
1821
  leftGroup.appendChild(buttons.history);
1716
1822
  leftGroup.appendChild(divider);
1717
- container.appendChild(leftGroup);
1823
+ content = document.createElement("div");
1824
+ content.className = "grabby-toolbar-content";
1825
+ content.appendChild(leftGroup);
1718
1826
  if (options.review) {
1719
1827
  status = document.createElement("span");
1720
1828
  status.className = "grabby-toolbar-status";
@@ -1731,16 +1839,22 @@ function createToolbarRenderer(callbacks, options = {}) {
1731
1839
  e.stopPropagation();
1732
1840
  callbacks.onFinish?.();
1733
1841
  });
1734
- container.appendChild(status);
1735
- container.appendChild(buttons.finish);
1842
+ content.appendChild(status);
1843
+ content.appendChild(buttons.finish);
1736
1844
  allElements.add(status);
1737
1845
  }
1738
- if (!options.hideEnable) container.appendChild(buttons.enable);
1739
- container.appendChild(buttons.dismiss);
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
+ }
1740
1853
  getUiRoot().appendChild(container);
1741
1854
  allElements.clear();
1742
1855
  allElements.add(container);
1743
1856
  allElements.add(leftGroup);
1857
+ allElements.add(content);
1744
1858
  allElements.add(divider);
1745
1859
  for (const btn of Object.values(buttons)) {
1746
1860
  allElements.add(btn);
@@ -1764,9 +1878,10 @@ function createToolbarRenderer(callbacks, options = {}) {
1764
1878
  buttons.selection.classList.remove("grabby-btn-active");
1765
1879
  }
1766
1880
  const count = state.toolbar.comments.length;
1767
- if (badge) {
1768
- badge.hidden = count === 0;
1769
- badge.textContent = count > 99 ? "99+" : String(count);
1881
+ for (const b of [badge, expandBadge]) {
1882
+ if (!b) continue;
1883
+ b.hidden = count === 0;
1884
+ b.textContent = count > 99 ? "99+" : String(count);
1770
1885
  }
1771
1886
  buttons.history.setAttribute("aria-label", count ? `Comments (${count})` : "Comments");
1772
1887
  if (status && buttons.finish) {
@@ -1784,6 +1899,33 @@ function createToolbarRenderer(callbacks, options = {}) {
1784
1899
  leftGroup?.classList.add("grabby-toolbar-left-hidden");
1785
1900
  }
1786
1901
  },
1902
+ collapse() {
1903
+ if (collapsed) return;
1904
+ collapsed = true;
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`;
1911
+ },
1912
+ expand() {
1913
+ if (!collapsed) return;
1914
+ collapsed = false;
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);
1925
+ },
1926
+ isCollapsed() {
1927
+ return collapsed;
1928
+ },
1787
1929
  isToolbarElement(el) {
1788
1930
  if (allElements.has(el)) return true;
1789
1931
  let current = el;
@@ -1795,12 +1937,15 @@ function createToolbarRenderer(callbacks, options = {}) {
1795
1937
  return false;
1796
1938
  },
1797
1939
  dispose() {
1940
+ clearMorph();
1798
1941
  container?.remove();
1799
1942
  removeStyles(STYLE_ID3);
1800
1943
  container = null;
1801
1944
  leftGroup = null;
1945
+ content = null;
1802
1946
  buttons = {};
1803
1947
  badge = null;
1948
+ expandBadge = null;
1804
1949
  status = null;
1805
1950
  allElements.clear();
1806
1951
  }
@@ -2367,6 +2512,18 @@ function createCommentPopover(callbacks) {
2367
2512
  font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 4px; border: none;
2368
2513
  background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer; text-decoration: underline;
2369
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); }
2370
2527
  #${POPOVER_ID} .grabby-cp-hint {
2371
2528
  font-size: 11px;
2372
2529
  color: var(--grabby-text-muted, #94a3b8);
@@ -2428,6 +2585,37 @@ function createCommentPopover(callbacks) {
2428
2585
  function isEditable(el) {
2429
2586
  return !!el && el !== textarea && el !== nameInput && isEditableElement(el);
2430
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
+ }
2431
2619
  function finish(identity) {
2432
2620
  const ctx = currentCtx;
2433
2621
  const value = pendingValue;
@@ -2493,11 +2681,7 @@ function createCommentPopover(callbacks) {
2493
2681
  e.stopImmediatePropagation();
2494
2682
  if (e.key === "Enter" && !e.shiftKey) {
2495
2683
  e.preventDefault();
2496
- const v = textarea.value.trim();
2497
- if (!v) return;
2498
- pendingValue = v;
2499
- if (askIdentity) showIdentityStep();
2500
- else finish();
2684
+ save();
2501
2685
  } else if (e.key === "Escape") {
2502
2686
  e.preventDefault();
2503
2687
  const ctx = currentCtx;
@@ -2531,6 +2715,7 @@ function createCommentPopover(callbacks) {
2531
2715
  currentCtx = { mode: opts.mode, entryId: opts.entryId };
2532
2716
  askIdentity = opts.askIdentity === true && opts.mode === "new";
2533
2717
  visible = true;
2718
+ if (opts.mode === "edit") el.appendChild(editActions());
2534
2719
  position(el, opts.anchor);
2535
2720
  attachKey();
2536
2721
  textarea?.focus();
@@ -3062,9 +3247,10 @@ function createOutbox(deps) {
3062
3247
  }, delay);
3063
3248
  }
3064
3249
  function wireShape(c) {
3065
- const { screenshot: _shot, sync: _sync, ...rest } = c;
3250
+ const { screenshot: _shot, sync: _sync, pin: _pin, ...rest } = c;
3066
3251
  void _shot;
3067
3252
  void _sync;
3253
+ void _pin;
3068
3254
  return rest;
3069
3255
  }
3070
3256
  function postComment(comment) {
@@ -3374,11 +3560,314 @@ function createFreezeOverlay() {
3374
3560
  };
3375
3561
  }
3376
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
+
3377
3866
  // src/core/overlay/select-feedback.ts
3378
- var STYLE_ID9 = "__grabby-feedback-styles__";
3867
+ var STYLE_ID10 = "__grabby-feedback-styles__";
3379
3868
  function injectStyles() {
3380
- if (hasStyles(STYLE_ID9)) return;
3381
- addStyles(STYLE_ID9, `
3869
+ if (hasStyles(STYLE_ID10)) return;
3870
+ addStyles(STYLE_ID10, `
3382
3871
  @keyframes grabby-flash {
3383
3872
  0% { opacity: 1; }
3384
3873
  100% { opacity: 0; transform: scale(1.02); }
@@ -3457,7 +3946,7 @@ function showSelectFeedback(element, label = "Selected") {
3457
3946
  setTimeout(cleanup, 1200);
3458
3947
  }
3459
3948
  function disposeFeedbackStyles() {
3460
- removeStyles(STYLE_ID9);
3949
+ removeStyles(STYLE_ID10);
3461
3950
  }
3462
3951
 
3463
3952
  // src/core/storage/history-persistence.ts
@@ -4550,6 +5039,21 @@ function flushLeftovers(options) {
4550
5039
  }
4551
5040
  });
4552
5041
  }
5042
+ var COLLAPSED_KEY = "grabby:v1:collapsed";
5043
+ function loadCollapsed() {
5044
+ try {
5045
+ return sessionStorage.getItem(COLLAPSED_KEY) === "1";
5046
+ } catch {
5047
+ return false;
5048
+ }
5049
+ }
5050
+ function saveCollapsed(on) {
5051
+ try {
5052
+ if (on) sessionStorage.setItem(COLLAPSED_KEY, "1");
5053
+ else sessionStorage.removeItem(COLLAPSED_KEY);
5054
+ } catch {
5055
+ }
5056
+ }
4553
5057
  function isDevMode() {
4554
5058
  try {
4555
5059
  if (typeof ngDevMode !== "undefined" && ngDevMode === false) return false;
@@ -4630,8 +5134,12 @@ function createGrabInstance(options) {
4630
5134
  let sourceResolver = adapters.resolveSource;
4631
5135
  const cleanClasses = (list) => adapters.cleanClasses(list.filter((c) => !isNoiseClass(c)));
4632
5136
  let selectedElement = null;
5137
+ let selectedPin;
4633
5138
  let pendingShot = null;
5139
+ const commentedElements = /* @__PURE__ */ new Map();
5140
+ let editingFromMarker = false;
4634
5141
  let level = loadLevel(merged.detailLevel);
5142
+ let collapsed = loadCollapsed();
4635
5143
  const pendingShotDeletes = /* @__PURE__ */ new Map();
4636
5144
  themeManager.apply(store.state.toolbar.themeMode);
4637
5145
  updateToastOffset();
@@ -4688,7 +5196,7 @@ function createGrabInstance(options) {
4688
5196
  column: c.target.source?.column ?? null
4689
5197
  };
4690
5198
  }
4691
- function saveComment(element, text, shot) {
5199
+ function saveComment(element, text, shot, pin) {
4692
5200
  const now = Date.now();
4693
5201
  const comment = {
4694
5202
  id: randomId(),
@@ -4705,8 +5213,10 @@ function createGrabInstance(options) {
4705
5213
  target: captureTarget(element, { componentResolver, sourceResolver, cleanClasses }),
4706
5214
  screenshot: null,
4707
5215
  framework: adapters.frameworkFor(element),
4708
- ...outbox ? { sync: "pending" } : {}
5216
+ ...outbox ? { sync: "pending" } : {},
5217
+ ...pin ? { pin } : {}
4709
5218
  };
5219
+ commentedElements.set(comment.id, element);
4710
5220
  setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
4711
5221
  pluginRegistry.callHook("onComment", comment, element);
4712
5222
  outbox?.send(comment.id);
@@ -4751,6 +5261,7 @@ function createGrabInstance(options) {
4751
5261
  const idSet = new Set(ids);
4752
5262
  const before = comments();
4753
5263
  const removed = before.filter((c) => idSet.has(c.id));
5264
+ for (const id of ids) commentedElements.delete(id);
4754
5265
  setComments(before.filter((c) => !idSet.has(c.id)));
4755
5266
  const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
4756
5267
  const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
@@ -4805,9 +5316,24 @@ function createGrabInstance(options) {
4805
5316
  function isAnyToolbarElement(el) {
4806
5317
  return isUiNode(el) || freezeOverlay.isFreezeElement(el);
4807
5318
  }
5319
+ function hideCommentPopover() {
5320
+ commentPopover.hide();
5321
+ endMarkerEdit();
5322
+ if (picker.isHolding()) {
5323
+ selectedElement = null;
5324
+ selectedPin = void 0;
5325
+ pendingShot = null;
5326
+ picker.release();
5327
+ }
5328
+ }
5329
+ function endMarkerEdit() {
5330
+ if (!editingFromMarker) return;
5331
+ editingFromMarker = false;
5332
+ overlay.hide();
5333
+ }
4808
5334
  function closeAllPopovers() {
4809
5335
  commentsPanel.hide();
4810
- commentPopover.hide();
5336
+ hideCommentPopover();
4811
5337
  copySheet.close();
4812
5338
  finishSheet.close();
4813
5339
  }
@@ -4841,15 +5367,52 @@ function createGrabInstance(options) {
4841
5367
  pluginRegistry.callHook("onElementHover", element);
4842
5368
  }
4843
5369
  },
4844
- onSelect(element) {
5370
+ onSelect(element, point) {
4845
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
+ };
4846
5378
  pendingShot = store.state.options.screenshots ? captureScreenshot(element) : null;
4847
5379
  pluginRegistry.callHook("onElementSelect", element);
4848
5380
  coachMark.dismiss();
4849
5381
  showSelectFeedback(element);
5382
+ picker.hold(element);
4850
5383
  commentPopover.show({ anchor: element, mode: "new", askIdentity: shouldAskIdentity() });
4851
5384
  }
4852
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
+ }
4853
5416
  function doActivate() {
4854
5417
  if (!store.state.options.enabled) return;
4855
5418
  if (store.state.active) return;
@@ -4857,6 +5420,7 @@ function createGrabInstance(options) {
4857
5420
  store.state.toolbar = { ...store.state.toolbar, visible: true };
4858
5421
  toolbar.show();
4859
5422
  }
5423
+ if (collapsed) expandToolbar();
4860
5424
  closeAllPopovers();
4861
5425
  store.state.active = true;
4862
5426
  picker.activate();
@@ -4891,7 +5455,7 @@ function createGrabInstance(options) {
4891
5455
  }
4892
5456
  },
4893
5457
  onHistory() {
4894
- commentPopover.hide();
5458
+ hideCommentPopover();
4895
5459
  copySheet.close();
4896
5460
  if (commentsPanel.isVisible()) {
4897
5461
  commentsPanel.hide();
@@ -4908,16 +5472,30 @@ function createGrabInstance(options) {
4908
5472
  }
4909
5473
  toolbar.update(store.state);
4910
5474
  },
4911
- onDismiss() {
4912
- const { pending, failed } = reviewCounts();
4913
- if (live && outbox && (pending || failed)) {
4914
- openFinishSheet();
4915
- return;
4916
- }
4917
- exitFeedbackMode();
4918
- },
5475
+ // Close collapses the toolbar into a round button in the bottom-right
5476
+ // corner instead of removing it, so nothing is lost and it's one click
5477
+ // back. Comments keep sending while it's collapsed.
5478
+ onDismiss: collapseToolbar,
5479
+ onExpand: expandToolbar,
4919
5480
  onFinish: openFinishSheet
4920
- }, live ? { label: "Comment", dismissLabel: "Exit feedback mode", hideEnable: true, review: !!merged.server } : {});
5481
+ }, live ? { label: "Comment", dismissLabel: "Hide toolbar", expandLabel: "Leave feedback", hideEnable: true, review: !!merged.server } : { dismissLabel: "Hide toolbar", expandLabel: "Open Grabby toolbar" });
5482
+ function collapseToolbar() {
5483
+ closeAllPopovers();
5484
+ coachMark.dismiss();
5485
+ doDeactivate(true);
5486
+ collapsed = true;
5487
+ toolbar.collapse();
5488
+ saveCollapsed(true);
5489
+ updateToastOffset();
5490
+ updateMarkers();
5491
+ }
5492
+ function expandToolbar() {
5493
+ collapsed = false;
5494
+ toolbar.expand();
5495
+ saveCollapsed(false);
5496
+ updateToastOffset();
5497
+ updateMarkers();
5498
+ }
4921
5499
  const commentsPanel = createCommentsPanel({
4922
5500
  onHover(comment) {
4923
5501
  const el = comment ? safeQuery(comment.target.selector) : null;
@@ -5004,9 +5582,11 @@ function createGrabInstance(options) {
5004
5582
  if (ctx.mode === "new") {
5005
5583
  const element = selectedElement;
5006
5584
  const shot = pendingShot;
5585
+ const pin = selectedPin;
5007
5586
  selectedElement = null;
5587
+ selectedPin = void 0;
5008
5588
  pendingShot = null;
5009
- if (element) saveComment(element, value, shot);
5589
+ if (element) saveComment(element, value, shot, pin);
5010
5590
  doDeactivate(true);
5011
5591
  return;
5012
5592
  }
@@ -5017,16 +5597,23 @@ function createGrabInstance(options) {
5017
5597
  setComments(updated);
5018
5598
  outbox?.send(ctx.entryId);
5019
5599
  showToast("Comment updated");
5020
- commentsPanel.show([...updated]);
5600
+ if (editingFromMarker) endMarkerEdit();
5601
+ else commentsPanel.show([...updated]);
5021
5602
  },
5022
5603
  onCancel(ctx) {
5023
5604
  if (ctx.mode === "new") {
5024
5605
  selectedElement = null;
5606
+ selectedPin = void 0;
5025
5607
  pendingShot = null;
5026
5608
  doDeactivate(true);
5027
5609
  return;
5028
5610
  }
5029
- commentsPanel.show([...comments()]);
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);
5030
5617
  }
5031
5618
  });
5032
5619
  function handleDocumentClick(e) {
@@ -5054,7 +5641,7 @@ function createGrabInstance(options) {
5054
5641
  }
5055
5642
  window.addEventListener("beforeunload", handleBeforeUnload);
5056
5643
  function updateToastOffset() {
5057
- if (store.state.toolbar.visible) {
5644
+ if (store.state.toolbar.visible && !collapsed) {
5058
5645
  document.documentElement.style.setProperty("--grabby-toast-bottom", TOOLBAR_TOAST_OFFSET);
5059
5646
  } else {
5060
5647
  document.documentElement.style.removeProperty("--grabby-toast-bottom");
@@ -5182,6 +5769,7 @@ function createGrabInstance(options) {
5182
5769
  overlay.dispose();
5183
5770
  crosshair.dispose();
5184
5771
  freezeOverlay.dispose();
5772
+ markers.dispose();
5185
5773
  disposeToast();
5186
5774
  disposeFeedbackStyles();
5187
5775
  pluginRegistry.dispose();
@@ -5204,9 +5792,10 @@ function createGrabInstance(options) {
5204
5792
  keyboard.start();
5205
5793
  }
5206
5794
  store.state.toolbar = { ...store.state.toolbar, visible: false };
5795
+ if (collapsed) toolbar.collapse();
5207
5796
  if (live && merged.showToolbar) {
5208
5797
  api.showToolbar();
5209
- coachMark.maybeShow();
5798
+ if (!collapsed) coachMark.maybeShow();
5210
5799
  }
5211
5800
  store.subscribe((state, key) => {
5212
5801
  if (key === "options") {
@@ -5217,8 +5806,11 @@ function createGrabInstance(options) {
5217
5806
  doDeactivate(true);
5218
5807
  }
5219
5808
  }
5809
+ if (key === "options") updateMarkers();
5220
5810
  if (key === "toolbar") {
5221
5811
  updateToastOffset();
5812
+ updateMarkers();
5813
+ markers.refresh();
5222
5814
  if (state.options.persistHistory) {
5223
5815
  if (state.toolbar.comments.length > 0) {
5224
5816
  saveHistory(state.toolbar.comments);
@@ -5240,6 +5832,7 @@ function createGrabInstance(options) {
5240
5832
  if (merged.webhookUrl) {
5241
5833
  api.registerPlugin(createWebhookPlugin(merged.webhookUrl));
5242
5834
  }
5835
+ updateMarkers();
5243
5836
  return api;
5244
5837
  }
5245
5838
  export {