@daybook/feedback 1.4.3 → 1.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.
package/dist/widget.js CHANGED
@@ -2,6 +2,8 @@ import { captureAnchor } from './anchor.js';
2
2
  import { fromPaste, MAX_FILES, revoke, stage } from './files.js';
3
3
  import { isTyping } from './hotkey.js';
4
4
  import { measureClearance } from './clearance.js';
5
+ import { overlaps } from './blur.js';
6
+ import { PRIVATE_ATTRIBUTE } from './redact.js';
5
7
  /**
6
8
  * The reporter-facing UI, rendered inside a shadow root.
7
9
  *
@@ -21,6 +23,16 @@ export class FeedbackWidget {
21
23
  * more complex feedbacks". One stays the normal answer; the composer offers another.
22
24
  */
23
25
  this.pins = [];
26
+ /**
27
+ * What the reporter has blurred. PM-T-0682.
28
+ *
29
+ * Picked with the pin's own gesture, so there is nothing new to learn: click an element, or — the
30
+ * one thing a pin does not need — drag across an area. Held as pins because they need what a pin
31
+ * needs, an element to follow and a box to fall back on, but kept apart from them: a blur is not
32
+ * what the report is about, is never numbered among the pins, and never goes on the wire. Not even
33
+ * its text — a blur's anchor is recorded without it.
34
+ */
35
+ this.blurs = [];
24
36
  /** Set while the composer is hidden for "Add another pin"; calling it puts the panel back. */
25
37
  this.cancelAdding = null;
26
38
  /** Takes the page markers down when the composer goes. */
