autokast 0.0.0 → 0.1.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/LICENSE +29 -0
- package/README.md +165 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +300 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/inspect.d.ts +26 -0
- package/dist/inspect.js +193 -0
- package/dist/record/animations.d.ts +7 -0
- package/dist/record/animations.js +34 -0
- package/dist/record/capture.d.ts +85 -0
- package/dist/record/capture.js +202 -0
- package/dist/record/cast.d.ts +142 -0
- package/dist/record/cast.js +680 -0
- package/dist/record/cursor-style.d.ts +33 -0
- package/dist/record/cursor-style.js +252 -0
- package/dist/record/defaults.d.ts +96 -0
- package/dist/record/defaults.js +125 -0
- package/dist/record/editor.d.ts +11 -0
- package/dist/record/editor.js +48 -0
- package/dist/record/frame-pump.d.ts +91 -0
- package/dist/record/frame-pump.js +306 -0
- package/dist/record/index.d.ts +11 -0
- package/dist/record/index.js +287 -0
- package/dist/record/motion.d.ts +48 -0
- package/dist/record/motion.js +112 -0
- package/dist/record/pace.d.ts +69 -0
- package/dist/record/pace.js +133 -0
- package/dist/record/random.d.ts +12 -0
- package/dist/record/random.js +24 -0
- package/dist/record/scroll.d.ts +71 -0
- package/dist/record/scroll.js +249 -0
- package/dist/record/timeline.d.ts +34 -0
- package/dist/record/timeline.js +44 -0
- package/dist/render/background.d.ts +12 -0
- package/dist/render/background.js +209 -0
- package/dist/render/browser.d.ts +46 -0
- package/dist/render/browser.js +223 -0
- package/dist/render/camera.d.ts +119 -0
- package/dist/render/camera.js +372 -0
- package/dist/render/captions.d.ts +114 -0
- package/dist/render/captions.js +254 -0
- package/dist/render/color.d.ts +23 -0
- package/dist/render/color.js +78 -0
- package/dist/render/compositor.d.ts +185 -0
- package/dist/render/compositor.js +656 -0
- package/dist/render/cursor.d.ts +85 -0
- package/dist/render/cursor.js +314 -0
- package/dist/render/cursors/shapes.d.ts +34 -0
- package/dist/render/cursors/shapes.js +268 -0
- package/dist/render/defaults.d.ts +91 -0
- package/dist/render/defaults.js +139 -0
- package/dist/render/easing.d.ts +13 -0
- package/dist/render/easing.js +40 -0
- package/dist/render/effects.d.ts +39 -0
- package/dist/render/effects.js +91 -0
- package/dist/render/encoder.d.ts +52 -0
- package/dist/render/encoder.js +226 -0
- package/dist/render/index.d.ts +19 -0
- package/dist/render/index.js +138 -0
- package/dist/render/keycaps.d.ts +67 -0
- package/dist/render/keycaps.js +270 -0
- package/dist/render/scene.d.ts +59 -0
- package/dist/render/scene.js +230 -0
- package/dist/render/source.d.ts +21 -0
- package/dist/render/source.js +57 -0
- package/dist/render/spring.d.ts +11 -0
- package/dist/render/spring.js +47 -0
- package/dist/render/stage.d.ts +59 -0
- package/dist/render/stage.js +91 -0
- package/dist/render/timeline.d.ts +70 -0
- package/dist/render/timeline.js +157 -0
- package/dist/session.d.ts +14 -0
- package/dist/session.js +33 -0
- package/dist/types.d.ts +708 -0
- package/dist/types.js +1 -0
- package/package.json +61 -3
- package/skills/autokast/SKILL.md +300 -0
- package/skills/autokast/reference/jupyterlab.md +100 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
import type { BrowserContextOptions, LaunchOptions, Locator, Page } from 'playwright';
|
|
2
|
+
/**
|
|
3
|
+
* A point in viewport CSS pixels, origin at the top-left corner.
|
|
4
|
+
*/
|
|
5
|
+
export interface Point {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A size in pixels.
|
|
11
|
+
*/
|
|
12
|
+
export interface Size {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A rectangle in viewport CSS pixels.
|
|
18
|
+
*/
|
|
19
|
+
export interface Rect extends Point, Size {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Named easing curves that the renderer knows.
|
|
23
|
+
*/
|
|
24
|
+
export type EasingName = 'linear' | 'easeInOutCubic' | 'easeInOutQuart' | 'easeInOutQuint' | 'easeOutCubic' | 'easeOutQuart' | 'easeOutExpo' | 'smooth';
|
|
25
|
+
/**
|
|
26
|
+
* Cursor shapes that the renderer can draw. Unknown CSS cursors map to `default`.
|
|
27
|
+
*/
|
|
28
|
+
export type CursorStyle = 'default' | 'pointer' | 'text' | 'grab' | 'grabbing' | 'crosshair' | 'move' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'not-allowed' | 'none';
|
|
29
|
+
export type MouseButton = 'left' | 'right' | 'middle';
|
|
30
|
+
/**
|
|
31
|
+
* A captured frame. `file` is relative to the session directory.
|
|
32
|
+
*/
|
|
33
|
+
export interface FrameRef {
|
|
34
|
+
t: number;
|
|
35
|
+
file: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One cursor position sample.
|
|
39
|
+
*/
|
|
40
|
+
export interface CursorSample extends Point {
|
|
41
|
+
t: number;
|
|
42
|
+
}
|
|
43
|
+
export interface CursorStyleEvent {
|
|
44
|
+
type: 'cursorStyle';
|
|
45
|
+
t: number;
|
|
46
|
+
style: CursorStyle;
|
|
47
|
+
}
|
|
48
|
+
export interface MouseButtonEvent extends Point {
|
|
49
|
+
type: 'mouseDown' | 'mouseUp';
|
|
50
|
+
t: number;
|
|
51
|
+
button: MouseButton;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A key action. `shortcut` holds a combination such as `Shift+Enter`;
|
|
55
|
+
* `text` holds a typed character.
|
|
56
|
+
*/
|
|
57
|
+
export interface KeyEvent {
|
|
58
|
+
type: 'key';
|
|
59
|
+
t: number;
|
|
60
|
+
kind: 'shortcut' | 'text';
|
|
61
|
+
key: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* How the camera reacts to the cursor during a zoomed shot.
|
|
65
|
+
* `off`: the camera stays on its framing.
|
|
66
|
+
* `edge`: the camera pans only when the cursor comes near the edge of the view.
|
|
67
|
+
* `cursor`: the camera travels with the cursor and keeps it near the middle of the view.
|
|
68
|
+
*/
|
|
69
|
+
export type FollowMode = 'off' | 'edge' | 'cursor';
|
|
70
|
+
/**
|
|
71
|
+
* A camera directive. `focus: null` returns to the full view.
|
|
72
|
+
* The magnification is `scale`, or the named `level`, or else the scale that fits
|
|
73
|
+
* `focus` plus `padding` into the view.
|
|
74
|
+
*/
|
|
75
|
+
export interface ZoomEvent {
|
|
76
|
+
type: 'zoom';
|
|
77
|
+
t: number;
|
|
78
|
+
focus: Rect | null;
|
|
79
|
+
scale?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Name of a zoom level from the `zoom.levels` render option.
|
|
82
|
+
*/
|
|
83
|
+
level?: string;
|
|
84
|
+
padding?: number;
|
|
85
|
+
duration?: number;
|
|
86
|
+
easing?: EasingName;
|
|
87
|
+
/**
|
|
88
|
+
* Follow mode until the next zoom directive. Default: the `zoom.follow` render option.
|
|
89
|
+
* `true` means `edge` and `false` means `off`.
|
|
90
|
+
*/
|
|
91
|
+
follow?: FollowMode | boolean;
|
|
92
|
+
/**
|
|
93
|
+
* `cursor` marks a zoom on the cursor position with no target: the camera has no
|
|
94
|
+
* framing to return to.
|
|
95
|
+
*/
|
|
96
|
+
anchor?: 'target' | 'cursor';
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Removes the record time range [t, end) from the output.
|
|
100
|
+
*/
|
|
101
|
+
export interface CutEvent {
|
|
102
|
+
type: 'cut';
|
|
103
|
+
t: number;
|
|
104
|
+
end: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Plays the record time range [t, end) at `rate` times the normal speed.
|
|
108
|
+
*/
|
|
109
|
+
export interface SpeedEvent {
|
|
110
|
+
type: 'speed';
|
|
111
|
+
t: number;
|
|
112
|
+
end: number;
|
|
113
|
+
rate: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A text caption shown from `t` for `duration` milliseconds. `**` in the text starts and
|
|
117
|
+
* ends the emphasis.
|
|
118
|
+
*/
|
|
119
|
+
export interface CaptionEvent {
|
|
120
|
+
type: 'caption';
|
|
121
|
+
t: number;
|
|
122
|
+
duration: number;
|
|
123
|
+
text: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Dims everything except `rect` from `t` for `duration` milliseconds.
|
|
127
|
+
*/
|
|
128
|
+
export interface SpotlightEvent {
|
|
129
|
+
type: 'spotlight';
|
|
130
|
+
t: number;
|
|
131
|
+
duration: number;
|
|
132
|
+
rect: Rect;
|
|
133
|
+
padding?: number;
|
|
134
|
+
radius?: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A named point in time, for chapters and for debugging.
|
|
138
|
+
*/
|
|
139
|
+
export interface MarkerEvent {
|
|
140
|
+
type: 'marker';
|
|
141
|
+
t: number;
|
|
142
|
+
label: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The address of the page from `t`. With `typing`, the address bar of the browser frame
|
|
146
|
+
* shows the text as it is typed during that many milliseconds. With `show`, the address
|
|
147
|
+
* bar is larger for that many milliseconds.
|
|
148
|
+
*/
|
|
149
|
+
export interface UrlEvent {
|
|
150
|
+
type: 'url';
|
|
151
|
+
t: number;
|
|
152
|
+
url: string;
|
|
153
|
+
typing?: number;
|
|
154
|
+
show?: number;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* One Cast call with its start and end time, for inspection and debugging.
|
|
158
|
+
*/
|
|
159
|
+
export interface ActionEvent {
|
|
160
|
+
type: 'action';
|
|
161
|
+
t: number;
|
|
162
|
+
end: number;
|
|
163
|
+
call: string;
|
|
164
|
+
}
|
|
165
|
+
export type TimelineEvent = ActionEvent | CursorStyleEvent | MouseButtonEvent | KeyEvent | ZoomEvent | CutEvent | SpeedEvent | CaptionEvent | SpotlightEvent | MarkerEvent | UrlEvent;
|
|
166
|
+
/**
|
|
167
|
+
* The content of `session.json`.
|
|
168
|
+
*/
|
|
169
|
+
export interface Session {
|
|
170
|
+
version: 1;
|
|
171
|
+
name: string;
|
|
172
|
+
createdAt: string;
|
|
173
|
+
url?: string;
|
|
174
|
+
viewport: Size;
|
|
175
|
+
deviceScaleFactor: number;
|
|
176
|
+
/**
|
|
177
|
+
* Pixel size of the captured frames (viewport times device scale factor).
|
|
178
|
+
*/
|
|
179
|
+
frameSize: Size;
|
|
180
|
+
duration: number;
|
|
181
|
+
frames: FrameRef[];
|
|
182
|
+
cursor: CursorSample[];
|
|
183
|
+
events: TimelineEvent[];
|
|
184
|
+
/**
|
|
185
|
+
* Render options that the script supplied. `render()` options override them.
|
|
186
|
+
*/
|
|
187
|
+
render?: RenderOptions;
|
|
188
|
+
}
|
|
189
|
+
export interface CaptureOptions {
|
|
190
|
+
/**
|
|
191
|
+
* `realtime` captures the page as it paints. `frame-perfect` controls the page clock and
|
|
192
|
+
* captures one frame for each step of page time: the recording takes longer than real
|
|
193
|
+
* time, but page motion is exact on any machine. Needs the headless shell of Chromium.
|
|
194
|
+
*/
|
|
195
|
+
mode?: 'realtime' | 'frame-perfect';
|
|
196
|
+
/**
|
|
197
|
+
* Frames per second of page time in `frame-perfect` mode. Default: 60.
|
|
198
|
+
*/
|
|
199
|
+
fps?: number;
|
|
200
|
+
/**
|
|
201
|
+
* In `frame-perfect` mode, how far the page clock starts ahead of the real clock, in
|
|
202
|
+
* milliseconds. The page clock runs slower than real time, so without a lead a time
|
|
203
|
+
* stamp from a server can be in the page's future. Default: 600000.
|
|
204
|
+
*/
|
|
205
|
+
clockLead?: number;
|
|
206
|
+
format?: 'jpeg' | 'png';
|
|
207
|
+
/**
|
|
208
|
+
* JPEG quality, 0-100.
|
|
209
|
+
*/
|
|
210
|
+
quality?: number;
|
|
211
|
+
}
|
|
212
|
+
export interface BrowserOptions {
|
|
213
|
+
headless?: boolean;
|
|
214
|
+
channel?: string;
|
|
215
|
+
executablePath?: string;
|
|
216
|
+
args?: string[];
|
|
217
|
+
launchOptions?: LaunchOptions;
|
|
218
|
+
contextOptions?: BrowserContextOptions;
|
|
219
|
+
}
|
|
220
|
+
export interface CursorMotionOptions {
|
|
221
|
+
/**
|
|
222
|
+
* Start position. Default: the center of the viewport.
|
|
223
|
+
*/
|
|
224
|
+
start?: Point;
|
|
225
|
+
/**
|
|
226
|
+
* Speed multiplier for cursor moves. 2 is twice as fast.
|
|
227
|
+
*/
|
|
228
|
+
speed?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Path curvature, 0 (straight) to 1.
|
|
231
|
+
*/
|
|
232
|
+
curvature?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Limits for the duration of one move, in milliseconds.
|
|
235
|
+
*/
|
|
236
|
+
minDuration?: number;
|
|
237
|
+
maxDuration?: number;
|
|
238
|
+
}
|
|
239
|
+
export interface TypingOptions {
|
|
240
|
+
/**
|
|
241
|
+
* Mean delay between characters, in milliseconds. Default: 55, which gives about
|
|
242
|
+
* 13 characters per second with the pauses after spaces and punctuation.
|
|
243
|
+
*/
|
|
244
|
+
delay?: number;
|
|
245
|
+
/**
|
|
246
|
+
* Random variation of the delay, 0 to 1.
|
|
247
|
+
*/
|
|
248
|
+
variance?: number;
|
|
249
|
+
}
|
|
250
|
+
export interface PacingOptions {
|
|
251
|
+
/**
|
|
252
|
+
* Pause before the first action and after the last one, in milliseconds.
|
|
253
|
+
*/
|
|
254
|
+
startDelay?: number;
|
|
255
|
+
endDelay?: number;
|
|
256
|
+
/**
|
|
257
|
+
* Pause between the end of a cursor move and the button press.
|
|
258
|
+
*/
|
|
259
|
+
beforeClick?: number;
|
|
260
|
+
afterClick?: number;
|
|
261
|
+
afterType?: number;
|
|
262
|
+
/**
|
|
263
|
+
* Time the mouse button stays down for a click.
|
|
264
|
+
*/
|
|
265
|
+
pressDuration?: number;
|
|
266
|
+
}
|
|
267
|
+
export interface RecordOptions {
|
|
268
|
+
/**
|
|
269
|
+
* Name of the screencast. Used for the session directory and the default output.
|
|
270
|
+
*/
|
|
271
|
+
name?: string;
|
|
272
|
+
url?: string;
|
|
273
|
+
viewport?: Size;
|
|
274
|
+
deviceScaleFactor?: number;
|
|
275
|
+
colorScheme?: 'light' | 'dark';
|
|
276
|
+
/**
|
|
277
|
+
* Directory for the session. Default: `.autokast/<name>`.
|
|
278
|
+
*/
|
|
279
|
+
sessionDir?: string;
|
|
280
|
+
browser?: BrowserOptions;
|
|
281
|
+
capture?: CaptureOptions;
|
|
282
|
+
cursor?: CursorMotionOptions;
|
|
283
|
+
typing?: TypingOptions;
|
|
284
|
+
pacing?: PacingOptions;
|
|
285
|
+
/**
|
|
286
|
+
* How an off-screen target comes into view before an action. Default: `smooth`.
|
|
287
|
+
*/
|
|
288
|
+
scrollBehavior?: 'smooth' | 'instant';
|
|
289
|
+
/**
|
|
290
|
+
* Default time limit for one Cast call, in milliseconds.
|
|
291
|
+
*/
|
|
292
|
+
timeout?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Seed for the random variations (path curvature, typing rhythm).
|
|
295
|
+
*/
|
|
296
|
+
seed?: number;
|
|
297
|
+
/**
|
|
298
|
+
* Render options stored in the session as its defaults.
|
|
299
|
+
*/
|
|
300
|
+
render?: RenderOptions;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Something on the page: a Playwright locator, a selector, a point or a rectangle.
|
|
304
|
+
*/
|
|
305
|
+
export type Target = Locator | string | Point | Rect;
|
|
306
|
+
export interface MoveOptions {
|
|
307
|
+
/**
|
|
308
|
+
* Duration in milliseconds. Default: computed from the distance.
|
|
309
|
+
*/
|
|
310
|
+
duration?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Position relative to the target, as fractions of its size: 0.5 is the middle, and
|
|
313
|
+
* values below 0 or above 1 are outside the target. Default: near the center.
|
|
314
|
+
*/
|
|
315
|
+
position?: {
|
|
316
|
+
x: number;
|
|
317
|
+
y: number;
|
|
318
|
+
};
|
|
319
|
+
timeout?: number;
|
|
320
|
+
}
|
|
321
|
+
export interface DragOptions extends MoveOptions {
|
|
322
|
+
/**
|
|
323
|
+
* Position relative to the destination. `position` is for the source.
|
|
324
|
+
*/
|
|
325
|
+
toPosition?: {
|
|
326
|
+
x: number;
|
|
327
|
+
y: number;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Duration of the move while the button is down. Default: computed, slower than a free move.
|
|
331
|
+
*/
|
|
332
|
+
dragDuration?: number;
|
|
333
|
+
}
|
|
334
|
+
export interface ClickOptions extends MoveOptions {
|
|
335
|
+
button?: MouseButton;
|
|
336
|
+
clickCount?: number;
|
|
337
|
+
modifiers?: Array<'Alt' | 'Control' | 'Meta' | 'Shift'>;
|
|
338
|
+
/**
|
|
339
|
+
* Skips the Playwright actionability check.
|
|
340
|
+
*/
|
|
341
|
+
force?: boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Pause after the press, in milliseconds. Default: `pacing.afterClick`. Use 0 before a
|
|
344
|
+
* `cut` so that a loading state does not show.
|
|
345
|
+
*/
|
|
346
|
+
afterClick?: number;
|
|
347
|
+
}
|
|
348
|
+
export interface TypeOptions extends TypingOptions {
|
|
349
|
+
/**
|
|
350
|
+
* Clicks this target first to focus it, at `position` (fractions of its size) when given.
|
|
351
|
+
*/
|
|
352
|
+
into?: Target;
|
|
353
|
+
position?: {
|
|
354
|
+
x: number;
|
|
355
|
+
y: number;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* `auto` makes each line start at the indentation given in the text, also in
|
|
359
|
+
* editors that indent by themselves. `raw` sends the characters as they are.
|
|
360
|
+
*/
|
|
361
|
+
indent?: 'auto' | 'raw';
|
|
362
|
+
}
|
|
363
|
+
export interface ScrollOptions {
|
|
364
|
+
/**
|
|
365
|
+
* Moves the cursor to this target before the scroll.
|
|
366
|
+
*/
|
|
367
|
+
at?: Target;
|
|
368
|
+
duration?: number;
|
|
369
|
+
}
|
|
370
|
+
export interface ScrollToOptions {
|
|
371
|
+
/**
|
|
372
|
+
* Where the target ends in its scroll container. Default: `center`.
|
|
373
|
+
*/
|
|
374
|
+
block?: 'start' | 'center' | 'end' | 'nearest';
|
|
375
|
+
duration?: number;
|
|
376
|
+
timeout?: number;
|
|
377
|
+
}
|
|
378
|
+
export interface ZoomToOptions {
|
|
379
|
+
/**
|
|
380
|
+
* Magnification of the page relative to the full view: 2 shows the page twice as large.
|
|
381
|
+
* Without `scale` and `level`, the camera fits the target plus `padding` in the output.
|
|
382
|
+
*/
|
|
383
|
+
scale?: number;
|
|
384
|
+
/**
|
|
385
|
+
* A named zoom level: `wide`, `medium`, `close`, or a name from the `zoom.levels` render
|
|
386
|
+
* option. A render can change what each level means without a new recording.
|
|
387
|
+
*/
|
|
388
|
+
level?: string;
|
|
389
|
+
padding?: number;
|
|
390
|
+
/**
|
|
391
|
+
* How the camera reacts to the cursor during this shot: `off`, `edge` or `cursor`
|
|
392
|
+
* (`true` is `edge`, `false` is `off`). Default: the `zoom.follow` render option.
|
|
393
|
+
*/
|
|
394
|
+
follow?: FollowMode | boolean;
|
|
395
|
+
duration?: number;
|
|
396
|
+
easing?: EasingName;
|
|
397
|
+
/**
|
|
398
|
+
* How long the call waits before the next action: `true` for the whole camera move,
|
|
399
|
+
* `false` for no wait, or a number of milliseconds. Default: about a third of the move,
|
|
400
|
+
* so the next action overlaps the camera move.
|
|
401
|
+
*/
|
|
402
|
+
wait?: boolean | number;
|
|
403
|
+
}
|
|
404
|
+
export interface CaptionOptions {
|
|
405
|
+
/**
|
|
406
|
+
* Default: computed from the text length.
|
|
407
|
+
*/
|
|
408
|
+
duration?: number;
|
|
409
|
+
/**
|
|
410
|
+
* Waits for the caption to end. Default: false.
|
|
411
|
+
*/
|
|
412
|
+
wait?: boolean;
|
|
413
|
+
}
|
|
414
|
+
export interface GotoOptions {
|
|
415
|
+
/**
|
|
416
|
+
* Shows the URL as typed text in the address bar before the page opens. Default: true
|
|
417
|
+
* when the script selects the browser frame, false otherwise.
|
|
418
|
+
*/
|
|
419
|
+
typing?: boolean;
|
|
420
|
+
}
|
|
421
|
+
export interface ShowUrlOptions {
|
|
422
|
+
/**
|
|
423
|
+
* Default: 2000 ms.
|
|
424
|
+
*/
|
|
425
|
+
duration?: number;
|
|
426
|
+
/**
|
|
427
|
+
* Waits for the end. Default: true.
|
|
428
|
+
*/
|
|
429
|
+
wait?: boolean;
|
|
430
|
+
}
|
|
431
|
+
export interface SpotlightOptions {
|
|
432
|
+
duration?: number;
|
|
433
|
+
padding?: number;
|
|
434
|
+
radius?: number;
|
|
435
|
+
wait?: boolean;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The director that a script uses to act on the page and to control the camera.
|
|
439
|
+
* Every method adds to the timeline at the current record time.
|
|
440
|
+
*/
|
|
441
|
+
export interface Cast {
|
|
442
|
+
readonly page: Page;
|
|
443
|
+
readonly viewport: Size;
|
|
444
|
+
moveTo(target: Target, options?: MoveOptions): Promise<void>;
|
|
445
|
+
click(target: Target, options?: ClickOptions): Promise<void>;
|
|
446
|
+
dblclick(target: Target, options?: ClickOptions): Promise<void>;
|
|
447
|
+
rightClick(target: Target, options?: ClickOptions): Promise<void>;
|
|
448
|
+
hover(target: Target, options?: MoveOptions & {
|
|
449
|
+
hold?: number;
|
|
450
|
+
}): Promise<void>;
|
|
451
|
+
drag(from: Target, to: Target, options?: DragOptions): Promise<void>;
|
|
452
|
+
/**
|
|
453
|
+
* Clicks a native `<select>` and chooses options by value or label. The list does not
|
|
454
|
+
* open: the browser draws it outside the page, so the video could not show it.
|
|
455
|
+
*/
|
|
456
|
+
select(target: Locator | string, values: string | string[], options?: ClickOptions): Promise<void>;
|
|
457
|
+
scroll(delta: {
|
|
458
|
+
x?: number;
|
|
459
|
+
y?: number;
|
|
460
|
+
}, options?: ScrollOptions): Promise<void>;
|
|
461
|
+
/**
|
|
462
|
+
* Scrolls smoothly until the target is in view.
|
|
463
|
+
*/
|
|
464
|
+
scrollTo(target: Target, options?: ScrollToOptions): Promise<void>;
|
|
465
|
+
type(text: string, options?: TypeOptions): Promise<void>;
|
|
466
|
+
press(keys: string, options?: {
|
|
467
|
+
hold?: number;
|
|
468
|
+
}): Promise<void>;
|
|
469
|
+
/**
|
|
470
|
+
* Opens a URL and removes the load from the video. With the browser frame
|
|
471
|
+
* (`render.frame.chrome: 'browser'`), the address bar first shows the URL as it is typed.
|
|
472
|
+
*/
|
|
473
|
+
goto(url: string, options?: GotoOptions): Promise<void>;
|
|
474
|
+
/**
|
|
475
|
+
* Makes the address bar of the browser frame larger for a moment, so that the viewer can
|
|
476
|
+
* read the URL of the page. Does nothing when the script does not select the browser
|
|
477
|
+
* frame.
|
|
478
|
+
*/
|
|
479
|
+
showUrl(options?: ShowUrlOptions): Promise<void>;
|
|
480
|
+
zoomTo(target: Target, options?: ZoomToOptions): Promise<void>;
|
|
481
|
+
/**
|
|
482
|
+
* Zooms on the cursor position, to a named level or a scale, and lets the camera travel
|
|
483
|
+
* with the cursor (`follow: 'cursor'` unless the options say otherwise).
|
|
484
|
+
*/
|
|
485
|
+
zoom(level: string | number, options?: Omit<ZoomToOptions, 'scale' | 'level' | 'padding'>): Promise<void>;
|
|
486
|
+
zoomOut(options?: Omit<ZoomToOptions, 'scale' | 'level' | 'padding' | 'follow'>): Promise<void>;
|
|
487
|
+
wait(ms: number): Promise<void>;
|
|
488
|
+
/**
|
|
489
|
+
* Runs `fn` and removes that time from the video.
|
|
490
|
+
*/
|
|
491
|
+
cut<T>(fn: () => Promise<T>): Promise<T>;
|
|
492
|
+
/**
|
|
493
|
+
* Runs `fn` and plays that time at `rate` times the normal speed.
|
|
494
|
+
*/
|
|
495
|
+
speed<T>(rate: number, fn: () => Promise<T>): Promise<T>;
|
|
496
|
+
/**
|
|
497
|
+
* Shows a caption on the backdrop, one line at a time: text that is too long for one
|
|
498
|
+
* line shows as several lines in sequence. Words between `**` get the emphasis: they
|
|
499
|
+
* keep the full tone and the other words are dimmed.
|
|
500
|
+
*/
|
|
501
|
+
caption(text: string, options?: CaptionOptions): Promise<void>;
|
|
502
|
+
spotlight(target: Target, options?: SpotlightOptions): Promise<void>;
|
|
503
|
+
marker(label: string): void;
|
|
504
|
+
}
|
|
505
|
+
export type BackgroundOptions = {
|
|
506
|
+
type: 'solid';
|
|
507
|
+
color: string;
|
|
508
|
+
} | {
|
|
509
|
+
type: 'gradient';
|
|
510
|
+
colors: string[];
|
|
511
|
+
angle?: number;
|
|
512
|
+
} | {
|
|
513
|
+
type: 'image';
|
|
514
|
+
path: string;
|
|
515
|
+
blur?: number;
|
|
516
|
+
} | {
|
|
517
|
+
type: 'preset';
|
|
518
|
+
name: string;
|
|
519
|
+
};
|
|
520
|
+
export interface ShadowOptions {
|
|
521
|
+
color?: string;
|
|
522
|
+
blur?: number;
|
|
523
|
+
offsetY?: number;
|
|
524
|
+
}
|
|
525
|
+
export interface FrameOptions {
|
|
526
|
+
/**
|
|
527
|
+
* Space around the content. Below 1: a fraction of the output height. Otherwise pixels.
|
|
528
|
+
*/
|
|
529
|
+
padding?: number;
|
|
530
|
+
radius?: number;
|
|
531
|
+
shadow?: ShadowOptions | false;
|
|
532
|
+
/**
|
|
533
|
+
* `window` adds a title bar above the content. `browser` adds a browser toolbar with an
|
|
534
|
+
* address bar that follows the URL of the page.
|
|
535
|
+
*/
|
|
536
|
+
chrome?: 'none' | 'window' | 'browser';
|
|
537
|
+
title?: string;
|
|
538
|
+
chromeTheme?: 'light' | 'dark';
|
|
539
|
+
/**
|
|
540
|
+
* Text of the address bar. `true` (default) shows the URL of the page, a string shows
|
|
541
|
+
* that text for the whole video, and `false` leaves the address bar empty.
|
|
542
|
+
*/
|
|
543
|
+
address?: boolean | string;
|
|
544
|
+
/**
|
|
545
|
+
* Replaces the origin of the page URL in the address bar, for example
|
|
546
|
+
* `jupyterlite.github.io/demo` for a site that was recorded on `localhost:8000`.
|
|
547
|
+
*/
|
|
548
|
+
origin?: string;
|
|
549
|
+
}
|
|
550
|
+
export interface ClickEffectOptions {
|
|
551
|
+
type?: 'ripple' | 'ring' | 'none';
|
|
552
|
+
color?: string;
|
|
553
|
+
/**
|
|
554
|
+
* Final radius in output pixels at scale 1.
|
|
555
|
+
*/
|
|
556
|
+
size?: number;
|
|
557
|
+
duration?: number;
|
|
558
|
+
}
|
|
559
|
+
export interface CursorRenderOptions {
|
|
560
|
+
visible?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Size multiplier. 1 is the size of a system cursor at the capture scale.
|
|
563
|
+
*/
|
|
564
|
+
size?: number;
|
|
565
|
+
/**
|
|
566
|
+
* Position smoothing with a spring, 0 (off) to 1.
|
|
567
|
+
*/
|
|
568
|
+
smoothing?: number;
|
|
569
|
+
/**
|
|
570
|
+
* Scale of the cursor while a button is down.
|
|
571
|
+
*/
|
|
572
|
+
pressScale?: number;
|
|
573
|
+
/**
|
|
574
|
+
* Hides the cursor after this many milliseconds without a move. 0 keeps it visible.
|
|
575
|
+
*/
|
|
576
|
+
hideAfter?: number;
|
|
577
|
+
/**
|
|
578
|
+
* Motion blur of the cursor during fast moves, 0 (off) to 1 (a full frame of blur).
|
|
579
|
+
*/
|
|
580
|
+
motionBlur?: number;
|
|
581
|
+
/**
|
|
582
|
+
* How much the cursor leans into its travel, as if it had weight: 0 (off) to 1 and
|
|
583
|
+
* above. It swings back upright when the cursor stops.
|
|
584
|
+
*/
|
|
585
|
+
tilt?: number;
|
|
586
|
+
click?: ClickEffectOptions;
|
|
587
|
+
}
|
|
588
|
+
export interface AutoZoomOptions {
|
|
589
|
+
scale?: number;
|
|
590
|
+
/**
|
|
591
|
+
* Time the camera stays on a click after the last activity near it.
|
|
592
|
+
*/
|
|
593
|
+
hold?: number;
|
|
594
|
+
/**
|
|
595
|
+
* Clicks closer in time than this join into one zoom.
|
|
596
|
+
*/
|
|
597
|
+
mergeWindow?: number;
|
|
598
|
+
}
|
|
599
|
+
export interface ZoomRenderOptions {
|
|
600
|
+
/**
|
|
601
|
+
* Generates zooms from clicks and typing when the script gives no zoom directives.
|
|
602
|
+
*/
|
|
603
|
+
auto?: boolean | AutoZoomOptions;
|
|
604
|
+
/**
|
|
605
|
+
* `camera` scales the full frame past the output edges; `crop` zooms inside a fixed frame.
|
|
606
|
+
*/
|
|
607
|
+
mode?: 'camera' | 'crop';
|
|
608
|
+
/**
|
|
609
|
+
* In `camera` mode, what a zoomed shot shows at an edge of the page: `fill` covers the
|
|
610
|
+
* output with the page, `keep` keeps the window edge and the backdrop in view.
|
|
611
|
+
*/
|
|
612
|
+
edges?: 'fill' | 'keep';
|
|
613
|
+
maxScale?: number;
|
|
614
|
+
duration?: number;
|
|
615
|
+
easing?: EasingName;
|
|
616
|
+
/**
|
|
617
|
+
* How the camera reacts to the cursor while zoomed, for shots that do not set it.
|
|
618
|
+
* Default: `edge`.
|
|
619
|
+
*/
|
|
620
|
+
follow?: FollowMode;
|
|
621
|
+
/**
|
|
622
|
+
* How fast the camera catches up with the cursor. 1 is the default; 2 is twice as fast.
|
|
623
|
+
*/
|
|
624
|
+
followSpeed?: number;
|
|
625
|
+
/**
|
|
626
|
+
* Named zoom levels. Defaults: `wide` 1.3, `medium` 1.6, `close` 2.2.
|
|
627
|
+
*/
|
|
628
|
+
levels?: Record<string, number>;
|
|
629
|
+
motionBlur?: number;
|
|
630
|
+
}
|
|
631
|
+
export interface KeystrokeOptions {
|
|
632
|
+
show?: 'none' | 'shortcuts' | 'all';
|
|
633
|
+
position?: 'bottom' | 'top';
|
|
634
|
+
/**
|
|
635
|
+
* Key names on the caps: `mac` (⌘ Cmd, ⌥ Opt) or `pc` (Ctrl, Alt). Default: `mac` when
|
|
636
|
+
* the render runs on macOS, else `pc`.
|
|
637
|
+
*/
|
|
638
|
+
labels?: 'mac' | 'pc';
|
|
639
|
+
}
|
|
640
|
+
export interface CaptionRenderOptions {
|
|
641
|
+
position?: 'bottom' | 'top';
|
|
642
|
+
fontSize?: number;
|
|
643
|
+
fontFamily?: string;
|
|
644
|
+
}
|
|
645
|
+
export interface EncodeOptions {
|
|
646
|
+
/**
|
|
647
|
+
* `draft` renders fast for iteration; `max` is visually lossless and gives large files.
|
|
648
|
+
*/
|
|
649
|
+
quality?: 'draft' | 'standard' | 'high' | 'max';
|
|
650
|
+
/**
|
|
651
|
+
* Overrides for the encoder: constant rate factor, speed preset, pixel format.
|
|
652
|
+
*/
|
|
653
|
+
crf?: number;
|
|
654
|
+
preset?: string;
|
|
655
|
+
pixelFormat?: string;
|
|
656
|
+
ffmpegPath?: string;
|
|
657
|
+
}
|
|
658
|
+
export interface RenderOptions {
|
|
659
|
+
/**
|
|
660
|
+
* Output file. The extension selects the format: `.mp4`, `.webm` or `.gif`.
|
|
661
|
+
*/
|
|
662
|
+
output?: string;
|
|
663
|
+
size?: Size;
|
|
664
|
+
fps?: number;
|
|
665
|
+
background?: BackgroundOptions | string;
|
|
666
|
+
frame?: FrameOptions;
|
|
667
|
+
cursor?: CursorRenderOptions;
|
|
668
|
+
zoom?: ZoomRenderOptions;
|
|
669
|
+
keystrokes?: KeystrokeOptions;
|
|
670
|
+
captions?: CaptionRenderOptions;
|
|
671
|
+
encode?: EncodeOptions;
|
|
672
|
+
/**
|
|
673
|
+
* Renders only this output time range, in milliseconds.
|
|
674
|
+
*/
|
|
675
|
+
range?: {
|
|
676
|
+
start?: number;
|
|
677
|
+
end?: number;
|
|
678
|
+
};
|
|
679
|
+
onProgress?: (done: number, total: number) => void;
|
|
680
|
+
}
|
|
681
|
+
export interface RenderResult {
|
|
682
|
+
output: string;
|
|
683
|
+
duration: number;
|
|
684
|
+
frames: number;
|
|
685
|
+
size: Size;
|
|
686
|
+
fps: number;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Handle to a recorded session on disk.
|
|
690
|
+
*/
|
|
691
|
+
export interface RecordedSession {
|
|
692
|
+
dir: string;
|
|
693
|
+
session: Session;
|
|
694
|
+
render(options?: RenderOptions): Promise<RenderResult>;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Context for the `setup` step, which runs before the recording starts.
|
|
698
|
+
*/
|
|
699
|
+
export interface SetupContext {
|
|
700
|
+
page: Page;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* A screencast definition: the default export of a script for the CLI.
|
|
704
|
+
*/
|
|
705
|
+
export interface ScreencastDefinition extends RecordOptions {
|
|
706
|
+
setup?: (context: SetupContext) => Promise<void>;
|
|
707
|
+
run: (cast: Cast) => Promise<void>;
|
|
708
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|