@vitrinka/web 0.8.2 → 0.9.1
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/CHANGELOG.md +55 -0
- package/README.md +15 -8
- package/build/recorder/version.d.ts +2 -2
- package/build/recorder/version.js +1 -1
- package/build/report/i18n.d.ts +10 -2
- package/build/report/i18n.js +22 -6
- package/build/report/keybind.d.ts +10 -0
- package/build/report/keybind.js +23 -9
- package/build/report/place.d.ts +11 -0
- package/build/report/place.js +14 -0
- package/build/report/settings.d.ts +7 -1
- package/build/report/settings.js +8 -0
- package/build/report/styles.d.ts +1 -1
- package/build/report/styles.js +32 -14
- package/build/report/widget.d.ts +6 -2
- package/build/report/widget.js +135 -54
- package/build/report-widget.mjs +38 -20
- package/package.json +1 -1
package/build/report/widget.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* one numbered note line per mark, and Send — the capture frozen when the
|
|
10
10
|
* card opens (the buffer rolls on).
|
|
11
11
|
* - "Show us where" marks the frozen page under a top bar (vt-8020 D6 A): a segmented
|
|
12
|
-
*
|
|
12
|
+
* box · circle · arrow · cover, and Cancel, which leaves marking and drops
|
|
13
13
|
* this pass's marks (vt-8020 D12). The card stays on screen while marking, parked
|
|
14
14
|
* in the corner that covers none of the marks (place.ts). No element
|
|
15
|
-
* selector.
|
|
16
|
-
*
|
|
17
|
-
* move".
|
|
15
|
+
* selector. While marking, a coach rides on the card's top edge, never over
|
|
16
|
+
* the page: a tiny run of the picked shape's gesture and the words "click,
|
|
17
|
+
* hold and move", until the person presses "Got it, don't show again".
|
|
18
18
|
* - The reporter's files (vt-8020 D9, attachments.ts): 📎 in the card's foot,
|
|
19
19
|
* paste or drop onto the card; chips above the foot, refused at once past
|
|
20
20
|
* the project's caps, sent on the wire's attachment leg.
|
|
@@ -40,23 +40,26 @@ import { memberLinked, rememberDisplayMode } from './face';
|
|
|
40
40
|
import { acquireEngine, releaseEngine } from './engine';
|
|
41
41
|
import { browserLocale, parseLocale, REPORT_KINDS, strings } from './i18n';
|
|
42
42
|
import { normalizeIdentity, onSharedIdentity, sharedIdentity } from './identity';
|
|
43
|
-
import { keybindLabel, loadKeybind, matchesKeybind, readKeybindPress, saveKeybind, watchKeybind } from './keybind';
|
|
43
|
+
import { keybindAria, keybindLabel, loadKeybind, matchesKeybind, readKeybindPress, saveKeybind, watchKeybind } from './keybind';
|
|
44
44
|
import { arrowEnds, arrowHead, isMark, rectBetween, renumber, toWire, } from './markers';
|
|
45
|
-
import { cornerRect, pickCorner } from './place';
|
|
45
|
+
import { coachSide, cornerRect, pickCorner } from './place';
|
|
46
46
|
import { listMine, openSession, sessionLive } from './reader';
|
|
47
47
|
import { noteSent, readSent } from './sent';
|
|
48
|
-
import { readSize, SIZE_KEY, SIZE_SCALE, SIZES, techDetails, writePref } from './settings';
|
|
48
|
+
import { COACH_KEY, readCoach, readSize, SIZE_KEY, SIZE_SCALE, SIZES, techDetails, writePref } from './settings';
|
|
49
49
|
import { REPORT_CSS } from './styles';
|
|
50
50
|
import { EMPTY_CAPTURE, prepareCapture, ReportJob } from './wire';
|
|
51
51
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
52
52
|
const TITLE_CAP = 100;
|
|
53
|
-
|
|
53
|
+
/** The box leads and is the default: most problems are a region, and a box is the one gesture nobody has to learn. */
|
|
54
|
+
const TOOLS = ['box', 'circle', 'arrow', 'hide'];
|
|
54
55
|
/** A keyboard mark starts as this, centred; arrows move it 10 px, Shift+arrows resize it. */
|
|
55
56
|
const KB_DRAFT = { w: 160, h: 80 };
|
|
56
57
|
const MIN_KB_SIZE = 16;
|
|
57
58
|
/** The one card's size (vt-8020 D10: it never changes between states) and the clear band the marking bar keeps at the top. */
|
|
58
59
|
const CARD = { w: 380, h: 460 };
|
|
59
60
|
const BAR_CLEAR = 72;
|
|
61
|
+
/** The coach's box beside the card (styles: `.coach`), before the size setting scales it, and its gap to the card. */
|
|
62
|
+
const COACH = { w: 300, h: 160, gap: 10 };
|
|
60
63
|
/** The gap a parked card keeps on a side it did not rest against. */
|
|
61
64
|
const PARK_EDGE = 16;
|
|
62
65
|
const KB_STEPS = {
|
|
@@ -85,19 +88,68 @@ const ICON = {
|
|
|
85
88
|
pen: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10.8 2.7l2.5 2.5-7.6 7.6-3.1 0.6 0.6-3.1z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>',
|
|
86
89
|
check: '<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M7.5 12.3l3 3 6-6.3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
87
90
|
};
|
|
88
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* The coach's run of the picked shape (D21): a pointer presses, holds and moves, and the shape grows under it.
|
|
93
|
+
* ONE clock: every moving part is SMIL in the same SVG with the same keyTimes and linear timing, so the pointer
|
|
94
|
+
* and the stroke stay locked frame for frame (a CSS-eased stroke beside a linear SMIL pointer drew ahead of it).
|
|
95
|
+
*/
|
|
96
|
+
const COACH_TIMES = '0;0.18;0.72;1';
|
|
97
|
+
const COACH_DUR = '2.8s';
|
|
89
98
|
const LOOP_PATH = 'M 134 14 C 200 14, 214 50, 134 50 C 54 50, 68 14, 134 14';
|
|
90
|
-
|
|
99
|
+
const POINTER_SHAPE = '<path d="M0 0 L0 15 L4 11 L7 18 L10 16.6 L7 10 L12.5 10 Z" fill="#fff" stroke="#151417" stroke-width="1"/>';
|
|
100
|
+
/** One value run on the coach clock: still at `from`, moving to `to`, still at `to`. */
|
|
101
|
+
function coachAnim(attr, from, to) {
|
|
102
|
+
return `<animate attributeName="${attr}" values="${from};${from};${to};${to}" keyTimes="${COACH_TIMES}" calcMode="linear" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
103
|
+
}
|
|
104
|
+
function coachArt(shape, reduced) {
|
|
105
|
+
const still = (from, to) => (reduced ? to : from);
|
|
106
|
+
const anim = (attr, from, to) => (reduced ? '' : coachAnim(attr, from, to));
|
|
107
|
+
// The finished shape fades as the loop turns over; the press ring shows while the button is held.
|
|
108
|
+
const fade = reduced ? '' : `<animate attributeName="opacity" values="1;1;0" keyTimes="0;0.9;1" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
109
|
+
const hold = reduced
|
|
110
|
+
? ''
|
|
111
|
+
: `<animate attributeName="opacity" values="0;0;.9;.9;0;0" keyTimes="0;0.08;0.14;0.72;0.8;1" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
112
|
+
let scene;
|
|
113
|
+
let path;
|
|
114
|
+
let end;
|
|
115
|
+
if (shape === 'circle') {
|
|
116
|
+
path = LOOP_PATH;
|
|
117
|
+
end = { x: 134, y: 14 };
|
|
118
|
+
scene =
|
|
119
|
+
'<rect class="bar" x="84" y="27" width="100" height="10" rx="5"/>' +
|
|
120
|
+
`<path class="loop" d="${LOOP_PATH}" pathLength="200" stroke-dasharray="200" stroke-dashoffset="${still(200, 0)}">${anim('stroke-dashoffset', 200, 0)}${fade}</path>`;
|
|
121
|
+
}
|
|
122
|
+
else if (shape === 'arrow') {
|
|
123
|
+
path = 'M 74 54 L 128 33';
|
|
124
|
+
end = { x: 128, y: 33 };
|
|
125
|
+
// A zero-length line still paints its head, pointing nowhere: the arrow shows only once it moves.
|
|
126
|
+
const show = reduced ? '' : `<animate attributeName="opacity" values="0;0;1;1;0" keyTimes="0;0.18;0.19;0.9;1" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
127
|
+
scene =
|
|
128
|
+
'<defs><marker id="vr-coach-head" viewBox="0 0 10 10" refX="7" refY="5" markerWidth="5" markerHeight="5" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="#e6455f"/></marker></defs>' +
|
|
129
|
+
'<rect class="bar" x="136" y="27" width="70" height="10" rx="5"/>' +
|
|
130
|
+
`<line class="loop" x1="74" y1="54" x2="${still(74, 128)}" y2="${still(54, 33)}" marker-end="url(#vr-coach-head)"${reduced ? '' : ' opacity="0"'}>${anim('x2', 74, 128)}${anim('y2', 54, 33)}${show}</line>`;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// box and cover share the drag; a cover fills, so what is under it reads as gone.
|
|
134
|
+
const cover = shape === 'hide';
|
|
135
|
+
path = cover ? 'M 90 10 L 178 54' : 'M 96 12 L 172 52';
|
|
136
|
+
end = cover ? { x: 178, y: 54 } : { x: 172, y: 52 };
|
|
137
|
+
const x = cover ? 90 : 96;
|
|
138
|
+
const y = cover ? 10 : 12;
|
|
139
|
+
const w = end.x - x;
|
|
140
|
+
const hgt = end.y - y;
|
|
141
|
+
scene =
|
|
142
|
+
(cover
|
|
143
|
+
? '<rect class="bar" x="102" y="20" width="64" height="8" rx="4"/><rect class="bar" x="102" y="35" width="44" height="8" rx="4"/>'
|
|
144
|
+
: '<rect class="bar" x="110" y="27" width="48" height="10" rx="5"/>') +
|
|
145
|
+
`<rect class="${cover ? 'veil' : 'loop'}" x="${x}" y="${y}" width="${still(0, w)}" height="${still(0, hgt)}" rx="${cover ? 4 : 6}">${anim('width', 0, w)}${anim('height', 0, hgt)}${fade}</rect>`;
|
|
146
|
+
}
|
|
91
147
|
const motion = reduced
|
|
92
148
|
? ''
|
|
93
|
-
: `<animateMotion dur="
|
|
94
|
-
return (
|
|
95
|
-
|
|
96
|
-
`<
|
|
97
|
-
`<g class="pointer"${reduced ? ' transform="translate(134 14)"' : ''}>` +
|
|
98
|
-
'<circle class="hold" r="9"/>' +
|
|
99
|
-
'<path d="M0 0 L0 15 L4 11 L7 18 L10 16.6 L7 10 L12.5 10 Z" fill="#fff" stroke="#151417" stroke-width="1"/>' +
|
|
100
|
-
`${motion}</g></svg>`);
|
|
149
|
+
: `<animateMotion dur="${COACH_DUR}" repeatCount="indefinite" keyPoints="0;0;1;1" keyTimes="${COACH_TIMES}" calcMode="linear" path="${path}"/>`;
|
|
150
|
+
return (`<svg viewBox="0 0 268 64" aria-hidden="true" data-shape="${shape}">${scene}` +
|
|
151
|
+
`<g class="pointer"${reduced ? ` transform="translate(${end.x} ${end.y})"` : ''}>` +
|
|
152
|
+
`<circle class="hold" r="9"${reduced ? ' opacity=".9"' : ' opacity="0"'}>${hold}</circle>${POINTER_SHAPE}${motion}</g></svg>`);
|
|
101
153
|
}
|
|
102
154
|
function h(tag, attrs = {}, ...kids) {
|
|
103
155
|
const el = document.createElement(tag);
|
|
@@ -189,7 +241,9 @@ export function hitsOpener(ev, sel) {
|
|
|
189
241
|
/** The widget's DOM, built once into the HUD host's shadow mount. */
|
|
190
242
|
function buildDom(mount) {
|
|
191
243
|
const fabLabel = h('span');
|
|
192
|
-
|
|
244
|
+
// The chord is painted for the eye only: in the name it would rename the button ("Report a problem Alt+Shift+A");
|
|
245
|
+
// assistive technology hears it from aria-keyshortcuts (paint).
|
|
246
|
+
const fabKbd = h('kbd', { 'aria-hidden': 'true' });
|
|
193
247
|
const fab = h('button', { class: 'fab', type: 'button', part: 'button', 'aria-haspopup': 'dialog' }, fabLabel, fabKbd);
|
|
194
248
|
const title = h('h2', { id: 'vr-title' });
|
|
195
249
|
// Who you are, at a glance (vt-8020 D5 A): the chip opens the account popover, ⋯ the menu.
|
|
@@ -261,11 +315,14 @@ function buildDom(mount) {
|
|
|
261
315
|
sizeButtons.set(z, h('button', { type: 'button', role: 'radio', 'aria-checked': 'false', 'data-size': z }));
|
|
262
316
|
const sizeInd = h('span', { class: 'seg-ind', 'aria-hidden': 'true' });
|
|
263
317
|
const sizeSeg = h('div', { class: 'seg', role: 'radiogroup', 'aria-labelledby': 'vr-size-label' }, sizeInd, ...sizeButtons.values());
|
|
318
|
+
// The marking tips: the way back after "Got it, don't show again".
|
|
319
|
+
const coachLabel = h('span', { class: 'label', id: 'vr-coach-label' });
|
|
320
|
+
const coachSwitch = h('button', { class: 'switch', type: 'button', role: 'switch', 'aria-checked': 'true', 'aria-labelledby': 'vr-coach-label' }, h('span', { class: 'knob', 'aria-hidden': 'true' }));
|
|
264
321
|
// Technical details: read-only, for support conversations.
|
|
265
322
|
const techText = h('span');
|
|
266
323
|
const techBtn = h('button', { class: 'link', type: 'button', 'aria-expanded': 'false', 'aria-controls': 'vr-tech' }, techText, icon(ICON.chevron));
|
|
267
324
|
const tech = h('dl', { class: 'tech', id: 'vr-tech' });
|
|
268
|
-
const settings = h('div', { class: 'pane settings' }, h('div', { class: 'row' }, bindLabel, bindBtn), bindReason, bindHint, h('div', { class: 'row size-row' }, sizeLabel, sizeSeg), h('div', { class: 'tech-wrap' }, techBtn, tech), h('div', { class: 'settings-foot' }, back, unbind));
|
|
325
|
+
const settings = h('div', { class: 'pane settings' }, h('div', { class: 'row' }, bindLabel, bindBtn), bindReason, bindHint, h('div', { class: 'row size-row' }, sizeLabel, sizeSeg), h('div', { class: 'row tips-row' }, coachLabel, coachSwitch), h('div', { class: 'tech-wrap' }, techBtn, tech), h('div', { class: 'settings-foot' }, back, unbind));
|
|
269
326
|
const sentTitle = h('h3');
|
|
270
327
|
const sentBody = h('p', { class: 'sent-body' });
|
|
271
328
|
const seeText = h('span');
|
|
@@ -294,8 +351,17 @@ function buildDom(mount) {
|
|
|
294
351
|
const linkWait = h('p', { class: 'list-status', role: 'status' });
|
|
295
352
|
const linkRetry = h('button', { class: 'link', type: 'button' });
|
|
296
353
|
const linking = h('div', { class: 'pane linking' }, linkBack, linkLabel, linkCode, h('div', { class: 'link-go' }, linkOpen, linkQr), linkHint, linkWait, linkRetry);
|
|
354
|
+
// The coach (vt-8020) rides on the card's top edge while marking, never over the page it teaches about;
|
|
355
|
+
// its art follows the picked shape (paint), and one button turns it off for good.
|
|
356
|
+
const coachArtSlot = h('div', { class: 'coach-art' });
|
|
357
|
+
const coachText = h('p');
|
|
358
|
+
const coachMore = h('p');
|
|
359
|
+
const coachDismiss = h('button', { class: 'coach-ok', type: 'button' });
|
|
360
|
+
const coach = h('div', { class: 'coach', role: 'status' }, coachArtSlot, coachText, coachMore, coachDismiss);
|
|
361
|
+
// How to mark from the keyboard: the marking layer's description, for assistive technology only.
|
|
362
|
+
const coachKeys = h('p', { class: 'sr-only', id: 'vr-keys' });
|
|
297
363
|
const body = h('div', { class: 'body' }, describe, settings, sent, reports, recents, linking);
|
|
298
|
-
const card = h('section', { class: 'card', role: 'dialog', 'aria-modal': 'false', 'aria-labelledby': 'vr-title' }, head, accountPop, morePop, body, tray, foot);
|
|
364
|
+
const card = h('section', { class: 'card', role: 'dialog', 'aria-modal': 'false', 'aria-labelledby': 'vr-title' }, head, accountPop, morePop, body, tray, foot, coach);
|
|
299
365
|
const ink = svgEl('svg', { class: 'ink', 'aria-hidden': 'true' });
|
|
300
366
|
const defs = svgEl('defs', {});
|
|
301
367
|
const headMarker = svgEl('marker', { id: 'vr-head', viewBox: '0 0 10 10', refX: 7, refY: 5, markerWidth: 5, markerHeight: 5, orient: 'auto-start-reverse' });
|
|
@@ -305,11 +371,6 @@ function buildDom(mount) {
|
|
|
305
371
|
const draft = svgEl('g', { class: 'draft' });
|
|
306
372
|
ink.append(defs, shapes, draft);
|
|
307
373
|
const pins = h('div', { class: 'pins' });
|
|
308
|
-
const coachText = h('p');
|
|
309
|
-
const coachMore = h('p');
|
|
310
|
-
const coachKeys = h('p', { class: 'keys', id: 'vr-keys' });
|
|
311
|
-
const coach = h('div', { class: 'coach', role: 'status' });
|
|
312
|
-
coach.append(icon(coachArt(reducedMotion())), coachText, coachMore, coachKeys);
|
|
313
374
|
// The top bar (vt-8020 D6): one plain line, the shape as a segmented control whose indicator slides, Cancel.
|
|
314
375
|
const toolButtons = new Map();
|
|
315
376
|
const toolLabels = new Map();
|
|
@@ -328,7 +389,7 @@ function buildDom(mount) {
|
|
|
328
389
|
const ask = h('span', { class: 'tb-confirm', role: 'group' }, askText, discard, keep);
|
|
329
390
|
const toolbar = h('div', { class: 'tb', role: 'toolbar' }, barLead, seg, h('span', { class: 'tb-sep', 'aria-hidden': 'true' }), cancel, ask);
|
|
330
391
|
// Focusable: from the keyboard, Enter places a mark the arrows then move (markKey).
|
|
331
|
-
const mark = h('div', { class: 'mark', tabindex: '0', role: 'application', 'aria-describedby': 'vr-keys' }, pins,
|
|
392
|
+
const mark = h('div', { class: 'mark', tabindex: '0', role: 'application', 'aria-describedby': 'vr-keys' }, pins, coachKeys, toolbar);
|
|
332
393
|
mark.prepend(ink);
|
|
333
394
|
// The card after the marking layer: it stays on top of it, usable, while the reporter marks.
|
|
334
395
|
const root = h('div', { class: 'vr' }, fab, mark, card);
|
|
@@ -347,9 +408,9 @@ function buildDom(mount) {
|
|
|
347
408
|
notify, notifyBox, notifyText, error, where, whereText, send,
|
|
348
409
|
attach, fileInput, fileNote, files, tray,
|
|
349
410
|
settings, bindLabel, bindBtn, unbind, bindHint, bindReason, back,
|
|
350
|
-
sizeLabel, sizeButtons, sizeInd, sizeSeg, techText, techBtn, tech,
|
|
411
|
+
sizeLabel, sizeButtons, sizeInd, sizeSeg, coachLabel, coachSwitch, techText, techBtn, tech,
|
|
351
412
|
sent, sentTitle, sentBody, see, seeText, sentClose,
|
|
352
|
-
mark, ink, shapes, draft, pins, coach, coachText, coachMore, coachKeys,
|
|
413
|
+
mark, ink, shapes, draft, pins, coach, coachArtSlot, coachText, coachMore, coachDismiss, coachKeys,
|
|
353
414
|
toolbar, barLead, seg, segInd, toolButtons, toolLabels, cancel, ask, askText, discard, keep,
|
|
354
415
|
};
|
|
355
416
|
}
|
|
@@ -372,7 +433,11 @@ export class ReportWidget {
|
|
|
372
433
|
marking = false;
|
|
373
434
|
markers = [];
|
|
374
435
|
nextKey = 1;
|
|
375
|
-
tool =
|
|
436
|
+
tool = TOOLS[0];
|
|
437
|
+
/** The coach shows while marking until dismissed (settings.ts readCoach). */
|
|
438
|
+
coachOn = readCoach();
|
|
439
|
+
/** The shape the coach's art shows; its SVG is rebuilt (and its clock restarted) when the pick changes. */
|
|
440
|
+
coachShape = null;
|
|
376
441
|
frozen = null;
|
|
377
442
|
job = null;
|
|
378
443
|
sending = false;
|
|
@@ -658,6 +723,18 @@ export class ReportWidget {
|
|
|
658
723
|
this.placeCard(true);
|
|
659
724
|
});
|
|
660
725
|
}
|
|
726
|
+
const setCoach = (shown) => {
|
|
727
|
+
this.coachOn = shown;
|
|
728
|
+
writePref(COACH_KEY, shown ? 'on' : 'off');
|
|
729
|
+
this.paint();
|
|
730
|
+
};
|
|
731
|
+
on(e.coachDismiss, 'click', () => {
|
|
732
|
+
setCoach(false);
|
|
733
|
+
// The button that had focus is gone: drawing goes on from the layer.
|
|
734
|
+
if (this.marking)
|
|
735
|
+
e.mark.focus();
|
|
736
|
+
});
|
|
737
|
+
on(e.coachSwitch, 'click', () => setCoach(!this.coachOn));
|
|
661
738
|
on(e.techBtn, 'click', () => {
|
|
662
739
|
this.techOpen = !this.techOpen;
|
|
663
740
|
this.paint();
|
|
@@ -1263,8 +1340,6 @@ export class ReportWidget {
|
|
|
1263
1340
|
this.paint();
|
|
1264
1341
|
this.placeCard();
|
|
1265
1342
|
this.placeSeg(true);
|
|
1266
|
-
const vw = globalThis.innerWidth || 800;
|
|
1267
|
-
this.placeCoach({ x: vw / 2 - 150, y: BAR_CLEAR + 12 }, false);
|
|
1268
1343
|
this.e.mark.focus();
|
|
1269
1344
|
}
|
|
1270
1345
|
/** Leaves marking; the card stays where marking parked it until it closes (it never jumps back). */
|
|
@@ -1331,12 +1406,24 @@ export class ReportWidget {
|
|
|
1331
1406
|
card.classList.add('parked');
|
|
1332
1407
|
card.style.left = `${r.x}px`;
|
|
1333
1408
|
card.style.top = `${r.y}px`;
|
|
1409
|
+
this.placeCoachSide();
|
|
1334
1410
|
if (!land)
|
|
1335
1411
|
return;
|
|
1336
1412
|
// The read commits the new place as the style the glide starts from, so restoring the glide moves nothing.
|
|
1337
1413
|
void card.offsetWidth;
|
|
1338
1414
|
card.style.removeProperty('transition');
|
|
1339
1415
|
}
|
|
1416
|
+
/** The coach takes the card's edge that faces the open page (place.ts coachSide); styles place it by `data-side`. */
|
|
1417
|
+
placeCoachSide() {
|
|
1418
|
+
const k = SIZE_SCALE[this.size];
|
|
1419
|
+
// Measured in the layout it takes on the card's edge — the art shown, the card's width — never the one it
|
|
1420
|
+
// holds now ('over' hides the art), so a window grown back from a phone's size finds it above again. Both
|
|
1421
|
+
// writes land before the next paint: the trial layout is never seen. Hidden, it reads 0: the usual height.
|
|
1422
|
+
const coach = this.e.coach;
|
|
1423
|
+
coach.dataset.side = 'above';
|
|
1424
|
+
const h = coach.offsetHeight || COACH.h;
|
|
1425
|
+
coach.dataset.side = coachSide(this.parked ?? this.dock, this.frame(), { w: COACH.w * k, h: h * k }, COACH.gap * k);
|
|
1426
|
+
}
|
|
1340
1427
|
unpark() {
|
|
1341
1428
|
this.parked = null;
|
|
1342
1429
|
this.parkInsets = null;
|
|
@@ -1368,8 +1455,6 @@ export class ReportWidget {
|
|
|
1368
1455
|
this.e.coach.classList.add('pressing');
|
|
1369
1456
|
}
|
|
1370
1457
|
pointerMove(ev) {
|
|
1371
|
-
if (!this.markers.length)
|
|
1372
|
-
this.placeCoach({ x: ev.clientX, y: ev.clientY }, true);
|
|
1373
1458
|
const d = this.drawing;
|
|
1374
1459
|
if (!d || ev.pointerId !== d.pointer)
|
|
1375
1460
|
return;
|
|
@@ -1441,21 +1526,6 @@ export class ReportWidget {
|
|
|
1441
1526
|
return;
|
|
1442
1527
|
this.e.draft.replaceChildren(...this.shapeNodes({ shape: this.tool, rect: r, head: 'se' }));
|
|
1443
1528
|
}
|
|
1444
|
-
/** The coach rides beside the pointer, inside the viewport. */
|
|
1445
|
-
placeCoach(p, beside) {
|
|
1446
|
-
const vw = globalThis.innerWidth || 800;
|
|
1447
|
-
const vh = globalThis.innerHeight || 600;
|
|
1448
|
-
const w = this.e.coach.offsetWidth || 300;
|
|
1449
|
-
const hgt = this.e.coach.offsetHeight || 140;
|
|
1450
|
-
let x = beside ? p.x + 20 : p.x;
|
|
1451
|
-
let y = beside ? p.y + 20 : p.y;
|
|
1452
|
-
if (x + w > vw - 8)
|
|
1453
|
-
x = beside ? p.x - w - 20 : vw - w - 8;
|
|
1454
|
-
if (y + hgt > vh - 90)
|
|
1455
|
-
y = beside ? p.y - hgt - 20 : vh - hgt - 90;
|
|
1456
|
-
this.e.coach.style.left = `${Math.max(8, x)}px`;
|
|
1457
|
-
this.e.coach.style.top = `${Math.max(8, y)}px`;
|
|
1458
|
-
}
|
|
1459
1529
|
shapeNodes(m) {
|
|
1460
1530
|
const { x, y, w, h: hh } = m.rect;
|
|
1461
1531
|
if (m.shape === 'circle') {
|
|
@@ -1469,7 +1539,7 @@ export class ReportWidget {
|
|
|
1469
1539
|
}
|
|
1470
1540
|
const veil = svgEl('rect', { class: 'veil', x, y, width: w, height: hh, rx: 4 });
|
|
1471
1541
|
const label = svgEl('text', { class: 'veil-label', x: x + w / 2, y: y + hh / 2 + 4, 'text-anchor': 'middle' });
|
|
1472
|
-
label.textContent = w >
|
|
1542
|
+
label.textContent = w > 150 && hh > 20 ? this.s.hidden : '';
|
|
1473
1543
|
return [veil, label];
|
|
1474
1544
|
}
|
|
1475
1545
|
renderMarks() {
|
|
@@ -1806,6 +1876,8 @@ export class ReportWidget {
|
|
|
1806
1876
|
paintSettings() {
|
|
1807
1877
|
const { e, s } = this;
|
|
1808
1878
|
e.sizeLabel.textContent = s.size;
|
|
1879
|
+
e.coachLabel.textContent = s.coachSetting;
|
|
1880
|
+
e.coachSwitch.setAttribute('aria-checked', String(this.coachOn));
|
|
1809
1881
|
for (const [z, btn] of e.sizeButtons) {
|
|
1810
1882
|
btn.textContent = s.sizes[z];
|
|
1811
1883
|
btn.setAttribute('aria-checked', String(this.size === z));
|
|
@@ -1832,7 +1904,7 @@ export class ReportWidget {
|
|
|
1832
1904
|
e.fabLabel.textContent = s.button;
|
|
1833
1905
|
e.fab.setAttribute('aria-expanded', String(this.isOpen));
|
|
1834
1906
|
e.fab.setAttribute('aria-description', s.moveHint);
|
|
1835
|
-
e.fab.setAttribute('aria-keyshortcuts', 'Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight
|
|
1907
|
+
e.fab.setAttribute('aria-keyshortcuts', `${this.keybind ? `${keybindAria(this.keybind)} ` : ''}Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight`);
|
|
1836
1908
|
e.fabKbd.hidden = !this.keybind;
|
|
1837
1909
|
e.fabKbd.textContent = this.keybind ? keybindLabel(this.keybind) : '';
|
|
1838
1910
|
// The one card stays up while marking (vt-8020 D10): its note lines and Send are where the reporter finishes.
|
|
@@ -1913,7 +1985,8 @@ export class ReportWidget {
|
|
|
1913
1985
|
e.mark.hidden = !this.marking;
|
|
1914
1986
|
e.toolbar.setAttribute('aria-label', s.toolbar);
|
|
1915
1987
|
e.seg.setAttribute('aria-label', s.toolbar);
|
|
1916
|
-
|
|
1988
|
+
// Cover says what it is for the moment it is picked: the one tool that hides instead of points.
|
|
1989
|
+
e.barLead.textContent = this.tool === 'hide' ? s.barLeadHide : s.barLead;
|
|
1917
1990
|
for (const [tool, btn] of e.toolButtons) {
|
|
1918
1991
|
const label = e.toolLabels.get(tool);
|
|
1919
1992
|
if (label)
|
|
@@ -1926,9 +1999,17 @@ export class ReportWidget {
|
|
|
1926
1999
|
e.askText.textContent = s.discardMarks(this.markers.filter((m) => !this.passKeys.has(m.key)).length);
|
|
1927
2000
|
e.discard.textContent = s.discard;
|
|
1928
2001
|
e.keep.textContent = s.keep;
|
|
1929
|
-
e.coach.hidden = !this.marking || this.
|
|
1930
|
-
e.
|
|
2002
|
+
e.coach.hidden = !this.marking || !this.coachOn;
|
|
2003
|
+
if (e.coach.hidden)
|
|
2004
|
+
this.coachShape = null; // shown again, it starts its run from the top
|
|
2005
|
+
else if (this.coachShape !== this.tool) {
|
|
2006
|
+
this.coachShape = this.tool;
|
|
2007
|
+
e.coachArtSlot.replaceChildren(icon(coachArt(this.tool, reducedMotion())));
|
|
2008
|
+
this.placeCoachSide();
|
|
2009
|
+
}
|
|
2010
|
+
e.coachText.textContent = s.coach[this.tool];
|
|
1931
2011
|
e.coachMore.textContent = s.coachMore;
|
|
2012
|
+
e.coachDismiss.textContent = s.coachDismiss;
|
|
1932
2013
|
e.coachKeys.textContent = s.keyboardHint;
|
|
1933
2014
|
e.mark.setAttribute('aria-label', s.marking);
|
|
1934
2015
|
if (this.marking) {
|