@daybook/feedback 1.4.2 → 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. */
@@ -59,6 +71,20 @@ export class FeedbackWidget {
59
71
  * report opens where the install said it would.
60
72
  */
61
73
  this.dragged = null;
74
+ /**
75
+ * Where the reporter dragged the launcher, if they did. PM-B-0121.
76
+ *
77
+ * The clearance probe dodges small floating buttons, and deliberately not a host modal: its box is
78
+ * scenery, and a Save button in its footer is not fixed at all, so nothing tells the probe it is
79
+ * there. The reporter can see it, so they move the launcher off it.
80
+ *
81
+ * Remembered, unlike the panel's drag (see dragged). The panel is up for one report; the launcher
82
+ * is on every screen, and one moved off a Save button that comes back to the same spot on the next
83
+ * page load has been moved for nothing. The Flutter SDK remembers its button the same way.
84
+ */
85
+ this.launcherAt = readLauncherAt();
86
+ /** Set by a drag, so the click the browser fires when the press ends does not also open the picker. */
87
+ this.swallowClick = false;
62
88
  /** The reference of the last report, so the confirmation can quote it. */
63
89
  this.reference = null;
64
90
  /** How many attachments did not land, so the confirmation can be honest about it. */
@@ -123,9 +149,9 @@ export class FeedbackWidget {
123
149
  const near = at.startsWith('bottom') ? 'bottom' : 'top';
124
150
  const side = at.endsWith('right') ? 'right' : 'left';
125
151
  const offset = EDGE + this.clearance;
126
- style.textContent = `:host {
127
- --pm-${side}: ${EDGE}px; --pm-${side === 'right' ? 'left' : 'right'}: auto;
128
- --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;
129
155
  }`;
130
156
  }
131
157
  /** The box the widget would occupy if nothing were in its way. What the probe measures. */
@@ -162,6 +188,9 @@ export class FeedbackWidget {
162
188
  queued = false;
163
189
  if (this.mode !== 'idle')
164
190
  return;
191
+ // Where the reporter put it outranks where we would dodge to.
192
+ if (this.launcherAt)
193
+ return;
165
194
  try {
166
195
  const next = measureClearance(this.homeSlot(), this.host);
167
196
  // A pixel or two of churn is measurement noise, and acting on it makes the launcher shiver.
@@ -212,11 +241,81 @@ export class FeedbackWidget {
212
241
  if (this.host.isConnected)
213
242
  this.render();
214
243
  }
244
+ /**
245
+ * Keeps the host page's focus traps off our fields. PM-B-0120.
246
+ *
247
+ * A host modal holds focus inside itself, and our composer is outside it — in a shadow root at the
248
+ * end of body — so the trap reads every focus on our textarea as focus escaping and takes it back.
249
+ * The reporter clicks the field and cannot type. Naive UI does it on `focus` (vueuc's FocusTrap,
250
+ * resetting to the modal's first field); the focus-trap library on `focusin`, and it also
251
+ * prevents the default of `mousedown` and `touchstart`, so the click never focuses anything at all.
252
+ *
253
+ * All of them listen on the document in the capture phase, which runs before anything inside our
254
+ * shadow root — so contain(), which stops events on the way back up, is too late. The window's
255
+ * capture phase is the one place earlier than the document's. An event from inside our host is
256
+ * stopped there, and the trap never hears of it. Focus is not cancelable: the field keeps it.
257
+ *
258
+ * focus-trap also swallows every `click` outside its modal — preventDefault and
259
+ * stopImmediatePropagation — which left the launcher and Send dead under one. A click stopped at
260
+ * the window never reaches our handlers either, so a copy is dispatched on its own target inside
261
+ * the shadow root, not composed, to run them without the page seeing it. The copy is cancelled
262
+ * before it goes: the original still does the native part — ticks the checkbox, follows the label,
263
+ * opens the file picker, all as a trusted click — and two un-cancelled clicks would tick a box and
264
+ * untick it again. A `focusin` is dispatched again the same way, for the confirmation that holds
265
+ * itself open while it is in focus. Neither copy can leave the shadow root, so neither comes back.
266
+ */
267
+ shield() {
268
+ const guard = (event) => {
269
+ const path = event.composedPath();
270
+ if (!path.includes(this.host))
271
+ return;
272
+ event.stopImmediatePropagation();
273
+ const [target] = path;
274
+ if (!(target instanceof Node) || target === this.host)
275
+ return;
276
+ if (event.type === 'focusin') {
277
+ target.dispatchEvent(new FocusEvent('focusin', { bubbles: true, composed: false }));
278
+ }
279
+ else if (event.type === 'click' && event instanceof MouseEvent) {
280
+ const copy = new MouseEvent('click', {
281
+ bubbles: true,
282
+ cancelable: true,
283
+ composed: false,
284
+ detail: event.detail,
285
+ screenX: event.screenX,
286
+ screenY: event.screenY,
287
+ clientX: event.clientX,
288
+ clientY: event.clientY,
289
+ button: event.button,
290
+ buttons: event.buttons,
291
+ ctrlKey: event.ctrlKey,
292
+ shiftKey: event.shiftKey,
293
+ altKey: event.altKey,
294
+ metaKey: event.metaKey,
295
+ });
296
+ copy.preventDefault();
297
+ target.dispatchEvent(copy);
298
+ }
299
+ };
300
+ for (const type of SHIELDED)
301
+ window.addEventListener(type, guard, true);
302
+ this.detach.push(() => {
303
+ for (const type of SHIELDED)
304
+ window.removeEventListener(type, guard, true);
305
+ });
306
+ // Keys stop at our shadow root, on the way up. Typing in the composer is typing to us: the host's
307
+ // shortcuts see a key whose target is our host element, not a field, so their own "is somebody
308
+ // typing" check passes — and its Escape closes the host modal under the report being written.
309
+ const keep = (event) => event.stopPropagation();
310
+ for (const type of ['keydown', 'keyup', 'keypress'])
311
+ this.root.addEventListener(type, keep);
312
+ }
215
313
  mount() {
216
314
  document.body.appendChild(this.host);
217
315
  this.applyPlacement();
218
316
  this.render();
219
317
  this.watchClearance();
318
+ this.watchLauncher();
220
319
  if (this.options.hotkey !== null) {
221
320
  const hotkey = (this.options.hotkey ?? 'f').toLowerCase();
222
321
  const onKey = (event) => {
@@ -235,6 +334,7 @@ export class FeedbackWidget {
235
334
  if (this.mode === 'picking') {
236
335
  this.mode = 'idle';
237
336
  this.pins = [];
337
+ this.blurs = [];
238
338
  this.dragged = null;
239
339
  this.render();
240
340
  }
@@ -257,7 +357,10 @@ export class FeedbackWidget {
257
357
  };
258
358
  window.addEventListener('keydown', onKey);
259
359
  this.detach.push(() => window.removeEventListener('keydown', onKey));
360
+ // Keys from inside the widget stop at the shadow root (see shield), so they are heard there.
361
+ this.root.addEventListener('keydown', onKey);
260
362
  }
363
+ this.shield();
261
364
  }
262
365
  unmount() {
263
366
  for (const undo of this.detach.splice(0))
@@ -293,17 +396,103 @@ export class FeedbackWidget {
293
396
  * the whole reason to do it here rather than on the page: a report used to arrive as a selector,
294
397
  * a text snapshot and a picture of a whole screen, leaving whoever read it to work out which of
295
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.
296
403
  */
297
- conceal() {
404
+ conceal(cover = []) {
298
405
  const layer = this.root.getElementById('layer');
299
406
  const previous = layer.style.visibility;
300
407
  layer.style.visibility = 'hidden';
301
- 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
+ ];
302
414
  return () => {
303
415
  layer.style.visibility = previous;
304
- rings.forEach(ring => ring.remove());
416
+ drawn.forEach(element => element.remove());
305
417
  };
306
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
+ }
307
496
  /**
308
497
  * A ring over the pinned element, drawn in our own shadow root.
309
498
  *
@@ -401,6 +590,9 @@ export class FeedbackWidget {
401
590
  * three pins the reporter cannot tell which number is which without them. Drawn in the layer, so
402
591
  * the capture's conceal takes them away and the rings, which are the picture's version of the
403
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.
404
596
  */
405
597
  markPins(layer) {
406
598
  this.unmark?.();
@@ -410,6 +602,7 @@ export class FeedbackWidget {
410
602
  const draw = () => {
411
603
  frame = 0;
412
604
  holder.innerHTML = '';
605
+ this.veilBlurs(holder);
413
606
  if (this.pins.length < 1)
414
607
  return;
415
608
  const origin = this.origin();
@@ -446,8 +639,11 @@ export class FeedbackWidget {
446
639
  this.unmark = null;
447
640
  };
448
641
  }
449
- /** The picker over a hidden composer, for one more pin. Esc or a click puts the panel back. */
450
- 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) {
451
647
  const layer = this.root.getElementById('layer');
452
648
  const restore = () => {
453
649
  mask.remove();
@@ -455,11 +651,17 @@ export class FeedbackWidget {
455
651
  this.cancelAdding = null;
456
652
  this.redrawMarks?.();
457
653
  };
458
- const mask = this.picker(pin => {
459
- this.pins.push(pin);
460
- restore();
461
- done();
462
- }, `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})`);
463
665
  panel.style.visibility = 'hidden';
464
666
  this.cancelAdding = restore;
465
667
  layer.appendChild(mask);
@@ -524,14 +726,71 @@ export class FeedbackWidget {
524
726
  }
525
727
  // Re-clamped on every render rather than only on drop: the window the panel was placed in is
526
728
  // not necessarily the window it is being drawn in.
527
- const width = panel.offsetWidth || 380;
528
- const height = panel.offsetHeight || 240;
529
- const dx = clamp(at.dx, EDGE, Math.max(EDGE, window.innerWidth - width - EDGE));
530
- const dy = clamp(at.dy, EDGE, Math.max(EDGE, window.innerHeight - height - EDGE));
531
- panel.style.left = at.h === 'left' ? `${dx}px` : 'auto';
532
- panel.style.right = at.h === 'right' ? `${dx}px` : 'auto';
533
- panel.style.top = at.v === 'top' ? `${dy}px` : 'auto';
534
- panel.style.bottom = at.v === 'bottom' ? `${dy}px` : 'auto';
729
+ putAt(panel, at, panel.offsetWidth || 380, panel.offsetHeight || 240);
730
+ }
731
+ /** Draws the launcher where it was dragged, or leaves it to the corner the stylesheet gives it. */
732
+ placeLauncher(button) {
733
+ if (!this.launcherAt) {
734
+ button.style.left = button.style.right = button.style.top = button.style.bottom = '';
735
+ return;
736
+ }
737
+ putAt(button, this.launcherAt, button.offsetWidth || 120, button.offsetHeight || 36);
738
+ }
739
+ /** Keeps a dragged launcher on screen when the window changes size. */
740
+ watchLauncher() {
741
+ const onResize = () => {
742
+ const button = this.root.querySelector('.launcher');
743
+ if (button && this.mode === 'idle' && this.state === 'ready')
744
+ this.placeLauncher(button);
745
+ };
746
+ window.addEventListener('resize', onResize);
747
+ this.detach.push(() => window.removeEventListener('resize', onResize));
748
+ }
749
+ /**
750
+ * Press and drag the launcher anywhere; let go and it goes flush to the nearest edge.
751
+ *
752
+ * A press that travels less than DRAG_SLOP is a click, so a shaky hand still opens the picker.
753
+ */
754
+ movableLauncher(button) {
755
+ button.addEventListener('pointerdown', (event) => {
756
+ this.swallowClick = false;
757
+ if (event.button !== 0)
758
+ return;
759
+ const rect = button.getBoundingClientRect();
760
+ const grabX = event.clientX - rect.left;
761
+ const grabY = event.clientY - rect.top;
762
+ let dragging = false;
763
+ button.setPointerCapture(event.pointerId);
764
+ const move = (moved) => {
765
+ if (!dragging) {
766
+ if (Math.hypot(moved.clientX - event.clientX, moved.clientY - event.clientY) < DRAG_SLOP)
767
+ return;
768
+ dragging = true;
769
+ button.classList.add('launcher--dragging');
770
+ }
771
+ button.style.left = `${clamp(moved.clientX - grabX, 0, window.innerWidth - rect.width)}px`;
772
+ button.style.top = `${clamp(moved.clientY - grabY, 0, window.innerHeight - rect.height)}px`;
773
+ button.style.right = 'auto';
774
+ button.style.bottom = 'auto';
775
+ };
776
+ const drop = () => {
777
+ if (button.hasPointerCapture(event.pointerId))
778
+ button.releasePointerCapture(event.pointerId);
779
+ button.removeEventListener('pointermove', move);
780
+ button.removeEventListener('pointerup', drop);
781
+ button.removeEventListener('pointercancel', drop);
782
+ if (!dragging)
783
+ return;
784
+ button.classList.remove('launcher--dragging');
785
+ this.launcherAt = stickToFrame(button.getBoundingClientRect());
786
+ saveLauncherAt(this.launcherAt);
787
+ this.placeLauncher(button);
788
+ this.swallowClick = true;
789
+ };
790
+ button.addEventListener('pointermove', move);
791
+ button.addEventListener('pointerup', drop);
792
+ button.addEventListener('pointercancel', drop);
793
+ });
535
794
  }
536
795
  render() {
537
796
  const layer = this.root.getElementById('layer');
@@ -539,7 +798,14 @@ export class FeedbackWidget {
539
798
  this.cancelAdding = null;
540
799
  layer.innerHTML = '';
541
800
  if (this.mode === 'idle') {
542
- layer.appendChild(this.state === 'pending' ? this.pending() : this.launcher());
801
+ if (this.state === 'pending') {
802
+ layer.appendChild(this.pending());
803
+ return;
804
+ }
805
+ // Placed once it is in the document, because placing needs its size.
806
+ const button = this.launcher();
807
+ layer.appendChild(button);
808
+ this.placeLauncher(button);
543
809
  return;
544
810
  }
545
811
  if (this.mode === 'sent') {
@@ -596,17 +862,17 @@ export class FeedbackWidget {
596
862
  note.setAttribute('role', 'status');
597
863
  const reference = this.reference;
598
864
  const failed = this.uploadsFailed;
599
- note.innerHTML = `
600
- <div class="sent__tick" aria-hidden="true">&check;</div>
601
- <div class="sent__body">
602
- <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>
603
869
  ${reference
604
- ? `<div class="sent__ref">
605
- <code class="sent__id">${escapeHtml(reference)}</code>
606
- <button type="button" class="sent__copy" data-copy>Copy</button>
607
- </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>
608
874
  <div class="panel__anchor">Quote it if you follow it up.</div>`
609
- : ''}
875
+ : ''}
610
876
  ${failed > 0
611
877
  // Said out loud. The report itself is safe, and the reporter is the only person who can
612
878
  // tell that the picture they attached is missing from it — so they are told rather than
@@ -614,8 +880,8 @@ export class FeedbackWidget {
614
880
  ? `<div class="sent__warn">${failed === 1
615
881
  ? 'One attachment could not be uploaded.'
616
882
  : `${failed} attachments could not be uploaded.`} The report was filed without it.</div>`
617
- : ''}
618
- </div>
883
+ : ''}
884
+ </div>
619
885
  ${reference
620
886
  ? '<button type="button" class="panel__close" data-dismiss aria-label="Dismiss">&times;</button>'
621
887
  : ''}`;
@@ -651,22 +917,84 @@ export class FeedbackWidget {
651
917
  }
652
918
  launcher() {
653
919
  const button = launcherButton(this.buttonStyle, this.launcherLabel ?? 'Feedback');
654
- button.title = this.options.hotkey === null
920
+ button.title = (this.options.hotkey === null
655
921
  ? 'Report a problem'
656
- : `Report a problem (${(this.options.hotkey ?? 'f').toUpperCase()})`;
657
- button.onclick = () => { this.mode = 'picking'; this.render(); };
922
+ : `Report a problem (${(this.options.hotkey ?? 'f').toUpperCase()})`) + ' · drag to move';
923
+ button.onclick = () => {
924
+ if (this.swallowClick) {
925
+ this.swallowClick = false;
926
+ return;
927
+ }
928
+ this.mode = 'picking';
929
+ this.render();
930
+ };
931
+ this.movableLauncher(button);
658
932
  return button;
659
933
  }
660
934
  /**
661
935
  * The crosshair over the page. The first pin opens the composer; "Add another pin" passes
662
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.
663
942
  */
664
- picker(onPin, hint = 'Click the thing that is wrong') {
943
+ picker(onPin, hint = 'Click the thing that is wrong', blur = false) {
665
944
  const mask = document.createElement('div');
666
- mask.className = 'mask';
667
- 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>`
668
947
  + `<div class="hint">${escapeHtml(hint)} · <kbd>Esc</kbd> to cancel</div>`;
669
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
+ }
670
998
  // What is under the pointer, found the only way it can be with the mask on top: look through it.
671
999
  const beneath = (x, y) => {
672
1000
  mask.style.pointerEvents = 'none';
@@ -683,36 +1011,49 @@ export class FeedbackWidget {
683
1011
  */
684
1012
  let frame = 0;
685
1013
  mask.onmousemove = (event) => {
686
- if (frame)
1014
+ if (frame || area)
687
1015
  return;
688
1016
  const { clientX, clientY } = event;
689
1017
  frame = requestAnimationFrame(() => {
690
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;
691
1022
  const element = beneath(clientX, clientY);
692
1023
  if (!element || element === document.body || element === document.documentElement) {
693
1024
  hover.hidden = true;
694
1025
  return;
695
1026
  }
696
1027
  const rect = element.getBoundingClientRect();
697
- const origin = this.origin();
698
- hover.hidden = false;
699
- hover.style.left = `${rect.left - origin.left}px`;
700
- hover.style.top = `${rect.top - origin.top}px`;
701
- hover.style.width = `${rect.width}px`;
702
- hover.style.height = `${rect.height}px`;
1028
+ show({ left: rect.left, top: rect.top, width: rect.width, height: rect.height });
703
1029
  });
704
1030
  };
705
1031
  mask.onclick = (event) => {
1032
+ if (swallow) {
1033
+ swallow = false;
1034
+ return;
1035
+ }
706
1036
  // The mask has to stop intercepting before elementFromPoint runs, or every anchor resolves to
707
1037
  // the mask itself. The predecessor hit this too.
708
1038
  mask.style.pointerEvents = 'none';
709
1039
  const pin = pinAt(event.clientX, event.clientY);
710
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
+ }
711
1051
  if (onPin) {
712
1052
  onPin(pin);
713
1053
  return;
714
1054
  }
715
1055
  this.pins = [pin];
1056
+ this.blurs = [];
716
1057
  this.mode = 'composing';
717
1058
  this.render();
718
1059
  };
@@ -726,55 +1067,55 @@ export class FeedbackWidget {
726
1067
  // reporter pointed at something, and saying what they pointed at is how they know we understood.
727
1068
  // "Report a problem" is a heading anybody could have written; the anchor is theirs.
728
1069
  const capture = this.capture();
729
- panel.innerHTML = `
730
- <div class="panel__head" id="head">
731
- <span class="panel__grip" aria-hidden="true">⠿</span>
732
- <div class="panel__heading">
733
- <div class="panel__anchor">${escapeHtml(anchorLabel)}</div>
734
- <div class="panel__title">Report a problem</div>
735
- </div>
736
- <button id="close" class="panel__close" aria-label="Close">&times;</button>
737
- </div>
738
-
739
- <!-- The pins, when there is more than one to tell apart, and the way to add one. -->
740
- <div id="pins" class="pins"></div>
741
-
742
- <textarea id="message" rows="5" placeholder="What happened?"></textarea>
743
-
744
- <!--
745
- Under the message, not above it. Four filled buttons at the top were the loudest thing in the
746
- panel and the least important decision in it — the default is right almost every time, and
747
- what somebody came here to do is type.
748
- -->
749
- <div class="panel__kinds">
750
- ${['bug', 'idea', 'praise', 'question'].map((k, i) => `<button class="kind${i === 0 ? ' kind--on' : ''}" data-kind="${k}">${k}</button>`).join('')}
751
- </div>
752
-
753
- <input id="email" type="email" placeholder="Email (optional, so we can reply)" autocomplete="email" />
754
-
755
- <!-- One attachment area, not two. A checkbox for the screen and a dropzone for a file were
756
- two ways to do the same thing, stacked, both dim.
757
-
758
- The capture control is rendered only when it can actually do something. It used to be
759
- drawn whatever the host had configured and then ignored downstream, so ticking it was a
760
- promise nobody kept. -->
761
- <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">
762
1103
  ${capture.offered
763
- ? `<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>
764
1105
  <span class="drop__or">or paste, drop, or`
765
- : '<span class="drop__or">Paste, drop, or'}
766
- <input id="file" type="file" multiple accept="image/*,video/mp4,video/quicktime,video/webm" hidden />
767
- <button id="browse" class="link">choose a file</button>
768
- </span>
769
- </div>
770
-
771
- <div id="files" class="files"></div>
772
- <div id="status" class="status"></div>
773
-
774
- <div class="panel__foot">
775
- <span class="panel__note">Sends this page's contents, your browser, and recent errors.</span>
776
- <button id="cancel" class="ghost">Cancel</button>
777
- <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>
778
1119
  </div>`;
779
1120
  const files = [];
780
1121
  const fileList = panel.querySelector('#files');
@@ -877,14 +1218,53 @@ export class FeedbackWidget {
877
1218
  pinList.appendChild(row);
878
1219
  });
879
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';
880
1247
  if (this.pins.length < MAX_PINS) {
881
1248
  const add = document.createElement('button');
882
1249
  add.className = 'link pins__add';
883
1250
  add.id = 'add-pin';
884
1251
  add.textContent = this.pins.length > 0 ? '+ Add another pin' : '+ Pin something on the page';
885
1252
  add.onclick = () => this.pickAnother(panel, renderPins);
886
- pinList.appendChild(add);
1253
+ actions.appendChild(add);
887
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);
888
1268
  this.redrawMarks?.();
889
1269
  };
890
1270
  renderPins();
@@ -910,6 +1290,7 @@ export class FeedbackWidget {
910
1290
  revoke(files);
911
1291
  this.mode = 'idle';
912
1292
  this.pins = [];
1293
+ this.blurs = [];
913
1294
  this.dragged = null;
914
1295
  this.render();
915
1296
  };
@@ -927,7 +1308,7 @@ export class FeedbackWidget {
927
1308
  message: message.value.trim(),
928
1309
  kind,
929
1310
  email: email.value.trim() || undefined,
930
- anchors: this.pins.map(pin => pin.anchor),
1311
+ anchors: this.pins.map(pin => this.sendable(pin)),
931
1312
  withScreenshot: shot?.checked ?? false,
932
1313
  files: files.filter(f => !f.error),
933
1314
  });
@@ -942,6 +1323,7 @@ export class FeedbackWidget {
942
1323
  // cannot do if they never see it.
943
1324
  this.mode = 'sent';
944
1325
  this.pins = [];
1326
+ this.blurs = [];
945
1327
  this.render();
946
1328
  }
947
1329
  catch (error) {
@@ -1022,11 +1404,59 @@ export async function copyText(text) {
1022
1404
  const EDGE = 16;
1023
1405
  /** How far the ring sits outside the element it marks, so it frames rather than covers. */
1024
1406
  const RING_PAD = 3;
1407
+ /**
1408
+ * What a host page's focus trap listens to, and so what never leaves the widget. PM-B-0120.
1409
+ *
1410
+ * Not the pointer events: the panel and launcher drags run on them, an event stopped at the window
1411
+ * never reaches them, and no trap listens to them. `click` is here, and dispatched again inside.
1412
+ */
1413
+ const SHIELDED = ['focus', 'focusin', 'mousedown', 'touchstart', 'click'];
1414
+ /** How far a press on the launcher moves before it is a drag rather than a click. */
1415
+ const DRAG_SLOP = 5;
1416
+ /** Where a dragged launcher is kept, per site. PM-B-0121. */
1417
+ const LAUNCHER_KEY = 'daybook-feedback:launcher';
1418
+ function readLauncherAt() {
1419
+ try {
1420
+ const at = JSON.parse(localStorage.getItem(LAUNCHER_KEY) ?? 'null');
1421
+ // Checked field by field: the value only ever reaches a style as a side's name and a number, and
1422
+ // anything else in storage is somebody else's, or an older shape.
1423
+ if (at && (at.h === 'left' || at.h === 'right') && (at.v === 'top' || at.v === 'bottom')
1424
+ && Number.isFinite(at.dx) && Number.isFinite(at.dy)) {
1425
+ return { h: at.h, v: at.v, dx: at.dx, dy: at.dy };
1426
+ }
1427
+ }
1428
+ catch {
1429
+ // Storage blocked or unreadable: the launcher starts at home, which is where it would be anyway.
1430
+ }
1431
+ return null;
1432
+ }
1433
+ function saveLauncherAt(at) {
1434
+ try {
1435
+ localStorage.setItem(LAUNCHER_KEY, JSON.stringify(at));
1436
+ }
1437
+ catch {
1438
+ // Kept for this page view only.
1439
+ }
1440
+ }
1441
+ /**
1442
+ * Puts an element at a placement, re-clamped to the window it is drawn in now rather than the one
1443
+ * it was placed in.
1444
+ */
1445
+ function putAt(element, at, width, height) {
1446
+ const dx = clamp(at.dx, EDGE, Math.max(EDGE, window.innerWidth - width - EDGE));
1447
+ const dy = clamp(at.dy, EDGE, Math.max(EDGE, window.innerHeight - height - EDGE));
1448
+ element.style.left = at.h === 'left' ? `${dx}px` : 'auto';
1449
+ element.style.right = at.h === 'right' ? `${dx}px` : 'auto';
1450
+ element.style.top = at.v === 'top' ? `${dy}px` : 'auto';
1451
+ element.style.bottom = at.v === 'bottom' ? `${dy}px` : 'auto';
1452
+ }
1025
1453
  /**
1026
1454
  * How many pins one report may carry. Ten is more than any report has needed, and a limit keeps a
1027
1455
  * slipped hand from filing a report whose picture is nothing but rings.
1028
1456
  */
1029
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;
1030
1460
  function currentPage() {
1031
1461
  return location.pathname + location.search;
1032
1462
  }
@@ -1041,6 +1471,60 @@ function pinAt(clientX, clientY) {
1041
1471
  : { left: clientX - 12 + window.scrollX, top: clientY - 12 + window.scrollY, width: 24, height: 24 };
1042
1472
  return { anchor, element, box };
1043
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
+ }
1044
1528
  function labelFor(anchor) {
1045
1529
  if (anchor.elementText)
1046
1530
  return `“${anchor.elementText}”`;
@@ -1213,281 +1697,327 @@ export function previewLauncher(into, theme = {}) {
1213
1697
  const BUTTON_STYLES = ['pill', 'pill-icon', 'icon', 'text', 'outline'];
1214
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;';
1215
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;';
1216
- const STYLES = `
1217
- /*
1218
- Every colour in this file is one of these, and there are two sets of them.
1219
-
1220
- Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
1221
- application is a flashbang. It followed the host's scheme in exactly one respect before — it did
1222
- not, and was always light.
1223
-
1224
- System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
1225
- a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
1226
- dark gets those values written into the theme block instead, which is a later stylesheet at the
1227
- same specificity and therefore wins over the query.
1228
-
1229
- The accent pair is inverse emphasis — a dark pill on a light page, a light pill on a dark one —
1230
- because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
1231
- near-black application is a button nobody finds. A host that sets its own accent gets white text
1232
- on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
1233
- the one case where a very pale brand colour needs its own care.
1234
- */
1235
- :host {
1236
- all: initial;
1237
-
1238
- ${LIGHT}
1239
-
1240
- --pm-radius: 12px;
1241
-
1242
- /* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
1243
- "put it on the left" has to be four numbers and not one word. */
1244
- --pm-left: auto;
1245
- --pm-right: 16px;
1246
- --pm-top: auto;
1247
- --pm-bottom: 16px;
1248
- }
1249
-
1250
- @media (prefers-color-scheme: dark) {
1251
- :host { ${DARK} }
1252
- }
1253
- }
1254
- * { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
1255
- @media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
1256
- #layer { position: fixed; inset: 0; pointer-events: none }
1257
- .launcher {
1258
- position: fixed; pointer-events: auto;
1259
- left: var(--pm-left); right: var(--pm-right);
1260
- top: var(--pm-top); bottom: var(--pm-bottom);
1261
- /* A back-to-top button appearing on scroll moves us; gliding reads as making room, and jumping
1262
- reads as a bug. Honoured only where motion is welcome. */
1263
- transition: bottom .18s ease, top .18s ease;
1264
- padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
1265
- background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
1266
- box-shadow: 0 2px 12px rgba(0,0,0,.3);
1267
- }
1268
- .launcher:hover { filter: brightness(1.15) }
1269
- .launcher--pending { cursor: default; opacity: .85 }
1270
- .launcher--pending:hover { filter: none }
1271
- .launcher__icon { flex: none; width: 15px; height: 15px; display: block }
1272
- /* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
1273
- .launcher--preview { position: static; cursor: default; opacity: 1 }
1274
-
1275
- /*
1276
- Five buttons, because one button cannot be right for every page it is a guest on.
1277
-
1278
- A product with its own bold chat bubble does not want a second bold pill beside it; a spare
1279
- documentation site does not want a filled button at all; a dense application often wants the
1280
- smallest possible mark. The set is deliberately small — five things somebody can look at and
1281
- choose between in a moment, rather than a colour picker and a padding field.
1282
-
1283
- Every one of them keeps the same hit area at the same corner, so the clearance measurement and
1284
- the placement work unchanged whichever is picked.
1285
- */
1286
- .launcher { display: inline-flex; align-items: center; gap: 7px }
1287
-
1288
- /* Filled and round. The default, and the one that reads as a product feature. */
1289
- .launcher--pill {}
1290
-
1291
- /* The same, with the icon in front for pages where a word alone reads as body text. */
1292
- .launcher--pill-icon {}
1293
-
1294
- /* The mark on its own, for a corner that is already busy. */
1295
- .launcher--icon { padding: 10px; border-radius: 999px }
1296
-
1297
- /* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
1298
- .launcher--text {
1299
- background: transparent; color: var(--pm-ink); box-shadow: none;
1300
- padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
1301
- }
1302
- .launcher--text:hover { filter: none; color: var(--pm-accent) }
1303
-
1304
- /* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
1305
- .launcher--outline {
1306
- background: transparent; color: var(--pm-accent);
1307
- border: 1px solid currentColor; box-shadow: none;
1308
- }
1309
- .launcher--outline:hover { filter: none; background: var(--pm-sunken) }
1310
- .mask {
1311
- position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
1312
- background: rgba(23,23,23,.12);
1313
- }
1314
- /*
1315
- The pinned element, ringed for the screenshot.
1316
-
1317
- Three rings rather than one: a red line alone disappears against a red button, and a white one
1318
- disappears against a white card. Red, then white, then a soft red — one of the three is always
1319
- against something it contrasts with, on any page, without touching that page's own colours.
1320
- */
1321
- .ring {
1322
- position: fixed; pointer-events: none; border-radius: 3px;
1323
- border: 2px solid #ef4444;
1324
- box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
1325
- }
1326
- /* The number, on the ring's corner so it never covers what the ring is about. */
1327
- .ring__n, .marker__n {
1328
- position: absolute; top: -11px; left: -11px; min-width: 20px; height: 20px; padding: 0 5px;
1329
- border-radius: 10px; background: #ef4444; color: #fff; border: 2px solid #fff;
1330
- font: 600 11px/16px system-ui, sans-serif; text-align: center; box-sizing: border-box;
1331
- }
1332
- /* What a click would pin, while picking. Dashed, so it reads as "this one?" rather than "pinned". */
1333
- .hover {
1334
- position: fixed; pointer-events: none; border-radius: 3px;
1335
- outline: 2px dashed #ef4444; outline-offset: 2px; background: rgba(239,68,68,.06);
1336
- }
1337
- /* A pin already made, while the composer is open. */
1338
- .marker {
1339
- position: fixed; pointer-events: none; border-radius: 3px;
1340
- border: 2px solid #ef4444; box-shadow: 0 0 0 2px rgba(255,255,255,.85);
1341
- }
1342
- /*
1343
- Bottom, not top.
1344
-
1345
- At top:16px this landed on whatever the host puts at the top centre of their page — a logo, a
1346
- nav bar, a search field. We are a guest here and we do not know what is up there; on our own app
1347
- it covered the project switcher. The bottom centre is beside the launcher the reporter just
1348
- clicked, which is space the widget already owns, and it keeps their eyes near the thing they are
1349
- about to point at rather than sending them to the far edge of the screen and back.
1350
- */
1351
- .hint {
1352
- position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
1353
- padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
1354
- font-size: 12px; white-space: nowrap;
1355
- }
1356
- kbd {
1357
- padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
1358
- font-family: ui-monospace, monospace; font-size: 11px;
1359
- }
1360
- .panel {
1361
- position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
1362
- left: var(--pm-left); right: var(--pm-right);
1363
- top: var(--pm-top); bottom: var(--pm-bottom);
1364
- padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
1365
- box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
1366
- }
1367
- .panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
1368
- .panel__heading { min-width: 0 }
1369
- .panel__title { font-weight: 600; font-size: 14px }
1370
-
1371
- /*
1372
- The header is the handle.
1373
-
1374
- A 380px panel sits over the page somebody is reporting a problem with, and reading what is under
1375
- it used to mean closing the widget and losing what had been written. touch-action:none because a
1376
- drag on a touch screen is otherwise claimed by the page's own scrolling before we see it.
1377
- */
1378
- .drag { cursor: grab; touch-action: none; user-select: none }
1379
- .drag:active { cursor: grabbing }
1380
- .panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
1381
- .drag:hover .panel__grip { color: var(--pm-muted) }
1382
- .panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
1383
-
1384
- /* An incomplete report, said plainly. Amber rather than red: the words arrived. */
1385
- .sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
1386
-
1387
- /* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
1388
- .pins { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
1389
- .pin { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--pm-ink); }
1390
- .pin__n {
1391
- flex: none; min-width: 18px; height: 18px; border-radius: 9px; background: #ef4444; color: #fff;
1392
- font: 600 11px/18px system-ui, sans-serif; text-align: center;
1393
- }
1394
- .pin__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1395
- .pins__add { align-self: flex-start; font-size: 12px; }
1396
- .panel__anchor {
1397
- color: var(--pm-muted); font-size: 11px;
1398
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1399
- }
1400
- .panel__close {
1401
- margin-left: auto; border: 0; background: none; cursor: pointer;
1402
- color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
1403
- }
1404
- .panel__close:hover { color: var(--pm-ink) }
1405
-
1406
- /* A confirmation, not a form. */
1407
- .panel--sent { display: flex; align-items: flex-start; gap: 10px }
1408
- .sent__tick {
1409
- flex: none; width: 24px; height: 24px; border-radius: 999px;
1410
- background: var(--pm-good-bg); color: var(--pm-good);
1411
- display: grid; place-items: center; font-size: 14px;
1412
- }
1413
- .sent__body { min-width: 0 }
1414
-
1415
- /* The reference on its own line, at its own weight: it is the one thing here to take away. */
1416
- .sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
1417
- .sent__id {
1418
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
1419
- color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
1420
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1421
- }
1422
- .sent__copy {
1423
- flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
1424
- color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
1425
- }
1426
- .sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
1427
- .sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
1428
-
1429
- .panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
1430
- .kind {
1431
- flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
1432
- background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
1433
- }
1434
- .kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
1435
- textarea, input[type=email] {
1436
- width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
1437
- border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
1438
- }
1439
- textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
1440
-
1441
- /*
1442
- * Sixteen pixels on a touch device, or iOS zooms the host page.
1443
- *
1444
- * Safari zooms in whenever a focused field's text is under 16px and never zooms back out. At 13px
1445
- * that happened the moment somebody tapped the message box — so the act of reporting a bug left
1446
- * the reporter's view of OUR CUSTOMER's site magnified and scrolled sideways, which is a rude
1447
- * thing for an embedded widget to do to the page hosting it.
1448
- *
1449
- * The widget cannot fix this with a viewport meta even if that were acceptable: the meta belongs
1450
- * to the host page and is not ours to touch. Making the text big enough is the only move
1451
- * available, and it is the right one anyway.
1452
- */
1453
- @media (pointer: coarse) {
1454
- textarea, input[type=email] { font-size: 16px }
1455
- }
1456
- .shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
1457
-
1458
- /*
1459
- One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
1460
- an alternative to it — and put the escape hatch further from the thumb than the commit.
1461
- */
1462
- .panel__foot {
1463
- display: flex; align-items: center; gap: 8px; margin-top: 12px;
1464
- padding-top: 12px; border-top: 1px solid var(--pm-sunken);
1465
- }
1466
- .panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
1467
- .primary, .ghost {
1468
- padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
1469
- }
1470
- .primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
1471
- .primary:disabled { opacity: .5; cursor: default }
1472
- .ghost { border: 0; background: transparent; color: var(--pm-muted) }
1473
- .status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
1474
- /*
1475
- One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
1476
- stacked — two affordances for one job, and together the busiest part of a panel whose busiest part
1477
- should be the message.
1478
- */
1479
- .drop {
1480
- display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
1481
- margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
1482
- color: var(--pm-faint); font-size: 11px;
1483
- }
1484
- .drop__or { color: var(--pm-faint) }
1485
- .drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
1486
- .files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
1487
- .file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
1488
- .file--bad { color: var(--pm-warn) }
1489
- .file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
1490
- .file__icon { width: 28px; text-align: center }
1491
- .file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
1492
- .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 }
1493
2023
  `;