@vitrinka/web 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/README.md +59 -5
- package/build/hud.d.ts +1 -1
- package/build/hud.iife.js +46 -9
- package/build/protocol/index.d.ts +55 -4
- package/build/protocol/index.js +4 -2
- package/build/recorder/api.d.ts +25 -5
- package/build/recorder/api.js +21 -9
- package/build/recorder/attachments.d.ts +19 -0
- package/build/recorder/attachments.js +31 -0
- package/build/recorder/hud/Hud.d.ts +1 -1
- package/build/recorder/hud/Hud.js +43 -10
- package/build/recorder/hud/Sheet.d.ts +40 -5
- package/build/recorder/hud/Sheet.js +134 -8
- package/build/recorder/hud/attach.d.ts +26 -0
- package/build/recorder/hud/attach.js +136 -0
- package/build/recorder/hud/controller.d.ts +31 -3
- package/build/recorder/hud/controller.js +1 -1
- package/build/recorder/hud/host.js +2 -0
- package/build/recorder/hud/icons.d.ts +3 -0
- package/build/recorder/hud/icons.js +7 -0
- package/build/recorder/hud/layer.d.ts +4 -1
- package/build/recorder/hud/layer.js +11 -3
- package/build/recorder/hud/resize.d.ts +83 -0
- package/build/recorder/hud/resize.js +236 -0
- package/build/recorder/hud/styles.d.ts +1 -1
- package/build/recorder/hud/styles.js +38 -1
- package/build/recorder/link.d.ts +4 -1
- package/build/recorder/link.js +6 -2
- package/build/recorder/me.d.ts +7 -0
- package/build/recorder/me.js +62 -12
- package/build/recorder/page-controller.js +4 -3
- package/build/recorder/queue.d.ts +33 -3
- package/build/recorder/queue.js +404 -24
- package/build/recorder/report.d.ts +9 -0
- package/build/recorder/report.js +46 -4
- package/build/recorder/session.d.ts +13 -5
- package/build/recorder/session.js +42 -12
- package/build/recorder/storage/blobs.d.ts +32 -0
- package/build/recorder/storage/blobs.js +83 -0
- package/build/recorder/storage/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @vitrinka/web
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
- **Notes, annotations and bug reports carry images.** Testers asked to
|
|
6
|
+
attach a reference of "how it should be" while recording. The sheet now
|
|
7
|
+
takes images three ways: the **Attach image** paperclip beside Send,
|
|
8
|
+
an image pasted into the text box (a text paste stays a text paste), and
|
|
9
|
+
image files dropped onto the sheet, which highlights while you drag.
|
|
10
|
+
Thumbnails line up above the footer, each with a **Remove** ×. A note
|
|
11
|
+
carries up to 4 and may have no text; a bug report still needs its
|
|
12
|
+
description. The images survive a cancel like the draft's text. On the
|
|
13
|
+
board they become the tester's own thread message under the note.
|
|
14
|
+
- **Images are re-encoded before they leave the browser.** WebP at 0.85,
|
|
15
|
+
JPEG where the browser cannot write WebP, PNG when JPEG would lose
|
|
16
|
+
transparency. The long edge is at most 2560 px and the file at most
|
|
17
|
+
12 MiB; an animated image keeps its first frame. EXIF and GPS metadata are
|
|
18
|
+
gone. A file that is not an image is refused with the reason in the
|
|
19
|
+
footer's context slot, so the footer never moves.
|
|
20
|
+
- **Only where the server allows it.** The paperclip shows when
|
|
21
|
+
`GET /api/v1/recorder/policy` answers `attachments: true`. A server before
|
|
22
|
+
attachments omits the field, and a workspace can switch them off. The
|
|
23
|
+
recorder then sends notes as before, text only.
|
|
24
|
+
- **Wire.** Each image uploads to `POST /sessions/:id/shot?seq=N` with its
|
|
25
|
+
own Content-Type. An `attachment` event `{name, mime, bytes, w, h}` then
|
|
26
|
+
carries the returned `blobKey`. Its seq is allocated with the note's,
|
|
27
|
+
just below it, and the note lists the image seqs as `attachments`. An idle
|
|
28
|
+
bug report carries its images into its short session the same way. The
|
|
29
|
+
`protocol` module adds `AttachmentPayload`, `NotePayload` and
|
|
30
|
+
`RecorderPolicyResponse`.
|
|
31
|
+
- **A queued image survives a reload.** Its bytes wait in an IndexedDB
|
|
32
|
+
blob journal (`vitrinka.recorder.blobs`) until the server acknowledged its
|
|
33
|
+
event. A reload, or another tab finishing a closed tab's tail, uploads it
|
|
34
|
+
before its event is delivered, and Stop waits for it like the rest of the
|
|
35
|
+
tail. The queue holds at most 64 MiB (200 images) across notes; past that
|
|
36
|
+
the oldest image is dropped with a console warning and its note lands
|
|
37
|
+
without it.
|
|
38
|
+
- `HudController`: `HudSnapshot.canAttach`, `note(text, attachments?)`,
|
|
39
|
+
and `attachments` on `HudAnnotation` and `HudReport`. `HudAttachment` is
|
|
40
|
+
exported from `@vitrinka/web/hud`. A host without `canAttach` gets the text-only
|
|
41
|
+
HUD it had.
|
|
42
|
+
- The HUD's propagation shield also stops `paste` and the drag events, so a
|
|
43
|
+
page's own upload handler never takes an image meant for the sheet.
|
|
44
|
+
- **A roomier sheet you can resize.** The note, annotate and bug-report
|
|
45
|
+
sheet is now 440 px wide at every HUD size (was 288 at size M). Its text
|
|
46
|
+
box grows with the draft up to 20 rows, then scrolls; the footer row keeps
|
|
47
|
+
its layout and the sheet stays beside the pill, inside the viewport. A grip
|
|
48
|
+
on the corner away from the pill (**Resize note**, **Resize annotation**,
|
|
49
|
+
**Resize report**) drags the width (320 to 960 px) and the text box's cap
|
|
50
|
+
live; on a phone's full-width bottom sheet it drags the cap alone. Its
|
|
51
|
+
arrow keys step 16 px (Shift: 64), and Enter or a double-click restores
|
|
52
|
+
the default.
|
|
53
|
+
- **The sheet size is a HUD preference.** `HudPrefs` gains `sheetW` and
|
|
54
|
+
`sheetH` (CSS px, 0 = the default) and `DEFAULT_PREFS` carries 0 for both.
|
|
55
|
+
A resize calls `setPrefs({sheetW, sheetH})` once, on release. The in-page
|
|
56
|
+
recorder applies it at once, keeps it in its storage, and sends it to
|
|
57
|
+
`PATCH /api/v1/recorder/me` in a request of its own. A server that
|
|
58
|
+
predates the fields answers that request 422. The size then stays on the
|
|
59
|
+
device for the page's lifetime, with no retry and no error, and size and
|
|
60
|
+
details still sync. A linked user's server copy wins on load, as for size
|
|
61
|
+
and details. An answer without the fields never resets the device's size.
|
|
62
|
+
|
|
3
63
|
## 0.3.4
|
|
4
64
|
|
|
5
65
|
- **Two tabs no longer collide on event sequence numbers.** Events and rrweb
|
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ controls**) that unfolds into the tools on hover, focus or tap and folds back
|
|
|
128
128
|
|---|---|---|
|
|
129
129
|
| sync chip | | `synced` · `sending N` · `offline · N` · `ended` — readable without hovering |
|
|
130
130
|
| ⏸ Pause / ▶ Resume | ⌥⇧P (Alt⇧P) | freezes the clock and capture |
|
|
131
|
-
| ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel (the draft
|
|
131
|
+
| ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel (the draft and its images survive a cancel); the pill says **Saved**. Images: see [Attach images](#attach-images) |
|
|
132
132
|
| ⌖ 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: `board` (an annotation on the board) or `task` (also filed as an intake draft) |
|
|
133
133
|
| ■ Stop | ⌥⇧S | the pill asks **Stop & save?** (Esc / **Keep recording** cancels), shows **Saving…** with progress while the tail drains, then **Saved · Open board** until you dismiss it |
|
|
134
134
|
| ⋯ | | 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) |
|
|
@@ -159,6 +159,16 @@ device only. Technical details shows events captured, queue and pending
|
|
|
159
159
|
chunks, the last sync and its state, the server's seq, the session id and
|
|
160
160
|
the recorder version.
|
|
161
161
|
|
|
162
|
+
The note, annotate and bug-report sheet is 440 px wide at every HUD size,
|
|
163
|
+
and its text box grows with what you type up to 20 rows, then scrolls. Drag
|
|
164
|
+
the grip on the sheet's free corner (the one away from the pill) to change
|
|
165
|
+
the width and that cap; on a phone the sheet spans the screen, so its grip
|
|
166
|
+
changes the cap alone. With the grip focused, the arrow keys move it 16 px
|
|
167
|
+
(Shift: 64 px), and Enter or a double-click restores the default. The size is a
|
|
168
|
+
preference too (`sheetW`, `sheetH` in CSS px, 0 = the default). It is sent
|
|
169
|
+
in a PATCH of its own when you let go. A server that predates it answers 422,
|
|
170
|
+
and the size then stays on the device while size and details still sync.
|
|
171
|
+
|
|
162
172
|
The sheet renders inside the topmost open dialog when one exists, so a
|
|
163
173
|
Radix focus trap or a `<dialog>.showModal()` never fights it, and nothing
|
|
164
174
|
you do on the pill reaches the page (a "close on outside click" never fires
|
|
@@ -187,8 +197,9 @@ went wrong (required) and offers **Mark on screen** — annotate mode's
|
|
|
187
197
|
element pick or region drag. Send files one short session under the pill's
|
|
188
198
|
credential: title `Bug report: <first line>`, `meta.kind: "report"` and
|
|
189
199
|
`meta.devicePixelRatio`; the buffered events with their original
|
|
190
|
-
timestamps; the rrweb windows as chunks;
|
|
191
|
-
with `task: true` (the marked region, else the
|
|
200
|
+
timestamps; the rrweb windows as chunks; any images you attached; your
|
|
201
|
+
description as an annotation with `task: true` (the marked region, else the
|
|
202
|
+
whole viewport); then done.
|
|
192
203
|
vitrinka renders stills from the clip, pins the annotation on the board and
|
|
193
204
|
files it as an intake draft. The pill says **Sending…**, then **Sent · Open
|
|
194
205
|
board** (it is in Recents too); a failure offers **Retry**, which resumes
|
|
@@ -205,6 +216,32 @@ the running session instead.
|
|
|
205
216
|
Then nothing is captured until a recording starts, and Report a bug is
|
|
206
217
|
offered only during one.
|
|
207
218
|
|
|
219
|
+
## Attach images
|
|
220
|
+
|
|
221
|
+
A note, an annotation and a bug report can carry reference images — "how
|
|
222
|
+
it should be" beside what it does. In the sheet: the **Attach image**
|
|
223
|
+
paperclip beside Send picks them, pasting an image into the text box adds
|
|
224
|
+
it (a text paste stays a text paste), and dropping image files onto the
|
|
225
|
+
sheet adds them (it highlights while you drag). They line up as thumbnails
|
|
226
|
+
above the footer, each with a **Remove** ×. Up to 4 per note; a note with
|
|
227
|
+
images may have no text, a bug report still needs its description. Like
|
|
228
|
+
the text, the images survive a cancel until the next send.
|
|
229
|
+
|
|
230
|
+
Each image is re-encoded in the browser before it is stored or sent: WebP
|
|
231
|
+
at 0.85 (JPEG where the browser cannot write WebP, PNG when JPEG would lose
|
|
232
|
+
transparency), long edge ≤ 2560 px, ≤ 12 MiB, the first frame of an
|
|
233
|
+
animated one. EXIF and GPS metadata never leave the device. A file that is
|
|
234
|
+
not an image, or one still too large, is refused with the reason in the
|
|
235
|
+
sheet's footer.
|
|
236
|
+
|
|
237
|
+
The paperclip shows only when your vitrinka server answers
|
|
238
|
+
`attachments: true` to the policy read (`GET /api/v1/recorder/policy`): a
|
|
239
|
+
server before attachments leaves it out, and a workspace can switch
|
|
240
|
+
attachments off. On the board, each note's images become your own thread
|
|
241
|
+
message under it — image tiles and the lightbox. Images are not masked by a
|
|
242
|
+
`maskAllText` policy: they are your deliberate upload, not captured screen.
|
|
243
|
+
What goes over the wire: [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md#attached-images-web-hud).
|
|
244
|
+
|
|
208
245
|
## Driving it from code
|
|
209
246
|
|
|
210
247
|
`window.__vitrinkaRecorder` — for agents and tests:
|
|
@@ -234,11 +271,15 @@ const unmount = mountRecorderHud(controller, { title: () => document.title });
|
|
|
234
271
|
`subscribe(fn)` calls back after a change. The snapshot holds `linked`,
|
|
235
272
|
`canUnlink`, `annotating`, `recording` (session, clock, sync), `account`,
|
|
236
273
|
`prefs`, `recents`, `workspaceUrl`, `version` and, optionally,
|
|
237
|
-
`canReport`.
|
|
274
|
+
`canReport` and `canAttach`.
|
|
238
275
|
- Actions: `start`, `togglePause`, `stop` (resolves `{boardUrl?}`, rejects
|
|
239
276
|
while the server is unreachable), `note`, `annotate`, `setAnnotating`,
|
|
240
277
|
`link`, `unlink`, `getMe`, `setPrefs` and `refreshRecents`; optionally
|
|
241
278
|
`holdReport` and `report` — without them the menu has no **Report a bug**.
|
|
279
|
+
- With `canAttach: true` the sheets take images: `note(text, attachments)`,
|
|
280
|
+
`annotate({…, attachments})` and `report({…, attachments})` hand over
|
|
281
|
+
`HudAttachment`s (`{name, blob, w, h}`) the HUD has already re-encoded —
|
|
282
|
+
png, webp or jpeg, ≤ 2560 px, ≤ 12 MiB. Uploading them is the host's job.
|
|
242
283
|
|
|
243
284
|
The full contract is in `src/recorder/hud/controller.ts`.
|
|
244
285
|
|
|
@@ -259,7 +300,8 @@ same mount as one self-contained script with React bundled in:
|
|
|
259
300
|
| navigation | `nav` | `{url, route, spa}` — `url` scrubbed of query/fragment secrets, the start URL included |
|
|
260
301
|
| network | `net` | `{method, url, status, ms, reqHeaders, resHeaders, reqBody, resBody, via}` — redacted, capped at 64 KiB per body; the recorder's own uploads are never recorded |
|
|
261
302
|
| console | `console` | `{level: 'error', text}` |
|
|
262
|
-
| notes | `note` | `{text, route}`; annotations add `{rect, selector, annotate: true, task?}` |
|
|
303
|
+
| notes | `note` | `{text, route}`; annotations add `{rect, selector, annotate: true, task?}`; a note with images adds `attachments: [seq…]` |
|
|
304
|
+
| images | `attachment` | `{name, mime, bytes, w, h}` + `blobKey` — the image itself is uploaded to `/shot?seq=N` first; its seq sits just below its note's |
|
|
263
305
|
|
|
264
306
|
Data goes to your vitrinka server only. Details, the redaction rules and the
|
|
265
307
|
policy fetch: [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md).
|
|
@@ -300,6 +342,18 @@ Pending allocations have a 16 MiB byte budget, 20,000-event count limit and
|
|
|
300
342
|
200-chunk limit; overflow drops the oldest capture with a warning and health
|
|
301
343
|
failure, matching the queue's existing bounded retry behavior.
|
|
302
344
|
|
|
345
|
+
Attached images are too big for `localStorage`: their bytes wait in an
|
|
346
|
+
IndexedDB blob journal (`vitrinka.recorder.blobs`) while the queue keeps
|
|
347
|
+
their metadata. A note and its images take one allocation, so a reload — or
|
|
348
|
+
another tab finishing a closed tab's tail — uploads each queued image to
|
|
349
|
+
`/shot` before its `attachment` event is delivered. Stop waits for them as
|
|
350
|
+
it waits for the rest of the tail. The bytes leave the journal once the
|
|
351
|
+
server acknowledged the image's event, or when its session ends. Without
|
|
352
|
+
IndexedDB the images still upload from the open tab; only the reload
|
|
353
|
+
guarantee is lost, and the recorder says so. The queue holds at most
|
|
354
|
+
64 MiB (200 images) across notes: past that the oldest image is dropped
|
|
355
|
+
with a console warning, and its note lands without it.
|
|
356
|
+
|
|
303
357
|
## Development
|
|
304
358
|
|
|
305
359
|
```bash
|
package/build/hud.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* defining `globalThis.VitrinkaHud.mount`.
|
|
6
6
|
*/
|
|
7
7
|
export { mountRecorderHud, type MountHudOptions } from './recorder/hud/mount';
|
|
8
|
-
export { DEFAULT_PREFS, type HudAccount, type HudAnnotation, type HudController, type HudLinkCode, type HudLinkFlow, type HudPrefs, type HudRecent, type HudRecentStatus, type HudRecording, type HudRect, type HudReport, type HudSaved, type HudSize, type HudSnapshot, type HudSync, type HudSyncState, } from './recorder/hud/controller';
|
|
8
|
+
export { DEFAULT_PREFS, type HudAccount, type HudAnnotation, type HudAttachment, type HudController, type HudLinkCode, type HudLinkFlow, type HudPrefs, type HudRecent, type HudRecentStatus, type HudRecording, type HudRect, type HudReport, type HudSaved, type HudSize, type HudSnapshot, type HudSync, type HudSyncState, } from './recorder/hud/controller';
|
|
9
9
|
export type { RecorderStorage } from './recorder/storage';
|