@@ -137,9 +149,9 @@ export class FeedbackWidget {
137
149
  const near = at.startsWith('bottom') ? 'bottom' : 'top';
138
150
  const side = at.endsWith('right') ? 'right' : 'left';
139
151
  const offset = EDGE + this.clearance;
140
- style.textContent = `:host {
141
- --pm-${side}: ${EDGE}px; --pm-${side === 'right' ? 'left' : 'right'}: auto;
142
- --pm-${near}: ${offset}px; --pm-${near === 'bottom' ? 'top' : 'bottom'}: auto;
152
+ style.textContent = `:host {
153
+ --pm-${side}: ${EDGE}px; --pm-${side === 'right' ? 'left' : 'right'}: auto;
154
+ --pm-${near}: ${offset}px; --pm-${near === 'bottom' ? 'top' : 'bottom'}: auto;
143
155
  }`;
144
156
  }
145
157
  /** The box the widget would occupy if nothing were in its way. What the probe measures. */
@@ -322,6 +334,7 @@ export class FeedbackWidget {
322
334
  if (this.mode === 'picking') {
323
335
  this.mode = 'idle';
324
336
  this.pins = [];
337
+ this.blurs = [];
325
338
  this.dragged = null;
326
339
  this.render();
327
340
  }
@@ -383,17 +396,103 @@ export class FeedbackWidget {
383
396
  * the whole reason to do it here rather than on the page: a report used to arrive as a selector,
384
397
  * a text snapshot and a picture of a whole screen, leaving whoever read it to work out which of
385
398
  * forty things on that screen the sentence was about. Now the picture says.
399
+ *
400
+ * The same layer covers what must not be in the picture (PM-T-0682): the reporter's blurs, exactly
401
+ * as they saw them while writing, and `cover` — credentials the capture found on screen, in
402
+ * viewport pixels. Covers go in first and rings after, so a pin on something blurred still shows.
386
403
  */
387
- conceal() {
404
+ conceal(cover = []) {
388
405
  const layer = this.root.getElementById('layer');
389
406
  const previous = layer.style.visibility;
390
407
  layer.style.visibility = 'hidden';
391
- const rings = this.ringPins();
408
+ const origin = this.origin();
409
+ const drawn = [
410
+ ...this.veilBlurs(this.root),
411
+ ...cover.map(box => this.root.appendChild(veil(box, origin, null, true))),
412
+ ...this.ringPins(),
413
+ ];
392
414
  return () => {
393
415
  layer.style.visibility = previous;
394
- rings.forEach(ring => ring.remove());
416
+ drawn.forEach(element => element.remove());
395
417
  };
396
418
  }
419
+ /**
420
+ * Where the reporter's blurs are now, for the captures.
421
+ *
422
+ * An element blur hands over the element, so the snapshot can withhold its subtree and the picture
423
+ * can blur it as it does a private one. If the element cannot be found any more — re-rendered,
424
+ * its selector stale — the box it was picked in goes over as an area instead. A blur that quietly
425
+ * stopped applying because the page re-rendered would be the worst way for this to fail.
426
+ */
427
+ blurred() {
428
+ const elements = [];
429
+ const regions = [];
430
+ for (const blur of this.blurs) {
431
+ const rect = this.pinRect(blur);
432
+ if (!rect)
433
+ continue;
434
+ const element = this.elementOf(blur);
435
+ if (element)
436
+ elements.push(element);
437
+ else
438
+ regions.push(rect);
439
+ }
440
+ return { elements, regions };
441
+ }
442
+ /** A pin's element on this page now: the one picked, or what its selector finds. */
443
+ elementOf(pin) {
444
+ if ((pin.anchor.page ?? currentPage()) !== currentPage())
445
+ return null;
446
+ if (pin.element?.isConnected)
447
+ return pin.element;
448
+ if (!pin.anchor.selector || pin.anchor.selector === 'body')
449
+ return null;
450
+ try {
451
+ return document.querySelector(pin.anchor.selector);
452
+ }
453
+ catch {
454
+ return null;
455
+ }
456
+ }
457
+ /** The reporter's blurs, drawn into `into`. For the page while composing and for the picture. */
458
+ veilBlurs(into) {
459
+ const origin = this.origin();
460
+ const numbered = this.blurs.length > 1;
461
+ return this.blurs.flatMap((blur, index) => {
462
+ const rect = this.pinRect(blur);
463
+ if (!rect)
464
+ return [];
465
+ const label = numbered ? `Blurred ${index + 1}` : 'Blurred';
466
+ return [into.appendChild(veil(rect, origin, label, false))];
467
+ });
468
+ }
469
+ /**
470
+ * A pin as it may leave the page.
471
+ *
472
+ * Its text is dropped when it is something the report must not describe: a pin on an element the
473
+ * reporter blurred, or on one around it, or on a spot inside an area they blurred — they pointed at
474
+ * the balance and blurred the balance, and the pin's text snapshot would otherwise carry the
475
+ * balance. With redaction on, the same goes for a pin on or around a data-daybook-private element,
476
+ * which the snapshot and the picture already withhold and the anchor did not. The selector stays:
477
+ * it says which element, not what it says.
478
+ */
479
+ sendable(pin) {
480
+ if (!pin.anchor.elementText)
481
+ return pin.anchor;
482
+ const element = this.elementOf(pin);
483
+ const rect = this.pinRect(pin);
484
+ const blurred = this.blurs.some(blur => {
485
+ const target = this.elementOf(blur);
486
+ if (target && element)
487
+ return target.contains(element) || element.contains(target);
488
+ const area = this.pinRect(blur);
489
+ return !!area && !!rect && overlaps(area, rect);
490
+ });
491
+ const marked = `[${PRIVATE_ATTRIBUTE}]`;
492
+ const hidden = blurred || (this.options.redact !== false && !!element
493
+ && (!!element.closest(marked) || !!element.querySelector(marked)));
494
+ return hidden ? { ...pin.anchor, elementText: null } : pin.anchor;
495
+ }
397
496
  /**
398
497
  * A ring over the pinned element, drawn in our own shadow root.
399
498
  *
@@ -491,6 +590,9 @@ export class FeedbackWidget {
491
590
  * three pins the reporter cannot tell which number is which without them. Drawn in the layer, so
492
591
  * the capture's conceal takes them away and the rings, which are the picture's version of the
493
592
  * same thing, go in instead.
593
+ *
594
+ * The blurs are drawn here as well, and drawn the way the picture will have them: the reporter
595
+ * decides what is safe to send by looking at it, so what they look at has to be what is sent.
494
596
  */
495
597
  markPins(layer) {
496
598
  this.unmark?.();
@@ -500,6 +602,7 @@ export class FeedbackWidget {
500
602
  const draw = () => {
501
603
  frame = 0;
502
604
  holder.innerHTML = '';
605
+ this.veilBlurs(holder);
503
606
  if (this.pins.length < 1)
504
607
  return;
505
608
  const origin = this.origin();
@@ -536,8 +639,11 @@ export class FeedbackWidget {
536
639
  this.unmark = null;
537
640
  };
538
641
  }
539
- /** The picker over a hidden composer, for one more pin. Esc or a click puts the panel back. */
540
- pickAnother(panel, done) {
642
+ /**
643
+ * The picker over a hidden composer, for one more pin — or, with `blur`, for something to blur.
644
+ * Esc or a pick puts the panel back.
645
+ */
646
+ pickAnother(panel, done, blur = false) {
541
647
  const layer = this.root.getElementById('layer');
542
648
  const restore = () => {
543
649
  mask.remove();
@@ -545,11 +651,17 @@ export class FeedbackWidget {
545
651
  this.cancelAdding = null;
546
652
  this.redrawMarks?.();
547
653
  };
548
- const mask = this.picker(pin => {
549
- this.pins.push(pin);
550
- restore();
551
- done();
552
- }, `Click what else is involved (pin ${this.pins.length + 1})`);
654
+ const mask = blur
655
+ ? this.picker(found => {
656
+ this.blurs.push(found);
657
+ restore();
658
+ done();
659
+ }, 'Click what to blur, or drag across an area', true)
660
+ : this.picker(pin => {
661
+ this.pins.push(pin);
662
+ restore();
663
+ done();
664
+ }, `Click what else is involved (pin ${this.pins.length + 1})`);
553
665
  panel.style.visibility = 'hidden';
554
666
  this.cancelAdding = restore;
555
667
  layer.appendChild(mask);
@@ -750,17 +862,17 @@ export class FeedbackWidget {
750
862
  note.setAttribute('role', 'status');
751
863
  const reference = this.reference;
752
864
  const failed = this.uploadsFailed;
753
- note.innerHTML = `
754
- <div class="sent__tick" aria-hidden="true">&check;</div>
755
- <div class="sent__body">
756
- <div class="panel__title">Thank you — that is on its way.</div>
865
+ note.innerHTML = `
866
+ <div class="sent__tick" aria-hidden="true">&check;</div>
867
+ <div class="sent__body">
868
+ <div class="panel__title">Thank you — that is on its way.</div>
757
869
  ${reference
758
- ? `<div class="sent__ref">
759
- <code class="sent__id">${escapeHtml(reference)}</code>
760
- <button type="button" class="sent__copy" data-copy>Copy</button>
761
- </div>
870
+ ? `<div class="sent__ref">
871
+ <code class="sent__id">${escapeHtml(reference)}</code>
872
+ <button type="button" class="sent__copy" data-copy>Copy</button>
873
+ </div>
762
874
  <div class="panel__anchor">Quote it if you follow it up.</div>`
763
- : ''}
875
+ : ''}
764
876
  ${failed > 0
765
877
  // Said out loud. The report itself is safe, and the reporter is the only person who can
766
878
  // tell that the picture they attached is missing from it — so they are told rather than
@@ -768,8 +880,8 @@ export class FeedbackWidget {
768
880
  ? `<div class="sent__warn">${failed === 1
769
881
  ? 'One attachment could not be uploaded.'
770
882
  : `${failed} attachments could not be uploaded.`} The report was filed without it.</div>`
771
- : ''}
772
- </div>
883
+ : ''}
884
+ </div>
773
885
  ${reference
774
886
  ? '<button type="button" class="panel__close" data-dismiss aria-label="Dismiss">&times;</button>'
775
887
  : ''}`;
@@ -822,13 +934,67 @@ export class FeedbackWidget {
822
934
  /**
823
935
  * The crosshair over the page. The first pin opens the composer; "Add another pin" passes
824
936
  * `onPin` and gets the new pin back instead, with the composer left exactly as it was.
937
+ *
938
+ * With `blur` it picks something to blur (PM-T-0682), and takes a drag as well as a click: an
939
+ * element is the right unit for a card or a field, and the wrong one for half a table, a corner of
940
+ * a chart or a canvas that has no elements inside it at all. What a click would blur is shown
941
+ * blurred under the pointer before the click, and a drag shows its area blurred as it is drawn.
825
942
  */
826
- picker(onPin, hint = 'Click the thing that is wrong') {
943
+ picker(onPin, hint = 'Click the thing that is wrong', blur = false) {
827
944
  const mask = document.createElement('div');
828
- mask.className = 'mask';
829
- mask.innerHTML = `<div class="hover" hidden></div>`
945
+ mask.className = blur ? 'mask mask--blur' : 'mask';
946
+ mask.innerHTML = `<div class="${blur ? 'hover hover--blur' : 'hover'}" hidden></div>`
830
947
  + `<div class="hint">${escapeHtml(hint)} · <kbd>Esc</kbd> to cancel</div>`;
831
948
  const hover = mask.querySelector('.hover');
949
+ // The area being dragged out, while it is: from where the press began to where the pointer is.
950
+ let area = null;
951
+ let pressed = null;
952
+ // A drag ends in a click on the mask, which must not also blur whatever is under the pointer.
953
+ let swallow = false;
954
+ const show = (box) => {
955
+ const origin = this.origin();
956
+ hover.hidden = false;
957
+ hover.style.left = `${box.left - origin.left}px`;
958
+ hover.style.top = `${box.top - origin.top}px`;
959
+ hover.style.width = `${box.width}px`;
960
+ hover.style.height = `${box.height}px`;
961
+ };
962
+ if (blur) {
963
+ const between = (event) => ({
964
+ left: Math.min(pressed.x, event.clientX),
965
+ top: Math.min(pressed.y, event.clientY),
966
+ width: Math.abs(event.clientX - pressed.x),
967
+ height: Math.abs(event.clientY - pressed.y),
968
+ });
969
+ mask.addEventListener('pointerdown', (event) => {
970
+ if (event.button !== 0)
971
+ return;
972
+ pressed = { x: event.clientX, y: event.clientY };
973
+ mask.setPointerCapture(event.pointerId);
974
+ });
975
+ mask.addEventListener('pointermove', (event) => {
976
+ if (!pressed)
977
+ return;
978
+ // The same slop as the launcher's: a shaky click is still a click.
979
+ if (!area && Math.hypot(event.clientX - pressed.x, event.clientY - pressed.y) < DRAG_SLOP)
980
+ return;
981
+ area = between(event);
982
+ show(area);
983
+ });
984
+ const release = (event) => {
985
+ if (mask.hasPointerCapture(event.pointerId))
986
+ mask.releasePointerCapture(event.pointerId);
987
+ const drawn = area;
988
+ pressed = null;
989
+ area = null;
990
+ if (!drawn || event.type === 'pointercancel')
991
+ return;
992
+ swallow = true;
993
+ onPin?.(areaPin(drawn));
994
+ };
995
+ mask.addEventListener('pointerup', release);
996
+ mask.addEventListener('pointercancel', release);
997
+ }
832
998
  // What is under the pointer, found the only way it can be with the mask on top: look through it.
833
999
  const beneath = (x, y) => {
834
1000
  mask.style.pointerEvents = 'none';
@@ -845,36 +1011,49 @@ export class FeedbackWidget {
845
1011
  */
846
1012
  let frame = 0;
847
1013
  mask.onmousemove = (event) => {
848
- if (frame)
1014
+ if (frame || area)
849
1015
  return;
850
1016
  const { clientX, clientY } = event;
851
1017
  frame = requestAnimationFrame(() => {
852
1018
  frame = 0;
1019
+ // A drag began after this frame was asked for; the outline is the area's now.
1020
+ if (area)
1021
+ return;
853
1022
  const element = beneath(clientX, clientY);
854
1023
  if (!element || element === document.body || element === document.documentElement) {
855
1024
  hover.hidden = true;
856
1025
  return;
857
1026
  }
858
1027
  const rect = element.getBoundingClientRect();
859
- const origin = this.origin();
860
- hover.hidden = false;
861
- hover.style.left = `${rect.left - origin.left}px`;
862
- hover.style.top = `${rect.top - origin.top}px`;
863
- hover.style.width = `${rect.width}px`;
864
- hover.style.height = `${rect.height}px`;
1028
+ show({ left: rect.left, top: rect.top, width: rect.width, height: rect.height });
865
1029
  });
866
1030
  };
867
1031
  mask.onclick = (event) => {
1032
+ if (swallow) {
1033
+ swallow = false;
1034
+ return;
1035
+ }
868
1036
  // The mask has to stop intercepting before elementFromPoint runs, or every anchor resolves to
869
1037
  // the mask itself. The predecessor hit this too.
870
1038
  mask.style.pointerEvents = 'none';
871
1039
  const pin = pinAt(event.clientX, event.clientY);
872
1040
  mask.style.pointerEvents = '';
1041
+ if (blur) {
1042
+ // Empty page is not a thing to blur — a pin there is a spot, and a 24px blur hides nothing.
1043
+ // Nothing happens, and the hint already says what does: drag across the area instead.
1044
+ if (!pin.element)
1045
+ return;
1046
+ // Without its text: the anchor is only how the blur finds its element again, and the text is
1047
+ // the very thing being hidden.
1048
+ onPin?.({ ...pin, anchor: { ...pin.anchor, elementText: null } });
1049
+ return;
1050
+ }
873
1051
  if (onPin) {
874
1052
  onPin(pin);
875
1053
  return;
876
1054
  }
877
1055
  this.pins = [pin];
1056
+ this.blurs = [];
878
1057
  this.mode = 'composing';
879
1058
  this.render();
880
1059
  };
@@ -888,55 +1067,55 @@ export class FeedbackWidget {
888
1067
  // reporter pointed at something, and saying what they pointed at is how they know we understood.
889
1068
  // "Report a problem" is a heading anybody could have written; the anchor is theirs.
890
1069
  const capture = this.capture();
891
- panel.innerHTML = `
892
- <div class="panel__head" id="head">
893
- <span class="panel__grip" aria-hidden="true">⠿</span>
894
- <div class="panel__heading">
895
- <div class="panel__anchor">${escapeHtml(anchorLabel)}</div>
896
- <div class="panel__title">Report a problem</div>
897
- </div>
898
- <button id="close" class="panel__close" aria-label="Close">&times;</button>
899
- </div>
900
-
901
- <!-- The pins, when there is more than one to tell apart, and the way to add one. -->
902
- <div id="pins" class="pins"></div>
903
-
904
- <textarea id="message" rows="5" placeholder="What happened?"></textarea>
905
-
906
- <!--
907
- Under the message, not above it. Four filled buttons at the top were the loudest thing in the
908
- panel and the least important decision in it — the default is right almost every time, and
909
- what somebody came here to do is type.
910
- -->
911
- <div class="panel__kinds">
912
- ${['bug', 'idea', 'praise', 'question'].map((k, i) => `<button class="kind${i === 0 ? ' kind--on' : ''}" data-kind="${k}">${k}</button>`).join('')}
913
- </div>
914
-
915
- <input id="email" type="email" placeholder="Email (optional, so we can reply)" autocomplete="email" />
916
-
917
- <!-- One attachment area, not two. A checkbox for the screen and a dropzone for a file were
918
- two ways to do the same thing, stacked, both dim.
919
-
920
- The capture control is rendered only when it can actually do something. It used to be
921
- drawn whatever the host had configured and then ignored downstream, so ticking it was a
922
- promise nobody kept. -->
923
- <div id="drop" class="drop">
1070
+ panel.innerHTML = `
1071
+ <div class="panel__head" id="head">
1072
+ <span class="panel__grip" aria-hidden="true">⠿</span>
1073
+ <div class="panel__heading">
1074
+ <div class="panel__anchor">${escapeHtml(anchorLabel)}</div>
1075
+ <div class="panel__title">Report a problem</div>
1076
+ </div>
1077
+ <button id="close" class="panel__close" aria-label="Close">&times;</button>
1078
+ </div>
1079
+
1080
+ <!-- The pins, when there is more than one to tell apart, and the way to add one. -->
1081
+ <div id="pins" class="pins"></div>
1082
+
1083
+ <textarea id="message" rows="5" placeholder="What happened?"></textarea>
1084
+
1085
+ <!--
1086
+ Under the message, not above it. Four filled buttons at the top were the loudest thing in the
1087
+ panel and the least important decision in it — the default is right almost every time, and
1088
+ what somebody came here to do is type.
1089
+ -->
1090
+ <div class="panel__kinds">
1091
+ ${['bug', 'idea', 'praise', 'question'].map((k, i) => `<button class="kind${i === 0 ? ' kind--on' : ''}" data-kind="${k}">${k}</button>`).join('')}
1092
+ </div>
1093
+
1094
+ <input id="email" type="email" placeholder="Email (optional, so we can reply)" autocomplete="email" />
1095
+
1096
+ <!-- One attachment area, not two. A checkbox for the screen and a dropzone for a file were
1097
+ two ways to do the same thing, stacked, both dim.
1098
+
1099
+ The capture control is rendered only when it can actually do something. It used to be
1100
+ drawn whatever the host had configured and then ignored downstream, so ticking it was a
1101
+ promise nobody kept. -->
1102
+ <div id="drop" class="drop">
924
1103
  ${capture.offered
925
- ? `<label class="shot"><input id="shot" type="checkbox" ${capture.checked ? 'checked' : ''} /> Capture the screen</label>
1104
+ ? `<label class="shot"><input id="shot" type="checkbox" ${capture.checked ? 'checked' : ''} /> Capture the screen</label>
926
1105
  <span class="drop__or">or paste, drop, or`
