@vitrinka/web 0.1.5 → 0.2.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 (67) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +73 -21
  3. package/build/hud.d.ts +9 -0
  4. package/build/hud.iife.js +411 -0
  5. package/build/hud.js +8 -0
  6. package/build/recorder/api.d.ts +2 -0
  7. package/build/recorder/block.d.ts +7 -0
  8. package/build/recorder/block.js +7 -0
  9. package/build/recorder/capture/click.d.ts +2 -4
  10. package/build/recorder/capture/click.js +2 -31
  11. package/build/recorder/capture/rrweb.d.ts +2 -2
  12. package/build/recorder/capture/rrweb.js +2 -2
  13. package/build/recorder/capture/selector.d.ts +8 -0
  14. package/build/recorder/capture/selector.js +35 -0
  15. package/build/recorder/hud/AnnotateOverlay.d.ts +7 -1
  16. package/build/recorder/hud/AnnotateOverlay.js +51 -17
  17. package/build/recorder/hud/Hud.d.ts +16 -1
  18. package/build/recorder/hud/Hud.js +251 -83
  19. package/build/recorder/hud/LinkSheet.d.ts +3 -3
  20. package/build/recorder/hud/LinkSheet.js +1 -1
  21. package/build/recorder/hud/Menu.d.ts +30 -0
  22. package/build/recorder/hud/Menu.js +73 -0
  23. package/build/recorder/hud/RecorderPill.d.ts +36 -27
  24. package/build/recorder/hud/RecorderPill.js +212 -123
  25. package/build/recorder/hud/Sheet.d.ts +1 -1
  26. package/build/recorder/hud/Sheet.js +1 -1
  27. package/build/recorder/hud/Tooltip.d.ts +19 -0
  28. package/build/recorder/hud/Tooltip.js +94 -0
  29. package/build/recorder/hud/controller.d.ts +148 -0
  30. package/build/recorder/hud/controller.js +17 -0
  31. package/build/recorder/hud/flow.d.ts +54 -0
  32. package/build/recorder/hud/flow.js +39 -0
  33. package/build/recorder/hud/host.js +1 -1
  34. package/build/recorder/hud/icons.d.ts +7 -0
  35. package/build/recorder/hud/icons.js +19 -0
  36. package/build/recorder/hud/iife.d.ts +13 -0
  37. package/build/recorder/hud/iife.js +11 -0
  38. package/build/recorder/hud/layer.d.ts +29 -6
  39. package/build/recorder/hud/layer.js +67 -33
  40. package/build/recorder/hud/mount.d.ts +13 -0
  41. package/build/recorder/hud/mount.js +27 -0
  42. package/build/recorder/hud/place.d.ts +43 -0
  43. package/build/recorder/hud/place.js +63 -0
  44. package/build/recorder/hud/spots.d.ts +45 -0
  45. package/build/recorder/hud/spots.js +107 -0
  46. package/build/recorder/hud/status.d.ts +31 -0
  47. package/build/recorder/hud/status.js +67 -0
  48. package/build/recorder/hud/styles.d.ts +28 -18
  49. package/build/recorder/hud/styles.js +295 -122
  50. package/build/recorder/hud/useDock.d.ts +9 -8
  51. package/build/recorder/hud/useDock.js +41 -20
  52. package/build/recorder/index.d.ts +2 -2
  53. package/build/recorder/index.js +9 -18
  54. package/build/recorder/link.d.ts +1 -1
  55. package/build/recorder/link.js +8 -2
  56. package/build/recorder/me.d.ts +34 -0
  57. package/build/recorder/me.js +172 -0
  58. package/build/recorder/page-controller.d.ts +12 -0
  59. package/build/recorder/page-controller.js +100 -0
  60. package/build/recorder/queue.d.ts +4 -0
  61. package/build/recorder/queue.js +2 -0
  62. package/build/recorder/recents.d.ts +23 -0
  63. package/build/recorder/recents.js +80 -0
  64. package/build/recorder/session.d.ts +2 -2
  65. package/build/recorder/session.js +15 -1
  66. package/build/recorder/storage/index.js +2 -1
  67. package/package.json +9 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @vitrinka/web
2
2
 
