glitchgrab 1.59.1 → 1.60.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/dist/index.js CHANGED
@@ -1485,10 +1485,21 @@ function drawStroke(ctx, s) {
1485
1485
  ctx.moveTo(s.points[0].x, s.points[0].y);
1486
1486
  for (let i = 1; i < s.points.length; i++) ctx.lineTo(s.points[i].x, s.points[i].y);
1487
1487
  ctx.stroke();
1488
- } else {
1488
+ } else if (s.type === "circle") {
1489
1489
  ctx.beginPath();
1490
1490
  ctx.arc(s.cx, s.cy, s.r, 0, Math.PI * 2);
1491
1491
  ctx.stroke();
1492
+ } else {
1493
+ if (Math.hypot(s.x2 - s.x1, s.y2 - s.y1) < 3) return;
1494
+ const angle = Math.atan2(s.y2 - s.y1, s.x2 - s.x1);
1495
+ const head = Math.max(14, s.width * 4);
1496
+ ctx.beginPath();
1497
+ ctx.moveTo(s.x1, s.y1);
1498
+ ctx.lineTo(s.x2, s.y2);
1499
+ ctx.moveTo(s.x2 - head * Math.cos(angle - Math.PI / 6), s.y2 - head * Math.sin(angle - Math.PI / 6));
1500
+ ctx.lineTo(s.x2, s.y2);
1501
+ ctx.lineTo(s.x2 - head * Math.cos(angle + Math.PI / 6), s.y2 - head * Math.sin(angle + Math.PI / 6));
1502
+ ctx.stroke();
1492
1503
  }
1493
1504
  }
1494
1505
  function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
@@ -1537,7 +1548,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1537
1548
  e.currentTarget.setPointerCapture(e.pointerId);
1538
1549
  const { x, y } = getPos(e);
1539
1550
  setCurrentStroke(
1540
- tool === "pen" ? { type: "freehand", color, width: strokeWidth, points: [{ x, y }] } : { type: "circle", color, width: strokeWidth, cx: x, cy: y, r: 0 }
1551
+ tool === "pen" ? { type: "freehand", color, width: strokeWidth, points: [{ x, y }] } : tool === "circle" ? { type: "circle", color, width: strokeWidth, cx: x, cy: y, r: 0 } : { type: "arrow", color, width: strokeWidth, x1: x, y1: y, x2: x, y2: y }
1541
1552
  );
1542
1553
  };
1543
1554
  const handlePointerMove = (e) => {
@@ -1546,6 +1557,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1546
1557
  setCurrentStroke((prev) => {
1547
1558
  if (!prev) return prev;
1548
1559
  if (prev.type === "freehand") return { ...prev, points: [...prev.points, { x, y }] };
1560
+ if (prev.type === "arrow") return { ...prev, x2: x, y2: y };
1549
1561
  return { ...prev, r: Math.hypot(x - prev.cx, y - prev.cy) };
1550
1562
  });
1551
1563
  };
@@ -1626,6 +1638,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1626
1638
  children: [
1627
1639
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setTool("pen"), style: iconBtn(tool === "pen"), title: "Freehand", "aria-label": "Freehand tool", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 20h9M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1628
1640
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setTool("circle"), style: iconBtn(tool === "circle"), title: "Circle", "aria-label": "Circle tool", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "8", stroke: "currentColor", strokeWidth: "1.8" }) }) }),
1641
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setTool("arrow"), style: iconBtn(tool === "arrow"), title: "Arrow", "aria-label": "Arrow tool", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 19L19 5M19 5h-8M19 5v8", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1629
1642
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { width: "1px", height: "20px", background: "rgba(255,255,255,0.15)" } }),
1630
1643
  PALETTE.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1631
1644
  "button",