927
- : '<span class="drop__or">Paste, drop, or'}
928
- <input id="file" type="file" multiple accept="image/*,video/mp4,video/quicktime,video/webm" hidden />
929
- <button id="browse" class="link">choose a file</button>
930
- </span>
931
- </div>
932
-
933
- <div id="files" class="files"></div>
934
- <div id="status" class="status"></div>
935
-
936
- <div class="panel__foot">
937
- <span class="panel__note">Sends this page's contents, your browser, and recent errors.</span>
938
- <button id="cancel" class="ghost">Cancel</button>
939
- <button id="send" class="primary">Send</button>
1106
+ : '<span class="drop__or">Paste, drop, or'}
1107
+ <input id="file" type="file" multiple accept="image/*,video/mp4,video/quicktime,video/webm" hidden />
1108
+ <button id="browse" class="link">choose a file</button>
1109
+ </span>
1110
+ </div>
1111
+
1112
+ <div id="files" class="files"></div>
1113
+ <div id="status" class="status"></div>
1114
+
1115
+ <div class="panel__foot">
1116
+ <span class="panel__note">Sends this page's contents, your browser, and recent errors.</span>
1117
+ <button id="cancel" class="ghost">Cancel</button>
1118
+ <button id="send" class="primary">Send</button>
940
1119
  </div>`;
941
1120
  const files = [];
942
1121
  const fileList = panel.querySelector('#files');
@@ -1039,14 +1218,53 @@ export class FeedbackWidget {
1039
1218
  pinList.appendChild(row);
1040
1219
  });
1041
1220
  }
1221
+ // The blurs, each with its own remove. Listed from the first, unlike the pins: a single pin is
1222
+ // already named in the heading, and a blur is named nowhere else in the panel.
1223
+ this.blurs.forEach((blur, index) => {
1224
+ const row = document.createElement('div');
1225
+ row.className = 'pin';
1226
+ const number = document.createElement('span');
1227
+ number.className = 'pin__n pin__n--blur';
1228
+ number.textContent = String(index + 1);
1229
+ row.appendChild(number);
1230
+ const label = document.createElement('span');
1231
+ label.className = 'pin__label';
1232
+ label.textContent = blurLabel(blur);
1233
+ row.appendChild(label);
1234
+ const remove = document.createElement('button');
1235
+ remove.className = 'link';
1236
+ remove.textContent = '×';
1237
+ remove.setAttribute('aria-label', `Remove blur ${index + 1}`);
1238
+ remove.onclick = () => {
1239
+ this.blurs.splice(index, 1);
1240
+ renderPins();
1241
+ };
1242
+ row.appendChild(remove);
1243
+ pinList.appendChild(row);
1244
+ });
1245
+ const actions = document.createElement('div');
1246
+ actions.className = 'pins__actions';
1042
1247
  if (this.pins.length < MAX_PINS) {
1043
1248
  const add = document.createElement('button');
1044
1249
  add.className = 'link pins__add';
1045
1250
  add.id = 'add-pin';
1046
1251
  add.textContent = this.pins.length > 0 ? '+ Add another pin' : '+ Pin something on the page';
1047
1252
  add.onclick = () => this.pickAnother(panel, renderPins);
1048
- pinList.appendChild(add);
1253
+ actions.appendChild(add);
1049
1254
  }
1255
+ // Beside "Add another pin", because it is the same gesture for the opposite purpose: one
1256
+ // points at what the report is about, the other at what it must not show.
1257
+ if (this.blurs.length < MAX_BLURS) {
1258
+ const hide = document.createElement('button');
1259
+ hide.className = 'link pins__add';
1260
+ hide.id = 'add-blur';
1261
+ hide.textContent = this.blurs.length > 0 ? 'Blur something else' : 'Blur something';
1262
+ hide.title = 'Hide part of the page from the screenshot and the page snapshot';
1263
+ hide.onclick = () => this.pickAnother(panel, renderPins, true);
1264
+ actions.appendChild(hide);
1265
+ }
1266
+ if (actions.childElementCount > 0)
1267
+ pinList.appendChild(actions);
1050
1268
  this.redrawMarks?.();
1051
1269
  };
1052
1270
  renderPins();
@@ -1072,6 +1290,7 @@ export class FeedbackWidget {
1072
1290
  revoke(files);
1073
1291
  this.mode = 'idle';
1074
1292
  this.pins = [];
1293
+ this.blurs = [];
1075
1294
  this.dragged = null;
1076
1295
  this.render();
1077
1296
  };
@@ -1089,7 +1308,7 @@ export class FeedbackWidget {
1089
1308
  message: message.value.trim(),
1090
1309
  kind,
1091
1310
  email: email.value.trim() || undefined,
1092
- anchors: this.pins.map(pin => pin.anchor),
1311
+ anchors: this.pins.map(pin => this.sendable(pin)),
1093
1312
  withScreenshot: shot?.checked ?? false,
1094
1313
  files: files.filter(f => !f.error),
1095
1314
  });
@@ -1104,6 +1323,7 @@ export class FeedbackWidget {
1104
1323
  // cannot do if they never see it.
1105
1324
  this.mode = 'sent';
1106
1325
  this.pins = [];
1326
+ this.blurs = [];
1107
1327
  this.render();
1108
1328
  }
1109
1329
  catch (error) {
@@ -1235,6 +1455,8 @@ function putAt(element, at, width, height) {
1235
1455
  * slipped hand from filing a report whose picture is nothing but rings.
1236
1456
  */
1237
1457
  const MAX_PINS = 10;
1458
+ /** The same limit for blurs, and for the same reason: a picture that is all blur shows nothing. */
1459
+ const MAX_BLURS = 10;
1238
1460
  function currentPage() {
1239
1461
  return location.pathname + location.search;
1240
1462
  }
@@ -1249,6 +1471,60 @@ function pinAt(clientX, clientY) {
1249
1471
  : { left: clientX - 12 + window.scrollX, top: clientY - 12 + window.scrollY, width: 24, height: 24 };
1250
1472
  return { anchor, element, box };
1251
1473
  }
1474
+ /**
1475
+ * An area dragged out to blur, held as a pin with no element: pinRect then falls through to the box,
1476
+ * in page coordinates like any pin's, so it stays over the same content when the page scrolls.
1477
+ */
1478
+ function areaPin(area) {
1479
+ return {
1480
+ anchor: { selector: null, offsetX: 0, offsetY: 0, elementText: null, page: currentPage() },
1481
+ element: null,
1482
+ box: {
1483
+ left: area.left + window.scrollX,
1484
+ top: area.top + window.scrollY,
1485
+ width: area.width,
1486
+ height: area.height,
1487
+ },
1488
+ };
1489
+ }
1490
+ /**
1491
+ * A blur's line in the panel. Never its text, which is what it hides; its kind and its size are
1492
+ * enough to match it to the numbered blur on the page.
1493
+ */
1494
+ function blurLabel(blur) {
1495
+ const size = `${Math.round(blur.box.width)} × ${Math.round(blur.box.height)}`;
1496
+ return `${blur.element ? 'Blurred element' : 'Blurred area'} · ${size}`;
1497
+ }
1498
+ /**
1499
+ * One cover over the page, in our own layer.
1500
+ *
1501
+ * A blur is a backdrop filter: it blurs whatever is painted under it without touching the element
1502
+ * that painted it, so nothing on the host page changes and there is nothing to undo there. Where the
1503
+ * browser has no backdrop-filter the stylesheet makes it solid instead, because a cover that quietly
1504
+ * shows what it covers is worse than an ugly one.
1505
+ *
1506
+ * `secret` is a cover the capture asked for over a credential it found: solid, not blurred, and
1507
+ * without a label. A blurred key of a known shape can be read back more often than one would like; a
1508
+ * grey bar cannot, and nobody needs to see the shape of a key to understand the report.
1509
+ */
1510
+ function veil(rect, origin, label, secret) {
1511
+ const pad = secret ? 2 : 0;
1512
+ const cover = document.createElement('div');
1513
+ cover.className = secret ? 'veil veil--secret' : 'veil';
1514
+ cover.style.left = `${rect.left - origin.left - pad}px`;
1515
+ cover.style.top = `${rect.top - origin.top - pad}px`;
1516
+ cover.style.width = `${rect.width + pad * 2}px`;
1517
+ cover.style.height = `${rect.height + pad * 2}px`;
1518
+ // Said in the picture too, so whoever reads it knows the smudge was put there on purpose — where it
1519
+ // fits. On a blurred line of text the tag would cover more of the page than the blur does.
1520
+ if (label && rect.width >= 72 && rect.height >= 22) {
1521
+ const tag = document.createElement('span');
1522
+ tag.className = 'veil__tag';
1523
+ tag.textContent = label;
1524
+ cover.appendChild(tag);
1525
+ }
1526
+ return cover;
1527
+ }
1252
1528
  function labelFor(anchor) {
1253
1529
  if (anchor.elementText)
1254
1530
  return `“${anchor.elementText}”`;
@@ -1421,284 +1697,327 @@ export function previewLauncher(into, theme = {}) {
1421
1697
  const BUTTON_STYLES = ['pill', 'pill-icon', 'icon', 'text', 'outline'];
1422
1698
  const LIGHT = '--pm-surface: #fff; --pm-ink: #171717; --pm-muted: #525252; --pm-faint: #a3a3a3; --pm-line: #e5e5e5; --pm-line-strong: #d4d4d4; --pm-sunken: #f5f5f5; --pm-kbd: #404040; --pm-warn: #b45309; --pm-good: #047857; --pm-good-bg: #ecfdf5; --pm-good-line: #a7f3d0; --pm-accent: #171717; --pm-on-accent: #fafafa;';
1423
1699
  const DARK = '--pm-surface: #1c1c1c; --pm-ink: #fafafa; --pm-muted: #a3a3a3; --pm-faint: #737373; --pm-line: #333; --pm-line-strong: #454545; --pm-sunken: #262626; --pm-kbd: #d4d4d4; --pm-warn: #fbbf24; --pm-good: #34d399; --pm-good-bg: #05271f; --pm-good-line: #065f46; --pm-accent: #fafafa; --pm-on-accent: #171717;';
1424
- const STYLES = `
1425
- /*
1426
- Every colour in this file is one of these, and there are two sets of them.
1427
-
1428
- Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
1429
- application is a flashbang. It followed the host's scheme in exactly one respect before — it did
1430
- not, and was always light.
1431
-
1432
- System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
1433
- a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
1434
- dark gets those values written into the theme block instead, which is a later stylesheet at the
1435
- same specificity and therefore wins over the query.
1436
-
1437
- The accent pair is inverse emphasis — a dark pill on a light page, a light pill on a dark one —
1438
- because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
1439
- near-black application is a button nobody finds. A host that sets its own accent gets white text
1440
- on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
1441
- the one case where a very pale brand colour needs its own care.
1442
- */
1443
- :host {
1444
- all: initial;
1445
-
1446
- ${LIGHT}
1447
-
1448
- --pm-radius: 12px;
1449
-
1450
- /* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
1451
- "put it on the left" has to be four numbers and not one word. */
1452
- --pm-left: auto;
1453
- --pm-right: 16px;
1454
- --pm-top: auto;
1455
- --pm-bottom: 16px;
1456
- }
1457
-
1458
- @media (prefers-color-scheme: dark) {
1459
- :host { ${DARK} }
1460
- }
1461
- }
1462
- * { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
1463
- @media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
1464
- #layer { position: fixed; inset: 0; pointer-events: none }
1465
- .launcher {
1466
- position: fixed; pointer-events: auto;
1467
- left: var(--pm-left); right: var(--pm-right);
1468
- top: var(--pm-top); bottom: var(--pm-bottom);
1469
- /* A back-to-top button appearing on scroll moves us; gliding reads as making room, and jumping
1470
- reads as a bug. Honoured only where motion is welcome. */
1471
- transition: bottom .18s ease, top .18s ease;
1472
- padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
1473
- background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
1474
- box-shadow: 0 2px 12px rgba(0,0,0,.3);
1475
- }
1476
- /* Dragged to move (PM-B-0121); touch-action:none or a touch drag is claimed by page scrolling. */
1477
- .launcher { touch-action: none; user-select: none }
1478
- .launcher--dragging { transition: none; cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.35) }
1479
- .launcher:hover { filter: brightness(1.15) }
1480
- .launcher--pending { cursor: default; opacity: .85 }
1481
- .launcher--pending:hover { filter: none }
1482
- .launcher__icon { flex: none; width: 15px; height: 15px; display: block }
1483
- /* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
1484
- .launcher--preview { position: static; cursor: default; opacity: 1 }
1485
-
1486
- /*
1487
- Five buttons, because one button cannot be right for every page it is a guest on.
1488
-
1489
- A product with its own bold chat bubble does not want a second bold pill beside it; a spare
1490
- documentation site does not want a filled button at all; a dense application often wants the
1491
- smallest possible mark. The set is deliberately small — five things somebody can look at and
1492
- choose between in a moment, rather than a colour picker and a padding field.
1493
-
1494
- Every one of them keeps the same hit area at the same corner, so the clearance measurement and
1495
- the placement work unchanged whichever is picked.
1496
- */
1497
- .launcher { display: inline-flex; align-items: center; gap: 7px }
1498
-
1499
- /* Filled and round. The default, and the one that reads as a product feature. */
1500
- .launcher--pill {}
1501
-
1502
- /* The same, with the icon in front for pages where a word alone reads as body text. */
1503
- .launcher--pill-icon {}
1504
-
1505
- /* The mark on its own, for a corner that is already busy. */
1506
- .launcher--icon { padding: 10px; border-radius: 999px }
1507
-
1508
- /* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
1509
- .launcher--text {
1510
- background: transparent; color: var(--pm-ink); box-shadow: none;
1511
- padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
1512
- }
1513
- .launcher--text:hover { filter: none; color: var(--pm-accent) }
1514
-
1515
- /* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
1516
- .launcher--outline {
1517
- background: transparent; color: var(--pm-accent);
1518
- border: 1px solid currentColor; box-shadow: none;
1519
- }
1520
- .launcher--outline:hover { filter: none; background: var(--pm-sunken) }
1521
- .mask {
1522
- position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
1523
- background: rgba(23,23,23,.12);
1524
- }
1525
- /*
1526
- The pinned element, ringed for the screenshot.
1527
-
1528
- Three rings rather than one: a red line alone disappears against a red button, and a white one
1529
- disappears against a white card. Red, then white, then a soft red — one of the three is always
1530
- against something it contrasts with, on any page, without touching that page's own colours.
1531
- */
1532
- .ring {
1533
- position: fixed; pointer-events: none; border-radius: 3px;
1534
- border: 2px solid #ef4444;
1535
- box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
1536
- }
1537
- /* The number, on the ring's corner so it never covers what the ring is about. */
1538
- .ring__n, .marker__n {
1539
- position: absolute; top: -11px; left: -11px; min-width: 20px; height: 20px; padding: 0 5px;
1540
- border-radius: 10px; background: #ef4444; color: #fff; border: 2px solid #fff;
1541
- font: 600 11px/16px system-ui, sans-serif; text-align: center; box-sizing: border-box;
1542
- }
1543
- /* What a click would pin, while picking. Dashed, so it reads as "this one?" rather than "pinned". */
1544
- .hover {
1545
- position: fixed; pointer-events: none; border-radius: 3px;
1546
- outline: 2px dashed #ef4444; outline-offset: 2px; background: rgba(239,68,68,.06);
1547
- }
1548
- /* A pin already made, while the composer is open. */
1549
- .marker {
1550
- position: fixed; pointer-events: none; border-radius: 3px;
1551
- border: 2px solid #ef4444; box-shadow: 0 0 0 2px rgba(255,255,255,.85);
1552
- }
1553
- /*
1554
- Bottom, not top.
1555
-
1556
- At top:16px this landed on whatever the host puts at the top centre of their page — a logo, a
1557
- nav bar, a search field. We are a guest here and we do not know what is up there; on our own app
1558
- it covered the project switcher. The bottom centre is beside the launcher the reporter just
1559
- clicked, which is space the widget already owns, and it keeps their eyes near the thing they are
1560
- about to point at rather than sending them to the far edge of the screen and back.
1561
- */
1562
- .hint {
1563
- position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
1564
- padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
1565
- font-size: 12px; white-space: nowrap;
1566
- }
1567
- kbd {
1568
- padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
1569
- font-family: ui-monospace, monospace; font-size: 11px;
1570
- }
1571
- .panel {
1572
- position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
1573
- left: var(--pm-left); right: var(--pm-right);
1574
- top: var(--pm-top); bottom: var(--pm-bottom);
1575
- padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
1576
- box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
1577
- }
1578
- .panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
1579
- .panel__heading { min-width: 0 }
1580
- .panel__title { font-weight: 600; font-size: 14px }
1581
-
1582
- /*
1583
- The header is the handle.
1584
-
1585
- A 380px panel sits over the page somebody is reporting a problem with, and reading what is under
1586
- it used to mean closing the widget and losing what had been written. touch-action:none because a
1587
- drag on a touch screen is otherwise claimed by the page's own scrolling before we see it.
1588
- */
1589
- .drag { cursor: grab; touch-action: none; user-select: none }
1590
- .drag:active { cursor: grabbing }
1591
- .panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
1592
- .drag:hover .panel__grip { color: var(--pm-muted) }
1593
- .panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
1594
-
1595
- /* An incomplete report, said plainly. Amber rather than red: the words arrived. */
1596
- .sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
1597
-
1598
- /* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
1599
- .pins { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
1600
- .pin { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--pm-ink); }
1601
- .pin__n {
1602
- flex: none; min-width: 18px; height: 18px; border-radius: 9px; background: #ef4444; color: #fff;
1603
- font: 600 11px/18px system-ui, sans-serif; text-align: center;
1604
- }
1605
- .pin__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1606
- .pins__add { align-self: flex-start; font-size: 12px; }
1607
- .panel__anchor {
1608
- color: var(--pm-muted); font-size: 11px;
1609
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1610
- }
1611
- .panel__close {
1612
- margin-left: auto; border: 0; background: none; cursor: pointer;
1613
- color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
1614
- }
1615
- .panel__close:hover { color: var(--pm-ink) }
1616
-
1617
- /* A confirmation, not a form. */
1618
- .panel--sent { display: flex; align-items: flex-start; gap: 10px }
1619
- .sent__tick {
1620
- flex: none; width: 24px; height: 24px; border-radius: 999px;
1621
- background: var(--pm-good-bg); color: var(--pm-good);
1622
- display: grid; place-items: center; font-size: 14px;
1623
- }
1624
- .sent__body { min-width: 0 }
1625
-
1626
- /* The reference on its own line, at its own weight: it is the one thing here to take away. */
1627
- .sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
1628
- .sent__id {
1629
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
1630
- color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
1631
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1632
- }
1633
- .sent__copy {
1634
- flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
1635
- color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
1636
- }
1637
- .sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
1638
- .sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
1639
-
1640
- .panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
1641
- .kind {
1642
- flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
1643
- background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
1644
- }
1645
- .kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
1646
- textarea, input[type=email] {
1647
- width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
1648
- border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
1649
- }
1650
- textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
1651
-
1652
- /*
1653
- * Sixteen pixels on a touch device, or iOS zooms the host page.
1654
- *
1655
- * Safari zooms in whenever a focused field's text is under 16px and never zooms back out. At 13px
1656
- * that happened the moment somebody tapped the message box — so the act of reporting a bug left
1657
- * the reporter's view of OUR CUSTOMER's site magnified and scrolled sideways, which is a rude
1658
- * thing for an embedded widget to do to the page hosting it.
1659
- *
1660
- * The widget cannot fix this with a viewport meta even if that were acceptable: the meta belongs
1661
- * to the host page and is not ours to touch. Making the text big enough is the only move
1662
- * available, and it is the right one anyway.
1663
- */
1664
- @media (pointer: coarse) {
1665
- textarea, input[type=email] { font-size: 16px }
1666
- }
1667
- .shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
1668
-
1669
- /*
1670
- One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
1671
- an alternative to it — and put the escape hatch further from the thumb than the commit.
1672
- */
1673
- .panel__foot {
1674
- display: flex; align-items: center; gap: 8px; margin-top: 12px;
1675
- padding-top: 12px; border-top: 1px solid var(--pm-sunken);
1676
- }
1677
- .panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
1678
- .primary, .ghost {
1679
- padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
1680
- }
1681
- .primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
1682
- .primary:disabled { opacity: .5; cursor: default }
1683
- .ghost { border: 0; background: transparent; color: var(--pm-muted) }
1684
- .status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
1685
- /*
1686
- One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
1687
- stacked — two affordances for one job, and together the busiest part of a panel whose busiest part
1688
- should be the message.
1689
- */
1690
- .drop {
1691
- display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
1692
- margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
1693
- color: var(--pm-faint); font-size: 11px;
1694
- }
1695
- .drop__or { color: var(--pm-faint) }
1696
- .drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
1697
- .files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
1698
- .file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
1699
- .file--bad { color: var(--pm-warn) }
1700
- .file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
1701
- .file__icon { width: 28px; text-align: center }
1702
- .file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
1703
- .link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
1700
+ const STYLES = `
1701
+ /*
1702
+ Every colour in this file is one of these, and there are two sets of them.
1703
+
1704
+ Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
1705
+ application is a flashbang. It followed the host's scheme in exactly one respect before — it did
1706
+ not, and was always light.
1707
+
1708
+ System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
1709
+ a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
1710
+ dark gets those values written into the theme block instead, which is a later stylesheet at the
1711
+ same specificity and therefore wins over the query.
1712
+
1713
+ The accent pair is inverse emphasis — a dark pill on a light page, a light pill on a dark one —
1714
+ because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
1715
+ near-black application is a button nobody finds. A host that sets its own accent gets white text
1716
+ on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
1717
+ the one case where a very pale brand colour needs its own care.
1718
+ */
1719
+ :host {
1720
+ all: initial;
1721
+
1722
+ ${LIGHT}
1723
+
1724
+ --pm-radius: 12px;
1725
+
1726
+ /* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
1727
+ "put it on the left" has to be four numbers and not one word. */
1728
+ --pm-left: auto;
1729
+ --pm-right: 16px;
1730
+ --pm-top: auto;
1731
+ --pm-bottom: 16px;
1732
+ }
1733
+
1734
+ @media (prefers-color-scheme: dark) {
1735
+ :host { ${DARK} }
1736
+ }
1737
+ }
1738
+ * { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
1739
+ @media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
1740
+ #layer { position: fixed; inset: 0; pointer-events: none }
1741
+ .launcher {
1742
+ position: fixed; pointer-events: auto;
1743
+ left: var(--pm-left); right: var(--pm-right);
1744
+ top: var(--pm-top); bottom: var(--pm-bottom);
1745
+ /* A back-to-top button appearing on scroll moves us; gliding reads as making room, and jumping
1746
+ reads as a bug. Honoured only where motion is welcome. */
1747
+ transition: bottom .18s ease, top .18s ease;
1748
+ padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
1749
+ background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
1750
+ box-shadow: 0 2px 12px rgba(0,0,0,.3);
1751
+ }
1752
+ /* Dragged to move (PM-B-0121); touch-action:none or a touch drag is claimed by page scrolling. */
1753
+ .launcher { touch-action: none; user-select: none }
1754
+ .launcher--dragging { transition: none; cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.35) }
1755
+ .launcher:hover { filter: brightness(1.15) }
1756
+ .launcher--pending { cursor: default; opacity: .85 }
1757
+ .launcher--pending:hover { filter: none }
1758
+ .launcher__icon { flex: none; width: 15px; height: 15px; display: block }
1759
+ /* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
1760
+ .launcher--preview { position: static; cursor: default; opacity: 1 }
1761
+
1762
+ /*
1763
+ Five buttons, because one button cannot be right for every page it is a guest on.
1764
+
1765
+ A product with its own bold chat bubble does not want a second bold pill beside it; a spare
1766
+ documentation site does not want a filled button at all; a dense application often wants the
1767
+ smallest possible mark. The set is deliberately small — five things somebody can look at and
1768
+ choose between in a moment, rather than a colour picker and a padding field.
1769
+
1770
+ Every one of them keeps the same hit area at the same corner, so the clearance measurement and
1771
+ the placement work unchanged whichever is picked.
1772
+ */
1773
+ .launcher { display: inline-flex; align-items: center; gap: 7px }
1774
+
1775
+ /* Filled and round. The default, and the one that reads as a product feature. */
1776
+ .launcher--pill {}
1777
+
1778
+ /* The same, with the icon in front for pages where a word alone reads as body text. */
1779
+ .launcher--pill-icon {}
1780
+
1781
+ /* The mark on its own, for a corner that is already busy. */
1782
+ .launcher--icon { padding: 10px; border-radius: 999px }
1783
+
1784
+ /* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
1785
+ .launcher--text {
1786
+ background: transparent; color: var(--pm-ink); box-shadow: none;
1787
+ padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
1788
+ }
1789
+ .launcher--text:hover { filter: none; color: var(--pm-accent) }
1790
+
1791
+ /* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
1792
+ .launcher--outline {
1793
+ background: transparent; color: var(--pm-accent);
1794
+ border: 1px solid currentColor; box-shadow: none;
1795
+ }
1796
+ .launcher--outline:hover { filter: none; background: var(--pm-sunken) }
1797
+ .mask {
1798
+ position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
1799
+ background: rgba(23,23,23,.12);
1800
+ }
1801
+ /*
1802
+ The pinned element, ringed for the screenshot.
1803
+
1804
+ Three rings rather than one: a red line alone disappears against a red button, and a white one
1805
+ disappears against a white card. Red, then white, then a soft red — one of the three is always
1806
+ against something it contrasts with, on any page, without touching that page's own colours.
1807
+ */
1808
+ .ring {
1809
+ position: fixed; pointer-events: none; border-radius: 3px;
1810
+ border: 2px solid #ef4444;
1811
+ box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
1812
+ }
1813
+ /* The number, on the ring's corner so it never covers what the ring is about. */
1814
+ .ring__n, .marker__n {
1815
+ position: absolute; top: -11px; left: -11px; min-width: 20px; height: 20px; padding: 0 5px;
1816
+ border-radius: 10px; background: #ef4444; color: #fff; border: 2px solid #fff;
1817
+ font: 600 11px/16px system-ui, sans-serif; text-align: center; box-sizing: border-box;
1818
+ }
1819
+ /* What a click would pin, while picking. Dashed, so it reads as "this one?" rather than "pinned". */
1820
+ .hover {
1821
+ position: fixed; pointer-events: none; border-radius: 3px;
1822
+ outline: 2px dashed #ef4444; outline-offset: 2px; background: rgba(239,68,68,.06);
1823
+ }
1824
+ /* A pin already made, while the composer is open. */
1825
+ .marker {
1826
+ position: fixed; pointer-events: none; border-radius: 3px;
1827
+ border: 2px solid #ef4444; box-shadow: 0 0 0 2px rgba(255,255,255,.85);
1828
+ }
1829
+ /*
1830
+ A blur (PM-T-0682): the reporter's, on the page while they write and in the picture after.
1831
+
1832
+ A backdrop filter, so it blurs what is painted under it and touches nothing of the host's. The grey
1833
+ tint and the hairline make it read as a cover rather than as a page that failed to render. Neutral,
1834
+ not red: red on this layer means "this is what the report is about", and a blur means the opposite.
1835
+ */
1836
+ .veil {
1837
+ position: fixed; pointer-events: none; border-radius: 3px;
1838
+ -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
1839
+ background: rgba(115,115,115,.35);
1840
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 0 0 1px rgba(23,23,23,.3);
1841
+ }
1842
+ /*
1843
+ Solid where nothing can be blurred behind an element: a cover that shows what it covers is worse
1844
+ than a grey box. That is Firefox before 103 and Chrome before 76, which say so.
1845
+
1846
+ One engine has been seen to claim it and not draw it — WebKit's Windows port, which no shipping
1847
+ browser uses — and the preview there is a tint over legible text. It has no getDisplayMedia, so it
1848
+ never takes a picture; the snapshot does not depend on any of this; and an element blur is also
1849
+ blurred on the element itself for the frame (screenshot.ts). Checked drawing in Chromium.
1850
+ */
1851
+ @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
1852
+ .veil { background: #8a8a8a }
1853
+ }
1854
+ /* Over a credential the capture found: solid, because a blurred key of a known shape can sometimes be
1855
+ read back, and nobody needs its shape to understand the report. */
1856
+ .veil--secret { background: #737373; box-shadow: none; border-radius: 2px }
1857
+ .veil__tag {
1858
+ position: absolute; right: 3px; bottom: 3px; padding: 0 5px; border-radius: 4px;
1859
+ background: rgba(23,23,23,.72); color: #fff; font: 600 10px/16px system-ui, sans-serif;
1860
+ white-space: nowrap;
1861
+ }
1862
+ /* What a click would blur, blurred already: the reporter sees the result before committing to it. */
1863
+ .hover--blur {
1864
+ outline-color: #525252;
1865
+ -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
1866
+ background: rgba(115,115,115,.25);
1867
+ }
1868
+ /* A touch drag draws the area rather than scrolling the page underneath it. */
1869
+ .mask--blur { touch-action: none }
1870
+ /*
1871
+ Bottom, not top.
1872
+
1873
+ At top:16px this landed on whatever the host puts at the top centre of their page — a logo, a
1874
+ nav bar, a search field. We are a guest here and we do not know what is up there; on our own app
1875
+ it covered the project switcher. The bottom centre is beside the launcher the reporter just
1876
+ clicked, which is space the widget already owns, and it keeps their eyes near the thing they are
1877
+ about to point at rather than sending them to the far edge of the screen and back.
1878
+ */
1879
+ .hint {
1880
+ position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
1881
+ padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
1882
+ font-size: 12px; white-space: nowrap;
1883
+ }
1884
+ kbd {
1885
+ padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
1886
+ font-family: ui-monospace, monospace; font-size: 11px;
1887
+ }
1888
+ .panel {
1889
+ position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
1890
+ left: var(--pm-left); right: var(--pm-right);
1891
+ top: var(--pm-top); bottom: var(--pm-bottom);
1892
+ padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
1893
+ box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
1894
+ }
1895
+ .panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
1896
+ .panel__heading { min-width: 0 }
1897
+ .panel__title { font-weight: 600; font-size: 14px }
1898
+
1899
+ /*
1900
+ The header is the handle.
1901
+
1902
+ A 380px panel sits over the page somebody is reporting a problem with, and reading what is under
1903
+ it used to mean closing the widget and losing what had been written. touch-action:none because a
1904
+ drag on a touch screen is otherwise claimed by the page's own scrolling before we see it.
1905
+ */
1906
+ .drag { cursor: grab; touch-action: none; user-select: none }
1907
+ .drag:active { cursor: grabbing }
1908
+ .panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
1909
+ .drag:hover .panel__grip { color: var(--pm-muted) }
1910
+ .panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
1911
+
1912
+ /* An incomplete report, said plainly. Amber rather than red: the words arrived. */
1913
+ .sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
1914
+
1915
+ /* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
1916
+ .pins { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
1917
+ .pin { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--pm-ink); }
1918
+ .pin__n {
1919
+ flex: none; min-width: 18px; height: 18px; border-radius: 9px; background: #ef4444; color: #fff;
1920
+ font: 600 11px/18px system-ui, sans-serif; text-align: center;
1921
+ }
1922
+ .pin__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1923
+ .pin__n--blur { background: #737373 }
1924
+ .pins__actions { display: flex; flex-wrap: wrap; gap: 4px 14px }
1925
+ .pins__add { align-self: flex-start; font-size: 12px; }
1926
+ .panel__anchor {
1927
+ color: var(--pm-muted); font-size: 11px;
1928
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1929
+ }
1930
+ .panel__close {
1931
+ margin-left: auto; border: 0; background: none; cursor: pointer;
1932
+ color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
1933
+ }
1934
+ .panel__close:hover { color: var(--pm-ink) }
1935
+
1936
+ /* A confirmation, not a form. */
1937
+ .panel--sent { display: flex; align-items: flex-start; gap: 10px }
1938
+ .sent__tick {
1939
+ flex: none; width: 24px; height: 24px; border-radius: 999px;
1940
+ background: var(--pm-good-bg); color: var(--pm-good);
1941
+ display: grid; place-items: center; font-size: 14px;
1942
+ }
1943
+ .sent__body { min-width: 0 }
1944
+
1945
+ /* The reference on its own line, at its own weight: it is the one thing here to take away. */
1946
+ .sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
1947
+ .sent__id {
1948
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
1949
+ color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
1950
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1951
+ }
1952
+ .sent__copy {
1953
+ flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
1954
+ color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
1955
+ }
1956
+ .sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
1957
+ .sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
1958
+
1959
+ .panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
1960
+ .kind {
1961
+ flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
1962
+ background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
1963
+ }
1964
+ .kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
1965
+ textarea, input[type=email] {
1966
+ width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
1967
+ border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
1968
+ }
1969
+ textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
1970
+
1971
+ /*
1972
+ * Sixteen pixels on a touch device, or iOS zooms the host page.
1973
+ *
1974
+ * Safari zooms in whenever a focused field's text is under 16px and never zooms back out. At 13px
1975
+ * that happened the moment somebody tapped the message box — so the act of reporting a bug left
1976
+ * the reporter's view of OUR CUSTOMER's site magnified and scrolled sideways, which is a rude
1977
+ * thing for an embedded widget to do to the page hosting it.
1978
+ *
1979
+ * The widget cannot fix this with a viewport meta even if that were acceptable: the meta belongs
1980
+ * to the host page and is not ours to touch. Making the text big enough is the only move
1981
+ * available, and it is the right one anyway.
1982
+ */
1983
+ @media (pointer: coarse) {
1984
+ textarea, input[type=email] { font-size: 16px }
1985
+ }
1986
+ .shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
1987
+
1988
+ /*
1989
+ One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
1990
+ an alternative to it — and put the escape hatch further from the thumb than the commit.
1991
+ */
1992
+ .panel__foot {
1993
+ display: flex; align-items: center; gap: 8px; margin-top: 12px;
1994
+ padding-top: 12px; border-top: 1px solid var(--pm-sunken);
1995
+ }
1996
+ .panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
1997
+ .primary, .ghost {
1998
+ padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
1999
+ }
2000
+ .primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
2001
+ .primary:disabled { opacity: .5; cursor: default }
2002
+ .ghost { border: 0; background: transparent; color: var(--pm-muted) }
2003
+ .status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
2004
+ /*
2005
+ One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
2006
+ stacked — two affordances for one job, and together the busiest part of a panel whose busiest part
2007
+ should be the message.
2008
+ */
2009
+ .drop {
2010
+ display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
2011
+ margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
2012
+ color: var(--pm-faint); font-size: 11px;
2013
+ }
2014
+ .drop__or { color: var(--pm-faint) }
2015
+ .drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
2016
+ .files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
2017
+ .file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
2018
+ .file--bad { color: var(--pm-warn) }
2019
+ .file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
2020
+ .file__icon { width: 28px; text-align: center }
2021
+ .file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
2022
+ .link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
1704
2023
  `;