@json-layout/vocabulary 0.14.0 → 0.15.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.
Files changed (46) hide show
  1. package/package.json +5 -5
  2. package/src/components/compile-types.js +61 -0
  3. package/src/components/index.js +226 -0
  4. package/src/components/types.ts +378 -0
  5. package/src/index.js +3 -0
  6. package/src/layout-keyword/index.js +9 -2
  7. package/src/layout-keyword/schema.js +67 -62
  8. package/src/layout-keyword/schema.json +35 -50
  9. package/src/layout-keyword/types.ts +111 -42
  10. package/src/normalize.js +92 -53
  11. package/src/normalized-layout/index.js +18 -64
  12. package/src/normalized-layout/schema.js +235 -762
  13. package/src/normalized-layout/schema.json +118 -324
  14. package/src/normalized-layout/types.ts +163 -233
  15. package/src/types.ts +11 -0
  16. package/src/validate.js +42 -0
  17. package/types/components/compile-types.d.ts +13 -0
  18. package/types/components/compile-types.d.ts.map +1 -0
  19. package/types/components/index.d.ts +52 -0
  20. package/types/components/index.d.ts.map +1 -0
  21. package/types/components/types.d.ts +329 -0
  22. package/types/components/types.d.ts.map +1 -0
  23. package/types/index.d.ts +2 -0
  24. package/types/index.d.ts.map +1 -1
  25. package/types/layout-keyword/index.d.ts +6 -1
  26. package/types/layout-keyword/index.d.ts.map +1 -1
  27. package/types/layout-keyword/schema.d.ts +43 -26
  28. package/types/layout-keyword/types.d.ts +111 -18
  29. package/types/layout-keyword/types.d.ts.map +1 -1
  30. package/types/normalize.d.ts +3 -2
  31. package/types/normalize.d.ts.map +1 -1
  32. package/types/normalized-layout/index.d.ts +19 -65
  33. package/types/normalized-layout/index.d.ts.map +1 -1
  34. package/types/normalized-layout/schema.d.ts +171 -526
  35. package/types/normalized-layout/types.d.ts +163 -208
  36. package/types/normalized-layout/types.d.ts.map +1 -1
  37. package/types/types.d.ts +10 -0
  38. package/types/types.d.ts.map +1 -1
  39. package/types/validate.d.ts +8 -0
  40. package/types/validate.d.ts.map +1 -0
  41. package/src/layout-keyword/validate.js +0 -2
  42. package/src/normalized-layout/validate.js +0 -3
  43. package/types/layout-keyword/validate.d.ts +0 -23
  44. package/types/layout-keyword/validate.d.ts.map +0 -1
  45. package/types/normalized-layout/validate.d.ts +0 -23
  46. package/types/normalized-layout/validate.d.ts.map +0 -1
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "$id": "https://json-layout.github.io/normalized-layout-keyword",
3
- "title": "normalized layout",
4
- "oneOf": [
5
- {"$ref": "#/$defs/switch-struct"},
6
- {"$ref": "#/$defs/comp-object"}
7
- ],
8
3
  "$defs": {
4
+ "normalized-layout": {
5
+ "title": "normalized layout",
6
+ "type": "object",
7
+ "unevaluatedProperties": false,
8
+ "oneOf": [
9
+ {"$ref": "#/$defs/switch-struct"},
10
+ {"$ref": "#/$defs/base-comp-object"}
11
+ ]
12
+ },
9
13
  "switch-struct": {
10
14
  "type": "object",
11
15
  "required": ["switch"],
@@ -13,353 +17,151 @@
13
17
  "properties": {
14
18
  "switch": {
15
19
  "type": "array",
16
- "items": {"$ref": "#/$defs/comp-object"}
20
+ "items": {"$ref": "#/$defs/base-comp-object"}
17
21
  }
18
22
  }
19
23
  },
20
- "comp-object": {
24
+ "base-comp-object": {
21
25
  "type": "object",
22
26
  "required": ["comp"],
23
- "unevaluatedProperties": false,
27
+ "properties": {
28
+ "comp": {"type": "string"},
29
+ "if": {"$ref": "#/$defs/expression"},
30
+ "options": {"$ref": "#/$defs/state-node-options-base"},
31
+ "getOptions": {"$ref": "#/$defs/expression"},
32
+ "defaultData": {},
33
+ "getDefaultData": {"$ref": "#/$defs/expression"},
34
+ "constData": {},
35
+ "getConstData": {"$ref": "#/$defs/expression"},
36
+ "transformData": {"$ref": "#/$defs/expression"},
37
+ "nullable": {"type": "boolean"},
38
+ "help": {"type": "string"},
39
+ "cols": {"$ref": "#/$defs/cols-obj"},
40
+ "props": {"$ref": "#/$defs/state-node-props-lib"},
41
+ "getProps": {"$ref": "#/$defs/expression"},
42
+ "slots": {
43
+ "type": "object",
44
+ "allOf": [
45
+ {"$ref": "#/$defs/state-node-slots-lib"},
46
+ {
47
+ "properties": {
48
+ "before": {"$ref": "#/$defs/slot"},
49
+ "after": {"$ref": "#/$defs/slot"},
50
+ "component": {"$ref": "#/$defs/slot"}
51
+ }
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ },
57
+ "composite-comp-object": {
24
58
  "allOf": [
59
+ {"$ref": "#/$defs/base-comp-object"},
25
60
  {
61
+ "type": "object",
62
+ "required": ["children", "comp"],
26
63
  "properties": {
27
- "if": {"$ref": "#/$defs/expression"},
28
- "options": {"$ref": "#/$defs/state-node-options-base"},
29
- "getOptions": {"$ref": "#/$defs/expression"},
30
- "defaultData": {},
31
- "getDefaultData": {"$ref": "#/$defs/expression"},
32
- "constData": {},
33
- "getConstData": {"$ref": "#/$defs/expression"},
34
- "transformData": {"$ref": "#/$defs/expression"},
35
- "nullable": {"type": "boolean"},
36
- "help": {"type": "string"},
37
- "cols": {"$ref": "#/$defs/cols-obj"},
38
- "props": {"$ref": "#/$defs/state-node-props-lib"},
39
- "getProps": {"$ref": "#/$defs/expression"},
40
- "slots": {
41
- "type": "object",
42
- "allOf": [
43
- {"$ref": "#/$defs/state-node-slots-lib"},
44
- {
45
- "properties": {
46
- "before": {"$ref": "#/$defs/slot"},
47
- "after": {"$ref": "#/$defs/slot"},
48
- "component": {"$ref": "#/$defs/slot"}
49
- }
50
- }
51
- ]
52
- }
64
+ "comp": {"type": "string"},
65
+ "title": {"type": ["string", "null"]},
66
+ "subtitle": {"type": ["string", "null"]},
67
+ "children": {"$ref": "#/$defs/children"}
53
68
  }
54
- },
55
- {
56
- "discriminator": {"propertyName": "comp"},
57
- "oneOf": [
58
- {"$ref": "#/$defs/none"},
59
- {"$ref": "#/$defs/list"},
60
- {"$ref": "#/$defs/text-field"},
61
- {"$ref": "#/$defs/number-field"},
62
- {"$ref": "#/$defs/textarea"},
63
- {"$ref": "#/$defs/markdown"},
64
- {"$ref": "#/$defs/checkbox"},
65
- {"$ref": "#/$defs/switch"},
66
- {"$ref": "#/$defs/slider"},
67
- {"$ref": "#/$defs/date-picker"},
68
- {"$ref": "#/$defs/date-time-picker"},
69
- {"$ref": "#/$defs/time-picker"},
70
- {"$ref": "#/$defs/color-picker"},
71
- {"$ref": "#/$defs/combobox"},
72
- {"$ref": "#/$defs/number-combobox"},
73
- {"$ref": "#/$defs/select"},
74
- {"$ref": "#/$defs/autocomplete"},
75
- {"$ref": "#/$defs/one-of-select"},
76
- {"$ref": "#/$defs/section"},
77
- {"$ref": "#/$defs/tabs"},
78
- {"$ref": "#/$defs/vertical-tabs"},
79
- {"$ref": "#/$defs/expansion-panels"},
80
- {"$ref": "#/$defs/stepper"},
81
- {"$ref": "#/$defs/file-input"}
82
- ]
83
69
  }
84
70
  ]
85
71
  },
86
- "composite-comp-object": {
87
- "type": "object",
88
- "discriminator": {"propertyName": "comp"},
89
- "oneOf": [
90
- {"$ref": "#/$defs/section"},
91
- {"$ref": "#/$defs/tabs"},
92
- {"$ref": "#/$defs/vertical-tabs"},
93
- {"$ref": "#/$defs/expansion-panels"}
72
+ "simple-comp-object": {
73
+ "allOf": [
74
+ {"$ref": "#/$defs/base-comp-object"},
75
+ {
76
+ "type": "object",
77
+ "required": ["comp"],
78
+ "properties": {
79
+ "comp": {"type": "string"},
80
+ "label": {"type": "string"}
81
+ }
82
+ }
94
83
  ]
95
84
  },
96
- "none": {
97
- "type": "object",
98
- "required": ["comp"],
99
- "properties": {
100
- "comp": {"const": "none"}
101
-
102
- }
103
- },
104
- "section": {
105
- "type": "object",
106
- "required": ["comp", "children"],
107
- "properties": {
108
- "comp": {"const": "section"},
109
- "title": {"type": ["string", "null"]},
110
- "subtitle": {"type": ["string", "null"]},
111
- "children": {"$ref": "#/$defs/children"}
112
- }
85
+ "focusable-comp-object": {
86
+ "allOf": [
87
+ {"$ref": "#/$defs/base-comp-object"},
88
+ {
89
+ "type": "object",
90
+ "required": ["comp"],
91
+ "properties": {
92
+ "comp": {"type": "string"},
93
+ "label": {"type": "string"},
94
+ "autofocus": {"type": "boolean"}
95
+ }
96
+ }
97
+ ]
113
98
  },
114
- "tabs": {
115
- "type": "object",
116
- "required": ["comp", "children"],
117
- "properties": {
118
- "comp": {"const": "tabs"},
119
- "title": {"type": ["string", "null"]},
120
- "subtitle": {"type": ["string", "null"]},
121
- "children": {"$ref": "#/$defs/children"}
122
- }
99
+ "items-based-comp-object": {
100
+ "allOf": [
101
+ {"$ref": "#/$defs/base-comp-object"},
102
+ {
103
+ "type": "object",
104
+ "required": ["comp"],
105
+ "properties": {
106
+ "comp": {"type": "string"},
107
+ "items": {"$ref": "#/$defs/select-items"},
108
+ "getItems": {"$ref": "#/$defs/get-items"},
109
+ "multiple": {"type": "boolean"},
110
+ "separator": {"type": "string"}
111
+ }
112
+ }
113
+ ]
123
114
  },
124
- "vertical-tabs": {
125
- "type": "object",
126
- "required": ["comp", "children"],
127
- "properties": {
128
- "comp": {"const": "vertical-tabs"},
129
- "title": {"type": ["string", "null"]},
130
- "subtitle": {"type": ["string", "null"]},
131
- "children": {"$ref": "#/$defs/children"}
132
- }
115
+ "multiple-compat-comp-object": {
116
+ "allOf": [
117
+ {"$ref": "#/$defs/base-comp-object"},
118
+ {
119
+ "type": "object",
120
+ "required": ["comp"],
121
+ "properties": {
122
+ "comp": {"type": "string"},
123
+ "multiple": {"type": "boolean"}
124
+ }
125
+ }
126
+ ]
133
127
  },
134
- "expansion-panels": {
128
+ "child-ref": {
135
129
  "type": "object",
136
- "required": ["comp", "children"],
130
+ "required": ["key"],
131
+ "additionalProperties": false,
137
132
  "properties": {
138
- "comp": {"const": "expansion-panels"},
139
- "title": {"type": ["string", "null"]},
140
- "subtitle": {"type": ["string", "null"]},
141
- "children": {"$ref": "#/$defs/children"}
133
+ "key": {"type": ["string", "integer"]},
134
+ "cols": {"$ref": "#/$defs/cols-obj"}
142
135
  }
143
136
  },
144
- "stepper": {
137
+ "child-composite": {
145
138
  "type": "object",
146
- "required": ["comp", "children"],
139
+ "required": ["key", "children"],
147
140
  "properties": {
148
- "comp": {"const": "stepper"},
141
+ "key": {"type": ["string", "integer"]},
142
+ "cols": {"$ref": "#/$defs/cols-obj"},
143
+ "comp": {"type": "string"},
149
144
  "title": {"type": ["string", "null"]},
150
145
  "subtitle": {"type": ["string", "null"]},
151
146
  "children": {"$ref": "#/$defs/children"}
152
147
  }
153
148
  },
154
149
  "child": {
150
+ "title": "Child",
155
151
  "type": "object",
156
- "unevaluatedProperties": false,
157
- "required": ["key"],
158
- "properties": {
159
- "key": {"type": ["string", "integer"]},
160
- "cols": {"$ref": "#/$defs/cols-obj"}
161
- },
162
- "anyOf": [
163
- {},
164
- {"$ref": "#/$defs/composite-comp-object"}
152
+ "oneOf": [
153
+ {
154
+ "$ref": "#/$defs/child-ref"
155
+ },
156
+ {
157
+ "$ref": "#/$defs/child-composite"
158
+ }
165
159
  ]
166
160
  },
167
161
  "children": {
168
162
  "type": "array",
169
163
  "items": {"$ref": "#/$defs/child"}
170
164
  },
171
- "list": {
172
- "type": "object",
173
- "required": ["comp", "listEditMode", "listActions"],
174
- "properties": {
175
- "comp": {"const": "list"},
176
- "title": {"type": "string"},
177
- "listEditMode": {"type": "string", "enum": ["inline", "inline-single", "menu", "dialog"]},
178
- "listActions": {"type": "array", "items": {"type": "string", "enum": ["add", "edit", "delete", "sort", "duplicate"]}},
179
- "itemTitle": {"$ref": "#/$defs/expression"},
180
- "itemSubtitle": {"$ref": "#/$defs/expression"},
181
- "messages": {
182
- "type": "object",
183
- "additionalProperties": false,
184
- "properties": {
185
- "addItem": {"type": "string"},
186
- "delete": {"type": "string"},
187
- "edit": {"type": "string"},
188
- "duplicate": {"type": "string"},
189
- "sort": {"type": "string"}
190
- }
191
- }
192
- }
193
- },
194
- "text-field": {
195
- "type": "object",
196
- "required": ["comp", "label"],
197
- "properties": {
198
- "comp": {"const": "text-field"},
199
- "label": {"type": "string"},
200
- "autofocus": {"type": "boolean"}
201
- }
202
- },
203
- "number-field": {
204
- "type": "object",
205
- "required": ["comp", "label"],
206
- "properties": {
207
- "comp": {"const": "number-field"},
208
- "label": {"type": "string"},
209
- "autofocus": {"type": "boolean"},
210
- "step": {"type": "number"},
211
- "min": {"type": "number"},
212
- "max": {"type": "number"}
213
- }
214
- },
215
- "textarea": {
216
- "type": "object",
217
- "required": ["comp", "label"],
218
- "properties": {
219
- "comp": {"const": "textarea"},
220
- "label": {"type": "string"},
221
- "autofocus": {"type": "boolean"}
222
- }
223
- },
224
- "markdown": {
225
- "type": "object",
226
- "required": ["comp", "label"],
227
- "properties": {
228
- "comp": {"const": "markdown"},
229
- "label": {"type": "string"},
230
- "autofocus": {"type": "boolean"}
231
- }
232
- },
233
- "checkbox": {
234
- "type": "object",
235
- "required": ["comp", "label"],
236
- "properties": {
237
- "comp": {"const": "checkbox"},
238
- "label": {"type": "string"}
239
- }
240
- },
241
- "switch": {
242
- "type": "object",
243
- "required": ["comp", "label"],
244
- "properties": {
245
- "comp": {"const": "switch"},
246
- "label": {"type": "string"}
247
- }
248
- },
249
- "slider": {
250
- "type": "object",
251
- "required": ["comp", "label", "min", "max"],
252
- "properties": {
253
- "comp": {"const": "slider"},
254
- "label": {"type": "string"},
255
- "step": {"type": "number"},
256
- "min": {"type": "number"},
257
- "max": {"type": "number"}
258
- }
259
- },
260
- "date-picker": {
261
- "type": "object",
262
- "required": ["comp", "label"],
263
- "properties": {
264
- "comp": {"const": "date-picker"},
265
- "label": {"type": "string"},
266
- "min": {"type": "string", "format": "date"},
267
- "max": {"type": "string", "format": "date"},
268
- "format": {"type": "string", "enum": ["date", "date-time"], "default": "date"}
269
- }
270
- },
271
- "date-time-picker": {
272
- "type": "object",
273
- "required": ["comp", "label"],
274
- "properties": {
275
- "comp": {"const": "date-time-picker"},
276
- "label": {"type": "string"},
277
- "min": {"type": "string", "format": "date-time"},
278
- "max": {"type": "string", "format": "date-time"}
279
- }
280
- },
281
- "time-picker": {
282
- "type": "object",
283
- "required": ["comp", "label"],
284
- "properties": {
285
- "comp": {"const": "time-picker"},
286
- "label": {"type": "string"},
287
- "min": {"type": "string", "format": "time"},
288
- "max": {"type": "string", "format": "time"}
289
- }
290
- },
291
- "color-picker": {
292
- "type": "object",
293
- "required": ["comp", "label"],
294
- "properties": {
295
- "comp": {"const": "color-picker"},
296
- "label": {"type": "string"}
297
- }
298
- },
299
- "combobox": {
300
- "type": "object",
301
- "required": ["comp", "label"],
302
- "properties": {
303
- "comp": {"const": "combobox"},
304
- "label": {"type": "string"},
305
- "autofocus": {"type": "boolean"},
306
- "items": {"$ref": "#/$defs/select-items"},
307
- "getItems": {"$ref": "#/$defs/get-items"},
308
- "multiple": {"type": "boolean"},
309
- "separator": {"type": "string"}
310
- }
311
- },
312
- "number-combobox": {
313
- "type": "object",
314
- "required": ["comp", "label"],
315
- "properties": {
316
- "comp": {"const": "number-combobox"},
317
- "label": {"type": "string"},
318
- "autofocus": {"type": "boolean"},
319
- "items": {"$ref": "#/$defs/select-items"},
320
- "getItems": {"$ref": "#/$defs/get-items"},
321
- "multiple": {"type": "boolean"},
322
- "step": {"type": "number"},
323
- "min": {"type": "number"},
324
- "max": {"type": "number"}
325
- }
326
- },
327
- "select": {
328
- "type": "object",
329
- "required": ["comp", "label"],
330
- "properties": {
331
- "comp": {"const": "select"},
332
- "label": {"type": "string"},
333
- "autofocus": {"type": "boolean"},
334
- "items": {"$ref": "#/$defs/select-items"},
335
- "getItems": {"$ref": "#/$defs/get-items"},
336
- "multiple": {"type": "boolean"},
337
- "separator": {"type": "string"}
338
- }
339
- },
340
- "autocomplete": {
341
- "type": "object",
342
- "required": ["comp", "label"],
343
- "properties": {
344
- "comp": {"const": "autocomplete"},
345
- "label": {"type": "string"},
346
- "autofocus": {"type": "boolean"},
347
- "items": {"$ref": "#/$defs/select-items"},
348
- "getItems": {"$ref": "#/$defs/get-items"},
349
- "multiple": {"type": "boolean"},
350
- "separator": {"type": "string"}
351
- }
352
- },
353
- "file-input": {
354
- "type": "object",
355
- "required": ["comp", "label"],
356
- "properties": {
357
- "comp": {"const": "file-input"},
358
- "label": {"type": "string"},
359
- "accept": {"type": "string"},
360
- "multiple": {"type": "boolean"}
361
- }
362
- },
363
165
  "select-items": {
364
166
  "type": "array",
365
167
  "items": {"$ref": "#/$defs/select-item"}
@@ -407,14 +209,6 @@
407
209
  }
408
210
  }
409
211
  },
410
- "one-of-select": {
411
- "type": "object",
412
- "required": ["comp", "label"],
413
- "properties": {
414
- "comp": {"const": "one-of-select"},
415
- "label": {"type": "string"}
416
- }
417
- },
418
212
  "expression": {
419
213
  "type": "object",
420
214
  "required": ["type", "expr", "pure"],