@@ -2500,6 +2513,7 @@ function AssistSheet({
2500
2513
  canReadPdf = false,
2501
2514
  onRemoveFile,
2502
2515
  onRemoveImage,
2516
+ onAnnotateImage,
2503
2517
  attachmentCount,
2504
2518
  context,
2505
2519
  reportTypeLabel,
@@ -2619,6 +2633,12 @@ function AssistSheet({
2619
2633
  const id = setTimeout(() => setAutoFileLeft((n) => n === null ? null : n - 1), 1e3);
2620
2634
  return () => clearTimeout(id);
2621
2635
  }, [autoFileLeft, isSubmitting, submitted, phase]);
2636
+ function markUp(index, shot) {
2637
+ if (!onAnnotateImage) return;
2638
+ stopAutoFile("marked up an image");
2639
+ logEvent("image_markup", pageShot && shot === pageShot ? "page capture" : "attached");
2640
+ onAnnotateImage(index);
2641
+ }
2622
2642
  function stopAutoFile(reason) {
2623
2643
  if (autoFileLeft === null) return;
2624
2644
  setAutoFileLeft(null);
@@ -3044,7 +3064,7 @@ function AssistSheet({
3044
3064
  @keyframes gg-autofile{from{transform:scaleX(0)}to{transform:scaleX(1)}}
3045
3065
  @keyframes gg-spin{to{transform:rotate(360deg)}}
3046
3066
  @keyframes gg-dot{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-3px);opacity:1}}
3047
- [data-gg-sheet-send]:focus-visible,[data-gg-chip]:focus-visible,[data-gg-assist-remove]:focus-visible,[data-gg-stop-auto-file]:focus-visible{outline:2px solid currentColor;outline-offset:2px}
3067
+ [data-gg-sheet-send]:focus-visible,[data-gg-chip]:focus-visible,[data-gg-assist-remove]:focus-visible,[data-gg-assist-annotate]:focus-visible,[data-gg-stop-auto-file]:focus-visible{outline:2px solid currentColor;outline-offset:2px}
3048
3068
  ` }),
3049
3069
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3050
3070
  "div",
@@ -3098,7 +3118,10 @@ function AssistSheet({
3098
3118
  display: "flex",
3099
3119
  alignItems: "flex-start",
3100
3120
  justifyContent: "space-between",
3101
- gap: "12px",
3121
+ // The title is one unbreakable line, so on a phone-width sheet the
3122
+ // pills drop to their own row instead of landing on the Beta tag (#591).
3123
+ flexWrap: "wrap",
3124
+ gap: "8px 12px",
3102
3125
  minWidth: 0
3103
3126
  },
3104
3127
  children: [
@@ -3143,7 +3166,7 @@ function AssistSheet({
3143
3166
  projectSlot ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { marginLeft: "6px" }, children: projectSlot }) : null
3144
3167
  ] })
3145
3168
  ] }),
3146
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "6px", flexShrink: 0 }, children: [
3169
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "6px", flexShrink: 0, marginLeft: "auto" }, children: [
3147
3170
  historyKey && (showChats || otherChats.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3148
3171
  "button",
3149
3172
  {
@@ -3206,7 +3229,8 @@ function AssistSheet({
3206
3229
  ref: scrollRef,
3207
3230
  style: {
3208
3231
  flex: 1,
3209
- minHeight: narrow ? "180px" : 0,
3232
+ // 0 while the "already filed?" card is up: its footer scrolls instead (#590).
3233
+ minHeight: narrow && !similarSlot ? "180px" : 0,
3210
3234
  overflowY: "auto",
3211
3235
  padding: "16px",
3212
3236
  display: "flex",
@@ -4058,7 +4082,10 @@ function AssistSheet({
4058
4082
  borderTop: `1px solid ${t.border}`,
4059
4083
  padding: "12px 16px",
4060
4084
  paddingBottom: narrow ? "max(12px, env(safe-area-inset-bottom))" : "12px",
4061
- backgroundColor: t.bg
4085
+ backgroundColor: t.bg,
4086
+ // The "already filed?" card can be taller than the sheet; scroll
4087
+ // it instead of clipping its buttons off the bottom (#590).
4088
+ ...similarSlot ? { maxHeight: "70%", overflowY: "auto" } : {}
4062
4089
  },
4063
4090
  children: [
4064
4091
  phase === "solved" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -4138,7 +4165,9 @@ function AssistSheet({
4138
4165
  src: shot,
4139
4166
  alt: read ? "Attached image the assistant reads" : "Attached image",
4140
4167
  "data-gg-assist-thumb": "",
4168
+ onClick: onAnnotateImage ? () => markUp(i, shot) : void 0,
4141
4169
  style: {
4170
+ cursor: onAnnotateImage ? "pointer" : void 0,
4142
4171
  display: "block",
4143
4172
  width: "100%",
4144
4173
  height: "100%",
@@ -4150,6 +4179,59 @@ function AssistSheet({
4150
4179
  }
4151
4180
  }
4152
4181
  ),
4182
+ onAnnotateImage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4183
+ "button",
4184
+ {
4185
+ type: "button",
4186
+ "data-gg-assist-annotate": "",
4187
+ "aria-label": `Draw on image ${i + 1}`,
4188
+ title: "Draw or circle on this image",
4189
+ onClick: () => markUp(i, shot),
4190
+ style: {
4191
+ position: "absolute",
4192
+ bottom: "-13px",
4193
+ right: "-13px",
4194
+ width: "32px",
4195
+ height: "32px",
4196
+ border: "none",
4197
+ background: "transparent",
4198
+ padding: 0,
4199
+ cursor: "pointer",
4200
+ display: "flex",
4201
+ alignItems: "center",
4202
+ justifyContent: "center",
4203
+ borderRadius: "50%"
4204
+ },
4205
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4206
+ "span",
4207
+ {
4208
+ "aria-hidden": "true",
4209
+ style: {
4210
+ width: "20px",
4211
+ height: "20px",
4212
+ boxSizing: "border-box",
4213
+ borderRadius: "50%",
4214
+ border: `2px solid ${t.bg}`,
4215
+ background: t.accent,
4216
+ color: t.accentText,
4217
+ display: "flex",
4218
+ alignItems: "center",
4219
+ justifyContent: "center"
4220
+ },
4221
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4222
+ "path",
4223
+ {
4224
+ d: "M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z",
4225
+ stroke: "currentColor",
4226
+ strokeWidth: "2.6",
4227
+ strokeLinecap: "round",
4228
+ strokeLinejoin: "round"
4229
+ }
4230
+ ) })
4231
+ }
4232
+ )
4233
+ }
4234
+ ),
4153
4235
  onRemoveImage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4154
4236
  "button",
4155
4237
  {
@@ -6341,6 +6423,10 @@ function ReportDialog({
6341
6423
  setAttachingTo(null);
6342
6424
  }
6343
6425
  };
6426
+ const plainIssueTitle = (title) => (
6427
+ // Only emphasis markers: a lone "_" is part of a name (task_module).
6428
+ title.replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/[*`]+/g, "").replace(/\s+/g, " ").trim() || title
6429
+ );
6344
6430
  const similarCard = similarIssues ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
