@json-layout/vocabulary 1.2.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-layout/vocabulary",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Main JSON Layout vocabulary as JSON schemas and Typescript types. Also contains some small utility functions to validate and normalize annotations.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,6 +28,9 @@ export const standardComponents = [
28
28
  {
29
29
  name: 'none'
30
30
  },
31
+ {
32
+ name: 'slot'
33
+ },
31
34
  {
32
35
  name: 'section',
33
36
  composite: true
@@ -16,7 +16,17 @@ export type None = {
16
16
  (BaseCompObject & {
17
17
  comp: string;
18
18
  label?: string;
19
- hint?: string;
19
+ hint?: string | null;
20
+ [k: string]: unknown;
21
+ });
22
+ export type Slot = {
23
+ comp?: "slot";
24
+ [k: string]: unknown;
25
+ } & BaseCompObject &
26
+ (BaseCompObject & {
27
+ comp: string;
28
+ label?: string;
29
+ hint?: string | null;
20
30
  [k: string]: unknown;
21
31
  });
22
32
  export type Section = {
@@ -92,7 +102,7 @@ export type List = {
92
102
  (BaseCompObject & {
93
103
  comp: string;
94
104
  label?: string;
95
- hint?: string;
105
+ hint?: string | null;
96
106
  [k: string]: unknown;
97
107
  }) & {
98
108
  title?: string;
@@ -117,7 +127,7 @@ export type TextField = {
117
127
  (BaseCompObject & {
118
128
  comp: string;
119
129
  label?: string;
120
- hint?: string;
130
+ hint?: string | null;
121
131
  [k: string]: unknown;
122
132
  }) &
123
133
  (BaseCompObject & {
@@ -135,7 +145,7 @@ export type Textarea = {
135
145
  (BaseCompObject & {
136
146
  comp: string;
137
147
  label?: string;
138
- hint?: string;
148
+ hint?: string | null;
139
149
  [k: string]: unknown;
140
150
  }) &
141
151
  (BaseCompObject & {
@@ -153,7 +163,7 @@ export type NumberField = {
153
163
  (BaseCompObject & {
154
164
  comp: string;
155
165
  label?: string;
156
- hint?: string;
166
+ hint?: string | null;
157
167
  [k: string]: unknown;
158
168
  }) &
159
169
  (BaseCompObject & {
@@ -174,7 +184,7 @@ export type Checkbox = {
174
184
  (BaseCompObject & {
175
185
  comp: string;
176
186
  label?: string;
177
- hint?: string;
187
+ hint?: string | null;
178
188
  [k: string]: unknown;
179
189
  });
180
190
  export type Switch = {
@@ -184,7 +194,7 @@ export type Switch = {
184
194
  (BaseCompObject & {
185
195
  comp: string;
186
196
  label?: string;
187
- hint?: string;
197
+ hint?: string | null;
188
198
  [k: string]: unknown;
189
199
  });
190
200
  export type Slider = {
@@ -194,7 +204,7 @@ export type Slider = {
194
204
  (BaseCompObject & {
195
205
  comp: string;
196
206
  label?: string;
197
- hint?: string;
207
+ hint?: string | null;
198
208
  [k: string]: unknown;
199
209
  }) & {
200
210
  step?: number;
@@ -209,7 +219,7 @@ export type DatePicker = {
209
219
  (BaseCompObject & {
210
220
  comp: string;
211
221
  label?: string;
212
- hint?: string;
222
+ hint?: string | null;
213
223
  [k: string]: unknown;
214
224
  }) & {
215
225
  min?: string;
@@ -224,7 +234,7 @@ export type DateTimePicker = {
224
234
  (BaseCompObject & {
225
235
  comp: string;
226
236
  label?: string;
227
- hint?: string;
237
+ hint?: string | null;
228
238
  [k: string]: unknown;
229
239
  }) & {
230
240
  min?: string;
@@ -238,7 +248,7 @@ export type TimePicker = {
238
248
  (BaseCompObject & {
239
249
  comp: string;
240
250
  label?: string;
241
- hint?: string;
251
+ hint?: string | null;
242
252
  [k: string]: unknown;
243
253
  }) & {
244
254
  min?: string;
@@ -252,7 +262,7 @@ export type ColorPicker = {
252
262
  (BaseCompObject & {
253
263
  comp: string;
254
264
  label?: string;
255
- hint?: string;
265
+ hint?: string | null;
256
266
  [k: string]: unknown;
257
267
  });
258
268
  export type Select = {
@@ -262,7 +272,7 @@ export type Select = {
262
272
  (BaseCompObject & {
263
273
  comp: string;
264
274
  label?: string;
265
- hint?: string;
275
+ hint?: string | null;
266
276
  [k: string]: unknown;
267
277
  }) &
268
278
  (BaseCompObject & {
@@ -289,7 +299,7 @@ export type Autocomplete = {
289
299
  (BaseCompObject & {
290
300
  comp: string;
291
301
  label?: string;
292
- hint?: string;
302
+ hint?: string | null;
293
303
  [k: string]: unknown;
294
304
  }) &
295
305
  (BaseCompObject & {
@@ -316,7 +326,7 @@ export type Combobox = {
316
326
  (BaseCompObject & {
317
327
  comp: string;
318
328
  label?: string;
319
- hint?: string;
329
+ hint?: string | null;
320
330
  [k: string]: unknown;
321
331
  }) &
322
332
  (BaseCompObject & {
@@ -343,7 +353,7 @@ export type NumberCombobox = {
343
353
  (BaseCompObject & {
344
354
  comp: string;
345
355
  label?: string;
346
- hint?: string;
356
+ hint?: string | null;
347
357
  [k: string]: unknown;
348
358
  }) &
349
359
  (BaseCompObject & {
@@ -375,7 +385,7 @@ export type CheckboxGroup = {
375
385
  (BaseCompObject & {
376
386
  comp: string;
377
387
  label?: string;
378
- hint?: string;
388
+ hint?: string | null;
379
389
  [k: string]: unknown;
380
390
  }) &
381
391
  (BaseCompObject & {
@@ -397,7 +407,7 @@ export type SwitchGroup = {
397
407
  (BaseCompObject & {
398
408
  comp: string;
399
409
  label?: string;
400
- hint?: string;
410
+ hint?: string | null;
401
411
  [k: string]: unknown;
402
412
  }) &
403
413
  (BaseCompObject & {
@@ -419,7 +429,7 @@ export type RadioGroup = {
419
429
  (BaseCompObject & {
420
430
  comp: string;
421
431
  label?: string;
422
- hint?: string;
432
+ hint?: string | null;
423
433
  [k: string]: unknown;
424
434
  }) &
425
435
  (BaseCompObject & {
@@ -435,7 +445,7 @@ export type FileInput = {
435
445
  (BaseCompObject & {
436
446
  comp: string;
437
447
  label?: string;
438
- hint?: string;
448
+ hint?: string | null;
439
449
  [k: string]: unknown;
440
450
  }) &
441
451
  (BaseCompObject & {
@@ -460,7 +470,7 @@ export type OneOfSelect = {
460
470
  (BaseCompObject & {
461
471
  comp: string;
462
472
  label?: string;
463
- hint?: string;
473
+ hint?: string | null;
464
474
  [k: string]: unknown;
465
475
  }) & {
466
476
  emptyData?: boolean;
@@ -7,6 +7,7 @@ import {ajv} from '../validate.js'
7
7
  * @typedef {import('./types.js').PartialChildren} PartialChildren
8
8
  * @typedef {import('./types.js').PartialChild} PartialChild
9
9
  * @typedef {import('./types.js').PartialChildComposite} PartialChildComposite
10
+ * @typedef {import('./types.js').PartialChildSlot} PartialChildSlot
10
11
  * @typedef {import('./types.js').PartialSwitch} PartialSwitch
11
12
  * @typedef {import('./types.js').PartialCompObject} PartialCompObject
12
13
  * @typedef {import('./types.js').PartialGetItems} PartialGetItems
@@ -14,6 +15,8 @@ import {ajv} from '../validate.js'
14
15
  * @typedef {import('./types.js').PartialExpression} PartialExpression
15
16
  * @typedef {import('./types.js').PartialGetItemsObj} PartialGetItemsObj
16
17
  * @typedef {import('./types.js').PartialSlotMarkdown} PartialSlotMarkdown
18
+ * @typedef {import('./types.js').PartialSlotText} PartialSlotText
19
+ * @typedef {import('./types.js').PartialSlotName} PartialSlotName
17
20
  * @typedef {import('./types.js').PartialSlot} PartialSlot
18
21
  * @typedef {import('./types.js').PartialSelectItem} PartialSelectItem
19
22
  * @typedef {{ errors: any, (layoutKeyword: any): layoutKeyword is LayoutKeyword }} ValidateLayoutKeyword
@@ -40,7 +43,12 @@ export function isPartialChildren (layoutKeyword) {
40
43
 
41
44
  /** @type {(partialChild: PartialChild) => partialChild is PartialChildComposite} */
42
45
  export function isPartialChildComposite (partialChild) {
43
- return typeof partialChild !== 'string' && "children" in partialChild
46
+ return typeof partialChild !== 'string' && 'children' in partialChild
47
+ }
48
+
49
+ /** @type {(partialChild: PartialChild) => partialChild is PartialChildSlot} */
50
+ export function isPartialChildSlot (partialChild) {
51
+ return typeof partialChild !== 'string' && ('text' in partialChild || 'markdown' in partialChild || 'name' in partialChild)
44
52
  }
45
53
 
46
54
  /** @type {(layoutKeyword: LayoutKeyword) => layoutKeyword is PartialCompObject} */
@@ -66,4 +74,14 @@ export function isPartialGetItemsFetch (getItems) {
66
74
  /** @type {(partialSlot: PartialSlot) => partialSlot is PartialSlotMarkdown} */
67
75
  export function isPartialSlotMarkdown (partialSlot) {
68
76
  return typeof partialSlot == 'object' && !!/** @type {PartialSlotMarkdown} */(partialSlot).markdown
77
+ }
78
+
79
+ /** @type {(partialSlot: PartialSlot) => partialSlot is PartialSlotText} */
80
+ export function isPartialSlotText (partialSlot) {
81
+ return typeof partialSlot == 'object' && !!/** @type {PartialSlotText} */(partialSlot).text
82
+ }
83
+
84
+ /** @type {(partialSlot: PartialSlot) => partialSlot is PartialSlotName} */
85
+ export function isPartialSlotName (partialSlot) {
86
+ return typeof partialSlot == 'object' && !!/** @type {PartialSlotName} */(partialSlot).name
69
87
  }
@@ -54,6 +54,12 @@ export default {
54
54
  "label": {
55
55
  "type": "string"
56
56
  },
57
+ "hint": {
58
+ "type": [
59
+ "string",
60
+ "null"
61
+ ]
62
+ },
57
63
  "title": {
58
64
  "type": [
59
65
  "string",
@@ -170,6 +176,14 @@ export default {
170
176
  },
171
177
  "if": {
172
178
  "$ref": "#/$defs/partial-expression"
179
+ },
180
+ "slots": {
181
+ "type": "object",
182
+ "patternProperties": {
183
+ ".*": {
184
+ "$ref": "#/$defs/partial-slot"
185
+ }
186
+ }
173
187
  }
174
188
  }
175
189
  },
@@ -202,19 +216,58 @@ export default {
202
216
  },
203
217
  "if": {
204
218
  "$ref": "#/$defs/partial-expression"
219
+ },
220
+ "slots": {
221
+ "type": "object",
222
+ "patternProperties": {
223
+ ".*": {
224
+ "$ref": "#/$defs/partial-slot"
225
+ }
226
+ }
205
227
  }
206
228
  }
207
229
  },
230
+ "partial-child-slot": {
231
+ "type": "object",
232
+ "properties": {
233
+ "cols": {
234
+ "$ref": "#/$defs/partial-cols"
235
+ },
236
+ "if": {
237
+ "$ref": "#/$defs/partial-expression"
238
+ }
239
+ },
240
+ "oneOf": [
241
+ {
242
+ "$ref": "#/$defs/partial-slot-text"
243
+ },
244
+ {
245
+ "$ref": "#/$defs/partial-slot-markdown"
246
+ },
247
+ {
248
+ "$ref": "#/$defs/partial-slot-name"
249
+ }
250
+ ]
251
+ },
208
252
  "partial-child": {
209
253
  "anyOf": [
210
254
  {
211
255
  "type": "string"
212
256
  },
257
+ {
258
+ "type": "array",
259
+ "items": {
260
+ "$ref": "#/$defs/partial-child"
261
+ }
262
+ },
213
263
  {
214
264
  "$ref": "#/$defs/partial-child-ref"
215
265
  },
216
266
  {
217
267
  "$ref": "#/$defs/partial-child-composite"
268
+ },
269
+ {
270
+ "$ref": "#/$defs/partial-child-slot"
218
271
  }
219
272
  ]
220
273
  },
@@ -32,6 +32,7 @@
32
32
  "help": {"type": "string"},
33
33
  "children": {"$ref": "#/$defs/partial-children"},
34
34
  "label": {"type": "string"},
35
+ "hint": {"type": ["string", "null"]},
35
36
  "title": {"type": ["string", "null"]},
36
37
  "subtitle": {"type": ["string", "null"]},
37
38
  "step": {"type": "number"},
@@ -72,7 +73,13 @@
72
73
  "properties": {
73
74
  "key": {"type": ["string", "integer"]},
74
75
  "cols": {"$ref": "#/$defs/partial-cols"},
75
- "if": {"$ref": "#/$defs/partial-expression"}
76
+ "if": {"$ref": "#/$defs/partial-expression"},
77
+ "slots": {
78
+ "type": "object",
79
+ "patternProperties": {
80
+ ".*": {"$ref": "#/$defs/partial-slot"}
81
+ }
82
+ }
76
83
  }
77
84
  },
78
85
  "partial-child-composite": {
@@ -84,14 +91,34 @@
84
91
  "subtitle": {"type": ["string", "null"]},
85
92
  "children": {"$ref": "#/$defs/partial-children"},
86
93
  "cols": {"$ref": "#/$defs/partial-cols"},
87
- "if": {"$ref": "#/$defs/partial-expression"}
94
+ "if": {"$ref": "#/$defs/partial-expression"},
95
+ "slots": {
96
+ "type": "object",
97
+ "patternProperties": {
98
+ ".*": {"$ref": "#/$defs/partial-slot"}
99
+ }
100
+ }
88
101
  }
89
102
  },
103
+ "partial-child-slot": {
104
+ "type": "object",
105
+ "properties": {
106
+ "cols": {"$ref": "#/$defs/partial-cols"},
107
+ "if": {"$ref": "#/$defs/partial-expression"}
108
+ },
109
+ "oneOf": [
110
+ {"$ref": "#/$defs/partial-slot-text"},
111
+ {"$ref": "#/$defs/partial-slot-markdown"},
112
+ {"$ref": "#/$defs/partial-slot-name"}
113
+ ]
114
+ },
90
115
  "partial-child": {
91
116
  "anyOf": [
92
117
  {"type": "string"},
118
+ {"type": "array", "items": {"$ref": "#/$defs/partial-child"}},
93
119
  {"$ref": "#/$defs/partial-child-ref"},
94
- {"$ref": "#/$defs/partial-child-composite"}
120
+ {"$ref": "#/$defs/partial-child-composite"},
121
+ {"$ref": "#/$defs/partial-child-slot"}
95
122
  ]
96
123
  },
97
124
  "partial-children": {
@@ -12,7 +12,7 @@ export type ComponentName = string;
12
12
  * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
13
13
  * via the `definition` "partial-child".
14
14
  */
15
- export type PartialChild = string | PartialChildRef | PartialChildComposite;
15
+ export type PartialChild = string | PartialChild[] | PartialChildRef | PartialChildComposite | PartialChildSlot;
16
16
  /**
17
17
  * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
18
18
  * via the `definition` "partial-cols".
@@ -28,6 +28,30 @@ export type PartialColsNumber = number;
28
28
  * via the `definition` "partial-expression".
29
29
  */
30
30
  export type PartialExpression = string | PartialExpressionObj;
31
+ /**
32
+ * This interface was referenced by `undefined`'s JSON-Schema definition
33
+ * via the `patternProperty` ".*".
34
+ *
35
+ * This interface was referenced by `undefined`'s JSON-Schema definition
36
+ * via the `patternProperty` ".*".
37
+ *
38
+ * This interface was referenced by `undefined`'s JSON-Schema definition
39
+ * via the `patternProperty` ".*".
40
+ *
41
+ * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
42
+ * via the `definition` "partial-slot".
43
+ */
44
+ export type PartialSlot = string | PartialSlotText | PartialSlotMarkdown | PartialSlotName;
45
+ export type PartialChildSlot = {
46
+ cols?: PartialCols;
47
+ if?: PartialExpression;
48
+ [k: string]: unknown;
49
+ } & PartialChildSlot1;
50
+ /**
51
+ * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
52
+ * via the `definition` "partial-child-slot".
53
+ */
54
+ export type PartialChildSlot1 = PartialSlotText | PartialSlotMarkdown | PartialSlotName;
31
55
  /**
32
56
  * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
33
57
  * via the `definition` "partial-children".
@@ -68,14 +92,6 @@ export type PartialGetItemsObj = {
68
92
  | PartialExpressionObj
69
93
  | PartialGetItemsFetch
70
94
  );
71
- /**
72
- * This interface was referenced by `undefined`'s JSON-Schema definition
73
- * via the `patternProperty` ".*".
74
- *
75
- * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
76
- * via the `definition` "partial-slot".
77
- */
78
- export type PartialSlot = string | PartialSlotText | PartialSlotMarkdown | PartialSlotName;
79
95
 
80
96
  export interface HttpsJsonLayoutGithubIoLayoutKeyword {
81
97
  [k: string]: unknown;
@@ -88,6 +104,9 @@ export interface PartialChildRef {
88
104
  key: string | number;
89
105
  cols?: PartialCols;
90
106
  if?: PartialExpression;
107
+ slots?: {
108
+ [k: string]: PartialSlot;
109
+ };
91
110
  }
92
111
  /**
93
112
  * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
@@ -110,6 +129,27 @@ export interface PartialExpressionObj {
110
129
  expr: string;
111
130
  [k: string]: unknown;
112
131
  }
132
+ /**
133
+ * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
134
+ * via the `definition` "partial-slot-text".
135
+ */
136
+ export interface PartialSlotText {
137
+ text: string;
138
+ }
139
+ /**
140
+ * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
141
+ * via the `definition` "partial-slot-markdown".
142
+ */
143
+ export interface PartialSlotMarkdown {
144
+ markdown: string;
145
+ }
146
+ /**
147
+ * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
148
+ * via the `definition` "partial-slot-name".
149
+ */
150
+ export interface PartialSlotName {
151
+ name: string;
152
+ }
113
153
  /**
114
154
  * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
115
155
  * via the `definition` "partial-child-composite".
@@ -121,6 +161,9 @@ export interface PartialChildComposite {
121
161
  children: PartialChildren;
122
162
  cols?: PartialCols;
123
163
  if?: PartialExpression;
164
+ slots?: {
165
+ [k: string]: PartialSlot;
166
+ };
124
167
  [k: string]: unknown;
125
168
  }
126
169
  /**
@@ -132,6 +175,7 @@ export interface PartialCompObject {
132
175
  help?: string;
133
176
  children?: PartialChildren;
134
177
  label?: string;
178
+ hint?: string | null;
135
179
  title?: string | null;
136
180
  subtitle?: string | null;
137
181
  step?: number;
@@ -172,27 +216,6 @@ export interface PartialGetItemsFetch {
172
216
  url: PartialExpression;
173
217
  [k: string]: unknown;
174
218
  }
175
- /**
176
- * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
177
- * via the `definition` "partial-slot-text".
178
- */
179
- export interface PartialSlotText {
180
- text: string;
181
- }
182
- /**
183
- * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
184
- * via the `definition` "partial-slot-markdown".
185
- */
186
- export interface PartialSlotMarkdown {
187
- markdown: string;
188
- }
189
- /**
190
- * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
191
- * via the `definition` "partial-slot-name".
192
- */
193
- export interface PartialSlotName {
194
- name: string;
195
- }
196
219
  /**
197
220
  * This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
198
221
  * via the `definition` "partial-switch".