3
+ ## 0.2.0
4
+
5
+ - **Stop is in the pill.** A ■ next to the other tools. It asks inline
6
+ ("Stop & save? Stop · Keep recording"; Esc or Keep cancels). Then the pill
7
+ says **Saving…**, with a spinner and a progress bar while the tail drains.
8
+ Then it says **Saved · Open board**, with the server's board link. That
9
+ stays until you dismiss it. If the server cannot be reached, the pill says
10
+ so and offers **Retry**. Nothing is lost. Unlink asks the same way.
11
+ - **Recents and the account.** The ⋯ menu (now on the idle puck too) names
12
+ who the recorder is linked as: `you@… · Workspace`, or `Recorder key ·
13
+ <name> · project <p>` for a key build. It lists the device's last five
14
+ recordings, with age, length, status and a link to each board. It has
15
+ **Go to vitrinka**. A recent without a board link is refreshed from the
16
+ session's own read.
17
+ - **Eight spots, and a vertical pill.** Move to is a miniature screen with
18
+ eight spots: a 3×3 grid without the centre. At middle left and middle
19
+ right, the recording pill stands up and becomes vertical. Its menu,
20
+ tooltips and sheets open sideways. A pushed-away tab comes back to the
21
+ nearest third of its edge.
22
+ - **Tooltips never clip.** There is one tooltip, and it shows the shortcut.
23
+ It is placed inside the viewport, flipping and shifting as needed from
24
+ every spot. Menus, sheets and the details card follow the same placement.
25
+ - **A sync chip you can read.** `synced`, `sending N`, `offline · N` or
26
+ `ended`, with an icon and a colour for each, and no hover needed. A routine
27
+ 2s flush does not flicker it.
28
+ - **Size and technical details.** S · M · L scales the whole HUD. Technical
29
+ details shows events, queue and chunks, last sync, server seq, session id
30
+ and recorder version. Both are user prefs (`GET`/`PATCH
31
+ /api/v1/recorder/me`) and are cached on the device. They stay on the
32
+ device for key builds, servers without the route, and offline.
33
+ - **"Saved" on the pill** for a moment after a note or annotation.
34
+ - **Annotate does not touch the page.** A drag over text no longer selects
35
+ it. Presses, moves and hovers no longer reach the app. The crosshair is
36
+ set by a blocked stylesheet, so the page's `<html>` is never restyled.
37
+ - The record dot's ripple is drawn outside layout, so the dot and the clock
38
+ are spaced evenly.
39
+ - **The HUD is a seam.** `@vitrinka/web/hud` exports
40
+ `mountRecorderHud(controller, opts)` and the `HudController` contract. The
41
+ in-page recorder is one implementation of it. `build/hud.iife.js`
42
+ (`@vitrinka/web/hud.iife.js`) is the same mount as one self-contained
43
+ script with React bundled in. It defines `globalThis.VitrinkaHud.mount`.
44
+ - The HUD's surfaces stay out of the recording. The rrweb-blocked host is
45
+ 0×0. rrweb 2 cannot drop a blocked node entirely, so it leaves an empty,
46
+ zero-size placeholder. Clicks, the recorder's own requests and `vitrinka:`
47
+ logs are not captured.
48
+
3
49
  ## 0.1.5
4
50
 
5
51
  - **A `project` prop.** `VitrinkaRecorderRoot` takes `project`. A
package/README.md CHANGED
@@ -118,31 +118,45 @@ returned unchanged otherwise.
118
118
 
119
119
  Idle, the HUD is a 28px glass puck: a hollow ring until the device is linked
120
120
  (**Link recorder**), a muted dot once it is (**Start recording** — the session
121
- title is `document.title`, or the `title` prop); the label slides out on hover
122
- or focus. Recording, it rests as a dot + timer capsule (**Recorder controls**)
123
- that unfolds into the tools on hover, focus or tap and folds back 2.5s after
124
- you leave (keycaps show on hover):
121
+ title is `document.title`, or the `title` prop); the label and a ⋯ slide out
122
+ on hover or focus. Recording, it rests as a dot + timer capsule (**Recorder
123
+ controls**) that unfolds into the tools on hover, focus or tap and folds back
124
+ 2.5s after you leave (a tooltip names each tool and its shortcut):
125
125
 
126
126
  | Control | Shortcut | What |
127
127
  |---|---|---|
128
+ | sync chip | | `synced` · `sending N` · `offline · N` · `ended` — readable without hovering |
128
129
  | ⏸ Pause / ▶ Resume | ⌥⇧P (Alt⇧P) | freezes the clock and capture |
