@nonstrict/recordkit 0.87.2 → 0.97.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 (54) hide show
  1. package/bin/README.md +1 -1
  2. package/bin/recordkit-rpc +0 -0
  3. package/out/Errors.d.ts +91 -0
  4. package/out/Errors.js +63 -0
  5. package/out/Errors.js.map +1 -0
  6. package/out/InputEvents.d.ts +661 -0
  7. package/out/InputEvents.js +8 -0
  8. package/out/InputEvents.js.map +1 -0
  9. package/out/IpcRecordKit.js +13 -0
  10. package/out/IpcRecordKit.js.map +1 -1
  11. package/out/NonstrictRPC.d.ts +9 -0
  12. package/out/NonstrictRPC.js +27 -4
  13. package/out/NonstrictRPC.js.map +1 -1
  14. package/out/RecordKit.d.ts +267 -5
  15. package/out/RecordKit.js +243 -3
  16. package/out/RecordKit.js.map +1 -1
  17. package/out/Recorder.d.ts +451 -53
  18. package/out/Recorder.js +80 -2
  19. package/out/Recorder.js.map +1 -1
  20. package/out/RecordingMetadata.d.ts +96 -0
  21. package/out/RecordingMetadata.js +12 -0
  22. package/out/RecordingMetadata.js.map +1 -0
  23. package/out/WebAudioUtils.d.ts +35 -0
  24. package/out/WebAudioUtils.js +37 -0
  25. package/out/WebAudioUtils.js.map +1 -1
  26. package/out/WindowLevels.d.ts +46 -0
  27. package/out/WindowLevels.js +41 -0
  28. package/out/WindowLevels.js.map +1 -0
  29. package/out/browser.d.ts +8 -1
  30. package/out/browser.js +3 -1
  31. package/out/browser.js.map +1 -1
  32. package/out/index.cjs +603 -9
  33. package/out/index.cjs.map +1 -1
  34. package/out/index.d.ts +8 -0
  35. package/out/index.js +3 -0
  36. package/out/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/Errors.test.ts +38 -0
  39. package/src/Errors.ts +151 -0
  40. package/src/InputEvents.ts +695 -0
  41. package/src/IpcRecordKit.ts +12 -0
  42. package/src/NonstrictRPC.test.ts +24 -1
  43. package/src/NonstrictRPC.ts +29 -5
  44. package/src/RecordKit.ts +347 -11
  45. package/src/Recorder.schema.test.ts +167 -0
  46. package/src/Recorder.ts +558 -80
  47. package/src/RecordingMetadata.ts +125 -0
  48. package/src/WebAudioUtils.test.ts +78 -0
  49. package/src/WebAudioUtils.ts +57 -1
  50. package/src/WindowLevels.test.ts +34 -0
  51. package/src/WindowLevels.ts +47 -0
  52. package/src/browser.ts +12 -2
  53. package/src/index.ts +8 -0
  54. package/src/__snapshots__/NonstrictRPC.test.ts.snap +0 -24
