@gnawbit/tabretake 0.0.0-stage → 0.4.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.
@@ -0,0 +1,616 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/gnawbit/tabretake/main/schemas/story.schema.json",
4
+ "title": "TabRetake story, recording marks or recorded timeline",
5
+ "oneOf": [
6
+ {
7
+ "$ref": "#/definitions/story"
8
+ },
9
+ {
10
+ "$ref": "#/definitions/marks"
11
+ },
12
+ {
13
+ "$ref": "#/definitions/record"
14
+ }
15
+ ],
16
+ "definitions": {
17
+ "viewport": {
18
+ "type": "object",
19
+ "properties": {
20
+ "width": {
21
+ "type": "integer",
22
+ "minimum": 1
23
+ },
24
+ "height": {
25
+ "type": "integer",
26
+ "minimum": 1
27
+ }
28
+ },
29
+ "additionalProperties": false,
30
+ "required": [
31
+ "width",
32
+ "height"
33
+ ]
34
+ },
35
+ "vertical": {
36
+ "type": "object",
37
+ "properties": {
38
+ "zoom": {
39
+ "type": "number",
40
+ "minimum": 1,
41
+ "maximum": 10,
42
+ "description": "Portrait focus magnification; --vertical-zoom overrides this value."
43
+ },
44
+ "badge": {
45
+ "type": "string"
46
+ },
47
+ "titleLines": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "string"
51
+ },
52
+ "minItems": 1,
53
+ "maxItems": 2
54
+ },
55
+ "titleSize": {
56
+ "type": "number",
57
+ "exclusiveMinimum": 0
58
+ },
59
+ "titleY": {
60
+ "type": "number",
61
+ "minimum": 0
62
+ },
63
+ "subtitle": {
64
+ "type": "string"
65
+ },
66
+ "subtitleSize": {
67
+ "type": "number",
68
+ "exclusiveMinimum": 0
69
+ },
70
+ "subtitleGap": {
71
+ "type": "number",
72
+ "minimum": 0
73
+ },
74
+ "cta": {
75
+ "type": "string"
76
+ },
77
+ "ctaSize": {
78
+ "type": "number",
79
+ "exclusiveMinimum": 0
80
+ },
81
+ "ctaY": {
82
+ "type": "number",
83
+ "minimum": 0
84
+ },
85
+ "watermark": {
86
+ "type": "boolean"
87
+ }
88
+ },
89
+ "additionalProperties": false
90
+ },
91
+ "step": {
92
+ "type": "object",
93
+ "properties": {
94
+ "action": {
95
+ "enum": [
96
+ "wait",
97
+ "goto",
98
+ "click",
99
+ "type",
100
+ "hover",
101
+ "focus",
102
+ "drag",
103
+ "scroll",
104
+ "press",
105
+ "waitFor",
106
+ "screenshot"
107
+ ]
108
+ },
109
+ "selector": {
110
+ "type": "string",
111
+ "minLength": 1
112
+ },
113
+ "role": {
114
+ "type": "string",
115
+ "minLength": 1
116
+ },
117
+ "name": {
118
+ "type": "string",
119
+ "minLength": 1
120
+ },
121
+ "text": {
122
+ "type": "string",
123
+ "minLength": 1
124
+ },
125
+ "value": {
126
+ "type": "string"
127
+ },
128
+ "url": {
129
+ "type": "string",
130
+ "minLength": 1
131
+ },
132
+ "key": {
133
+ "type": "string",
134
+ "minLength": 1
135
+ },
136
+ "file": {
137
+ "type": "string",
138
+ "minLength": 1
139
+ },
140
+ "ms": {
141
+ "type": "number",
142
+ "minimum": 0,
143
+ "description": "Milliseconds."
144
+ },
145
+ "pause": {
146
+ "type": "number",
147
+ "minimum": 0,
148
+ "description": "Milliseconds."
149
+ },
150
+ "timeout": {
151
+ "type": "number",
152
+ "exclusiveMinimum": 0,
153
+ "description": "Milliseconds."
154
+ },
155
+ "dx": {
156
+ "type": "number"
157
+ },
158
+ "dy": {
159
+ "type": "number"
160
+ },
161
+ "y": {
162
+ "type": "number"
163
+ },
164
+ "steps": {
165
+ "type": "integer",
166
+ "minimum": 1
167
+ },
168
+ "caption": {
169
+ "type": "string"
170
+ },
171
+ "zoom": {
172
+ "type": "boolean"
173
+ }
174
+ },
175
+ "additionalProperties": false,
176
+ "required": [
177
+ "action"
178
+ ],
179
+ "allOf": [
180
+ {
181
+ "if": {
182
+ "properties": {
183
+ "action": {
184
+ "enum": [
185
+ "click",
186
+ "type",
187
+ "hover",
188
+ "focus",
189
+ "drag"
190
+ ]
191
+ }
192
+ }
193
+ },
194
+ "then": {
195
+ "anyOf": [
196
+ {
197
+ "required": [
198
+ "selector"
199
+ ]
200
+ },
201
+ {
202
+ "required": [
203
+ "role"
204
+ ]
205
+ },
206
+ {
207
+ "required": [
208
+ "name"
209
+ ]
210
+ },
211
+ {
212
+ "required": [
213
+ "text"
214
+ ]
215
+ }
216
+ ]
217
+ }
218
+ },
219
+ {
220
+ "if": {
221
+ "properties": {
222
+ "action": {
223
+ "const": "type"
224
+ }
225
+ }
226
+ },
227
+ "then": {
228
+ "anyOf": [
229
+ {
230
+ "required": [
231
+ "value"
232
+ ]
233
+ },
234
+ {
235
+ "required": [
236
+ "text"
237
+ ]
238
+ }
239
+ ]
240
+ }
241
+ },
242
+ {
243
+ "if": {
244
+ "properties": {
245
+ "action": {
246
+ "const": "waitFor"
247
+ }
248
+ }
249
+ },
250
+ "then": {
251
+ "anyOf": [
252
+ {
253
+ "required": [
254
+ "url"
255
+ ]
256
+ },
257
+ {
258
+ "required": [
259
+ "selector"
260
+ ]
261
+ },
262
+ {
263
+ "required": [
264
+ "text"
265
+ ]
266
+ }
267
+ ]
268
+ }
269
+ },
270
+ {
271
+ "if": {
272
+ "properties": {
273
+ "action": {
274
+ "const": "goto"
275
+ }
276
+ }
277
+ },
278
+ "then": {
279
+ "properties": {
280
+ "url": {
281
+ "type": "string",
282
+ "format": "uri",
283
+ "pattern": "^https?://"
284
+ }
285
+ }
286
+ }
287
+ }
288
+ ]
289
+ },
290
+ "mark": {
291
+ "type": "object",
292
+ "properties": {
293
+ "t": {
294
+ "type": "number",
295
+ "minimum": 0,
296
+ "description": "Seconds on the output timeline."
297
+ },
298
+ "duration": {
299
+ "type": "number",
300
+ "minimum": 0,
301
+ "description": "Seconds on the output timeline."
302
+ },
303
+ "x": {
304
+ "type": "number",
305
+ "minimum": 0,
306
+ "description": "Values from 0 to 1 are normalized source coordinates; larger values are source pixels."
307
+ },
308
+ "y": {
309
+ "type": "number",
310
+ "minimum": 0,
311
+ "description": "Values from 0 to 1 are normalized source coordinates; larger values are source pixels."
312
+ },
313
+ "caption": {
314
+ "type": "string"
315
+ },
316
+ "zoom": {
317
+ "type": "boolean"
318
+ },
319
+ "label": {
320
+ "type": "string"
321
+ }
322
+ },
323
+ "additionalProperties": false
324
+ },
325
+ "event": {
326
+ "type": "object",
327
+ "properties": {
328
+ "t": {
329
+ "type": "number",
330
+ "minimum": 0,
331
+ "description": "Milliseconds on the recorded timeline."
332
+ },
333
+ "tEnd": {
334
+ "type": "number",
335
+ "minimum": 0,
336
+ "description": "Milliseconds on the recorded timeline."
337
+ },
338
+ "x": {
339
+ "type": "number"
340
+ },
341
+ "y": {
342
+ "type": "number"
343
+ },
344
+ "action": {
345
+ "type": "string",
346
+ "minLength": 1
347
+ },
348
+ "caption": {
349
+ "type": "string"
350
+ },
351
+ "zoom": {
352
+ "type": "boolean"
353
+ },
354
+ "label": {
355
+ "type": "string"
356
+ }
357
+ },
358
+ "additionalProperties": false,
359
+ "required": [
360
+ "t"
361
+ ]
362
+ },
363
+ "settings": {
364
+ "type": "object",
365
+ "properties": {
366
+ "$schema": {
367
+ "type": "string",
368
+ "minLength": 1
369
+ },
370
+ "displayUrl": {
371
+ "type": "string"
372
+ },
373
+ "out": {
374
+ "type": "string",
375
+ "minLength": 1
376
+ },
377
+ "viewport": {
378
+ "$ref": "#/definitions/viewport"
379
+ },
380
+ "brand": {
381
+ "type": "object",
382
+ "properties": {
383
+ "background": {
384
+ "type": "string",
385
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
386
+ },
387
+ "accent": {
388
+ "type": "string",
389
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
390
+ }
391
+ },
392
+ "additionalProperties": false
393
+ },
394
+ "vertical": {
395
+ "$ref": "#/definitions/vertical"
396
+ },
397
+ "posterAt": {
398
+ "type": "number",
399
+ "minimum": 0
400
+ },
401
+ "zoomDuration": {
402
+ "type": "number",
403
+ "minimum": 0
404
+ },
405
+ "url": {
406
+ "type": "string",
407
+ "format": "uri",
408
+ "pattern": "^https?://"
409
+ },
410
+ "scale": {
411
+ "const": 1
412
+ },
413
+ "initialWait": {
414
+ "type": "number",
415
+ "minimum": 0
416
+ },
417
+ "tail": {
418
+ "type": "number",
419
+ "minimum": 0
420
+ },
421
+ "steps": {
422
+ "type": "array",
423
+ "minItems": 1,
424
+ "items": {
425
+ "$ref": "#/definitions/step"
426
+ }
427
+ }
428
+ },
429
+ "additionalProperties": false
430
+ },
431
+ "story": {
432
+ "type": "object",
433
+ "properties": {
434
+ "$schema": {
435
+ "type": "string",
436
+ "minLength": 1
437
+ },
438
+ "displayUrl": {
439
+ "type": "string"
440
+ },
441
+ "out": {
442
+ "type": "string",
443
+ "minLength": 1
444
+ },
445
+ "viewport": {
446
+ "$ref": "#/definitions/viewport"
447
+ },
448
+ "brand": {
449
+ "type": "object",
450
+ "properties": {
451
+ "background": {
452
+ "type": "string",
453
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
454
+ },
455
+ "accent": {
456
+ "type": "string",
457
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
458
+ }
459
+ },
460
+ "additionalProperties": false
461
+ },
462
+ "vertical": {
463
+ "$ref": "#/definitions/vertical"
464
+ },
465
+ "posterAt": {
466
+ "type": "number",
467
+ "minimum": 0
468
+ },
469
+ "zoomDuration": {
470
+ "type": "number",
471
+ "minimum": 0
472
+ },
473
+ "url": {
474
+ "type": "string",
475
+ "format": "uri",
476
+ "pattern": "^https?://"
477
+ },
478
+ "scale": {
479
+ "const": 1
480
+ },
481
+ "initialWait": {
482
+ "type": "number",
483
+ "minimum": 0
484
+ },
485
+ "tail": {
486
+ "type": "number",
487
+ "minimum": 0
488
+ },
489
+ "steps": {
490
+ "type": "array",
491
+ "minItems": 1,
492
+ "items": {
493
+ "$ref": "#/definitions/step"
494
+ }
495
+ }
496
+ },
497
+ "additionalProperties": false,
498
+ "required": [
499
+ "url",
500
+ "steps"
501
+ ]
502
+ },
503
+ "marks": {
504
+ "type": "object",
505
+ "properties": {
506
+ "$schema": {
507
+ "type": "string",
508
+ "minLength": 1
509
+ },
510
+ "displayUrl": {
511
+ "type": "string"
512
+ },
513
+ "out": {
514
+ "type": "string",
515
+ "minLength": 1
516
+ },
517
+ "viewport": {
518
+ "$ref": "#/definitions/viewport"
519
+ },
520
+ "brand": {
521
+ "type": "object",
522
+ "properties": {
523
+ "background": {
524
+ "type": "string",
525
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
526
+ },
527
+ "accent": {
528
+ "type": "string",
529
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
530
+ }
531
+ },
532
+ "additionalProperties": false
533
+ },
534
+ "vertical": {
535
+ "$ref": "#/definitions/vertical"
536
+ },
537
+ "posterAt": {
538
+ "type": "number",
539
+ "minimum": 0
540
+ },
541
+ "zoomDuration": {
542
+ "type": "number",
543
+ "minimum": 0
544
+ },
545
+ "url": {
546
+ "type": "string"
547
+ },
548
+ "video": {
549
+ "type": "string",
550
+ "minLength": 1
551
+ },
552
+ "duration": {
553
+ "type": "number",
554
+ "exclusiveMinimum": 0
555
+ },
556
+ "marks": {
557
+ "type": "array",
558
+ "items": {
559
+ "$ref": "#/definitions/mark"
560
+ }
561
+ }
562
+ },
563
+ "additionalProperties": false,
564
+ "required": [
565
+ "marks"
566
+ ]
567
+ },
568
+ "record": {
569
+ "type": "object",
570
+ "properties": {
571
+ "$schema": {
572
+ "type": "string",
573
+ "minLength": 1
574
+ },
575
+ "config": {
576
+ "$ref": "#/definitions/settings"
577
+ },
578
+ "url": {
579
+ "type": "string"
580
+ },
581
+ "viewport": {
582
+ "$ref": "#/definitions/viewport"
583
+ },
584
+ "scale": {
585
+ "const": 1
586
+ },
587
+ "video": {
588
+ "type": "string",
589
+ "minLength": 1
590
+ },
591
+ "videoOffset": {
592
+ "type": "number",
593
+ "minimum": 0
594
+ },
595
+ "duration": {
596
+ "type": "number",
597
+ "exclusiveMinimum": 0
598
+ },
599
+ "events": {
600
+ "type": "array",
601
+ "items": {
602
+ "$ref": "#/definitions/event"
603
+ }
604
+ },
605
+ "recordedAt": {
606
+ "type": "string"
607
+ }
608
+ },
609
+ "additionalProperties": false,
610
+ "required": [
611
+ "video",
612
+ "events"
613
+ ]
614
+ }
615
+ }
616
+ }
@@ -0,0 +1,22 @@
1
+ import { commandOptions, parseCommand } from "./lib/options.mjs";
2
+ import { name, nodeRange, schemaVersion, version } from "./lib/metadata.mjs";
3
+
4
+ export function capabilities(argv) {
5
+ const { values } = parseCommand("capabilities", argv);
6
+ const result = {
7
+ schemaVersion, name, version,
8
+ runtime: { node: nodeRange },
9
+ commands: Object.fromEntries(Object.entries(commandOptions).map(([command, options]) => [
10
+ command, { options, json: Boolean(options.json) },
11
+ ])),
12
+ outputs: ["mp4", "gif", "png"],
13
+ };
14
+ if (values.json) console.log(JSON.stringify(result));
15
+ else {
16
+ console.log(`${name} ${version}`);
17
+ for (const [command, { options }] of Object.entries(result.commands)) {
18
+ console.log(`${command}: ${Object.keys(options).map((key) => `--${key}`).join(" ")}`);
19
+ }
20
+ }
21
+ return result;
22
+ }