129
- | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel (the draft survives a cancel) |
130
- | ⌖ Annotate | ⌥⇧A | click or tap an element, or drag a region (a finger too — the page does not scroll or press while annotating), then describe it; `board` (an annotation on the board) or `task` (also filed as an intake draft) |
131
- | ⋯ | | **Open board** (the server-minted link) · **Stop recording** · **Unlink** · **Move to** |
132
-
133
- Move it anywhere: drag the puck or capsule and it lands on one of six spots
134
- (corners, top and bottom centre) — a flick lands where it is thrown; push it
135
- past a side edge and it tucks into a 6px tab (**Show recorder** brings it
136
- back). Arrow keys on the focused handle and **Move to** do the same without a
137
- drag; the spot is remembered per site. Sheets (≤ 288px) open toward the
138
- middle of the page from wherever it sits; on a phone they are a bottom sheet
139
- above the keyboard and the link sheet drops the QR.
140
-
141
- The sync glyph is honest: ✓ means the server confirmed it holds everything
142
- captured; a second line unfolds only for a backlog, an outage (`offline ·
143
- N held · retrying` — nothing is dropped, the tail is kept in `localStorage`)
144
- or a session the server closed. Stop drains first and refuses while the
145
- server is unreachable — stop again once online.
130
+ | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel (the draft survives a cancel); the pill says **Saved** |
131
+ | ⌖ 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) |
132
+ | ■ 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 |
133
+ | ⋯ | | the linked account · **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) |
134
+
135
+ Move it anywhere: drag the puck or capsule and it lands on one of eight
136
+ spots (a 3×3 grid without the centre). A flick lands where it is thrown.
137
+ Push it past a side edge and it tucks into a 6px tab (**Show recorder**
138
+ brings it back). At middle left and middle right the recording pill stands
139
+ up into a vertical bar. Arrow keys on the focused handle and **Position** do
140
+ the same without a drag; the spot is remembered per site. Tooltips, the
141
+ menu and sheets (≤ 288px at M) open toward the middle of the page from
142
+ wherever the HUD sits: sideways from a vertical one. They flip and shift so
143
+ they never leave the viewport. On a phone, sheets are a bottom sheet above
144
+ the keyboard and the link sheet drops the QR.
145
+
146
+ The sync chip is honest: `synced` means the server confirmed it holds
147
+ everything captured. A backlog reads `sending N`. An outage reads
148
+ `offline · N` (nothing is dropped; the tail is kept in `localStorage`). A
149
+ session the server closed reads `ended`. A one-line detail also unfolds for
150
+ an outage or an ended session. Stop drains first and refuses while the server
151
+ is unreachable: the pill says so and offers **Retry**.
152
+
153
+ **Size** and **Technical details** are user preferences. For a linked device
154
+ they are stored in vitrinka (`GET`/`PATCH /api/v1/recorder/me`), so they follow
155
+ the user, and are cached on the device for an instant first paint and for
156
+ offline use. A key build, or a server without the route, keeps them on the
157
+ device only. Technical details shows events captured, queue and pending
158
+ chunks, the last sync and its state, the server's seq, the session id and
159
+ the recorder version.
146
160
 
147
161
  The sheet renders inside the topmost open dialog when one exists, so a
148
162
  Radix focus trap or a `<dialog>.showModal()` never fights it, and nothing
@@ -160,6 +174,38 @@ const { boardUrl } = await __vitrinkaRecorder.stop();
160
174
  __vitrinkaRecorder.status(); // { recording, sessionId, elapsedMs, queued, synced, … }
161
175
  ```
162
176
 
177
+ ## The HUD on its own (`@vitrinka/web/hud`)
178
+
179
+ The HUD is driven only through a `HudController`. The in-page recorder is one
180
+ implementation; another host (the browser extension) mounts the same HUD with
181
+ its own:
182
+
183
+ ```ts
184
+ import { mountRecorderHud, type HudController } from '@vitrinka/web/hud';
185
+
186
+ const unmount = mountRecorderHud(controller, { title: () => document.title });
187
+ ```
188
+
189
+ `HudController` is a snapshot plus actions:
190
+
191
+ - `getSnapshot()` returns the same object until something changes;
192
+ `subscribe(fn)` calls back after a change. The snapshot holds `linked`,
193
+ `canUnlink`, `annotating`, `recording` (session, clock, sync), `account`,
194
+ `prefs`, `recents`, `workspaceUrl` and `version`.
195
+ - Actions: `start`, `togglePause`, `stop` (resolves `{boardUrl?}`, rejects
196
+ while the server is unreachable), `note`, `annotate`, `setAnnotating`,
197
+ `link`, `unlink`, `getMe`, `setPrefs` and `refreshRecents`.
198
+
199
+ The full contract is in `src/recorder/hud/controller.ts`.
200
+
201
+ Without a bundler, `@vitrinka/web/hud.iife.js` (`build/hud.iife.js`) is the
202
+ same mount as one self-contained script with React bundled in:
203
+
204
+ ```html
205
+ <script src="hud.iife.js"></script>
206
+ <script>const unmount = VitrinkaHud.mount(controller);</script>
207
+ ```
208
+
163
209
  ## What is captured, exactly
164
210
 
165
211
  | Lane | Event `kind` | Payload |
@@ -174,6 +220,12 @@ __vitrinkaRecorder.status(); // { recording, sessionId, elapsedMs, queued, synce
174
220
  Data goes to your vitrinka server only. Details, the redaction rules and the
175
221
  policy fetch: [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md).
176
222
 
223
+ The HUD itself never enters a recording. Every surface sits under one 0×0
224
+ shadow host carrying rrweb's block attribute. rrweb 2 always leaves a
225
+ placeholder for a blocked node; this one is empty, so the replay shows no
226
+ box. The HUD's clicks, its requests to your server and its `vitrinka:` logs
227
+ are not captured.
228
+
177
229
  ## Storage
178
230
 
179
231
  The undelivered tail lives in `localStorage` (a recording survives a reload
package/build/hud.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `@vitrinka/web/hud` — the recorder HUD on its own, for hosts that bring
3
+ * their own recorder (the browser extension). Implement `HudController` and
4
+ * mount it; `build/hud.iife.js` is the same mount as a self-contained script
5
+ * defining `globalThis.VitrinkaHud.mount`.
6
+ */
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 HudSize, type HudSnapshot, type HudSync, type HudSyncState, } from './recorder/hud/controller';
9
+ export type { RecorderStorage } from './recorder/storage';