@hussmartinez/image-sdk 0.3.0 → 0.5.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,1032 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v3.schema.json",
4
+ "title": "hm-image-plan, version 3",
5
+ "description": "An image-sdk plan: one source, its crop, orientation, develop adjustments and filter, the layers over it, which from this version may be drawings and arrows (docs/adr/0014), the redactions over those, the export's size, and the metadata fields the user keeps (docs/formats/hm-image-plan.md, sdk-core ADR 0045). Positions are whole pixels of the oriented source, which is also the scene that layers and redactions are placed in. An animation arrives in a later version: here animation is null. Beyond this schema, readers check that the base's source and every image layer's are ones the document lists, that their crops fit inside them, that a shape has a fill or a stroke, that a drawing's runs hold an x and a y for each point and stay within the scene's coordinates from its origin, that an arrow's ends differ, that no two items share a key, and that layers and redactions together are at most 1,024.",
6
+ "type": "object",
7
+ "required": [
8
+ "format",
9
+ "version",
10
+ "sources",
11
+ "base",
12
+ "layers",
13
+ "redactions",
14
+ "animation",
15
+ "output",
16
+ "metadata"
17
+ ],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "format": {
21
+ "const": "hm-image-plan"
22
+ },
23
+ "version": {
24
+ "const": 3
25
+ },
26
+ "sources": {
27
+ "description": "The sources by id. The base names one of them.",
28
+ "type": "object",
29
+ "propertyNames": {
30
+ "minLength": 1
31
+ },
32
+ "additionalProperties": {
33
+ "$ref": "#/$defs/source"
34
+ }
35
+ },
36
+ "base": {
37
+ "$ref": "#/$defs/base"
38
+ },
39
+ "layers": {
40
+ "description": "The layers over the base, bottom to top.",
41
+ "type": "array",
42
+ "maxItems": 1024,
43
+ "items": {
44
+ "$ref": "#/$defs/layer"
45
+ }
46
+ },
47
+ "redactions": {
48
+ "description": "The redactions, applied over everything else, in order.",
49
+ "type": "array",
50
+ "maxItems": 1024,
51
+ "items": {
52
+ "$ref": "#/$defs/redaction"
53
+ }
54
+ },
55
+ "animation": {
56
+ "description": "The animation. Always null in this version.",
57
+ "type": "null"
58
+ },
59
+ "output": {
60
+ "$ref": "#/$defs/output"
61
+ },
62
+ "metadata": {
63
+ "$ref": "#/$defs/metadata"
64
+ }
65
+ },
66
+ "$defs": {
67
+ "pixels": {
68
+ "description": "A whole number of pixels from 0.",
69
+ "type": "integer",
70
+ "minimum": 0,
71
+ "maximum": 9007199254740991
72
+ },
73
+ "size": {
74
+ "description": "A whole number of pixels from 1.",
75
+ "type": "integer",
76
+ "minimum": 1,
77
+ "maximum": 9007199254740991
78
+ },
79
+ "asset": {
80
+ "description": "A content-addressed reference to a source's bytes. Documents never inline them.",
81
+ "type": "object",
82
+ "required": ["asset", "mediaType", "size"],
83
+ "additionalProperties": false,
84
+ "properties": {
85
+ "asset": {
86
+ "description": "sha256: and the lowercase hex SHA-256 of the bytes.",
87
+ "type": "string",
88
+ "pattern": "^sha256:[0-9a-f]{64}$"
89
+ },
90
+ "mediaType": {
91
+ "description": "The bytes' media type, in lowercase.",
92
+ "type": "string",
93
+ "maxLength": 255,
94
+ "pattern": "^[a-z0-9][a-z0-9!#$&^_.+-]*/[a-z0-9][a-z0-9!#$&^_.+-]*$"
95
+ },
96
+ "size": {
97
+ "description": "The size of the bytes.",
98
+ "type": "integer",
99
+ "minimum": 0,
100
+ "maximum": 9007199254740991
101
+ }
102
+ }
103
+ },
104
+ "source": {
105
+ "description": "A source's oriented size, after its EXIF orientation, which a crop must fit inside.",
106
+ "type": "object",
107
+ "required": ["width", "height"],
108
+ "additionalProperties": false,
109
+ "properties": {
110
+ "width": {
111
+ "$ref": "#/$defs/size"
112
+ },
113
+ "height": {
114
+ "$ref": "#/$defs/size"
115
+ },
116
+ "asset": {
117
+ "$ref": "#/$defs/asset"
118
+ }
119
+ }
120
+ },
121
+ "crop": {
122
+ "description": "A rectangle in whole pixels of the oriented source.",
123
+ "type": "object",
124
+ "required": ["x", "y", "width", "height"],
125
+ "additionalProperties": false,
126
+ "properties": {
127
+ "x": {
128
+ "$ref": "#/$defs/pixels"
129
+ },
130
+ "y": {
131
+ "$ref": "#/$defs/pixels"
132
+ },
133
+ "width": {
134
+ "$ref": "#/$defs/size"
135
+ },
136
+ "height": {
137
+ "$ref": "#/$defs/size"
138
+ }
139
+ }
140
+ },
141
+ "orientation": {
142
+ "description": "The plan's rotation, then its flips.",
143
+ "type": "object",
144
+ "required": ["rotate", "flipX", "flipY"],
145
+ "additionalProperties": false,
146
+ "properties": {
147
+ "rotate": {
148
+ "description": "Clockwise, in degrees.",
149
+ "enum": [0, 90, 180, 270]
150
+ },
151
+ "flipX": {
152
+ "type": "boolean"
153
+ },
154
+ "flipY": {
155
+ "type": "boolean"
156
+ }
157
+ }
158
+ },
159
+ "level": {
160
+ "description": "A develop adjustment: a whole number from -100 to 100, where 0 is unchanged.",
161
+ "type": "integer",
162
+ "minimum": -100,
163
+ "maximum": 100
164
+ },
165
+ "develop": {
166
+ "description": "Every develop adjustment, in the order they're applied.",
167
+ "type": "object",
168
+ "required": [
169
+ "temperature",
170
+ "tint",
171
+ "exposure",
172
+ "highlights",
173
+ "shadows",
174
+ "contrast",
175
+ "saturation",
176
+ "vibrance"
177
+ ],
178
+ "additionalProperties": false,
179
+ "properties": {
180
+ "temperature": {
181
+ "$ref": "#/$defs/level"
182
+ },
183
+ "tint": {
184
+ "$ref": "#/$defs/level"
185
+ },
186
+ "exposure": {
187
+ "$ref": "#/$defs/level"
188
+ },
189
+ "highlights": {
190
+ "$ref": "#/$defs/level"
191
+ },
192
+ "shadows": {
193
+ "$ref": "#/$defs/level"
194
+ },
195
+ "contrast": {
196
+ "$ref": "#/$defs/level"
197
+ },
198
+ "saturation": {
199
+ "$ref": "#/$defs/level"
200
+ },
201
+ "vibrance": {
202
+ "$ref": "#/$defs/level"
203
+ }
204
+ }
205
+ },
206
+ "developValues": {
207
+ "description": "Some develop adjustments; the others keep their values.",
208
+ "type": "object",
209
+ "required": [],
210
+ "additionalProperties": false,
211
+ "properties": {
212
+ "temperature": {
213
+ "$ref": "#/$defs/level"
214
+ },
215
+ "tint": {
216
+ "$ref": "#/$defs/level"
217
+ },
218
+ "exposure": {
219
+ "$ref": "#/$defs/level"
220
+ },
221
+ "highlights": {
222
+ "$ref": "#/$defs/level"
223
+ },
224
+ "shadows": {
225
+ "$ref": "#/$defs/level"
226
+ },
227
+ "contrast": {
228
+ "$ref": "#/$defs/level"
229
+ },
230
+ "saturation": {
231
+ "$ref": "#/$defs/level"
232
+ },
233
+ "vibrance": {
234
+ "$ref": "#/$defs/level"
235
+ }
236
+ }
237
+ },
238
+ "filter": {
239
+ "description": "A filter preset and its strength, or null for none.",
240
+ "oneOf": [
241
+ {
242
+ "type": "null"
243
+ },
244
+ {
245
+ "type": "object",
246
+ "required": ["preset", "strength"],
247
+ "additionalProperties": false,
248
+ "properties": {
249
+ "preset": {
250
+ "enum": ["vivid", "warm", "cool", "fade", "mono", "noir", "sepia"]
251
+ },
252
+ "strength": {
253
+ "type": "integer",
254
+ "minimum": 0,
255
+ "maximum": 100
256
+ }
257
+ }
258
+ }
259
+ ]
260
+ },
261
+ "output": {
262
+ "description": "The export's size: the composition scaled by a factor up to 1, or fitted inside a box without enlarging it. The scale is copied, never computed, so it compares exactly.",
263
+ "oneOf": [
264
+ {
265
+ "type": "object",
266
+ "required": ["kind", "scale"],
267
+ "additionalProperties": false,
268
+ "properties": {
269
+ "kind": {
270
+ "const": "scale"
271
+ },
272
+ "scale": {
273
+ "type": "number",
274
+ "exclusiveMinimum": 0,
275
+ "maximum": 1
276
+ }
277
+ }
278
+ },
279
+ {
280
+ "type": "object",
281
+ "required": ["kind", "width", "height"],
282
+ "additionalProperties": false,
283
+ "properties": {
284
+ "kind": {
285
+ "const": "fit"
286
+ },
287
+ "width": {
288
+ "$ref": "#/$defs/size"
289
+ },
290
+ "height": {
291
+ "$ref": "#/$defs/size"
292
+ }
293
+ }
294
+ }
295
+ ]
296
+ },
297
+ "metadataValue": {
298
+ "description": "Text to keep, or empty to keep nothing. Its length is in Unicode code points, as maxLength counts it.",
299
+ "type": "string",
300
+ "maxLength": 2000
301
+ },
302
+ "metadataField": {
303
+ "enum": ["title", "description", "artist", "copyright"]
304
+ },
305
+ "metadata": {
306
+ "description": "The fields the user keeps on export. Never a location.",
307
+ "type": "object",
308
+ "required": ["title", "description", "artist", "copyright"],
309
+ "additionalProperties": false,
310
+ "properties": {
311
+ "title": {
312
+ "$ref": "#/$defs/metadataValue"
313
+ },
314
+ "description": {
315
+ "$ref": "#/$defs/metadataValue"
316
+ },
317
+ "artist": {
318
+ "$ref": "#/$defs/metadataValue"
319
+ },
320
+ "copyright": {
321
+ "$ref": "#/$defs/metadataValue"
322
+ }
323
+ }
324
+ },
325
+ "base": {
326
+ "description": "The image being edited.",
327
+ "type": "object",
328
+ "required": ["source", "crop", "orientation", "develop", "filter"],
329
+ "additionalProperties": false,
330
+ "properties": {
331
+ "source": {
332
+ "description": "The id of a source the document lists.",
333
+ "type": "string",
334
+ "minLength": 1
335
+ },
336
+ "crop": {
337
+ "oneOf": [
338
+ {
339
+ "type": "null"
340
+ },
341
+ {
342
+ "$ref": "#/$defs/crop"
343
+ }
344
+ ]
345
+ },
346
+ "orientation": {
347
+ "$ref": "#/$defs/orientation"
348
+ },
349
+ "develop": {
350
+ "$ref": "#/$defs/develop"
351
+ },
352
+ "filter": {
353
+ "$ref": "#/$defs/filter"
354
+ }
355
+ }
356
+ },
357
+ "key": {
358
+ "description": "An item's identity: any text of 1 to 64 Unicode code points, unique in the document.",
359
+ "type": "string",
360
+ "minLength": 1,
361
+ "maxLength": 64
362
+ },
363
+ "scenePosition": {
364
+ "description": "A position in whole pixels of the scene, which may be outside it.",
365
+ "type": "integer",
366
+ "minimum": -65536,
367
+ "maximum": 65536
368
+ },
369
+ "sceneLength": {
370
+ "description": "A length in whole pixels of the scene.",
371
+ "type": "integer",
372
+ "minimum": 1,
373
+ "maximum": 65536
374
+ },
375
+ "colour": {
376
+ "description": "A colour as #rrggbb, in lower case.",
377
+ "type": "string",
378
+ "pattern": "^#[0-9a-f]{6}$"
379
+ },
380
+ "redactionMode": {
381
+ "enum": ["solid", "pixelate"]
382
+ },
383
+ "redaction": {
384
+ "description": "A region an export doesn't show: a rectangle of the scene, filled with a colour or with coarse blocks.",
385
+ "oneOf": [
386
+ {
387
+ "type": "object",
388
+ "required": ["key", "mode", "x", "y", "width", "height", "colour"],
389
+ "additionalProperties": false,
390
+ "properties": {
391
+ "key": {
392
+ "$ref": "#/$defs/key"
393
+ },
394
+ "x": {
395
+ "$ref": "#/$defs/scenePosition"
396
+ },
397
+ "y": {
398
+ "$ref": "#/$defs/scenePosition"
399
+ },
400
+ "width": {
401
+ "$ref": "#/$defs/sceneLength"
402
+ },
403
+ "height": {
404
+ "$ref": "#/$defs/sceneLength"
405
+ },
406
+ "mode": {
407
+ "const": "solid"
408
+ },
409
+ "colour": {
410
+ "$ref": "#/$defs/colour"
411
+ }
412
+ }
413
+ },
414
+ {
415
+ "type": "object",
416
+ "required": ["key", "mode", "x", "y", "width", "height"],
417
+ "additionalProperties": false,
418
+ "properties": {
419
+ "key": {
420
+ "$ref": "#/$defs/key"
421
+ },
422
+ "x": {
423
+ "$ref": "#/$defs/scenePosition"
424
+ },
425
+ "y": {
426
+ "$ref": "#/$defs/scenePosition"
427
+ },
428
+ "width": {
429
+ "$ref": "#/$defs/sceneLength"
430
+ },
431
+ "height": {
432
+ "$ref": "#/$defs/sceneLength"
433
+ },
434
+ "mode": {
435
+ "const": "pixelate"
436
+ }
437
+ }
438
+ }
439
+ ]
440
+ },
441
+ "redactionProps": {
442
+ "description": "Some of a redaction's fields. Beyond this schema, the reducer checks the result: setting mode to pixelate drops the colour, so a colour can't be set on a pixelated redaction, and setting mode to solid needs a colour.",
443
+ "type": "object",
444
+ "additionalProperties": false,
445
+ "properties": {
446
+ "mode": {
447
+ "$ref": "#/$defs/redactionMode"
448
+ },
449
+ "x": {
450
+ "$ref": "#/$defs/scenePosition"
451
+ },
452
+ "y": {
453
+ "$ref": "#/$defs/scenePosition"
454
+ },
455
+ "width": {
456
+ "$ref": "#/$defs/sceneLength"
457
+ },
458
+ "height": {
459
+ "$ref": "#/$defs/sceneLength"
460
+ },
461
+ "colour": {
462
+ "$ref": "#/$defs/colour"
463
+ }
464
+ }
465
+ },
466
+ "keys": {
467
+ "description": "At least one key, none repeated.",
468
+ "type": "array",
469
+ "minItems": 1,
470
+ "uniqueItems": true,
471
+ "items": {
472
+ "$ref": "#/$defs/key"
473
+ }
474
+ },
475
+ "text": {
476
+ "description": "Text with no control character other than a line feed, and no bidirectional embedding, override or isolate control.",
477
+ "type": "string",
478
+ "pattern": "^[^\\u0000-\\u0009\\u000B-\\u001F\\u007F\\u202A-\\u202E\\u2066-\\u2069]*$"
479
+ },
480
+ "opacity": {
481
+ "type": "integer",
482
+ "minimum": 0,
483
+ "maximum": 100
484
+ },
485
+ "rotation": {
486
+ "description": "Tenths of a degree, clockwise about the box's centre.",
487
+ "type": "integer",
488
+ "minimum": 0,
489
+ "maximum": 3599
490
+ },
491
+ "flipX": {
492
+ "description": "Whether the layer is mirrored left to right, about its box's own vertical axis, before it's turned.",
493
+ "type": "boolean"
494
+ },
495
+ "font": {
496
+ "enum": ["sans-serif", "serif", "monospace"]
497
+ },
498
+ "align": {
499
+ "enum": ["start", "center", "end"]
500
+ },
501
+ "shape": {
502
+ "enum": ["rectangle", "ellipse"]
503
+ },
504
+ "stroke": {
505
+ "type": "object",
506
+ "required": ["colour", "width"],
507
+ "additionalProperties": false,
508
+ "properties": {
509
+ "colour": {
510
+ "$ref": "#/$defs/colour"
511
+ },
512
+ "width": {
513
+ "type": "integer",
514
+ "minimum": 1,
515
+ "maximum": 1024
516
+ }
517
+ }
518
+ },
519
+ "layer": {
520
+ "description": "A layer over the base: text, a shape or another image, in a box of the scene that may be mirrored and is turned about its centre; a drawing, at an origin; or an arrow, between two points.",
521
+ "oneOf": [
522
+ {
523
+ "type": "object",
524
+ "required": [
525
+ "key",
526
+ "kind",
527
+ "name",
528
+ "visible",
529
+ "opacity",
530
+ "x",
531
+ "y",
532
+ "width",
533
+ "height",
534
+ "rotation",
535
+ "flipX",
536
+ "text",
537
+ "font",
538
+ "bold",
539
+ "colour",
540
+ "align"
541
+ ],
542
+ "additionalProperties": false,
543
+ "properties": {
544
+ "key": {
545
+ "$ref": "#/$defs/key"
546
+ },
547
+ "name": {
548
+ "allOf": [
549
+ {
550
+ "$ref": "#/$defs/text"
551
+ },
552
+ {
553
+ "type": "string",
554
+ "maxLength": 100
555
+ }
556
+ ]
557
+ },
558
+ "visible": {
559
+ "type": "boolean"
560
+ },
561
+ "opacity": {
562
+ "$ref": "#/$defs/opacity"
563
+ },
564
+ "x": {
565
+ "$ref": "#/$defs/scenePosition"
566
+ },
567
+ "y": {
568
+ "$ref": "#/$defs/scenePosition"
569
+ },
570
+ "width": {
571
+ "$ref": "#/$defs/sceneLength"
572
+ },
573
+ "height": {
574
+ "$ref": "#/$defs/sceneLength"
575
+ },
576
+ "rotation": {
577
+ "$ref": "#/$defs/rotation"
578
+ },
579
+ "flipX": {
580
+ "$ref": "#/$defs/flipX"
581
+ },
582
+ "kind": {
583
+ "const": "text"
584
+ },
585
+ "text": {
586
+ "allOf": [
587
+ {
588
+ "$ref": "#/$defs/text"
589
+ },
590
+ {
591
+ "type": "string",
592
+ "maxLength": 1000
593
+ }
594
+ ]
595
+ },
596
+ "font": {
597
+ "$ref": "#/$defs/font"
598
+ },
599
+ "bold": {
600
+ "type": "boolean"
601
+ },
602
+ "colour": {
603
+ "$ref": "#/$defs/colour"
604
+ },
605
+ "align": {
606
+ "$ref": "#/$defs/align"
607
+ }
608
+ }
609
+ },
610
+ {
611
+ "type": "object",
612
+ "required": [
613
+ "key",
614
+ "kind",
615
+ "name",
616
+ "visible",
617
+ "opacity",
618
+ "x",
619
+ "y",
620
+ "width",
621
+ "height",
622
+ "rotation",
623
+ "flipX",
624
+ "shape",
625
+ "fill",
626
+ "stroke"
627
+ ],
628
+ "additionalProperties": false,
629
+ "properties": {
630
+ "key": {
631
+ "$ref": "#/$defs/key"
632
+ },
633
+ "name": {
634
+ "allOf": [
635
+ {
636
+ "$ref": "#/$defs/text"
637
+ },
638
+ {
639
+ "type": "string",
640
+ "maxLength": 100
641
+ }
642
+ ]
643
+ },
644
+ "visible": {
645
+ "type": "boolean"
646
+ },
647
+ "opacity": {
648
+ "$ref": "#/$defs/opacity"
649
+ },
650
+ "x": {
651
+ "$ref": "#/$defs/scenePosition"
652
+ },
653
+ "y": {
654
+ "$ref": "#/$defs/scenePosition"
655
+ },
656
+ "width": {
657
+ "$ref": "#/$defs/sceneLength"
658
+ },
659
+ "height": {
660
+ "$ref": "#/$defs/sceneLength"
661
+ },
662
+ "rotation": {
663
+ "$ref": "#/$defs/rotation"
664
+ },
665
+ "flipX": {
666
+ "$ref": "#/$defs/flipX"
667
+ },
668
+ "kind": {
669
+ "const": "shape"
670
+ },
671
+ "shape": {
672
+ "$ref": "#/$defs/shape"
673
+ },
674
+ "fill": {
675
+ "oneOf": [
676
+ {
677
+ "type": "null"
678
+ },
679
+ {
680
+ "$ref": "#/$defs/colour"
681
+ }
682
+ ]
683
+ },
684
+ "stroke": {
685
+ "oneOf": [
686
+ {
687
+ "type": "null"
688
+ },
689
+ {
690
+ "$ref": "#/$defs/stroke"
691
+ }
692
+ ]
693
+ }
694
+ }
695
+ },
696
+ {
697
+ "type": "object",
698
+ "required": [
699
+ "key",
700
+ "kind",
701
+ "name",
702
+ "visible",
703
+ "opacity",
704
+ "x",
705
+ "y",
706
+ "width",
707
+ "height",
708
+ "rotation",
709
+ "flipX",
710
+ "source",
711
+ "crop"
712
+ ],
713
+ "additionalProperties": false,
714
+ "properties": {
715
+ "key": {
716
+ "$ref": "#/$defs/key"
717
+ },
718
+ "name": {
719
+ "allOf": [
720
+ {
721
+ "$ref": "#/$defs/text"
722
+ },
723
+ {
724
+ "type": "string",
725
+ "maxLength": 100
726
+ }
727
+ ]
728
+ },
729
+ "visible": {
730
+ "type": "boolean"
731
+ },
732
+ "opacity": {
733
+ "$ref": "#/$defs/opacity"
734
+ },
735
+ "x": {
736
+ "$ref": "#/$defs/scenePosition"
737
+ },
738
+ "y": {
739
+ "$ref": "#/$defs/scenePosition"
740
+ },
741
+ "width": {
742
+ "$ref": "#/$defs/sceneLength"
743
+ },
744
+ "height": {
745
+ "$ref": "#/$defs/sceneLength"
746
+ },
747
+ "rotation": {
748
+ "$ref": "#/$defs/rotation"
749
+ },
750
+ "flipX": {
751
+ "$ref": "#/$defs/flipX"
752
+ },
753
+ "kind": {
754
+ "const": "image"
755
+ },
756
+ "source": {
757
+ "type": "string",
758
+ "minLength": 1
759
+ },
760
+ "crop": {
761
+ "oneOf": [
762
+ {
763
+ "type": "null"
764
+ },
765
+ {
766
+ "$ref": "#/$defs/crop"
767
+ }
768
+ ]
769
+ }
770
+ }
771
+ },
772
+ {
773
+ "type": "object",
774
+ "required": ["key", "kind", "name", "visible", "opacity", "x", "y", "strokes"],
775
+ "additionalProperties": false,
776
+ "properties": {
777
+ "key": {
778
+ "$ref": "#/$defs/key"
779
+ },
780
+ "name": {
781
+ "allOf": [
782
+ {
783
+ "$ref": "#/$defs/text"
784
+ },
785
+ {
786
+ "type": "string",
787
+ "maxLength": 100
788
+ }
789
+ ]
790
+ },
791
+ "visible": {
792
+ "type": "boolean"
793
+ },
794
+ "opacity": {
795
+ "$ref": "#/$defs/opacity"
796
+ },
797
+ "kind": {
798
+ "const": "drawing"
799
+ },
800
+ "x": {
801
+ "$ref": "#/$defs/scenePosition"
802
+ },
803
+ "y": {
804
+ "$ref": "#/$defs/scenePosition"
805
+ },
806
+ "strokes": {
807
+ "description": "In the order they're drawn. Beyond this schema, a drawing has at least one.",
808
+ "type": "array",
809
+ "maxItems": 1024,
810
+ "items": {
811
+ "$ref": "#/$defs/drawnStroke"
812
+ }
813
+ }
814
+ }
815
+ },
816
+ {
817
+ "type": "object",
818
+ "required": [
819
+ "key",
820
+ "kind",
821
+ "name",
822
+ "visible",
823
+ "opacity",
824
+ "from",
825
+ "to",
826
+ "colour",
827
+ "width"
828
+ ],
829
+ "additionalProperties": false,
830
+ "properties": {
831
+ "key": {
832
+ "$ref": "#/$defs/key"
833
+ },
834
+ "name": {
835
+ "allOf": [
836
+ {
837
+ "$ref": "#/$defs/text"
838
+ },
839
+ {
840
+ "type": "string",
841
+ "maxLength": 100
842
+ }
843
+ ]
844
+ },
845
+ "visible": {
846
+ "type": "boolean"
847
+ },
848
+ "opacity": {
849
+ "$ref": "#/$defs/opacity"
850
+ },
851
+ "kind": {
852
+ "const": "arrow"
853
+ },
854
+ "from": {
855
+ "$ref": "#/$defs/point"
856
+ },
857
+ "to": {
858
+ "$ref": "#/$defs/point"
859
+ },
860
+ "colour": {
861
+ "$ref": "#/$defs/colour"
862
+ },
863
+ "width": {
864
+ "$ref": "#/$defs/strokeWidth"
865
+ }
866
+ }
867
+ }
868
+ ]
869
+ },
870
+ "layerProps": {
871
+ "description": "Some of a layer's fields: any but its key and its kind, and a drawing's strokes, which the stroke commands change. Beyond this schema, the reducer checks that each field is one the layer's kind has, and the layer that results.",
872
+ "type": "object",
873
+ "additionalProperties": false,
874
+ "properties": {
875
+ "name": {
876
+ "allOf": [
877
+ {
878
+ "$ref": "#/$defs/text"
879
+ },
880
+ {
881
+ "type": "string",
882
+ "maxLength": 100
883
+ }
884
+ ]
885
+ },
886
+ "visible": {
887
+ "type": "boolean"
888
+ },
889
+ "opacity": {
890
+ "$ref": "#/$defs/opacity"
891
+ },
892
+ "x": {
893
+ "$ref": "#/$defs/scenePosition"
894
+ },
895
+ "y": {
896
+ "$ref": "#/$defs/scenePosition"
897
+ },
898
+ "width": {
899
+ "$ref": "#/$defs/sceneLength"
900
+ },
901
+ "height": {
902
+ "$ref": "#/$defs/sceneLength"
903
+ },
904
+ "rotation": {
905
+ "$ref": "#/$defs/rotation"
906
+ },
907
+ "flipX": {
908
+ "$ref": "#/$defs/flipX"
909
+ },
910
+ "text": {
911
+ "allOf": [
912
+ {
913
+ "$ref": "#/$defs/text"
914
+ },
915
+ {
916
+ "type": "string",
917
+ "maxLength": 1000
918
+ }
919
+ ]
920
+ },
921
+ "font": {
922
+ "$ref": "#/$defs/font"
923
+ },
924
+ "bold": {
925
+ "type": "boolean"
926
+ },
927
+ "colour": {
928
+ "$ref": "#/$defs/colour"
929
+ },
930
+ "align": {
931
+ "$ref": "#/$defs/align"
932
+ },
933
+ "shape": {
934
+ "$ref": "#/$defs/shape"
935
+ },
936
+ "fill": {
937
+ "oneOf": [
938
+ {
939
+ "type": "null"
940
+ },
941
+ {
942
+ "$ref": "#/$defs/colour"
943
+ }
944
+ ]
945
+ },
946
+ "stroke": {
947
+ "oneOf": [
948
+ {
949
+ "type": "null"
950
+ },
951
+ {
952
+ "$ref": "#/$defs/stroke"
953
+ }
954
+ ]
955
+ },
956
+ "source": {
957
+ "type": "string",
958
+ "minLength": 1
959
+ },
960
+ "crop": {
961
+ "oneOf": [
962
+ {
963
+ "type": "null"
964
+ },
965
+ {
966
+ "$ref": "#/$defs/crop"
967
+ }
968
+ ]
969
+ },
970
+ "from": {
971
+ "$ref": "#/$defs/point"
972
+ },
973
+ "to": {
974
+ "$ref": "#/$defs/point"
975
+ }
976
+ }
977
+ },
978
+ "strokeWidth": {
979
+ "description": "The width of a drawn stroke or an arrow's shaft, in whole scene pixels.",
980
+ "type": "integer",
981
+ "minimum": 1,
982
+ "maximum": 1024
983
+ },
984
+ "point": {
985
+ "description": "A point of the scene, in whole pixels.",
986
+ "type": "object",
987
+ "required": ["x", "y"],
988
+ "additionalProperties": false,
989
+ "properties": {
990
+ "x": {
991
+ "$ref": "#/$defs/scenePosition"
992
+ },
993
+ "y": {
994
+ "$ref": "#/$defs/scenePosition"
995
+ }
996
+ }
997
+ },
998
+ "run": {
999
+ "description": "One polyline of a stroke: [x0, y0, x1, y1, ...], 1 to 2,000 points in whole pixels from the drawing's origin. Beyond this schema, the count is even, and each point is within the scene's coordinates once the origin is added.",
1000
+ "type": "array",
1001
+ "minItems": 2,
1002
+ "maxItems": 4000,
1003
+ "items": {
1004
+ "type": "integer",
1005
+ "minimum": -131072,
1006
+ "maximum": 131072
1007
+ }
1008
+ },
1009
+ "drawnStroke": {
1010
+ "description": "One stroke of a drawing: what one gesture drew. It has more than one run only when it's long.",
1011
+ "type": "object",
1012
+ "required": ["colour", "width", "runs"],
1013
+ "additionalProperties": false,
1014
+ "properties": {
1015
+ "colour": {
1016
+ "$ref": "#/$defs/colour"
1017
+ },
1018
+ "width": {
1019
+ "$ref": "#/$defs/strokeWidth"
1020
+ },
1021
+ "runs": {
1022
+ "type": "array",
1023
+ "minItems": 1,
1024
+ "maxItems": 64,
1025
+ "items": {
1026
+ "$ref": "#/$defs/run"
1027
+ }
1028
+ }
1029
+ }
1030
+ }
1031
+ }
1032
+ }