@daybook/feedback 1.2.1 → 1.2.3
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/README.md +74 -3
- package/dist/clearance.d.ts +73 -0
- package/dist/clearance.js +154 -0
- package/dist/feedback.js +128 -46
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +32 -0
- package/dist/widget.d.ts +90 -10
- package/dist/widget.js +457 -132
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { captureAnchor } from './anchor.js';
|
|
2
2
|
import { fromPaste, MAX_FILES, revoke, stage } from './files.js';
|
|
3
3
|
import { isTyping } from './hotkey.js';
|
|
4
|
+
import { measureClearance } from './clearance.js';
|
|
4
5
|
/**
|
|
5
6
|
* The reporter-facing UI, rendered inside a shadow root.
|
|
6
7
|
*
|
|
@@ -17,6 +18,10 @@ export class FeedbackWidget {
|
|
|
17
18
|
this.mode = 'idle';
|
|
18
19
|
this.anchor = null;
|
|
19
20
|
this.detach = [];
|
|
21
|
+
/** Which of the five shapes the launcher takes. */
|
|
22
|
+
this.buttonStyle = 'pill';
|
|
23
|
+
/** How far the host page's own floating buttons push us out of that corner. */
|
|
24
|
+
this.clearance = 0;
|
|
20
25
|
/**
|
|
21
26
|
* What the widget is allowed to do, from the handshake.
|
|
22
27
|
*
|
|
@@ -32,13 +37,19 @@ export class FeedbackWidget {
|
|
|
32
37
|
*/
|
|
33
38
|
this.policy = null;
|
|
34
39
|
/**
|
|
35
|
-
* Where the reporter dragged the panel to, if they did.
|
|
40
|
+
* Where the reporter dragged the panel to, if they did — for this report only.
|
|
36
41
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
42
|
+
* It used to be remembered in localStorage, across reports and across visits, on the reasoning
|
|
43
|
+
* that somebody who moved it once would want it moved next time. In use that is not what it feels
|
|
44
|
+
* like: the widget turns up in a different place on every page of the app with no explanation of
|
|
45
|
+
* why, and the place it turns up is wherever it was last shoved out of the way — a position
|
|
46
|
+
* chosen to be temporary. A home you can move things away from is easier to live with than a
|
|
47
|
+
* position that drifts.
|
|
48
|
+
*
|
|
49
|
+
* So a drag lasts as long as the report. Sending resets it, closing resets it, and the next
|
|
50
|
+
* report opens where the install said it would.
|
|
40
51
|
*/
|
|
41
|
-
this.
|
|
52
|
+
this.dragged = null;
|
|
42
53
|
/** The reference of the last report, so the confirmation can quote it. */
|
|
43
54
|
this.reference = null;
|
|
44
55
|
/** How many attachments did not land, so the confirmation can be honest about it. */
|
|
@@ -50,7 +61,8 @@ export class FeedbackWidget {
|
|
|
50
61
|
this.host.style.cssText = 'position:fixed;inset:0;z-index:2147483000;pointer-events:none';
|
|
51
62
|
this.root = this.host.attachShadow({ mode: 'open' });
|
|
52
63
|
this.root.innerHTML =
|
|
53
|
-
`<style>${STYLES}</style><style id="theme"></style><
|
|
64
|
+
`<style>${STYLES}</style><style id="theme"></style><style id="place"></style>`
|
|
65
|
+
+ `<div id="layer"></div>`;
|
|
54
66
|
}
|
|
55
67
|
/**
|
|
56
68
|
* Applies the tokens the handshake served.
|
|
@@ -67,22 +79,125 @@ export class FeedbackWidget {
|
|
|
67
79
|
style.textContent = '';
|
|
68
80
|
return;
|
|
69
81
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
declarations.push(`--pm-radius: ${radius}`);
|
|
78
|
-
const corner = POSITIONS[theme.position ?? 'bottom-right'];
|
|
79
|
-
if (corner)
|
|
80
|
-
declarations.push(corner);
|
|
81
|
-
style.textContent = declarations.length > 0 ? `:host { ${declarations.join('; ')} }` : '';
|
|
82
|
+
style.textContent = themeVars(theme);
|
|
83
|
+
this.buttonStyle = buttonStyleOf(theme);
|
|
84
|
+
// The corner is deliberately NOT written here. Where the widget sits is decided by one method
|
|
85
|
+
// that also has to account for the host page's furniture, and two style blocks both claiming
|
|
86
|
+
// --pm-bottom is how the second one silently wins.
|
|
87
|
+
this.themePlacement = theme.position;
|
|
88
|
+
this.applyPlacement();
|
|
82
89
|
this.launcherLabel = typeof theme.launcherLabel === 'string' && theme.launcherLabel.length > 0
|
|
83
90
|
? theme.launcherLabel.slice(0, 24)
|
|
84
91
|
: undefined;
|
|
85
92
|
}
|
|
93
|
+
/** Where the widget lives: the caller's choice, then the workspace's, then the bottom right. */
|
|
94
|
+
get placement() {
|
|
95
|
+
return this.options.placement ?? this.themePlacement ?? 'bottom-right';
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Writes the corner, plus whatever room the page's own furniture needs, as four numbers.
|
|
99
|
+
*
|
|
100
|
+
* Numbers rather than a keyword because a custom property holds a value, not a property name —
|
|
101
|
+
* "put it bottom left" has to be four offsets. They are computed together because the clearance
|
|
102
|
+
* is an addition to one of them, and `calc(auto + 12px)` is not a length.
|
|
103
|
+
*
|
|
104
|
+
* This used to be a lookup table, which is what kept a server-sent position out of the stylesheet:
|
|
105
|
+
* an unrecognised key found nothing. Nothing is looked up now, and the same property holds for a
|
|
106
|
+
* better reason — the value itself never reaches the CSS. Only the words `left`, `right`, `top`
|
|
107
|
+
* and `bottom`, chosen here, and two numbers.
|
|
108
|
+
*/
|
|
109
|
+
applyPlacement() {
|
|
110
|
+
const style = this.root.getElementById('place');
|
|
111
|
+
if (!style)
|
|
112
|
+
return;
|
|
113
|
+
const at = this.placement;
|
|
114
|
+
const near = at.startsWith('bottom') ? 'bottom' : 'top';
|
|
115
|
+
const side = at.endsWith('right') ? 'right' : 'left';
|
|
116
|
+
const offset = EDGE + this.clearance;
|
|
117
|
+
style.textContent = `:host {
|
|
118
|
+
--pm-${side}: ${EDGE}px; --pm-${side === 'right' ? 'left' : 'right'}: auto;
|
|
119
|
+
--pm-${near}: ${offset}px; --pm-${near === 'bottom' ? 'top' : 'bottom'}: auto;
|
|
120
|
+
}`;
|
|
121
|
+
}
|
|
122
|
+
/** The box the widget would occupy if nothing were in its way. What the probe measures. */
|
|
123
|
+
homeSlot() {
|
|
124
|
+
const at = this.placement;
|
|
125
|
+
const width = 220;
|
|
126
|
+
const height = 48;
|
|
127
|
+
const right = at.endsWith('right') ? window.innerWidth - EDGE : EDGE + width;
|
|
128
|
+
const bottom = at.startsWith('bottom') ? window.innerHeight - EDGE : EDGE + height;
|
|
129
|
+
return {
|
|
130
|
+
left: right - width,
|
|
131
|
+
right,
|
|
132
|
+
top: bottom - height,
|
|
133
|
+
bottom,
|
|
134
|
+
v: at.startsWith('bottom') ? 'bottom' : 'top',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Keeps out of the way of whatever else is in the corner, as that changes.
|
|
139
|
+
*
|
|
140
|
+
* Re-measured rather than measured once, because the button most likely to collide with ours is
|
|
141
|
+
* the one that is not there yet: a back-to-top arrow appears on scroll, a chat bubble loads a
|
|
142
|
+
* second after the page. Scroll, resize and DOM changes all trigger a re-read, coalesced into at
|
|
143
|
+
* most one per frame.
|
|
144
|
+
*
|
|
145
|
+
* Never while the composer is open. Moving a form out from under somebody's cursor mid-sentence
|
|
146
|
+
* is a worse thing to do to them than overlapping a button they are not currently using.
|
|
147
|
+
*/
|
|
148
|
+
watchClearance() {
|
|
149
|
+
if (this.options.avoidOverlap === false)
|
|
150
|
+
return;
|
|
151
|
+
let queued = false;
|
|
152
|
+
const measure = () => {
|
|
153
|
+
queued = false;
|
|
154
|
+
if (this.mode !== 'idle')
|
|
155
|
+
return;
|
|
156
|
+
try {
|
|
157
|
+
const next = measureClearance(this.homeSlot(), this.host);
|
|
158
|
+
// A pixel or two of churn is measurement noise, and acting on it makes the launcher shiver.
|
|
159
|
+
if (Math.abs(next - this.clearance) < 4)
|
|
160
|
+
return;
|
|
161
|
+
this.clearance = next;
|
|
162
|
+
this.applyPlacement();
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Whatever the page did to make this throw, the widget staying where it is beats the widget
|
|
166
|
+
// not being there. Politeness is not worth an exception on somebody else's page.
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
// Every capability here is checked rather than assumed. This runs inside mount, so an
|
|
170
|
+
// environment without one of them would otherwise mean no widget at all rather than a widget
|
|
171
|
+
// that does not dodge — which is how a courtesy becomes an outage.
|
|
172
|
+
const soon = typeof requestAnimationFrame === 'function'
|
|
173
|
+
? (fn) => requestAnimationFrame(fn)
|
|
174
|
+
: (fn) => setTimeout(fn, 16);
|
|
175
|
+
const schedule = () => {
|
|
176
|
+
if (queued)
|
|
177
|
+
return;
|
|
178
|
+
queued = true;
|
|
179
|
+
soon(measure);
|
|
180
|
+
};
|
|
181
|
+
window.addEventListener('scroll', schedule, { passive: true, capture: true });
|
|
182
|
+
window.addEventListener('resize', schedule);
|
|
183
|
+
this.detach.push(() => {
|
|
184
|
+
window.removeEventListener('scroll', schedule, { capture: true });
|
|
185
|
+
window.removeEventListener('resize', schedule);
|
|
186
|
+
});
|
|
187
|
+
// Attributes as well as children: the back-to-top button usually exists all along and is being
|
|
188
|
+
// shown by a class or a style, which is not a childList change.
|
|
189
|
+
if (typeof MutationObserver === 'function') {
|
|
190
|
+
const observer = new MutationObserver(schedule);
|
|
191
|
+
observer.observe(document.documentElement, {
|
|
192
|
+
childList: true,
|
|
193
|
+
subtree: true,
|
|
194
|
+
attributes: true,
|
|
195
|
+
attributeFilter: ['style', 'class', 'hidden'],
|
|
196
|
+
});
|
|
197
|
+
this.detach.push(() => observer.disconnect());
|
|
198
|
+
}
|
|
199
|
+
schedule();
|
|
200
|
+
}
|
|
86
201
|
setState(state) {
|
|
87
202
|
this.state = state;
|
|
88
203
|
if (this.host.isConnected)
|
|
@@ -90,7 +205,9 @@ export class FeedbackWidget {
|
|
|
90
205
|
}
|
|
91
206
|
mount() {
|
|
92
207
|
document.body.appendChild(this.host);
|
|
208
|
+
this.applyPlacement();
|
|
93
209
|
this.render();
|
|
210
|
+
this.watchClearance();
|
|
94
211
|
if (this.options.hotkey !== null) {
|
|
95
212
|
const hotkey = (this.options.hotkey ?? 'f').toLowerCase();
|
|
96
213
|
const onKey = (event) => {
|
|
@@ -104,6 +221,7 @@ export class FeedbackWidget {
|
|
|
104
221
|
if (this.mode === 'picking') {
|
|
105
222
|
this.mode = 'idle';
|
|
106
223
|
this.anchor = null;
|
|
224
|
+
this.dragged = null;
|
|
107
225
|
this.render();
|
|
108
226
|
}
|
|
109
227
|
return;
|
|
@@ -151,16 +269,69 @@ export class FeedbackWidget {
|
|
|
151
269
|
return { offered: true, checked: asked !== 'optional' };
|
|
152
270
|
}
|
|
153
271
|
/**
|
|
154
|
-
* Takes the widget off the screen and hands back the undo.
|
|
272
|
+
* Takes the widget off the screen, rings what the report is about, and hands back the undo.
|
|
273
|
+
*
|
|
274
|
+
* For the screen capture. It is `visibility`, not `display`, because removing the panel from
|
|
275
|
+
* layout would reflow the host page underneath it and the picture would be of a page that never
|
|
276
|
+
* existed.
|
|
155
277
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
278
|
+
* The UI hides but the host element stays visible, because the ring is drawn inside it. That is
|
|
279
|
+
* the whole reason to do it here rather than on the page: a report used to arrive as a selector,
|
|
280
|
+
* a text snapshot and a picture of a whole screen, leaving whoever read it to work out which of
|
|
281
|
+
* forty things on that screen the sentence was about. Now the picture says.
|
|
159
282
|
*/
|
|
160
283
|
conceal() {
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
284
|
+
const layer = this.root.getElementById('layer');
|
|
285
|
+
const previous = layer.style.visibility;
|
|
286
|
+
layer.style.visibility = 'hidden';
|
|
287
|
+
const ring = this.ringAnchor();
|
|
288
|
+
return () => {
|
|
289
|
+
layer.style.visibility = previous;
|
|
290
|
+
ring?.remove();
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* A ring over the pinned element, drawn in our own shadow root.
|
|
295
|
+
*
|
|
296
|
+
* Not on the element itself. Setting a style on somebody else's node means fighting their
|
|
297
|
+
* specificity, risking a reflow that changes the picture being taken, and owning the undo — and
|
|
298
|
+
* the undo is the part that bites: hidePrivate already exists to blur private fields for a frame,
|
|
299
|
+
* and its comment is about exactly this, that a page left permanently altered because a capture
|
|
300
|
+
* threw is worse than the bug being reported. A rectangle in our own layer touches nothing.
|
|
301
|
+
*
|
|
302
|
+
* No scrim over the rest, tempting as it is. A screenshot is also the record of what the page
|
|
303
|
+
* looked like, and dimming it changes the colours in a report that may well be about the colours.
|
|
304
|
+
* The ring is doubled — red, white, red — so it carries on a dark page and on a light one without
|
|
305
|
+
* altering either.
|
|
306
|
+
*
|
|
307
|
+
* Resolved at capture time rather than at pick time: the composer may have been open for a while,
|
|
308
|
+
* and where the element is NOW is where the picture will show it.
|
|
309
|
+
*/
|
|
310
|
+
ringAnchor() {
|
|
311
|
+
const selector = this.anchor?.selector;
|
|
312
|
+
if (!selector)
|
|
313
|
+
return null;
|
|
314
|
+
let target = null;
|
|
315
|
+
try {
|
|
316
|
+
target = document.querySelector(selector);
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
// A selector the page has since invalidated. No ring beats an exception mid-capture.
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
if (!target)
|
|
323
|
+
return null;
|
|
324
|
+
const rect = target.getBoundingClientRect();
|
|
325
|
+
if (rect.width < 1 || rect.height < 1)
|
|
326
|
+
return null;
|
|
327
|
+
const ring = document.createElement('div');
|
|
328
|
+
ring.className = 'ring';
|
|
329
|
+
ring.style.left = `${rect.left - RING_PAD}px`;
|
|
330
|
+
ring.style.top = `${rect.top - RING_PAD}px`;
|
|
331
|
+
ring.style.width = `${rect.width + RING_PAD * 2}px`;
|
|
332
|
+
ring.style.height = `${rect.height + RING_PAD * 2}px`;
|
|
333
|
+
this.root.appendChild(ring);
|
|
334
|
+
return ring;
|
|
164
335
|
}
|
|
165
336
|
/**
|
|
166
337
|
* Makes the panel draggable by its header, and snaps it to a side when it is let go near one.
|
|
@@ -174,8 +345,7 @@ export class FeedbackWidget {
|
|
|
174
345
|
handle.classList.add('drag');
|
|
175
346
|
handle.title = 'Drag to move · double-click to reset';
|
|
176
347
|
handle.addEventListener('dblclick', () => {
|
|
177
|
-
this.
|
|
178
|
-
writePlacement(null);
|
|
348
|
+
this.dragged = null;
|
|
179
349
|
this.place(panel);
|
|
180
350
|
});
|
|
181
351
|
handle.addEventListener('pointerdown', (event) => {
|
|
@@ -206,8 +376,7 @@ export class FeedbackWidget {
|
|
|
206
376
|
handle.removeEventListener('pointerup', drop);
|
|
207
377
|
handle.removeEventListener('pointercancel', drop);
|
|
208
378
|
panel.classList.remove('panel--dragging');
|
|
209
|
-
this.
|
|
210
|
-
writePlacement(this.placement);
|
|
379
|
+
this.dragged = stickToFrame(panel.getBoundingClientRect());
|
|
211
380
|
this.place(panel);
|
|
212
381
|
};
|
|
213
382
|
handle.addEventListener('pointermove', move);
|
|
@@ -215,9 +384,9 @@ export class FeedbackWidget {
|
|
|
215
384
|
handle.addEventListener('pointercancel', drop);
|
|
216
385
|
});
|
|
217
386
|
}
|
|
218
|
-
/** Applies the
|
|
387
|
+
/** Applies the drag, if there is one, or hands the panel back to its home corner. */
|
|
219
388
|
place(panel) {
|
|
220
|
-
const at = this.
|
|
389
|
+
const at = this.dragged;
|
|
221
390
|
if (!at) {
|
|
222
391
|
panel.style.left = panel.style.right = panel.style.top = panel.style.bottom = '';
|
|
223
392
|
return;
|
|
@@ -241,11 +410,14 @@ export class FeedbackWidget {
|
|
|
241
410
|
return;
|
|
242
411
|
}
|
|
243
412
|
if (this.mode === 'sent') {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
|
|
413
|
+
// Home, deliberately, and the drag is dropped on the way.
|
|
414
|
+
//
|
|
415
|
+
// The confirmation used to appear wherever the composer had been dragged to, which is the one
|
|
416
|
+
// place it should not: the reporter moved the panel to see something underneath it, the panel
|
|
417
|
+
// is gone, and a tick they were not looking for lands over that same spot. The reference in it
|
|
418
|
+
// is the only copy they will ever be shown, so it goes where the widget lives.
|
|
419
|
+
this.dragged = null;
|
|
420
|
+
layer.appendChild(this.sent());
|
|
249
421
|
return;
|
|
250
422
|
}
|
|
251
423
|
if (this.mode === 'picking') {
|
|
@@ -344,9 +516,7 @@ export class FeedbackWidget {
|
|
|
344
516
|
return note;
|
|
345
517
|
}
|
|
346
518
|
launcher() {
|
|
347
|
-
const button =
|
|
348
|
-
button.className = 'launcher';
|
|
349
|
-
button.textContent = this.launcherLabel ?? 'Feedback';
|
|
519
|
+
const button = launcherButton(this.buttonStyle, this.launcherLabel ?? 'Feedback');
|
|
350
520
|
button.title = this.options.hotkey === null
|
|
351
521
|
? 'Report a problem'
|
|
352
522
|
: `Report a problem (${(this.options.hotkey ?? 'f').toUpperCase()})`;
|
|
@@ -512,6 +682,7 @@ export class FeedbackWidget {
|
|
|
512
682
|
revoke(files);
|
|
513
683
|
this.mode = 'idle';
|
|
514
684
|
this.anchor = null;
|
|
685
|
+
this.dragged = null;
|
|
515
686
|
this.render();
|
|
516
687
|
};
|
|
517
688
|
panel.querySelector('#cancel').onclick = dismiss;
|
|
@@ -619,56 +790,50 @@ export async function copyText(text) {
|
|
|
619
790
|
scratch.remove();
|
|
620
791
|
}
|
|
621
792
|
}
|
|
622
|
-
/**
|
|
623
|
-
const SNAP = 72;
|
|
793
|
+
/** The margin every edge of the widget keeps from the frame. */
|
|
624
794
|
const EDGE = 16;
|
|
795
|
+
/** How far the ring sits outside the element it marks, so it frames rather than covers. */
|
|
796
|
+
const RING_PAD = 3;
|
|
625
797
|
/** Enough of the header must stay reachable to drag it back. */
|
|
626
798
|
const HANDLE = 56;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
799
|
+
/**
|
|
800
|
+
* Where a dropped panel lands: against the nearest edge of the frame, always.
|
|
801
|
+
*
|
|
802
|
+
* It used to stay wherever it was let go unless that happened to be within 72px of a side, so the
|
|
803
|
+
* usual outcome of a drag was a panel floating in the middle of somebody's page at whatever angle
|
|
804
|
+
* the reporter's hand left it. Against a side it reads as a tool that has been put somewhere; in
|
|
805
|
+
* the middle it reads as something dropped.
|
|
806
|
+
*
|
|
807
|
+
* Only the nearest axis pins. Drag it to the left edge halfway down the page and it goes flush
|
|
808
|
+
* left, still halfway down — moving it to a side should not also move it to a corner it was not
|
|
809
|
+
* taken to.
|
|
810
|
+
*
|
|
811
|
+
* Offsets from a corner rather than absolute coordinates, because absolute coordinates do not
|
|
812
|
+
* survive a resize: a panel dropped at x=1600 is off-screen the moment the window narrows, and the
|
|
813
|
+
* reporter cannot reach the header to drag it back.
|
|
814
|
+
*/
|
|
815
|
+
function stickToFrame(rect) {
|
|
816
|
+
const gaps = {
|
|
817
|
+
left: rect.left,
|
|
818
|
+
right: window.innerWidth - rect.right,
|
|
819
|
+
top: rect.top,
|
|
820
|
+
bottom: window.innerHeight - rect.bottom,
|
|
821
|
+
};
|
|
822
|
+
const nearest = Object.keys(gaps)
|
|
823
|
+
.reduce((closest, side) => (gaps[side] < gaps[closest] ? side : closest));
|
|
824
|
+
const h = nearest === 'left' || nearest === 'right'
|
|
825
|
+
? nearest
|
|
826
|
+
: gaps.left <= gaps.right ? 'left' : 'right';
|
|
827
|
+
const v = nearest === 'top' || nearest === 'bottom'
|
|
828
|
+
? nearest
|
|
829
|
+
: gaps.top <= gaps.bottom ? 'top' : 'bottom';
|
|
635
830
|
return {
|
|
636
831
|
h,
|
|
637
832
|
v,
|
|
638
|
-
dx:
|
|
639
|
-
dy:
|
|
833
|
+
dx: nearest === h ? EDGE : Math.max(EDGE, Math.round(gaps[h])),
|
|
834
|
+
dy: nearest === v ? EDGE : Math.max(EDGE, Math.round(gaps[v])),
|
|
640
835
|
};
|
|
641
836
|
}
|
|
642
|
-
function readPlacement() {
|
|
643
|
-
try {
|
|
644
|
-
const raw = localStorage.getItem(PLACEMENT_KEY);
|
|
645
|
-
if (!raw)
|
|
646
|
-
return null;
|
|
647
|
-
const parsed = JSON.parse(raw);
|
|
648
|
-
// Validated rather than trusted: this is storage the host page can also write to, and the
|
|
649
|
-
// values go straight into a style property.
|
|
650
|
-
return (parsed.h === 'left' || parsed.h === 'right')
|
|
651
|
-
&& (parsed.v === 'top' || parsed.v === 'bottom')
|
|
652
|
-
&& Number.isFinite(parsed.dx) && Number.isFinite(parsed.dy)
|
|
653
|
-
? parsed
|
|
654
|
-
: null;
|
|
655
|
-
}
|
|
656
|
-
catch {
|
|
657
|
-
return null;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
function writePlacement(placement) {
|
|
661
|
-
try {
|
|
662
|
-
if (placement)
|
|
663
|
-
localStorage.setItem(PLACEMENT_KEY, JSON.stringify(placement));
|
|
664
|
-
else
|
|
665
|
-
localStorage.removeItem(PLACEMENT_KEY);
|
|
666
|
-
}
|
|
667
|
-
catch {
|
|
668
|
-
// Private mode, or a full quota. Losing where the panel was put is not worth an exception on
|
|
669
|
-
// somebody else's page.
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
837
|
function clamp(value, min, max) {
|
|
673
838
|
return Math.min(Math.max(value, min), max);
|
|
674
839
|
}
|
|
@@ -680,18 +845,6 @@ function escapeHtml(value) {
|
|
|
680
845
|
* hard-coded rather than inherited for the same reason — a host app's dark mode should not make our
|
|
681
846
|
* text invisible.
|
|
682
847
|
*/
|
|
683
|
-
/**
|
|
684
|
-
* Where the launcher and the panel sit, as a pair of custom properties.
|
|
685
|
-
*
|
|
686
|
-
* A fixed map rather than free text: the value goes into a stylesheet, and a position that is not
|
|
687
|
-
* one of these four is a string somebody chose.
|
|
688
|
-
*/
|
|
689
|
-
const POSITIONS = {
|
|
690
|
-
'bottom-right': '--pm-left: auto; --pm-right: 16px; --pm-top: auto; --pm-bottom: 16px',
|
|
691
|
-
'bottom-left': '--pm-left: 16px; --pm-right: auto; --pm-top: auto; --pm-bottom: 16px',
|
|
692
|
-
'top-right': '--pm-left: auto; --pm-right: 16px; --pm-top: 16px; --pm-bottom: auto',
|
|
693
|
-
'top-left': '--pm-left: 16px; --pm-right: auto; --pm-top: 16px; --pm-bottom: auto',
|
|
694
|
-
};
|
|
695
848
|
/**
|
|
696
849
|
* A hex colour, an rgb()/hsl() call, or a plain CSS colour word.
|
|
697
850
|
*
|
|
@@ -703,37 +856,209 @@ function isColor(value) {
|
|
|
703
856
|
return typeof value === 'string'
|
|
704
857
|
&& /^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/deg]+\)|[a-z]{3,20})$/i.test(value.trim());
|
|
705
858
|
}
|
|
859
|
+
/**
|
|
860
|
+
* The two palettes, as declaration lists.
|
|
861
|
+
*
|
|
862
|
+
* Written once and used twice: the stylesheet takes them for its default and its media query, and a
|
|
863
|
+
* workspace that has chosen light or dark takes the same string for the theme block. Two copies of
|
|
864
|
+
* fourteen colours would agree on the day they were written and not for long after.
|
|
865
|
+
*/
|
|
866
|
+
/**
|
|
867
|
+
* The mark, inline.
|
|
868
|
+
*
|
|
869
|
+
* A speech bubble because it is the one shape nobody has to be taught. Drawn with currentColor so
|
|
870
|
+
* it belongs to whichever preset it is in — filled white on a pill, accent-coloured in an outline.
|
|
871
|
+
*/
|
|
872
|
+
const ICON = '<svg class="launcher__icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">'
|
|
873
|
+
+ '<path d="M2 6.2C2 4.4 3.4 3 5.2 3h5.6C12.6 3 14 4.4 14 6.2v2.6c0 1.8-1.4 3.2-3.2 3.2H7l-3 2.4'
|
|
874
|
+
+ 'v-2.5A3.2 3.2 0 0 1 2 8.8V6.2Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>';
|
|
875
|
+
/**
|
|
876
|
+
* A theme, as the declarations it becomes. Shared so the preview cannot drift from the real thing.
|
|
877
|
+
*
|
|
878
|
+
* Every value is validated against a shape rather than passed through: a colour that is not a
|
|
879
|
+
* colour would otherwise close the property and let the rest of the string be read as CSS, and this
|
|
880
|
+
* string arrives from a server.
|
|
881
|
+
*/
|
|
882
|
+
function themeVars(theme) {
|
|
883
|
+
const declarations = [];
|
|
884
|
+
if (isColor(theme.accent))
|
|
885
|
+
declarations.push(`--pm-accent: ${theme.accent}`);
|
|
886
|
+
const radius = { none: '0', sm: '6px', md: '12px', lg: '18px' }[theme.cornerRadius ?? 'md'];
|
|
887
|
+
if (radius)
|
|
888
|
+
declarations.push(`--pm-radius: ${radius}`);
|
|
889
|
+
// System is the default and is what the base stylesheet already does, so "auto" writes nothing at
|
|
890
|
+
// all. Only a workspace that has overruled the reader gets a palette pinned here — where it beats
|
|
891
|
+
// the media query by being a later stylesheet at the same specificity.
|
|
892
|
+
if (theme.colorScheme === 'dark')
|
|
893
|
+
declarations.push(DARK);
|
|
894
|
+
else if (theme.colorScheme === 'light')
|
|
895
|
+
declarations.push(LIGHT);
|
|
896
|
+
return declarations.length > 0 ? `:host { ${declarations.join('; ')} }` : '';
|
|
897
|
+
}
|
|
898
|
+
const buttonStyleOf = (theme) => BUTTON_STYLES.includes(theme.buttonStyle)
|
|
899
|
+
? theme.buttonStyle
|
|
900
|
+
: 'pill';
|
|
901
|
+
/**
|
|
902
|
+
* The launcher, as an element. One builder, so the settings screen shows the real button.
|
|
903
|
+
*
|
|
904
|
+
* The icon is markup rather than a font or an image: one is a network request on somebody else's
|
|
905
|
+
* page and the other is a glyph that may not be there. The label is escaped on the way in — it
|
|
906
|
+
* arrives from the handshake, and everything from there is treated as data.
|
|
907
|
+
*/
|
|
908
|
+
function launcherButton(style, label) {
|
|
909
|
+
const button = document.createElement('button');
|
|
910
|
+
button.className = `launcher launcher--${style}`;
|
|
911
|
+
if (style === 'icon') {
|
|
912
|
+
button.innerHTML = ICON;
|
|
913
|
+
// Nothing to read, so the name has to come from somewhere. Without this the button is announced
|
|
914
|
+
// as "button" and a screen reader user has no idea what it does.
|
|
915
|
+
button.setAttribute('aria-label', label);
|
|
916
|
+
}
|
|
917
|
+
else if (style === 'pill-icon') {
|
|
918
|
+
button.innerHTML = `${ICON}<span>${escapeHtml(label)}</span>`;
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
button.textContent = label;
|
|
922
|
+
}
|
|
923
|
+
return button;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Draws the launcher, and only the launcher, inside an element you own.
|
|
927
|
+
*
|
|
928
|
+
* For a settings screen that has to show what a theme will look like before anybody saves it. It is
|
|
929
|
+
* the real button with the real stylesheet in a real shadow root: a second implementation in the
|
|
930
|
+
* console's own CSS would be a picture of the widget rather than the widget, and would begin lying
|
|
931
|
+
* the first time either one changed.
|
|
932
|
+
*
|
|
933
|
+
* Nothing else comes with it — no handshake, no listeners, no page-level positioning — so it is
|
|
934
|
+
* safe to call ten times on one screen. Call it again to change the theme; it replaces what it drew.
|
|
935
|
+
*/
|
|
936
|
+
export function previewLauncher(into, theme = {}) {
|
|
937
|
+
const root = into.shadowRoot ?? into.attachShadow({ mode: 'open' });
|
|
938
|
+
const label = typeof theme.launcherLabel === 'string' && theme.launcherLabel.length > 0
|
|
939
|
+
? theme.launcherLabel.slice(0, 24)
|
|
940
|
+
: 'Feedback';
|
|
941
|
+
root.innerHTML = `<style>${STYLES}</style><style>${themeVars(theme)}</style>`;
|
|
942
|
+
const button = launcherButton(buttonStyleOf(theme), label);
|
|
943
|
+
// In place, not pinned to the viewport: the caller is laying these out in a row.
|
|
944
|
+
button.classList.add('launcher--preview');
|
|
945
|
+
button.disabled = true;
|
|
946
|
+
root.appendChild(button);
|
|
947
|
+
}
|
|
948
|
+
/** The button shapes a workspace can choose between. Anything else falls back to the first. */
|
|
949
|
+
const BUTTON_STYLES = ['pill', 'pill-icon', 'icon', 'text', 'outline'];
|
|
950
|
+
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;';
|
|
951
|
+
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;';
|
|
706
952
|
const STYLES = `
|
|
953
|
+
/*
|
|
954
|
+
Every colour in this file is one of these, and there are two sets of them.
|
|
955
|
+
|
|
956
|
+
Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
|
|
957
|
+
application is a flashbang. It followed the host's scheme in exactly one respect before — it did
|
|
958
|
+
not, and was always light.
|
|
959
|
+
|
|
960
|
+
System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
|
|
961
|
+
a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
|
|
962
|
+
dark gets those values written into the theme block instead, which is a later stylesheet at the
|
|
963
|
+
same specificity and therefore wins over the query.
|
|
964
|
+
|
|
965
|
+
The accent pair is inverse emphasis — a dark pill on a light page, a light pill on a dark one —
|
|
966
|
+
because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
|
|
967
|
+
near-black application is a button nobody finds. A host that sets its own accent gets white text
|
|
968
|
+
on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
|
|
969
|
+
the one case where a very pale brand colour needs its own care.
|
|
970
|
+
*/
|
|
707
971
|
:host {
|
|
708
972
|
all: initial;
|
|
709
973
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
"put it on the left" has to be four numbers and not one word. */
|
|
713
|
-
--pm-accent: #171717;
|
|
974
|
+
${LIGHT}
|
|
975
|
+
|
|
714
976
|
--pm-radius: 12px;
|
|
977
|
+
|
|
978
|
+
/* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
|
|
979
|
+
"put it on the left" has to be four numbers and not one word. */
|
|
715
980
|
--pm-left: auto;
|
|
716
981
|
--pm-right: 16px;
|
|
717
982
|
--pm-top: auto;
|
|
718
983
|
--pm-bottom: 16px;
|
|
719
984
|
}
|
|
985
|
+
|
|
986
|
+
@media (prefers-color-scheme: dark) {
|
|
987
|
+
:host { ${DARK} }
|
|
988
|
+
}
|
|
989
|
+
}
|
|
720
990
|
* { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
|
|
991
|
+
@media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
|
|
721
992
|
#layer { position: fixed; inset: 0; pointer-events: none }
|
|
722
993
|
.launcher {
|
|
723
994
|
position: fixed; pointer-events: auto;
|
|
724
995
|
left: var(--pm-left); right: var(--pm-right);
|
|
725
996
|
top: var(--pm-top); bottom: var(--pm-bottom);
|
|
997
|
+
/* A back-to-top button appearing on scroll moves us; gliding reads as making room, and jumping
|
|
998
|
+
reads as a bug. Honoured only where motion is welcome. */
|
|
999
|
+
transition: bottom .18s ease, top .18s ease;
|
|
726
1000
|
padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
|
|
727
|
-
background: var(--pm-accent); color:
|
|
1001
|
+
background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
|
|
728
1002
|
box-shadow: 0 2px 12px rgba(0,0,0,.3);
|
|
729
1003
|
}
|
|
730
1004
|
.launcher:hover { filter: brightness(1.15) }
|
|
731
1005
|
.launcher--pending { cursor: default; opacity: .85 }
|
|
732
1006
|
.launcher--pending:hover { filter: none }
|
|
1007
|
+
.launcher__icon { flex: none; width: 15px; height: 15px; display: block }
|
|
1008
|
+
/* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
|
|
1009
|
+
.launcher--preview { position: static; cursor: default; opacity: 1 }
|
|
1010
|
+
|
|
1011
|
+
/*
|
|
1012
|
+
Five buttons, because one button cannot be right for every page it is a guest on.
|
|
1013
|
+
|
|
1014
|
+
A product with its own bold chat bubble does not want a second bold pill beside it; a spare
|
|
1015
|
+
documentation site does not want a filled button at all; a dense application often wants the
|
|
1016
|
+
smallest possible mark. The set is deliberately small — five things somebody can look at and
|
|
1017
|
+
choose between in a moment, rather than a colour picker and a padding field.
|
|
1018
|
+
|
|
1019
|
+
Every one of them keeps the same hit area at the same corner, so the clearance measurement and
|
|
1020
|
+
the placement work unchanged whichever is picked.
|
|
1021
|
+
*/
|
|
1022
|
+
.launcher { display: inline-flex; align-items: center; gap: 7px }
|
|
1023
|
+
|
|
1024
|
+
/* Filled and round. The default, and the one that reads as a product feature. */
|
|
1025
|
+
.launcher--pill {}
|
|
1026
|
+
|
|
1027
|
+
/* The same, with the icon in front for pages where a word alone reads as body text. */
|
|
1028
|
+
.launcher--pill-icon {}
|
|
1029
|
+
|
|
1030
|
+
/* The mark on its own, for a corner that is already busy. */
|
|
1031
|
+
.launcher--icon { padding: 10px; border-radius: 999px }
|
|
1032
|
+
|
|
1033
|
+
/* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
|
|
1034
|
+
.launcher--text {
|
|
1035
|
+
background: transparent; color: var(--pm-ink); box-shadow: none;
|
|
1036
|
+
padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
|
|
1037
|
+
}
|
|
1038
|
+
.launcher--text:hover { filter: none; color: var(--pm-accent) }
|
|
1039
|
+
|
|
1040
|
+
/* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
|
|
1041
|
+
.launcher--outline {
|
|
1042
|
+
background: transparent; color: var(--pm-accent);
|
|
1043
|
+
border: 1px solid currentColor; box-shadow: none;
|
|
1044
|
+
}
|
|
1045
|
+
.launcher--outline:hover { filter: none; background: var(--pm-sunken) }
|
|
733
1046
|
.mask {
|
|
734
1047
|
position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
|
|
735
1048
|
background: rgba(23,23,23,.12);
|
|
736
1049
|
}
|
|
1050
|
+
/*
|
|
1051
|
+
The pinned element, ringed for the screenshot.
|
|
1052
|
+
|
|
1053
|
+
Three rings rather than one: a red line alone disappears against a red button, and a white one
|
|
1054
|
+
disappears against a white card. Red, then white, then a soft red — one of the three is always
|
|
1055
|
+
against something it contrasts with, on any page, without touching that page's own colours.
|
|
1056
|
+
*/
|
|
1057
|
+
.ring {
|
|
1058
|
+
position: fixed; pointer-events: none; border-radius: 3px;
|
|
1059
|
+
border: 2px solid #ef4444;
|
|
1060
|
+
box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
|
|
1061
|
+
}
|
|
737
1062
|
/*
|
|
738
1063
|
Bottom, not top.
|
|
739
1064
|
|
|
@@ -745,18 +1070,18 @@ const STYLES = `
|
|
|
745
1070
|
*/
|
|
746
1071
|
.hint {
|
|
747
1072
|
position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
|
|
748
|
-
padding: 7px 12px; border-radius: 8px; background:
|
|
1073
|
+
padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
|
|
749
1074
|
font-size: 12px; white-space: nowrap;
|
|
750
1075
|
}
|
|
751
1076
|
kbd {
|
|
752
|
-
padding: 1px 5px; border-radius: 4px; background:
|
|
1077
|
+
padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
|
|
753
1078
|
font-family: ui-monospace, monospace; font-size: 11px;
|
|
754
1079
|
}
|
|
755
1080
|
.panel {
|
|
756
1081
|
position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
|
|
757
1082
|
left: var(--pm-left); right: var(--pm-right);
|
|
758
1083
|
top: var(--pm-top); bottom: var(--pm-bottom);
|
|
759
|
-
padding: 16px; border-radius: var(--pm-radius); background:
|
|
1084
|
+
padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
|
|
760
1085
|
box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
|
|
761
1086
|
}
|
|
762
1087
|
.panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
|
|
@@ -772,29 +1097,29 @@ kbd {
|
|
|
772
1097
|
*/
|
|
773
1098
|
.drag { cursor: grab; touch-action: none; user-select: none }
|
|
774
1099
|
.drag:active { cursor: grabbing }
|
|
775
|
-
.panel__grip { flex: none; color:
|
|
776
|
-
.drag:hover .panel__grip { color:
|
|
1100
|
+
.panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
|
|
1101
|
+
.drag:hover .panel__grip { color: var(--pm-muted) }
|
|
777
1102
|
.panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
|
|
778
1103
|
|
|
779
1104
|
/* An incomplete report, said plainly. Amber rather than red: the words arrived. */
|
|
780
|
-
.sent__warn { margin-top: 6px; color:
|
|
1105
|
+
.sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
|
|
781
1106
|
|
|
782
1107
|
/* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
|
|
783
1108
|
.panel__anchor {
|
|
784
|
-
color:
|
|
1109
|
+
color: var(--pm-muted); font-size: 11px;
|
|
785
1110
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
786
1111
|
}
|
|
787
1112
|
.panel__close {
|
|
788
1113
|
margin-left: auto; border: 0; background: none; cursor: pointer;
|
|
789
|
-
color:
|
|
1114
|
+
color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
|
|
790
1115
|
}
|
|
791
|
-
.panel__close:hover { color:
|
|
1116
|
+
.panel__close:hover { color: var(--pm-ink) }
|
|
792
1117
|
|
|
793
1118
|
/* A confirmation, not a form. */
|
|
794
1119
|
.panel--sent { display: flex; align-items: flex-start; gap: 10px }
|
|
795
1120
|
.sent__tick {
|
|
796
1121
|
flex: none; width: 24px; height: 24px; border-radius: 999px;
|
|
797
|
-
background:
|
|
1122
|
+
background: var(--pm-good-bg); color: var(--pm-good);
|
|
798
1123
|
display: grid; place-items: center; font-size: 14px;
|
|
799
1124
|
}
|
|
800
1125
|
.sent__body { min-width: 0 }
|
|
@@ -803,28 +1128,28 @@ kbd {
|
|
|
803
1128
|
.sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
|
|
804
1129
|
.sent__id {
|
|
805
1130
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
|
|
806
|
-
color:
|
|
1131
|
+
color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
|
|
807
1132
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
808
1133
|
}
|
|
809
1134
|
.sent__copy {
|
|
810
|
-
flex: none; border: 1px solid
|
|
811
|
-
color:
|
|
1135
|
+
flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
|
|
1136
|
+
color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
|
|
812
1137
|
}
|
|
813
|
-
.sent__copy:hover { border-color:
|
|
814
|
-
.sent__copy--done { border-color:
|
|
1138
|
+
.sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
|
|
1139
|
+
.sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
|
|
815
1140
|
|
|
816
1141
|
.panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
|
|
817
1142
|
.kind {
|
|
818
|
-
flex: 1; padding: 5px 0; border: 1px solid
|
|
819
|
-
background:
|
|
1143
|
+
flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
|
|
1144
|
+
background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
|
|
820
1145
|
}
|
|
821
|
-
.kind--on { border-color:
|
|
1146
|
+
.kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
|
|
822
1147
|
textarea, input[type=email] {
|
|
823
|
-
width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid
|
|
824
|
-
border-radius: 8px; font-size: 13px; resize: vertical; color:
|
|
1148
|
+
width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
|
|
1149
|
+
border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
|
|
825
1150
|
}
|
|
826
|
-
textarea:focus, input:focus { outline: 2px solid
|
|
827
|
-
.shot { display: flex; align-items: center; gap: 6px; color:
|
|
1151
|
+
textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
|
|
1152
|
+
.shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
|
|
828
1153
|
|
|
829
1154
|
/*
|
|
830
1155
|
One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
|
|
@@ -832,16 +1157,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
|
|
|
832
1157
|
*/
|
|
833
1158
|
.panel__foot {
|
|
834
1159
|
display: flex; align-items: center; gap: 8px; margin-top: 12px;
|
|
835
|
-
padding-top: 12px; border-top: 1px solid
|
|
1160
|
+
padding-top: 12px; border-top: 1px solid var(--pm-sunken);
|
|
836
1161
|
}
|
|
837
|
-
.panel__note { flex: 1; color:
|
|
1162
|
+
.panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
|
|
838
1163
|
.primary, .ghost {
|
|
839
1164
|
padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
|
|
840
1165
|
}
|
|
841
|
-
.primary { border: 0; background:
|
|
1166
|
+
.primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
|
|
842
1167
|
.primary:disabled { opacity: .5; cursor: default }
|
|
843
|
-
.ghost { border: 0; background: transparent; color:
|
|
844
|
-
.status { margin-top: 6px; color:
|
|
1168
|
+
.ghost { border: 0; background: transparent; color: var(--pm-muted) }
|
|
1169
|
+
.status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
|
|
845
1170
|
/*
|
|
846
1171
|
One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
|
|
847
1172
|
stacked — two affordances for one job, and together the busiest part of a panel whose busiest part
|
|
@@ -849,16 +1174,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
|
|
|
849
1174
|
*/
|
|
850
1175
|
.drop {
|
|
851
1176
|
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
|
|
852
|
-
margin-top: 8px; padding: 8px 10px; border: 1px dashed
|
|
853
|
-
color:
|
|
1177
|
+
margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
|
|
1178
|
+
color: var(--pm-faint); font-size: 11px;
|
|
854
1179
|
}
|
|
855
|
-
.drop__or { color:
|
|
856
|
-
.drop--over { border-color:
|
|
1180
|
+
.drop__or { color: var(--pm-faint) }
|
|
1181
|
+
.drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
|
|
857
1182
|
.files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
|
|
858
|
-
.file { display: flex; align-items: center; gap: 6px; font-size: 11px; color:
|
|
859
|
-
.file--bad { color:
|
|
1183
|
+
.file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
|
|
1184
|
+
.file--bad { color: var(--pm-warn) }
|
|
860
1185
|
.file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
|
|
861
1186
|
.file__icon { width: 28px; text-align: center }
|
|
862
1187
|
.file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
|
863
|
-
.link { border: 0; background: transparent; color:
|
|
1188
|
+
.link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
|
|
864
1189
|
`;
|