@@ -0,0 +1,695 @@
1
+ // Type definitions mirroring the JSON written to the input-events sidecar file inside a RecordKit
2
+ // recording bundle. RecordKit records mouse, keyboard, modifier-change and discontinuation events
3
+ // during a recording; they are serialized as JSON to a sidecar file in the bundle. These types
4
+ // mirror the Swift `Codable` types in `RKInputEvent.swift` exactly, so consumers can parse those
5
+ // JSON files type-safely. Each top-level event encodes as a flat object with a `"type"` discriminator
6
+ // at the same level as its payload properties (not nested). Types only — no runtime code in this module.
7
+
8
+ /**
9
+ * Time an input event occurred in the recording.
10
+ *
11
+ * @group Recording
12
+ */
13
+ export interface EventTime {
14
+ /** The time in seconds. Prefer this field for time math. */
15
+ seconds: number;
16
+ /**
17
+ * The numerator of the rational time value (`value / timescale ≈ seconds`; `value` is the
18
+ * truncated nanosecond count, so {@link EventTime.seconds} is authoritative).
19
+ *
20
+ * This mirrors a 64-bit integer; for extremely long recordings (beyond ~104 days at nanosecond
21
+ * timescale) it can exceed JavaScript's `Number.MAX_SAFE_INTEGER`, so prefer {@link EventTime.seconds}.
22
+ */
23
+ value: number;
24
+ /** The denominator (timescale) of the rational time value. */
25
+ timescale: number;
26
+ }
27
+
28
+ /**
29
+ * Input modifiers (like shift, option, command, etc) that change the behaviour
30
+ * of mouse clicks and keyboard presses.
31
+ *
32
+ * @group Recording
33
+ */
34
+ export type InputModifier =
35
+ /**
36
+ * Caps lock key, toggles on/off with a single press, making all input
37
+ * characters capitals.
38
+ *
39
+ * Usually found on the left side of the keyboard, available on all regular
40
+ * keyboards.
41
+ */
42
+ | 'capsLock'
43
+ /**
44
+ * Shift key, making input characters capitals as long as it is pressed. Also
45
+ * often involved in hotkeys.
46
+ *
47
+ * Usually found on both the left and right side of the character block on the
48
+ * keyboard, available on all regular keyboards.
49
+ */
50
+ | 'shift'
51
+ /**
52
+ * Control key, often involved in hotkeys.
53
+ *
54
+ * Usually found on both the left side of the character block on the keyboard,
55
+ * available on all regular keyboards.
56
+ */
57
+ | 'control'
58
+ /**
59
+ * Option key, used to type alternative characters. Also often involved in
60
+ * hotkeys.
61
+ *
62
+ * Usually found on both the left and right side of the character block on the
63
+ * keyboard, available on all regular keyboards.
64
+ */
65
+ | 'option'
66
+ /**
67
+ * Command key, often involved in hotkeys.
68
+ *
69
+ * Usually found on both the left and right side of the spacebar, available on
70
+ * all regular keyboards.
71
+ */
72
+ | 'command'
73
+ /**
74
+ * Function (fn) key, used to modify key behaviour of keys with system
75
+ * functionality.
76
+ *
77
+ * For example changing delete into forward delete or re-enabling function
78
+ * key behaviour instead of adjusting system settings like brightness or
79
+ * volume.
80
+ *
81
+ * Usually found on the bottom left of the keyboard or on larger keyboards to
82
+ * left of the numeric keypad, above the arrow keys, available on all regular
83
+ * keyboards.
84
+ */
85
+ | 'function';
86
+
87
+ /**
88
+ * Type of keyboard event.
89
+ *
90
+ * Represents the cause that generated a keyboard event.
91
+ *
92
+ * @group Recording
93
+ */
94
+ export type KeyboardEventType =
95
+ /** Key is pressed down. */
96
+ | 'down'
97
+ /** Key is released. */
98
+ | 'up';
99
+
100
+ /**
101
+ * Type of a keyboard key.
102
+ *
103
+ * Helps make the distinction between a regular character key (like A, 1, /,
104
+ * etc) and special keys (like escape, space, arrow keys, etc) without having to
105
+ * know exact keycodes or unicode characters.
106
+ *
107
+ * - note: Does not include modifier keys (like shift, option, command, etc)
108
+ * since those are supposed to be pressed together they're represented as
109
+ * {@link InputModifier}.
110
+ *
111
+ * @group Recording
112
+ */
113
+ export type KeyboardKeyType =
114
+ /**
115
+ * Character key, any key representing a character (letter or number) that is
116
+ * typed.
117
+ *
118
+ * This indicates the key doesn't represent any special key.
119
+ */
120
+ | 'character'
121
+ /**
122
+ * Escape key, exit the current state or abort the current action.
123
+ *
124
+ * Usually found in the top left of the keyboard, available on all regular
125
+ * keyboards.
126
+ */
127
+ | 'escape'
128
+ /**
129
+ * Delete key, also known as backspace. Removes the character left of the
130
+ * caret.
131
+ *
132
+ * Usually found in the top right of the character key block of the keyboard,
133
+ * available on all regular keyboards.
134
+ */
135
+ | 'delete'
136
+ /**
137
+ * Tab key, indent text or move to the next item.
138
+ *
139
+ * Usually found on the left side of the character key block of the keyboard,
140
+ * available on all regular keyboards.
141
+ */
142
+ | 'tab'
143
+ /**
144
+ * Return key, insert newline or confirm action. Also represents the enter key
145
+ * available on some keyboards.
146
+ *
147
+ * Usually found on the right side of the character key block of the keyboard,
148
+ * available on all regular keyboards.
149
+ */
150
+ | 'return'
151
+ /**
152
+ * Spacebar key, insert a space or confirm selection.
153
+ *
154
+ * Usually found on the bottom of the character key block of the keyboard,
155
+ * available on all regular keyboards.
156
+ */
157
+ | 'space'
158
+ /**
159
+ * Left arrow key, moves caret to the left.
160
+ *
161
+ * Usually found in the arrow block in the bottom right of the keyboard, or on
162
+ * larger keyboard in the center of the keyboard, available on all regular
163
+ * keyboards.
164
+ */
165
+ | 'leftArrow'
166
+ /**
167
+ * Right arrow key, moves caret to the right.
168
+ *
169
+ * Usually found in the arrow block in the bottom right of the keyboard, or on
170
+ * larger keyboard in the center of the keyboard, available on all regular
171
+ * keyboards.
172
+ */
173
+ | 'rightArrow'
174
+ /**
175
+ * Down arrow key, moves caret down.
176
+ *
177
+ * Usually found in the arrow block in the bottom right of the keyboard, or on
178
+ * larger keyboard in the center of the keyboard, available on all regular
179
+ * keyboards.
180
+ */
181
+ | 'downArrow'
182
+ /**
183
+ * Up arrow key, moves caret up.
184
+ *
185
+ * Usually found in the arrow block in the bottom right of the keyboard, or on
186
+ * larger keyboard in the center of the keyboard, available on all regular
187
+ * keyboards.
188
+ */
189
+ | 'upArrow'
190
+ /**
191
+ * Delete key, removes the character right of the caret.
192
+ *
193
+ * Usually found in the key block left of the numeric keypad and above the
194
+ * arrows on the Magic Keyboard. Not available as a key on the smaller Magic
195
+ * Keyboard and MacBooks.
196
+ */
197
+ | 'deleteForward'
198
+ /**
199
+ * Home key, scrolls to the very top.
200
+ *
201
+ * Usually found in the key block left of the numeric keypad and above the
202
+ * arrows on the Magic Keyboard. Not available as a key on the smaller Magic
203
+ * Keyboard and MacBooks.
204
+ */
205
+ | 'home'
206
+ /**
207
+ * End key, scrolls to the very bottom.
208
+ *
209
+ * Usually found in the key block left of the numeric keypad and above the
210
+ * arrows on the Magic Keyboard. Not available as a key on the smaller Magic
211
+ * Keyboard and MacBooks.
212
+ */
213
+ | 'end'
214
+ /**
215
+ * Page up key, scrolls one page up.
216
+ *
217
+ * Usually found in the key block left of the numeric keypad and above the
218
+ * arrows on the Magic Keyboard. Not available as a key on the smaller Magic
219
+ * Keyboard and MacBooks.
220
+ */
221
+ | 'pageUp'
222
+ /**
223
+ * Page down key, scroll one page down.
224
+ *
225
+ * Usually found in the key block left of the numeric keypad and above the
226
+ * arrows on the Magic Keyboard. Not available as a key on the smaller Magic
227
+ * Keyboard and MacBooks.
228
+ */
229
+ | 'pageDown'
230
+ /**
231
+ * Clear key, clears the contents of the focused entry field.
232
+ *
233
+ * Usually found on the top left of the numpad on the Apple Magic Keyboard. Not
234
+ * available as a key on the smaller Magic Keyboard and MacBooks.
235
+ */
236
+ | 'clear'
237
+ /**
238
+ * Function key 1, might default to the brightness system function and not be
239
+ * received at all.
240
+ *
241
+ * Usually found in the top row of keys, next to the escape key, available on
242
+ * most keyboards.
243
+ */
244
+ | 'f1'
245
+ /**
246
+ * Function key 2, might default to the brightness system function and not be
247
+ * received at all.
248
+ *
249
+ * Usually found in the top row of keys, available on most keyboards.
250
+ */
251
+ | 'f2'
252
+ /**
253
+ * Function key 3, might default to the mission control system function and
254
+ * not be received at all.
255
+ *
256
+ * Usually found in the top row of keys, available on most keyboards.
257
+ */
258
+ | 'f3'
259
+ /**
260
+ * Function key 4, might default to the search system function and not be
261
+ * received at all.
262
+ *
263
+ * Usually found in the top row of keys, available on most keyboards.
264
+ */
265
+ | 'f4'
266
+ /**
267
+ * Function key 5, might default to the Siri assistant system function and not
268
+ * be received at all.
269
+ *
270
+ * Usually found in the top row of keys, available on most keyboards.
271
+ */
272
+ | 'f5'
273
+ /**
274
+ * Function key 6, might default to the do not disturb system function and not
275
+ * be received at all.
276
+ *
277
+ * Usually found in the top row of keys, available on most keyboards.
278
+ */
279
+ | 'f6'
280
+ /**
281
+ * Function key 7, might default to the media control previous system function
282
+ * and not be received at all.
283
+ *
284
+ * Usually found in the top row of keys, available on most keyboards.
285
+ */
286
+ | 'f7'
287
+ /**
288
+ * Function key 8, might default to the media control play/pause system
289
+ * function and not be received at all.
290
+ *
291
+ * Usually found in the top row of keys, available on most keyboards.
292
+ */
293
+ | 'f8'
294
+ /**
295
+ * Function key 9, might default to the media control next system function and
296
+ * not be received at all.
297
+ *
298
+ * Usually found in the top row of keys, available on most keyboards.
299
+ */
300
+ | 'f9'
301
+ /**
302
+ * Function key 10, might default to the mute volume system function and not
303
+ * be received at all.
304
+ *
305
+ * Usually found in the top row of keys, available on most keyboards.
306
+ */
307
+ | 'f10'
308
+ /**
309
+ * Function key 11, might default to the decrease volume system function and
310
+ * not be received at all.
311
+ *
312
+ * Usually found in the top row of keys, available on most keyboards.
313
+ */
314
+ | 'f11'
315
+ /**
316
+ * Function key 12, might default to the increase volume system function and
317
+ * not be received at all.
318
+ *
319
+ * Usually found in the top row of keys, available on most keyboards.
320
+ */
321
+ | 'f12'
322
+ /**
323
+ * Function key 13, might default to the increase volume system function and
324
+ * not be received at all.
325
+ *
326
+ * Usually found in the top row of keys, available on larger keyboards such as
327
+ * the Magic Keyboard with Numeric Keypad.
328
+ */
329
+ | 'f13'
330
+ /**
331
+ * Function key 14, might default to the increase volume system function and
332
+ * not be received at all.
333
+ *
334
+ * Usually found in the top row of keys, available on older smaller keyboards
335
+ * without TouchID and larger keyboards such as the Magic Keyboard with
336
+ * Numeric Keypad.
337
+ */
338
+ | 'f14'
339
+ /**
340
+ * Function key 15, might default to the increase volume system function and
341
+ * not be received at all.
342
+ *
343
+ * Usually found in the top row of keys, available on larger keyboards such as
344
+ * the Magic Keyboard with Numeric Keypad.
345
+ */
346
+ | 'f15'
347
+ /**
348
+ * Function key 16, might default to the increase volume system function and
349
+ * not be received at all.
350
+ *
351
+ * Usually found in the top row of keys above the numeric keypad, available on
352
+ * larger keyboards such as the Magic Keyboard with Numeric Keypad.
353
+ */
354
+ | 'f16'
355
+ /**
356
+ * Function key 17, might default to the increase volume system function and
357
+ * not be received at all.
358
+ *
359
+ * Usually found in the top row of keys above the numeric keypad, available on
360
+ * larger keyboards such as the Magic Keyboard with Numeric Keypad.
361
+ */
362
+ | 'f17'
363
+ /**
364
+ * Function key 18, might default to the increase volume system function and
365
+ * not be received at all.
366
+ *
367
+ * Usually found in the top row of keys above the numeric keypad, available on
368
+ * larger keyboards such as the Magic Keyboard with Numeric Keypad.
369
+ */
370
+ | 'f18'
371
+ /**
372
+ * Function key 19, might default to the increase volume system function and
373
+ * not be received at all.
374
+ *
375
+ * Usually found in the top row of keys above the numeric keypad, available on
376
+ * larger keyboards such as the Magic Keyboard with Numeric Keypad.
377
+ */
378
+ | 'f19';
379
+
380
+ /**
381
+ * Type of mouse event.
382
+ *
383
+ * Represents the cause that generated a mouse event.
384
+ *
385
+ * @group Recording
386
+ */
387
+ export type MouseEventType =
388
+ /** Mouse button is pressed down. */
389
+ | 'down'
390
+ /** Mouse button is released. */
391
+ | 'up'
392
+ /** Mouse pointer is moved, without any buttons pressed. */
393
+ | 'moved'
394
+ /** Mouse pointer is moved, with a button pressed. */
395
+ | 'dragged'
396
+ /**
397
+ * Mouse cursor changed shape.
398
+ *
399
+ * The mouse cursor can change shape while the mouse is not used by the user.
400
+ * For example the application the mouse is hovering over can be unresponsive
401
+ * changing the mouse to the beachball, or content can appear like a link that
402
+ * moves under the cursor.
403
+ *
404
+ * This event indicates such a change of cursor shape.
405
+ */
406
+ | 'cursorChanged';
407
+
408
+ /**
409
+ * Mouse button types.
410
+ *
411
+ * @group Recording
412
+ */
413
+ export type MouseButton =
414
+ /** The primary mouse button (usually left button). */
415
+ | 'primary'
416
+ /** The secondary mouse button (usually right button). */
417
+ | 'secondary'
418
+ /** The center mouse button (usually scroll wheel click). */
419
+ | 'center'
420
+ /** Any other mouse button not covered by the above cases. */
421
+ | 'other';
422
+
423
+ /**
424
+ * Mouse cursor types (also called pointer).
425
+ *
426
+ * @group Recording
427
+ */
428
+ export type CursorType =
429
+ /** A custom cursor that is not recognized as a system cursor. */
430
+ | 'custom'
431
+
432
+ // Public System Cursors
433
+
434
+ /** The default system cursor, an arrow. */
435
+ | 'arrow'
436
+ /**
437
+ * System cursor that looks like a capital I with a tiny crossbeam at its
438
+ * middle.
439
+ */
440
+ | 'iBeam'
441
+ /** The cross-hair system cursor. */
442
+ | 'crosshair'
443
+ /** The closed-hand system cursor. */
444
+ | 'closedHand'
445
+ /** The open-hand system cursor. */
446
+ | 'openHand'
447
+ /** The pointing-hand system cursor. */
448
+ | 'pointingHand'
449
+ /** The resize-left system cursor. */
450
+ | 'resizeLeft'
451
+ /** The resize-right system cursor. */
452
+ | 'resizeRight'
453
+ /** The resize-left-and-right system cursor. */
454
+ | 'resizeLeftRight'
455
+ /** The resize-up system cursor. */
456
+ | 'resizeUp'
457
+ /** The resize-down system cursor. */
458
+ | 'resizeDown'
459
+ /** The resize-up-and-down system cursor. */
460
+ | 'resizeUpDown'
461
+ /**
462
+ * System cursor indicating that the current operation will result in a
463
+ * disappearing item.
464
+ */
465
+ | 'disappearingItem'
466
+ /** System cursor for editing vertical layout text. */
467
+ | 'iBeamCursorForVerticalLayout'
468
+ /** The operation not allowed system cursor. */
469
+ | 'operationNotAllowed'
470
+ /**
471
+ * System cursor indicating that the current operation will result in a link
472
+ * action.
473
+ */
474
+ | 'dragLink'
475
+ /**
476
+ * System cursor indicating that the current operation will result in a copy
477
+ * action.
478
+ */
479
+ | 'dragCopy'
480
+ /** The contextual menu system cursor. */
481
+ | 'contextualMenu'
482
+
483
+ // macOS 15+ Public System Cursors
484
+
485
+ /** The column resize system cursor. Available on macOS 15+. */
486
+ | 'columnResize'
487
+ /** The row resize system cursor. Available on macOS 15+. */
488
+ | 'rowResize'
489
+ /** The zoom in system cursor. Available on macOS 15+. */
490
+ | 'zoomIn'
491
+ /** The zoom out system cursor. Available on macOS 15+. */
492
+ | 'zoomOut'
493
+
494
+ // Private System Cursors
495
+
496
+ /** Private bottom-left resize cursor. */
497
+ | 'bottomLeftResize'
498
+ /** Private bottom-right resize cursor. */
499
+ | 'bottomRightResize'
500
+ /** Private top-left resize cursor. */
501
+ | 'topLeftResize'
502
+ /** Private top-right resize cursor. */
503
+ | 'topRightResize'
504
+ /** Private horizontal resize cursor. */
505
+ | 'horizontalResize'
506
+ /** Private vertical resize cursor. */
507
+ | 'verticalResize'
508
+ /**
509
+ * Private busy but clickable cursor (spinning beachball that's still
510
+ * interactive).
511
+ */
512
+ | 'busyButClickable'
513
+ /** Private generic drag cursor. */
514
+ | 'genericDrag'
515
+ /** Private hand cursor. */
516
+ | 'hand'
517
+ /** Private help cursor. */
518
+ | 'help'
519
+ /** Private override help cursor. */
520
+ | 'overrideHelp'
521
+
522
+ // Private Window Resize Cursors
523
+
524
+ /** Private window resize east cursor. */
525
+ | 'windowResizeEast'
526
+ /** Private window resize east-west cursor. */
527
+ | 'windowResizeEastWest'
528
+ /** Private window resize north cursor. */
529
+ | 'windowResizeNorth'
530
+ /** Private window resize north-east cursor. */
531
+ | 'windowResizeNorthEast'
532
+ /** Private window resize north-east-south-west cursor. */
533
+ | 'windowResizeNorthEastSouthWest'
534
+ /** Private window resize north-south cursor. */
535
+ | 'windowResizeNorthSouth'
536
+ /** Private window resize north-west cursor. */
537
+ | 'windowResizeNorthWest'
538
+ /** Private window resize north-west-south-east cursor. */
539
+ | 'windowResizeNorthWestSouthEast'
540
+ /** Private window resize south cursor. */
541
+ | 'windowResizeSouth'
542
+ /** Private window resize south-east cursor. */
543
+ | 'windowResizeSouthEast'
544
+ /** Private window resize south-west cursor. */
545
+ | 'windowResizeSouthWest'
546
+ /** Private window resize west cursor. */
547
+ | 'windowResizeWest';
548
+
549
+ /**
550
+ * Mouse movement and clicks.
551
+ *
552
+ * @group Recording
553
+ */
554
+ export interface RecordedMouseEvent {
555
+ /** Discriminator marking this as a mouse event. */
556
+ type: 'mouse';
557
+ /** Type of mouse event this is. */
558
+ mouseEventType: MouseEventType;
559
+ /** Time the event occurred in the recording. */
560
+ time: EventTime;
561
+ /**
562
+ * Input modifier keys (like shift, option, command, etc) pressed during this
563
+ * event.
564
+ *
565
+ * Possible values will appear at most once, no duplicate values will be
566
+ * present.
567
+ */
568
+ modifiers: InputModifier[];
569
+ /**
570
+ * X-axis position of the mouse cursor relative to the top left of recorded
571
+ * area, ranging from 0 to 1.
572
+ */
573
+ x: number;
574
+ /**
575
+ * Y-axis position of the mouse cursor relative to the top left of recorded
576
+ * area, ranging from 0 to 1.
577
+ */
578
+ y: number;
579
+ /** The relevant mouse button involved in this event. */
580
+ button?: MouseButton;
581
+ /** The type of cursor shown during this event. */
582
+ cursorType: CursorType;
583
+ /** Marks a click on the recording app. */
584
+ targetsCurrentProcess: boolean;
585
+ }
586
+
587
+ /**
588
+ * Keys pressed and released on the keyboard.
589
+ *
590
+ * - note: Pressing/releasing input modifiers (like shift, option, command, etc)
591
+ * are not captured by this event, but through {@link ModifiersChangedEvent}.
592
+ *
593
+ * @group Recording
594
+ */
595
+ export interface RecordedKeyboardEvent {
596
+ /** Discriminator marking this as a keyboard event. */
597
+ type: 'keyboard';
598
+ /** Type of keyboard event this is. */
599
+ keyboardEventType: KeyboardEventType;
600
+ /** Time the event occurred in the recording. */
601
+ time: EventTime;
602
+ /**
603
+ * Input modifier keys (like shift, option, command, etc) pressed during this
604
+ * event.
605
+ *
606
+ * Possible values will appear at most once, no duplicate values will be
607
+ * present.
608
+ */
609
+ modifiers: InputModifier[];
610
+ /**
611
+ * Classifies the key as a regular character key or one of the recognised
612
+ * special keys (escape, arrows, function keys, etc) without needing to
613
+ * inspect raw keycodes. See {@link KeyboardKeyType}.
614
+ */
615
+ keyType: KeyboardKeyType;
616
+ /**
617
+ * A short human-readable label for the key (e.g. `"esc"`, `"return"`, `"left"`, `"F1"`).
618
+ * Character keys carry the produced character, uppercased (e.g. `"A"`, `"1"`, `"/"`); the
619
+ * placeholder `"□"` is used only as a fallback when the character cannot be determined.
620
+ */
621
+ keyTitle: string;
622
+ /**
623
+ * A single-glyph symbol for the key (e.g. `"⎋"`, `"⏎"`, `"←"`, `"⌫"`). Function keys fall back to
624
+ * their label (`"F1"`); character keys carry the produced character, uppercased, with `"□"` as the
625
+ * fallback when it cannot be determined.
626
+ */
627
+ keySymbol: string;
628
+ /**
629
+ * The character(s) the key press produced, if any.
630
+ *
631
+ * Reflects the actual typed text after applying the active keyboard layout
632
+ * and modifiers (so e.g. shift yields a capital). Absent for keys that don't
633
+ * generate characters.
634
+ */
635
+ characters?: string;
636
+ /**
637
+ * Whether the key event is a repeat.
638
+ *
639
+ * Repeats happen when the user holds the key down for a longer period of time
640
+ * and the system starts repeating the same key press over and over again.
641
+ */
642
+ isARepeat: boolean;
643
+ }
644
+
645
+ /**
646
+ * Input modifiers (like shift, option, command, etc) pressed or released.
647
+ *
648
+ * @group Recording
649
+ */
650
+ export interface ModifiersChangedEvent {
651
+ /** Discriminator marking this as a modifiers-changed event. */
652
+ type: 'modifiersChanged';
653
+ /** Time the event occurred in the recording. */
654
+ time: EventTime;
655
+ /**
656
+ * Input modifier keys (like shift, option, command, etc) pressed during this
657
+ * event.
658
+ *
659
+ * Possible values will appear at most once, no duplicate values will be
660
+ * present.
661
+ */
662
+ modifiers: InputModifier[];
663
+ }
664
+
665
+ /**
666
+ * Event during input recording where the earlier and later events are no longer
667
+ * continuous, e.g. after a pause/resume.
668
+ *
669
+ * @group Recording
670
+ */
671
+ export interface DiscontinuationEvent {
672
+ /** Discriminator marking this as a discontinuation event. */
673
+ type: 'discontinuation';
674
+ /** Time the event occurred in the recording. */
675
+ time: EventTime;
676
+ }
677
+
678
+ /**
679
+ * A single input event recorded during a RecordKit recording.
680
+ *
681
+ * Discriminated union on the `type` field. The payload properties of each
682
+ * member are flattened alongside the `type` discriminator in the encoded JSON.
683
+ *
684
+ * @remarks
685
+ * Every member carries a {@link EventTime} `time` field. The mouse, keyboard
686
+ * and modifiers-changed members also carry a `modifiers` set; the
687
+ * discontinuation member has no modifiers (treat it as empty).
688
+ *
689
+ * @group Recording
690
+ */
691
+ export type RecordedInputEvent =
692
+ | RecordedMouseEvent
693
+ | RecordedKeyboardEvent
694
+ | ModifiersChangedEvent
695
+ | DiscontinuationEvent;