6345
6431
  "div",
6346
6432
  {
@@ -6428,10 +6514,7 @@ function ReportDialog({
6428
6514
  fontSize: "12.5px",
6429
6515
  lineHeight: 1.45,
6430
6516
  wordBreak: "break-word",
6431
- overflow: "hidden",
6432
- display: "-webkit-box",
6433
- WebkitLineClamp: 3,
6434
- WebkitBoxOrient: "vertical"
6517
+ overflowWrap: "anywhere"
6435
6518
  },
6436
6519
  children: [
6437
6520
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: t.textMuted, fontWeight: 600 }, children: [
@@ -6439,7 +6522,7 @@ function ReportDialog({
6439
6522
  issue.number
6440
6523
  ] }),
6441
6524
  " ",
6442
- issue.title
6525
+ plainIssueTitle(issue.title)
6443
6526
  ]
6444
6527
  }
6445
6528
  ),
@@ -8412,6 +8495,7 @@ function ReportDialog({
8412
8495
  pageShot,
8413
8496
  onAddFiles: addFiles,
8414
8497
  onRemoveImage: (index) => setScreenshots((prev) => prev.filter((_, i) => i !== index)),
8498
+ onAnnotateImage: setAnnotatingIndex,
8415
8499
  files: heldFiles,
8416
8500
  canReadPdf: !!readFile,
8417
8501
  onRemoveFile: (index) => setAttachments((prev) => prev.filter((_, i) => i !== index)),