@vitrinka/web 0.7.1 → 0.8.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +117 -19
  3. package/build/hud.iife.js +11 -11
  4. package/build/recorder/config.d.ts +6 -2
  5. package/build/recorder/hud/Hud.d.ts +3 -1
  6. package/build/recorder/hud/Hud.js +2 -2
  7. package/build/recorder/hud/Menu.d.ts +7 -1
  8. package/build/recorder/hud/Menu.js +2 -2
  9. package/build/recorder/hud/host.d.ts +13 -0
  10. package/build/recorder/hud/host.js +96 -1
  11. package/build/recorder/hud/icons.d.ts +2 -0
  12. package/build/recorder/hud/icons.js +4 -0
  13. package/build/recorder/hud/mount.d.ts +2 -0
  14. package/build/recorder/hud/mount.js +1 -0
  15. package/build/recorder/index.d.ts +6 -0
  16. package/build/recorder/index.js +3 -0
  17. package/build/recorder/lead.js +12 -2
  18. package/build/recorder/link.js +1 -1
  19. package/build/recorder/version.d.ts +2 -2
  20. package/build/recorder/version.js +1 -1
  21. package/build/report/attachments.d.ts +56 -0
  22. package/build/report/attachments.js +91 -0
  23. package/build/report/drag.d.ts +18 -0
  24. package/build/report/drag.js +34 -0
  25. package/build/report/element.d.ts +11 -2
  26. package/build/report/element.js +106 -15
  27. package/build/report/engine.d.ts +5 -1
  28. package/build/report/engine.js +7 -1
  29. package/build/report/face.d.ts +23 -0
  30. package/build/report/face.js +92 -0
  31. package/build/report/i18n.d.ts +75 -3
  32. package/build/report/i18n.js +125 -6
  33. package/build/report/place.d.ts +26 -0
  34. package/build/report/place.js +33 -0
  35. package/build/report/reader.d.ts +42 -0
  36. package/build/report/reader.js +39 -0
  37. package/build/report/recorder-face.js +6 -2
  38. package/build/report/sent.d.ts +16 -0
  39. package/build/report/sent.js +39 -0
  40. package/build/report/settings.d.ts +32 -0
  41. package/build/report/settings.js +47 -0
  42. package/build/report/styles.d.ts +1 -1
  43. package/build/report/styles.js +216 -52
  44. package/build/report/widget.d.ts +109 -3
  45. package/build/report/widget.js +1063 -99
  46. package/build/report/wire.d.ts +20 -9
  47. package/build/report/wire.js +44 -9
  48. package/build/report-widget.mjs +223 -59
  49. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,133 @@
1
1
  # @vitrinka/web
2
2
 
