@preset.nz/facets 0.1.2 → 0.2.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,860 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://facets.preset.nz/schema/v0.1.json",
4
+ "title": "@preset.nz/facets PropertySchema, 0.1",
5
+ "description": "An inspector panel as data: groups of rows of fields. Valid for every 0.1.x release; later 0.1 patches only add kinds and props. Playground: https://facets.preset.nz",
6
+ "type": "object",
7
+ "required": [
8
+ "version",
9
+ "groups"
10
+ ],
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "$schema": {
14
+ "type": "string",
15
+ "description": "This file's URL, for editors."
16
+ },
17
+ "version": {
18
+ "type": "number",
19
+ "description": "The host's own version of this schema. Bump it when the shape changes."
20
+ },
21
+ "title": {
22
+ "type": "string",
23
+ "description": "What the scope is called, e.g. \"Filter\". Heads the card; the host can override it."
24
+ },
25
+ "groups": {
26
+ "type": "array",
27
+ "description": "Rendered top to bottom, with a rule between groups.",
28
+ "items": {
29
+ "$ref": "#/definitions/group"
30
+ }
31
+ }
32
+ },
33
+ "definitions": {
34
+ "group": {
35
+ "type": "object",
36
+ "required": [
37
+ "id",
38
+ "rows"
39
+ ],
40
+ "additionalProperties": false,
41
+ "properties": {
42
+ "id": {
43
+ "type": "string",
44
+ "description": "Unique within the schema."
45
+ },
46
+ "title": {
47
+ "type": "string",
48
+ "description": "The heading. Omit it to render the group without one."
49
+ },
50
+ "description": {
51
+ "type": "string",
52
+ "description": "A line under the title."
53
+ },
54
+ "collapsible": {
55
+ "type": "boolean",
56
+ "description": "Fold under the title. Needs a title."
57
+ },
58
+ "defaultCollapsed": {
59
+ "type": "boolean",
60
+ "description": "Start folded."
61
+ },
62
+ "rows": {
63
+ "type": "array",
64
+ "description": "A field is a full-width row; an array of fields is one row laid out as a grid (usually two).",
65
+ "items": {
66
+ "anyOf": [
67
+ {
68
+ "$ref": "#/definitions/field"
69
+ },
70
+ {
71
+ "type": "array",
72
+ "items": {
73
+ "$ref": "#/definitions/field"
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ },
81
+ "disabledWhen": {
82
+ "type": "object",
83
+ "description": "Greys the field out depending on another field's value. Set one operator; if several are set, the first of equals, notEquals, in, notIn wins.",
84
+ "required": [
85
+ "path"
86
+ ],
87
+ "additionalProperties": false,
88
+ "properties": {
89
+ "path": {
90
+ "type": "string",
91
+ "description": "The field value to watch, by path."
92
+ },
93
+ "equals": {
94
+ "description": "Disabled when the value equals this."
95
+ },
96
+ "notEquals": {
97
+ "description": "Disabled unless the value equals this."
98
+ },
99
+ "in": {
100
+ "type": "array",
101
+ "description": "Disabled when the value is one of these."
102
+ },
103
+ "notIn": {
104
+ "type": "array",
105
+ "description": "Disabled unless the value is one of these."
106
+ }
107
+ }
108
+ },
109
+ "promote": {
110
+ "type": "array",
111
+ "description": "The views the field shows in besides the inspector, like a parm promoted to a Houdini asset's interface. \"card\": on the card. \"collapsed\": in a closed group's header and in a folded scope. Omit for inspector-only.",
112
+ "items": {
113
+ "enum": [
114
+ "card",
115
+ "collapsed"
116
+ ]
117
+ },
118
+ "uniqueItems": true
119
+ },
120
+ "selectOption": {
121
+ "type": "object",
122
+ "required": [
123
+ "value",
124
+ "label"
125
+ ],
126
+ "additionalProperties": false,
127
+ "properties": {
128
+ "value": {
129
+ "type": "string",
130
+ "description": "Stored in the value record."
131
+ },
132
+ "label": {
133
+ "type": "string",
134
+ "description": "Shown to the user."
135
+ }
136
+ }
137
+ },
138
+ "vectorComponent": {
139
+ "type": "object",
140
+ "additionalProperties": false,
141
+ "properties": {
142
+ "label": {
143
+ "type": "string",
144
+ "description": "Shown above the slot."
145
+ },
146
+ "suffix": {
147
+ "type": "string",
148
+ "description": "Unit after the number, e.g. px or °."
149
+ },
150
+ "min": {
151
+ "type": "number",
152
+ "description": "Lower bound."
153
+ },
154
+ "max": {
155
+ "type": "number",
156
+ "description": "Upper bound."
157
+ },
158
+ "step": {
159
+ "type": "number",
160
+ "description": "Increment. Default 1."
161
+ }
162
+ }
163
+ },
164
+ "field": {
165
+ "type": "object",
166
+ "description": "One field. kind picks the renderer: a built-in kind is checked strictly; any other kind is a custom kind registered by the host, which may carry extra props.",
167
+ "required": [
168
+ "kind",
169
+ "id"
170
+ ],
171
+ "properties": {
172
+ "kind": {
173
+ "type": "string",
174
+ "description": "The renderer to use. Built in: text, textarea, number, slider, select, color, checkbox, file, vector, separator, label. Anything else must be registered by the host with registerFieldRenderer().",
175
+ "examples": [
176
+ "text",
177
+ "textarea",
178
+ "number",
179
+ "slider",
180
+ "select",
181
+ "color",
182
+ "checkbox",
183
+ "file",
184
+ "vector",
185
+ "separator",
186
+ "label"
187
+ ]
188
+ },
189
+ "id": {
190
+ "type": "string",
191
+ "description": "Unique within the schema. Keys the field in the panel."
192
+ }
193
+ },
194
+ "allOf": [
195
+ {
196
+ "if": {
197
+ "required": [
198
+ "kind"
199
+ ],
200
+ "properties": {
201
+ "kind": {
202
+ "const": "text"
203
+ }
204
+ }
205
+ },
206
+ "then": {
207
+ "$ref": "#/definitions/text"
208
+ }
209
+ },
210
+ {
211
+ "if": {
212
+ "required": [
213
+ "kind"
214
+ ],
215
+ "properties": {
216
+ "kind": {
217
+ "const": "textarea"
218
+ }
219
+ }
220
+ },
221
+ "then": {
222
+ "$ref": "#/definitions/textarea"
223
+ }
224
+ },
225
+ {
226
+ "if": {
227
+ "required": [
228
+ "kind"
229
+ ],
230
+ "properties": {
231
+ "kind": {
232
+ "const": "number"
233
+ }
234
+ }
235
+ },
236
+ "then": {
237
+ "$ref": "#/definitions/number"
238
+ }
239
+ },
240
+ {
241
+ "if": {
242
+ "required": [
243
+ "kind"
244
+ ],
245
+ "properties": {
246
+ "kind": {
247
+ "const": "slider"
248
+ }
249
+ }
250
+ },
251
+ "then": {
252
+ "$ref": "#/definitions/slider"
253
+ }
254
+ },
255
+ {
256
+ "if": {
257
+ "required": [
258
+ "kind"
259
+ ],
260
+ "properties": {
261
+ "kind": {
262
+ "const": "select"
263
+ }
264
+ }
265
+ },
266
+ "then": {
267
+ "$ref": "#/definitions/select"
268
+ }
269
+ },
270
+ {
271
+ "if": {
272
+ "required": [
273
+ "kind"
274
+ ],
275
+ "properties": {
276
+ "kind": {
277
+ "const": "color"
278
+ }
279
+ }
280
+ },
281
+ "then": {
282
+ "$ref": "#/definitions/color"
283
+ }
284
+ },
285
+ {
286
+ "if": {
287
+ "required": [
288
+ "kind"
289
+ ],
290
+ "properties": {
291
+ "kind": {
292
+ "const": "checkbox"
293
+ }
294
+ }
295
+ },
296
+ "then": {
297
+ "$ref": "#/definitions/checkbox"
298
+ }
299
+ },
300
+ {
301
+ "if": {
302
+ "required": [
303
+ "kind"
304
+ ],
305
+ "properties": {
306
+ "kind": {
307
+ "const": "file"
308
+ }
309
+ }
310
+ },
311
+ "then": {
312
+ "$ref": "#/definitions/file"
313
+ }
314
+ },
315
+ {
316
+ "if": {
317
+ "required": [
318
+ "kind"
319
+ ],
320
+ "properties": {
321
+ "kind": {
322
+ "const": "vector"
323
+ }
324
+ }
325
+ },
326
+ "then": {
327
+ "$ref": "#/definitions/vector"
328
+ }
329
+ },
330
+ {
331
+ "if": {
332
+ "required": [
333
+ "kind"
334
+ ],
335
+ "properties": {
336
+ "kind": {
337
+ "const": "separator"
338
+ }
339
+ }
340
+ },
341
+ "then": {
342
+ "$ref": "#/definitions/separator"
343
+ }
344
+ },
345
+ {
346
+ "if": {
347
+ "required": [
348
+ "kind"
349
+ ],
350
+ "properties": {
351
+ "kind": {
352
+ "const": "label"
353
+ }
354
+ }
355
+ },
356
+ "then": {
357
+ "$ref": "#/definitions/label"
358
+ }
359
+ },
360
+ {
361
+ "if": {
362
+ "required": [
363
+ "kind"
364
+ ],
365
+ "properties": {
366
+ "kind": {
367
+ "not": {
368
+ "enum": [
369
+ "text",
370
+ "textarea",
371
+ "number",
372
+ "slider",
373
+ "select",
374
+ "color",
375
+ "checkbox",
376
+ "file",
377
+ "vector",
378
+ "separator",
379
+ "label"
380
+ ]
381
+ }
382
+ }
383
+ }
384
+ },
385
+ "then": {
386
+ "$ref": "#/definitions/custom"
387
+ }
388
+ }
389
+ ]
390
+ },
391
+ "text": {
392
+ "type": "object",
393
+ "description": "A single line of text. Value: string.",
394
+ "required": [
395
+ "kind",
396
+ "id",
397
+ "path"
398
+ ],
399
+ "properties": {
400
+ "kind": {
401
+ "const": "text"
402
+ },
403
+ "id": {
404
+ "type": "string",
405
+ "description": "Unique within the schema. Keys the field in the panel."
406
+ },
407
+ "label": {
408
+ "type": "string",
409
+ "description": "Shown above the field. Defaults to id."
410
+ },
411
+ "path": {
412
+ "type": "string",
413
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
414
+ },
415
+ "disabledWhen": {
416
+ "$ref": "#/definitions/disabledWhen"
417
+ },
418
+ "placeholder": {
419
+ "type": "string",
420
+ "description": "Shown while empty."
421
+ },
422
+ "promote": {
423
+ "$ref": "#/definitions/promote"
424
+ }
425
+ },
426
+ "additionalProperties": false
427
+ },
428
+ "textarea": {
429
+ "type": "object",
430
+ "description": "Several lines of text. Value: string.",
431
+ "required": [
432
+ "kind",
433
+ "id",
434
+ "path"
435
+ ],
436
+ "properties": {
437
+ "kind": {
438
+ "const": "textarea"
439
+ },
440
+ "id": {
441
+ "type": "string",
442
+ "description": "Unique within the schema. Keys the field in the panel."
443
+ },
444
+ "label": {
445
+ "type": "string",
446
+ "description": "Shown above the field. Defaults to id."
447
+ },
448
+ "path": {
449
+ "type": "string",
450
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
451
+ },
452
+ "disabledWhen": {
453
+ "$ref": "#/definitions/disabledWhen"
454
+ },
455
+ "placeholder": {
456
+ "type": "string",
457
+ "description": "Shown while empty."
458
+ },
459
+ "rows": {
460
+ "type": "number",
461
+ "description": "Visible lines. Default 3."
462
+ },
463
+ "promote": {
464
+ "$ref": "#/definitions/promote"
465
+ }
466
+ },
467
+ "additionalProperties": false
468
+ },
469
+ "number": {
470
+ "type": "object",
471
+ "description": "A number typed into a box. Value: number.",
472
+ "required": [
473
+ "kind",
474
+ "id",
475
+ "path"
476
+ ],
477
+ "properties": {
478
+ "kind": {
479
+ "const": "number"
480
+ },
481
+ "id": {
482
+ "type": "string",
483
+ "description": "Unique within the schema. Keys the field in the panel."
484
+ },
485
+ "label": {
486
+ "type": "string",
487
+ "description": "Shown above the field. Defaults to id."
488
+ },
489
+ "path": {
490
+ "type": "string",
491
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
492
+ },
493
+ "disabledWhen": {
494
+ "$ref": "#/definitions/disabledWhen"
495
+ },
496
+ "min": {
497
+ "type": "number",
498
+ "description": "Lower bound."
499
+ },
500
+ "max": {
501
+ "type": "number",
502
+ "description": "Upper bound."
503
+ },
504
+ "step": {
505
+ "type": "number",
506
+ "description": "Increment. Default 1."
507
+ },
508
+ "integer": {
509
+ "type": "boolean",
510
+ "description": "Whole numbers only: no fractional display, and a fine-step modifier never goes finer than step."
511
+ },
512
+ "suffix": {
513
+ "type": "string",
514
+ "description": "Unit after the number, e.g. px or °. Shown when the panel sets labelLayout to column or stacked."
515
+ },
516
+ "promote": {
517
+ "$ref": "#/definitions/promote"
518
+ }
519
+ },
520
+ "additionalProperties": false
521
+ },
522
+ "slider": {
523
+ "type": "object",
524
+ "description": "A number dragged along a range. Value: number.",
525
+ "required": [
526
+ "kind",
527
+ "id",
528
+ "path"
529
+ ],
530
+ "properties": {
531
+ "kind": {
532
+ "const": "slider"
533
+ },
534
+ "id": {
535
+ "type": "string",
536
+ "description": "Unique within the schema. Keys the field in the panel."
537
+ },
538
+ "label": {
539
+ "type": "string",
540
+ "description": "Shown above the field. Defaults to id."
541
+ },
542
+ "path": {
543
+ "type": "string",
544
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
545
+ },
546
+ "disabledWhen": {
547
+ "$ref": "#/definitions/disabledWhen"
548
+ },
549
+ "min": {
550
+ "type": "number",
551
+ "description": "Lower bound."
552
+ },
553
+ "max": {
554
+ "type": "number",
555
+ "description": "Upper bound."
556
+ },
557
+ "step": {
558
+ "type": "number",
559
+ "description": "Increment. Default 1."
560
+ },
561
+ "promote": {
562
+ "$ref": "#/definitions/promote"
563
+ }
564
+ },
565
+ "additionalProperties": false
566
+ },
567
+ "select": {
568
+ "type": "object",
569
+ "description": "One choice from a list. Value: the chosen option's value (string). Options can also come from optionsProvider(ctx), a function, which is set in code and has no JSON form.",
570
+ "required": [
571
+ "kind",
572
+ "id",
573
+ "path"
574
+ ],
575
+ "properties": {
576
+ "kind": {
577
+ "const": "select"
578
+ },
579
+ "id": {
580
+ "type": "string",
581
+ "description": "Unique within the schema. Keys the field in the panel."
582
+ },
583
+ "label": {
584
+ "type": "string",
585
+ "description": "Shown above the field. Defaults to id."
586
+ },
587
+ "path": {
588
+ "type": "string",
589
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
590
+ },
591
+ "disabledWhen": {
592
+ "$ref": "#/definitions/disabledWhen"
593
+ },
594
+ "options": {
595
+ "type": "array",
596
+ "description": "The choices.",
597
+ "items": {
598
+ "$ref": "#/definitions/selectOption"
599
+ }
600
+ },
601
+ "promote": {
602
+ "$ref": "#/definitions/promote"
603
+ }
604
+ },
605
+ "additionalProperties": false
606
+ },
607
+ "color": {
608
+ "type": "object",
609
+ "description": "A colour as a hex string, e.g. \"#2b7c76\". Value: string.",
610
+ "required": [
611
+ "kind",
612
+ "id",
613
+ "path"
614
+ ],
615
+ "properties": {
616
+ "kind": {
617
+ "const": "color"
618
+ },
619
+ "id": {
620
+ "type": "string",
621
+ "description": "Unique within the schema. Keys the field in the panel."
622
+ },
623
+ "label": {
624
+ "type": "string",
625
+ "description": "Shown above the field. Defaults to id."
626
+ },
627
+ "path": {
628
+ "type": "string",
629
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
630
+ },
631
+ "disabledWhen": {
632
+ "$ref": "#/definitions/disabledWhen"
633
+ },
634
+ "presets": {
635
+ "type": "array",
636
+ "items": {
637
+ "type": "string"
638
+ },
639
+ "description": "Hex strings. Declared in 0.1; the built-in renderer does not draw them."
640
+ },
641
+ "promote": {
642
+ "$ref": "#/definitions/promote"
643
+ }
644
+ },
645
+ "additionalProperties": false
646
+ },
647
+ "checkbox": {
648
+ "type": "object",
649
+ "description": "On or off. Value: boolean.",
650
+ "required": [
651
+ "kind",
652
+ "id",
653
+ "path"
654
+ ],
655
+ "properties": {
656
+ "kind": {
657
+ "const": "checkbox"
658
+ },
659
+ "id": {
660
+ "type": "string",
661
+ "description": "Unique within the schema. Keys the field in the panel."
662
+ },
663
+ "label": {
664
+ "type": "string",
665
+ "description": "Shown above the field. Defaults to id."
666
+ },
667
+ "path": {
668
+ "type": "string",
669
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
670
+ },
671
+ "disabledWhen": {
672
+ "$ref": "#/definitions/disabledWhen"
673
+ },
674
+ "promote": {
675
+ "$ref": "#/definitions/promote"
676
+ }
677
+ },
678
+ "additionalProperties": false
679
+ },
680
+ "file": {
681
+ "type": "object",
682
+ "description": "Shows a file's name; always read-only. Value: { \"name\": string }.",
683
+ "required": [
684
+ "kind",
685
+ "id",
686
+ "path"
687
+ ],
688
+ "properties": {
689
+ "kind": {
690
+ "const": "file"
691
+ },
692
+ "id": {
693
+ "type": "string",
694
+ "description": "Unique within the schema. Keys the field in the panel."
695
+ },
696
+ "label": {
697
+ "type": "string",
698
+ "description": "Shown above the field. Defaults to id."
699
+ },
700
+ "path": {
701
+ "type": "string",
702
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
703
+ },
704
+ "disabledWhen": {
705
+ "$ref": "#/definitions/disabledWhen"
706
+ },
707
+ "accept": {
708
+ "type": "string",
709
+ "description": "File types, as on <input>. Declared in 0.1; the built-in renderer ignores it."
710
+ },
711
+ "helperText": {
712
+ "type": "string",
713
+ "description": "A hint. Declared in 0.1; the built-in renderer does not draw it."
714
+ },
715
+ "promote": {
716
+ "$ref": "#/definitions/promote"
717
+ }
718
+ },
719
+ "additionalProperties": false
720
+ },
721
+ "vector": {
722
+ "type": "object",
723
+ "description": "Several numbers in one row: position, size, RGB, LCh. Value: number[], one per component.",
724
+ "required": [
725
+ "kind",
726
+ "id",
727
+ "path",
728
+ "components"
729
+ ],
730
+ "properties": {
731
+ "kind": {
732
+ "const": "vector"
733
+ },
734
+ "id": {
735
+ "type": "string",
736
+ "description": "Unique within the schema. Keys the field in the panel."
737
+ },
738
+ "label": {
739
+ "type": "string",
740
+ "description": "Shown above the field. Defaults to id."
741
+ },
742
+ "path": {
743
+ "type": "string",
744
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
745
+ },
746
+ "disabledWhen": {
747
+ "$ref": "#/definitions/disabledWhen"
748
+ },
749
+ "components": {
750
+ "type": "array",
751
+ "description": "One entry per slot; sets the arity.",
752
+ "items": {
753
+ "$ref": "#/definitions/vectorComponent"
754
+ }
755
+ },
756
+ "integer": {
757
+ "type": "boolean",
758
+ "description": "Truncate to whole numbers."
759
+ },
760
+ "precision": {
761
+ "type": "number",
762
+ "description": "Decimals shown when read-only."
763
+ },
764
+ "promote": {
765
+ "$ref": "#/definitions/promote"
766
+ }
767
+ },
768
+ "additionalProperties": false
769
+ },
770
+ "separator": {
771
+ "type": "object",
772
+ "description": "A horizontal rule between rows, with label as an optional caption. Holds no value, so it has no path.",
773
+ "required": [
774
+ "kind",
775
+ "id"
776
+ ],
777
+ "properties": {
778
+ "kind": {
779
+ "const": "separator"
780
+ },
781
+ "id": {
782
+ "type": "string",
783
+ "description": "Unique within the schema. Keys the field in the panel."
784
+ },
785
+ "label": {
786
+ "type": "string",
787
+ "description": "Shown above the field. Defaults to id."
788
+ },
789
+ "disabledWhen": {
790
+ "$ref": "#/definitions/disabledWhen"
791
+ },
792
+ "promote": {
793
+ "$ref": "#/definitions/promote"
794
+ }
795
+ },
796
+ "additionalProperties": false
797
+ },
798
+ "label": {
799
+ "type": "object",
800
+ "description": "Static text: a hint, a note, a sub-heading. The text is label. Holds no value, so it has no path.",
801
+ "required": [
802
+ "kind",
803
+ "id",
804
+ "label"
805
+ ],
806
+ "properties": {
807
+ "kind": {
808
+ "const": "label"
809
+ },
810
+ "id": {
811
+ "type": "string",
812
+ "description": "Unique within the schema. Keys the field in the panel."
813
+ },
814
+ "label": {
815
+ "type": "string",
816
+ "description": "Shown above the field. Defaults to id."
817
+ },
818
+ "disabledWhen": {
819
+ "$ref": "#/definitions/disabledWhen"
820
+ },
821
+ "promote": {
822
+ "$ref": "#/definitions/promote"
823
+ }
824
+ },
825
+ "additionalProperties": false
826
+ },
827
+ "custom": {
828
+ "type": "object",
829
+ "description": "A custom kind. The host's renderer decides which extra props it reads.",
830
+ "required": [
831
+ "kind",
832
+ "id",
833
+ "path"
834
+ ],
835
+ "properties": {
836
+ "kind": {
837
+ "type": "string"
838
+ },
839
+ "id": {
840
+ "type": "string",
841
+ "description": "Unique within the schema. Keys the field in the panel."
842
+ },
843
+ "label": {
844
+ "type": "string",
845
+ "description": "Shown above the field. Defaults to id."
846
+ },
847
+ "path": {
848
+ "type": "string",
849
+ "description": "A key into the record the scope's read() returns. A flat lookup, not a nested traversal: \"transform.x\" is one key."
850
+ },
851
+ "disabledWhen": {
852
+ "$ref": "#/definitions/disabledWhen"
853
+ },
854
+ "promote": {
855
+ "$ref": "#/definitions/promote"
856
+ }
857
+ }
858
+ }
859
+ }
860
+ }