web-remarq 0.4.1 → 0.4.2

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/dist/index.cjs CHANGED
@@ -1589,6 +1589,12 @@ var Popup = class {
1589
1589
  });
1590
1590
  actions.appendChild(resolveBtn);
1591
1591
  }
1592
+ const copyBtn = document.createElement("button");
1593
+ copyBtn.textContent = "Copy";
1594
+ copyBtn.addEventListener("click", () => {
1595
+ callbacks.onCopy();
1596
+ });
1597
+ actions.appendChild(copyBtn);
1592
1598
  const deleteBtn = document.createElement("button");
1593
1599
  deleteBtn.textContent = "Delete";
1594
1600
  deleteBtn.addEventListener("click", () => {
@@ -1747,12 +1753,14 @@ var MarkerManager = class {
1747
1753
  });
1748
1754
  this.container.appendChild(markerEl);
1749
1755
  this.markers.set(annotation.id, { annotation, target, markerEl });
1756
+ this.applyOutline(target, annotation.status);
1750
1757
  this.updatePosition(annotation.id);
1751
1758
  }
1752
1759
  removeMarker(id) {
1753
1760
  const entry = this.markers.get(id);
1754
1761
  if (entry) {
1755
1762
  entry.markerEl.remove();
1763
+ this.removeOutline(entry.target);
1756
1764
  this.markers.delete(id);
1757
1765
  }
1758
1766
  }
@@ -1766,6 +1774,7 @@ var MarkerManager = class {
1766
1774
  clear() {
1767
1775
  for (const entry of this.markers.values()) {
1768
1776
  entry.markerEl.remove();
1777
+ this.removeOutline(entry.target);
1769
1778
  }
1770
1779
  this.markers.clear();
1771
1780
  this.counter = 0;
@@ -1777,6 +1786,15 @@ var MarkerManager = class {
1777
1786
  }
1778
1787
  this.clear();
1779
1788
  }
1789
+ applyOutline(target, status) {
1790
+ const color = status === "pending" ? "#f97316" : "rgba(34, 197, 94, 0.5)";
1791
+ target.style.outline = `2px solid ${color}`;
1792
+ target.style.outlineOffset = "2px";
1793
+ }
1794
+ removeOutline(target) {
1795
+ target.style.outline = "";
1796
+ target.style.outlineOffset = "";
1797
+ }
1780
1798
  updatePosition(id) {
1781
1799
  const entry = this.markers.get(id);
1782
1800
  if (!entry) return;
@@ -2179,6 +2197,21 @@ function handleMarkerClick(annotationId) {
2179
2197
  onEdit: (newComment) => {
2180
2198
  storage.update(ann.id, { comment: newComment });
2181
2199
  refreshMarkers();
2200
+ },
2201
+ onCopy: () => {
2202
+ const fp = ann.fingerprint;
2203
+ const lines = [
2204
+ `[${ann.status}] "${ann.comment}"`,
2205
+ `Element: <${fp.tagName}>${fp.textContent ? ` "${fp.textContent}"` : ""}`,
2206
+ `Route: ${ann.route}`,
2207
+ `Viewport: ${ann.viewportBucket}px`
2208
+ ];
2209
+ if (fp.sourceLocation) lines.push(`Source: ${fp.sourceLocation}`);
2210
+ navigator.clipboard.writeText(lines.join("\n")).then(() => {
2211
+ showToast(themeManager.container, "Annotation copied");
2212
+ }).catch(() => {
2213
+ console.warn("[web-remarq] Clipboard write failed");
2214
+ });
2182
2215
  }
2183
2216
  }
2184
2217
  );