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