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.mjs CHANGED
@@ -1426,10 +1426,21 @@ function drawStroke(ctx, s) {
1426
1426
  ctx.moveTo(s.points[0].x, s.points[0].y);
1427
1427
  for (let i = 1; i < s.points.length; i++) ctx.lineTo(s.points[i].x, s.points[i].y);
1428
1428
  ctx.stroke();
1429
- } else {
1429
+ } else if (s.type === "circle") {
1430
1430
  ctx.beginPath();
1431
1431
  ctx.arc(s.cx, s.cy, s.r, 0, Math.PI * 2);
1432
1432
  ctx.stroke();
1433
+ } else {
1434
+ if (Math.hypot(s.x2 - s.x1, s.y2 - s.y1) < 3) return;
1435
+ const angle = Math.atan2(s.y2 - s.y1, s.x2 - s.x1);
1436
+ const head = Math.max(14, s.width * 4);
1437
+ ctx.beginPath();
1438
+ ctx.moveTo(s.x1, s.y1);
1439
+ ctx.lineTo(s.x2, s.y2);
1440
+ ctx.moveTo(s.x2 - head * Math.cos(angle - Math.PI / 6), s.y2 - head * Math.sin(angle - Math.PI / 6));
1441
+ ctx.lineTo(s.x2, s.y2);
1442
+ ctx.lineTo(s.x2 - head * Math.cos(angle + Math.PI / 6), s.y2 - head * Math.sin(angle + Math.PI / 6));
1443
+ ctx.stroke();
1433
1444
  }
1434
1445
  }
1435
1446
  function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
@@ -1478,7 +1489,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1478
1489
  e.currentTarget.setPointerCapture(e.pointerId);
1479
1490
  const { x, y } = getPos(e);
1480
1491
  setCurrentStroke(
1481
- tool === "pen" ? { type: "freehand", color, width: strokeWidth, points: [{ x, y }] } : { type: "circle", color, width: strokeWidth, cx: x, cy: y, r: 0 }
1492
+ 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 }
1482
1493
  );
1483
1494
  };
1484
1495
  const handlePointerMove = (e) => {
@@ -1487,6 +1498,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1487
1498
  setCurrentStroke((prev) => {
1488
1499
  if (!prev) return prev;
1489
1500
  if (prev.type === "freehand") return { ...prev, points: [...prev.points, { x, y }] };
1501
+ if (prev.type === "arrow") return { ...prev, x2: x, y2: y };
1490
1502
  return { ...prev, r: Math.hypot(x - prev.cx, y - prev.cy) };
1491
1503
  });
1492
1504
  };
@@ -1567,6 +1579,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1567
1579
  children: [
1568
1580
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setTool("pen"), style: iconBtn(tool === "pen"), title: "Freehand", "aria-label": "Freehand tool", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ 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" }) }) }),
1569
1581
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setTool("circle"), style: iconBtn(tool === "circle"), title: "Circle", "aria-label": "Circle tool", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "8", stroke: "currentColor", strokeWidth: "1.8" }) }) }),
1582
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setTool("arrow"), style: iconBtn(tool === "arrow"), title: "Arrow", "aria-label": "Arrow tool", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M5 19L19 5M19 5h-8M19 5v8", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1570
1583
  /* @__PURE__ */ jsx("div", { style: { width: "1px", height: "20px", background: "rgba(255,255,255,0.15)" } }),