3
+ ## 0.8.0
4
+
5
+ **Report a problem grows back up.** The calm face now gives the people in
6
+ your app what the recorder pill gave its testers: it says who they are,
7
+ links a vitrinka account, finds their earlier reports, and marks a problem
8
+ without hiding how to finish.
9
+
10
+ - **One card.** The describe card and every mark's note are now one card:
11
+ the reporter's word for it (**Bug · Suggestion · Question · Other**,
12
+ optional, sent as `type` — a hint for triage, never the category),
13
+ "What went wrong?", one numbered note line per mark, the attached files,
14
+ and **Send** in the foot. It keeps one size from drafting through
15
+ sending, an error and the thanks, so Send never leaves the screen; a long
16
+ list scrolls inside it. A note on a mark is now enough to send.
17
+ - **Marking under a top bar.** "Show us where" puts a glass bar at the top
18
+ of the page: one plain line ("Mark where the problem is"), a segmented
19
+ **Circle · Box · Arrow · Hide** whose indicator slides to the pick, and
20
+ **Cancel**. Cancel leaves marking and drops this pass's marks, asking
21
+ first ("Discard 2 marks?" · **Discard** / **Keep**); ⌘Z / Ctrl+Z takes
22
+ back the newest mark when no field has the caret; Esc, or "Show us where"
23
+ again, leaves marking and keeps the marks. **Done** and **Undo** are
24
+ gone: Done only returned to a card that no longer leaves the screen, and
25
+ the bottom bar it sat in hid how to finish.
26
+ - **Notes no longer float on the page.** Since 0.7.0 each mark's note
27
+ opened at the mark, a 220 px field over the page and over the other
28
+ marks. A mark now carries only a pin — its number and ✕ — and a press on
29
+ the number puts the caret in its line in the card.
30
+ - **The card parks away from the marks.** Marking starts with the card
31
+ exactly where it rested. It moves only when a mark lands under it, to the
32
+ corner that covers the least of the marks, clear of the top bar.
33
+ - **Who you are.** The header shows an account chip: the initials and
34
+ first name of the person your app signed (`identify({token})`, the name
35
+ as vitrinka returns it) or asserted, else **?**. It opens the account
36
+ popover: who, and how ("Signed in by this app", or that the team checks
37
+ an anonymous report first); **Link your vitrinka account** — the pill's
38
+ flow, a code with **Open vitrinka** and a QR — or **Linked to vitrinka
39
+ as …** with **Unlink**; and **Open the report portal** when the project
40
+ has one.
41
+ - **The ⋯ menu.** **My reports**; **Recent recordings** and **Record** for
42
+ a linked member; **Settings**; **Open vitrinka** (a member) or **Open the
43
+ report portal**. A list opens inside the card with ← back. Settings sits
44
+ behind a real cog: since 0.7.0 its glyph was a ring of rays that read as
45
+ brightness, a sun.
46
+ - **My reports.** For a reporter your server signed, the widget trades the
47
+ token once for a short-lived reporter session (`POST
48
+ /api/v1/report/session`) and lists their reports from `GET
49
+ /api/v1/report/mine` (header `X-Vitrinka-Reporter`), each with its step:
50
+ Received, Planned, In progress, Fixed, Done. A lapsed session is renewed
51
+ and asked once more; the `vkb_` key alone still reads nothing. An
52
+ asserted email or an anonymous reporter gets this browser's own sends
53
+ instead — the last 20 for this vitrinka and site, filed or "Waiting for
54
+ approval", marked "Sent from this browser".
55
+ - **The face switch for linked members** (npm entry only). A browser
56
+ holding a vitrinka member link for the widget's `base` gets **Record**:
57
+ it swaps Report a problem for the recorder pill in place, recording on
58
+ the member's own link, never your `vkb_` key. The idle pill's ⋯ menu then
59
+ offers **Report a problem**, which swaps back. The pick is remembered per
60
+ browser and origin (`vitrinka.report.face`); a member who never picked
61
+ starts on the pill when their vitrinka display mode is dev. Reporters
62
+ never see the switch, and a `vkr_` key the host passes is a build's, not
63
+ a person's. `report-widget.mjs` carries no pill, so the script tag offers
64
+ neither Record nor Recent recordings. New API: `onReportFace` on
65
+ `VitrinkaRecorderPill` and in `mountRecorderHud`'s options adds the
66
+ pill's row; `face` on the handle and the element now says which face is
67
+ on screen; a stored device link remembers the `base` it was minted on.
68
+ - **Attachments.** 📎 in the foot picks files; pasting or dropping a file
69
+ onto the card adds it (pasted text stays text). Each file is checked
70
+ against the project's caps — `attachments` in `GET
71
+ /api/v1/report-config`, by default 10 MiB per file, 5 per report, images,
72
+ PDF and text — before anything is sent, and one that breaks a cap is
73
+ refused at once, the line naming the cap. They ride their own leg, `POST
74
+ /api/v1/reports/{id}/attachment?name=`, after the create and before the
75
+ replay; **Try again** sends only the files that did not land, and a file
76
+ the server refuses for good is left out while the report still files.
77
+ - **Typing in the widget never fires the page's shortcuts.** A host that
78
+ listens in the capture phase on `window` or `document` (a BPMN modeler's
79
+ `e`) ran before the shadow host's bubble-phase shield, and shadow
80
+ retargeting showed it the host element as `event.target`, never the
81
+ field, so its "ignore keys while typing" check failed. One `window`
82
+ capture listener now stops typing keys aimed at a field of the card, a
83
+ mark's line or a pill sheet; the text still lands, and Enter, Esc, Tab
84
+ and chords that do not edit text (the reporter's shortcut, the pill's
85
+ ⌥⇧ keys) pass. Its limit: a `window` capture listener the page
86
+ registered before the widget mounted still runs first. Since 0.7.0 on
87
+ Report a problem; the pill's sheets had the same leak.
88
+ - **The button moves.** Drag it to any corner (it snaps to the nearest) or
89
+ press Alt+arrow while it has focus; the corner is remembered per origin
90
+ (`vitrinka.report.dock`) and the card opens beside it.
91
+ - **Size and technical details.** Settings adds Small · Medium · Large, one
92
+ scale for the button, the card and the marking bar
93
+ (`vitrinka.report.size`), and read-only technical details for a support
94
+ conversation: version, capture window, whether capture runs, the buffer
95
+ and its cap, the server.
96
+ - **The thanks say what happens next.** A filed report says the team will
97
+ take a look, with **See your report** when the server returned its page;
98
+ one held for approval (an asserted or anonymous reporter) says the team
99
+ checks it before it is filed.
100
+
101
+ Upgrading:
102
+
103
+ - **Upgrade vitrinka first.** My reports from the server, attachments, the
104
+ report type and a dev-mode member's start use doors that ship with the
105
+ vitrinka release serving this version as `/vendor/report-widget-1.mjs`:
106
+ `POST /api/v1/report/session`, `GET /api/v1/report/mine`, `POST
107
+ /api/v1/reports/{id}/attachment`, `type` in the report envelope,
108
+ `attachments` in `/api/v1/report-config` and `displayMode` on
109
+ `/api/v1/recorder/me`. The script tag always matches its server; an npm
110
+ host can run ahead of it. On an older vitrinka, My reports falls back to
111
+ this browser's list, each attachment is refused (the report files
112
+ without it, under the default caps) and a dev-mode start never triggers.
113
+ An older vitrinka refuses the unknown `type` field; the widget then sends
114
+ the report again without it, so the reporter's word is lost but the report
115
+ is not.
116
+ - **Done, Undo and "N places marked" are gone** (the `done`, `undo` and
117
+ `marked` strings). The catalog is internal, so no host code changes, but
118
+ a host test that clicked **Done** / **Hotovo** or **Undo** / **Zpět** in
119
+ marking now presses Esc or "Show us where" to finish, and the pin's ✕ or
120
+ ⌘Z to take a mark back.
121
+
122
+ ## 0.7.2
123
+
124
+ - **One pill when the extension starts in this tab.** The extension's hello
125
+ can reach the page before its claim does. The page then showed its quiet
126
+ "Recording in another tab" pill beside the extension's own, and kept it
127
+ after the claim landed, because the HUD heard only a change of leader. A
128
+ change of the claim's holder now reaches the HUD too, so the page's pill
129
+ hides as soon as the claim is read. Since 0.6.0.
130
+
3
131
  ## 0.7.1
4
132
 
5
133
  - **Report a problem hands focus back.** Closing the card returns focus to
package/README.md CHANGED
@@ -16,9 +16,9 @@ the last minute as a bug report ([Report a bug](#report-a-bug)).
16
16
 
17
17
  The same engine has a second face for the people who use your app:
18
18
  **[Report a problem](#report-a-problem-vitrinkawebreport)** — a large
19
- button, "What went wrong?", optional marks drawn on the page, and the last
20
- minutes attached under your project's capture profile. No React needed; it
21
- also ships as one file vitrinka serves.
19
+ button and one card: "What went wrong?", optional marks drawn on the page,
20
+ files, and the last minutes attached under your project's capture profile.
21
+ No React needed; it also ships as one file vitrinka serves.
22
22
 
23
23
  ## Install
24
24
 
@@ -185,7 +185,7 @@ vitrinka` (or `sending N`) · actions · frames · notes · pages:
185
185
  | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel. A cancelled draft (and its images) parks as a small drop on the pill: hover shows its first line, a click resumes it. The clock says **queued**, then **Saved** once the server has the note. Images: see [Attach images](#attach-images) |
186
186
  | ⌖ Annotate | ⌥⇧A | click or tap an element, or drag a region (a finger too). While annotating, the page gets no press, move or hover, does not scroll, and selects no text. Then describe it; the sheet names what you picked (its size and route; a crop only from a host that can show pixels outside the page — `HudController.captureRegion` — which neither recorder does, since the HUD's shadow root is open to the page) with **Reselect**. Everything lands on the board |
187
187
  | ■ Stop | ⌥⇧S | the pill asks **Stop & save?** (Esc / **Keep recording** cancels), shows **Saving…** with progress while the tail drains, then **Building board · k/n** while the server builds it, then **Board ready · Open board** until **Done** (a failed build says so, with **Retry**) |
188
- | ⋯ | | the linked account · **Report a bug** (below) · **Open this board** · **Recent** (this device's last five recordings, each linked to its board) · **Go to vitrinka** · **Size** S/M/L · **Technical details** · **Position** · **Unlink this device** (asks first) |
188
+ | ⋯ | | the linked account · **Report a bug** (below) · **Open this board** · **Recent** (this device's last five recordings, each linked to its board) · **Report a problem** (idle, with `onReportFace`: the way back from [Report a problem](#report-a-problem-vitrinkawebreport)'s face switch) · **Go to vitrinka** · **Size** S/M/L · **Technical details** · **Position** · **Unlink this device** (asks first) |
189
189
 
190
190
  Move it anywhere: drag the puck or capsule and it lands on one of eight
191
191
  spots (a 3×3 grid without the centre). A flick lands where it is thrown.
@@ -294,15 +294,31 @@ offered only during one.
294
294
  ## Report a problem (`@vitrinka/web/report`)
295
295
 
296
296
  The report face of the same engine, for the people using your app: a large
297
- **Report a problem** / **Nahlásit problém** button, a card that asks
298
- **What went wrong?** with Send, and **Show us where** to circle, box, point
299
- at or hide parts of the page — numbered marks with an optional note each,
300
- taught by a coach card ("click, hold and move") until the first mark
301
- exists; from the keyboard, Enter places a mark, arrows move it,
302
- Shift+arrows resize it and Enter sets it. The minutes before are attached under your project's **capture
297
+ **Report a problem** / **Nahlásit problém** button and ONE card. Its header
298
+ says who is reporting (the account chip) and holds the ⋯ menu; its body
299
+ takes the reporter's word for it — **Bug · Suggestion · Question · Other**,
300
+ optional, sent as `type`, a hint for your team's triage — and **What went
301
+ wrong?**, then one numbered note line per mark and the attached files; its
302
+ foot holds 📎, **Show us where** and **Send**. The card keeps one size from
303
+ drafting through sending, an error and the thanks, so Send is always in
304
+ view. The minutes before are attached under your project's **capture
303
305
  profile** (set in vitrinka; see [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md)
304
306
  § Report a problem). You need the project's report key (`vkb_…`).
305
307
 
308
+ **Marking.** **Show us where** puts a glass bar at the top of the page —
309
+ "Mark where the problem is", a segmented **Circle · Box · Arrow · Hide**
310
+ and **Cancel** — and you circle, box, point at or hide parts of the page,
311
+ taught by a coach card ("click, hold and move") until the first mark
312
+ exists. A mark carries a pin on the page (its number and ✕) and a line in
313
+ the card for its note; a press on the number puts the caret there, and a
314
+ note on a mark is enough to send. The card stays where it rested and moves
315
+ only when a mark lands under it, to the corner that covers the least of
316
+ the marks. Esc or **Show us where** again ends marking and keeps the
317
+ marks; **Cancel** drops this pass's marks, asking first (**Discard 2
318
+ marks?**); ⌘Z / Ctrl+Z removes the newest when no field has the caret.
319
+ From the keyboard, Enter places a mark, arrows move it, Shift+arrows
320
+ resize it and Enter sets it.
321
+
306
322
  **Script tag** — vitrinka serves the single-file build; `base` defaults to
307
323
  the origin it came from:
308
324
 
@@ -352,13 +368,14 @@ function ReportAProblem({ locale, token }: { locale: string; token?: string }) {
352
368
  | `locale` | `cs` · `en`; live as an attribute, and through `setLocale()` |
353
369
  | `button` | `false` hides the floating button: open the card from your own control |
354
370
  | `open-selector` / `openSelector` | a CSS selector of your control(s) that open the card |
355
- | `face` | `report` (default) or `recorder` — the recorder pill on the same engine (npm only; it takes a `vkr_` key or the device link) |
371
+ | `face` | `report` (default) or `recorder` — the recorder pill on the same engine (npm only; it takes a `vkr_` key or the device link). A linked member also switches in place: **The face switch** below |
356
372
  | `capture` | narrow the capture profile: `{storage: 'memory', windowSec, maxBytes, classes}` |
357
373
  | `identity` | as `identify()` below |
358
374
  | `appVersion`, `sanitizeUrl` | as on the recorder |
359
375
 
360
376
  The handle (and the element) has `open()`, `close()`, `identify()`,
361
- `setLocale()`; the handle also `unmount()`s. For the tag from npm, call
377
+ `setLocale()` and `face`, the face on screen (`recorder` while a member has
378
+ switched to the pill); the handle also `unmount()`s. For the tag from npm, call
362
379
  `defineReportElement()` once. Closing the card hands focus back to whatever
363
380
  had it when the card opened (your control, the field the shortcut fired in),
364
381
  else to the button: call `open()` once your control holds focus again — after
@@ -394,18 +411,95 @@ on the page; a widget's own `identify()` wins (`null` makes that widget
394
411
  anonymous, `undefined` hands it back to the page-wide one). Identity lives
395
412
  in memory only; pass it on every load.
396
413
 
414
+ **The account and the menu.** The header's chip shows the reporter's
415
+ initials and first name — the person your token names (the name as
416
+ vitrinka returns it) or the email you asserted — else **?**. It opens the
417
+ account popover: who, and how ("Signed in by this app", or that the team
418
+ checks an anonymous report first); the member link below; and **Open the
419
+ report portal** when the project has one bound. The ⋯ menu holds **My
420
+ reports**, **Recent recordings** and **Record** (a linked member, npm
421
+ only), **Settings**, and **Open vitrinka** (a member) or **Open the report
422
+ portal**. A list opens inside the card with ← back.
423
+
424
+ **My reports** depends on who reports:
425
+
426
+ - **A token your server signed**: vitrinka's list. The widget trades the
427
+ token once for a short-lived reporter session (`POST
428
+ /api/v1/report/session`, renewed when it lapses) and reads `GET
429
+ /api/v1/report/mine` with it (header `X-Vitrinka-Reporter`): each report
430
+ with its step — Received, Planned, In progress, Fixed, Done — linked to
431
+ its page. The `vkb_` key alone reads nothing.
432
+ - **An asserted email, or anonymous**: this browser's own sends — the last
433
+ 20 for this vitrinka and this site, filed or "Waiting for approval",
434
+ marked "Sent from this browser" (`localStorage`). A signed reporter gets
435
+ the same on a vitrinka without the session door.
436
+
437
+ **The member link.** A vitrinka member testing your app links their
438
+ account from the account popover with the pill's flow: a short code,
439
+ **Open vitrinka** (approve on this device) and a QR. Approval mints this
440
+ browser's own `vkr_` token, kept where the pill keeps its link
441
+ (`vitrinka.recorder.link`, with the `base` it was minted on), so linking
442
+ here links the pill on this site and **Unlink** forgets it for both.
443
+ Reporters never need it: your token vouches for them.
444
+
445
+ **The face switch** (npm entry only). A browser holding a member link for
446
+ the widget's `base` gets **Record** and **Recent recordings** in the ⋯
447
+ menu. **Record** swaps Report a problem for the recorder pill in place,
448
+ recording on the member's link, never your `vkb_` key; the idle pill's ⋯
449
+ menu then offers **Report a problem**, which swaps back. The pick is
450
+ remembered per browser and origin (`vitrinka.report.face`); a member who
451
+ never picked starts on the pill when their vitrinka display mode is dev
452
+ (`displayMode` from `/api/v1/recorder/me`, learned when the card opens).
453
+ `report-widget.mjs` carries no pill, so the script tag offers neither.
454
+ Your own pill takes the same way back with `onReportFace` on
455
+ `VitrinkaRecorderPill` (or `mountRecorderHud`).
456
+
397
457
  **Beside the recorder.** One page runs one capture: when the recorder face
398
458
  (`VitrinkaRecorderRoot`) is mounted it owns it, and Report a problem sends
399
459
  its reports without a capture of its own — mount one face per page (pick it
400
460
  by your app's mode, or with `face`).
401
461
 
402
- **The shortcut.** There is none by default. A reporter sets their own in the
403
- card's settings (⚙) by pressing it: a modifier other than Shift is required,
404
- Esc cancels. It is kept in `localStorage` (`vitrinka.recorder.report.keybind`).
405
-
406
- **What the reporter sees after Send**: "Thanks — we've got it", and **See
407
- your report** when the server returns the report's page. A failed send
408
- keeps every word; **Try again** resumes the same report.
462
+ **Attachments.** 📎 picks files; pasting or dropping a file onto the card
463
+ adds it (pasted text stays text). They line up above the foot, each with a
464
+ remove ✕, and the card keeps its size. Each file is checked against the
465
+ project's caps — `attachments` in `GET /api/v1/report-config`: bytes per
466
+ file, files per report and the types, by default 10 MiB, 5, and images,
467
+ PDF and text — before anything is sent, and one that breaks a cap is
468
+ refused at once, the line naming the cap. The files ride their own leg
469
+ (`POST /api/v1/reports/{id}/attachment?name=`) before the replay; **Try
470
+ again** sends only those that did not land, and a file the server refuses
471
+ for good is left out while the report still files.
472
+
473
+ **Where it sits.** Drag the button to any corner (it snaps to the nearest)
474
+ or press Alt+arrow while it has focus; the corner is remembered per site
475
+ (`vitrinka.report.dock`), and the card opens beside the button — above it
476
+ at the bottom, below it at the top. **Settings** (⋯) holds the shortcut
477
+ below, **Size** — Small · Medium · Large, one scale for the button, the
478
+ card and the marking bar (`vitrinka.report.size`) — and **Technical
479
+ details** for a support conversation: version, capture window, whether
480
+ capture runs, the buffer and its cap, the server.
481
+
482
+ **The shortcut.** There is none by default. A reporter sets their own in
483
+ **Settings** by pressing it: a modifier other than Shift is required, Esc
484
+ cancels. It is kept in `localStorage` (`vitrinka.recorder.report.keybind`).
485
+
486
+ **Typing stays in the widget.** A key typed into a field of the card, a
487
+ mark's line or a pill sheet never reaches your page's shortcuts — even one
488
+ bound in the capture phase on `window` or `document`, which runs before the
489
+ widget's own shield and, through shadow retargeting, sees the widget's
490
+ host element as `event.target`, never the field, so its "ignore keys while
491
+ typing" check cannot work. One `window` capture listener stops those keys;
492
+ the text still lands, and Enter, Esc, Tab and chords that do not edit text
493
+ pass. Its limit: a `window` capture listener your page registered before
494
+ the widget mounted still runs first — read `event.composedPath()[0]`
495
+ there, not `event.target`.
496
+
497
+ **What the reporter sees after Send**: "Thanks — we've got it", then what
498
+ happens next: a filed report says the team will take a look, with **See
499
+ your report** when the server returns the report's page; one held for
500
+ approval (an asserted or anonymous reporter) says the team checks it
501
+ before it is filed. A failed send keeps every word; **Try again** resumes
502
+ the same report.
409
503
 
410
504
  ## Attach images
411
505
 
@@ -461,6 +555,10 @@ import { mountRecorderHud, type HudController } from '@vitrinka/web/hud';
461
555
  const unmount = mountRecorderHud(controller, { title: () => document.title });
462
556
  ```
463
557
 
558
+ `onReportFace` in the options adds **Report a problem** to the idle ⋯
559
+ menu and is called when it is picked (`VitrinkaRecorderPill` takes the same
560
+ prop).
561
+
464
562
  `HudController` is a snapshot plus actions:
465
563
 
466
564
  - `getSnapshot()` returns the same object until something changes;