1571
1584
  PALETTE.map((c) => /* @__PURE__ */ jsx(
1572
1585
  "button",
@@ -2441,6 +2454,7 @@ function AssistSheet({
2441
2454
  canReadPdf = false,
2442
2455
  onRemoveFile,
2443
2456
  onRemoveImage,
2457
+ onAnnotateImage,
2444
2458
  attachmentCount,
2445
2459
  context,
2446
2460
  reportTypeLabel,
@@ -2560,6 +2574,12 @@ function AssistSheet({
2560
2574
  const id = setTimeout(() => setAutoFileLeft((n) => n === null ? null : n - 1), 1e3);
2561
2575
  return () => clearTimeout(id);
2562
2576
  }, [autoFileLeft, isSubmitting, submitted, phase]);
2577
+ function markUp(index, shot) {
2578
+ if (!onAnnotateImage) return;
2579
+ stopAutoFile("marked up an image");
2580
+ logEvent("image_markup", pageShot && shot === pageShot ? "page capture" : "attached");
2581
+ onAnnotateImage(index);
2582
+ }
2563
2583
  function stopAutoFile(reason) {
2564
2584
  if (autoFileLeft === null) return;
2565
2585
  setAutoFileLeft(null);
@@ -2985,7 +3005,7 @@ function AssistSheet({
2985
3005
  @keyframes gg-autofile{from{transform:scaleX(0)}to{transform:scaleX(1)}}
2986
3006
  @keyframes gg-spin{to{transform:rotate(360deg)}}
2987
3007
  @keyframes gg-dot{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-3px);opacity:1}}
2988
- [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}
3008
+ [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}
2989
3009
  ` }),
2990
3010
  /* @__PURE__ */ jsx3(
2991
3011
  "div",
@@ -3039,7 +3059,10 @@ function AssistSheet({
3039
3059
  display: "flex",
3040
3060
  alignItems: "flex-start",
3041
3061
  justifyContent: "space-between",
3042
- gap: "12px",
3062
+ // The title is one unbreakable line, so on a phone-width sheet the
3063
+ // pills drop to their own row instead of landing on the Beta tag (#591).
3064
+ flexWrap: "wrap",
3065
+ gap: "8px 12px",
3043
3066
  minWidth: 0
3044
3067
  },
3045
3068
  children: [
@@ -3084,7 +3107,7 @@ function AssistSheet({
3084
3107
  projectSlot ? /* @__PURE__ */ jsx3("span", { style: { marginLeft: "6px" }, children: projectSlot }) : null
3085
3108
  ] })
3086
3109
  ] }),
3087
- /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "6px", flexShrink: 0 }, children: [
3110
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "6px", flexShrink: 0, marginLeft: "auto" }, children: [
3088
3111
  historyKey && (showChats || otherChats.length > 0) && /* @__PURE__ */ jsx3(
3089
3112
  "button",
3090
3113
  {
@@ -3147,7 +3170,8 @@ function AssistSheet({
3147
3170
  ref: scrollRef,
3148
3171
  style: {
3149
3172
  flex: 1,
3150
- minHeight: narrow ? "180px" : 0,
3173
+ // 0 while the "already filed?" card is up: its footer scrolls instead (#590).
3174
+ minHeight: narrow && !similarSlot ? "180px" : 0,
3151
3175
  overflowY: "auto",
3152
3176
  padding: "16px",
3153
3177
  display: "flex",
@@ -3999,7 +4023,10 @@ function AssistSheet({
3999
4023
  borderTop: `1px solid ${t.border}`,
4000
4024
  padding: "12px 16px",
4001
4025
  paddingBottom: narrow ? "max(12px, env(safe-area-inset-bottom))" : "12px",
4002
- backgroundColor: t.bg
4026
+ backgroundColor: t.bg,
4027
+ // The "already filed?" card can be taller than the sheet; scroll
4028
+ // it instead of clipping its buttons off the bottom (#590).
4029
+ ...similarSlot ? { maxHeight: "70%", overflowY: "auto" } : {}
4003
4030
  },
4004
4031
  children: [
4005
4032
  phase === "solved" ? /* @__PURE__ */ jsx3(
@@ -4079,7 +4106,9 @@ function AssistSheet({
4079
4106
  src: shot,
4080
4107
  alt: read ? "Attached image the assistant reads" : "Attached image",
4081
4108
  "data-gg-assist-thumb": "",
4109
+ onClick: onAnnotateImage ? () => markUp(i, shot) : void 0,
4082
4110
  style: {
4111
+ cursor: onAnnotateImage ? "pointer" : void 0,
4083
4112
  display: "block",
4084
4113
  width: "100%",
4085
4114
  height: "100%",
@@ -4091,6 +4120,59 @@ function AssistSheet({
4091
4120
  }
4092
4121
  }
4093
4122
  ),
4123
+ onAnnotateImage && /* @__PURE__ */ jsx3(
4124
+ "button",
4125
+ {
4126
+ type: "button",
4127
+ "data-gg-assist-annotate": "",
4128
+ "aria-label": `Draw on image ${i + 1}`,
4129
+ title: "Draw or circle on this image",
4130
+ onClick: () => markUp(i, shot),
4131
+ style: {
4132
+ position: "absolute",
4133
+ bottom: "-13px",
4134
+ right: "-13px",
4135
+ width: "32px",
4136
+ height: "32px",
4137
+ border: "none",
4138
+ background: "transparent",
4139
+ padding: 0,
4140
+ cursor: "pointer",
4141
+ display: "flex",
4142
+ alignItems: "center",
4143
+ justifyContent: "center",
4144
+ borderRadius: "50%"
4145
+ },
4146
+ children: /* @__PURE__ */ jsx3(
4147
+ "span",
4148
+ {
4149
+ "aria-hidden": "true",
4150
+ style: {
4151
+ width: "20px",
4152
+ height: "20px",
4153
+ boxSizing: "border-box",
4154
+ borderRadius: "50%",
4155
+ border: `2px solid ${t.bg}`,
4156
+ background: t.accent,
4157
+ color: t.accentText,
4158
+ display: "flex",
4159
+ alignItems: "center",
4160
+ justifyContent: "center"
4161
+ },
4162
+ children: /* @__PURE__ */ jsx3("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx3(
4163
+ "path",
4164
+ {
4165
+ d: "M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z",
4166
+ stroke: "currentColor",
4167
+ strokeWidth: "2.6",
4168
+ strokeLinecap: "round",
4169
+ strokeLinejoin: "round"
4170
+ }
4171
+ ) })
4172
+ }
4173
+ )
4174
+ }
4175
+ ),
4094
4176
  onRemoveImage && /* @__PURE__ */ jsx3(
4095
4177
  "button",
4096
4178
  {
@@ -6282,6 +6364,10 @@ function ReportDialog({
6282
6364
  setAttachingTo(null);
6283
6365
  }
6284
6366
  };
6367
+ const plainIssueTitle = (title) => (
6368
+ // Only emphasis markers: a lone "_" is part of a name (task_module).
6369
+ title.replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/[*`]+/g, "").replace(/\s+/g, " ").trim() || title
6370
+ );
6285
6371
  const similarCard = similarIssues ? /* @__PURE__ */ jsxs5(
6286
6372
  "div",
6287
6373
  {
@@ -6369,10 +6455,7 @@ function ReportDialog({
6369
6455
  fontSize: "12.5px",
6370
6456
  lineHeight: 1.45,
6371
6457
  wordBreak: "break-word",
6372
- overflow: "hidden",
6373
- display: "-webkit-box",
6374
- WebkitLineClamp: 3,
6375
- WebkitBoxOrient: "vertical"
6458
+ overflowWrap: "anywhere"
6376
6459
  },
6377
6460
  children: [
6378
6461
  /* @__PURE__ */ jsxs5("span", { style: { color: t.textMuted, fontWeight: 600 }, children: [
@@ -6380,7 +6463,7 @@ function ReportDialog({
6380
6463
  issue.number
6381
6464
  ] }),
6382
6465
  " ",
6383
- issue.title
6466
+ plainIssueTitle(issue.title)
6384
6467
  ]
6385
6468
  }
6386
6469
  ),
@@ -8353,6 +8436,7 @@ function ReportDialog({
8353
8436
  pageShot,
8354
8437
  onAddFiles: addFiles,
8355
8438
  onRemoveImage: (index) => setScreenshots((prev) => prev.filter((_, i) => i !== index)),
8439
+ onAnnotateImage: setAnnotatingIndex,
8356
8440
  files: heldFiles,
8357
8441
  canReadPdf: !!readFile,
8358
8442
  onRemoveFile: (index) => setAttachments((prev) => prev.filter((_, i) => i !== index)),