@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 +1 -1
- package/src/components/index.js +3 -0
- package/src/components/types.ts +31 -21
- package/src/layout-keyword/index.js +19 -1
- package/src/layout-keyword/schema.js +53 -0
- package/src/layout-keyword/schema.json +30 -3
- package/src/layout-keyword/types.ts +53 -30
- package/src/normalize.js +85 -32
- package/src/normalized-layout/index.js +10 -2
- package/src/normalized-layout/schema.js +84 -20
- package/src/normalized-layout/schema.json +46 -22
- package/src/normalized-layout/types.ts +34 -8
- package/types/components/index.d.ts.map +1 -1
- package/types/components/types.d.ts +30 -21
- package/types/components/types.d.ts.map +1 -1
- package/types/layout-keyword/index.d.ts +9 -0
- package/types/layout-keyword/index.d.ts.map +1 -1
- package/types/layout-keyword/schema.d.ts +41 -0
- package/types/layout-keyword/types.d.ts +53 -30
- package/types/layout-keyword/types.d.ts.map +1 -1
- package/types/normalize.d.ts.map +1 -1
- package/types/normalized-layout/index.d.ts +11 -1
- package/types/normalized-layout/index.d.ts.map +1 -1
- package/types/normalized-layout/schema.d.ts +68 -19
- package/types/normalized-layout/types.d.ts +34 -8
- package/types/normalized-layout/types.d.ts.map +1 -1
package/src/normalize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateLayoutKeyword, isComponentName, isPartialCompObject, isPartialChildren, isPartialSwitch, isPartialGetItemsExpr, isPartialGetItemsObj, isPartialSlotMarkdown, isPartialGetItemsFetch, isPartialChildComposite } from './layout-keyword/index.js'
|
|
1
|
+
import { validateLayoutKeyword, isComponentName, isPartialCompObject, isPartialChildren, isPartialSwitch, isPartialGetItemsExpr, isPartialGetItemsObj, isPartialSlotMarkdown, isPartialGetItemsFetch, isPartialChildComposite, isPartialChildSlot, isPartialSlotText, isPartialSlotName } from './layout-keyword/index.js'
|
|
2
2
|
import { validateNormalizedLayout } from './normalized-layout/index.js'
|
|
3
3
|
import { getComponentValidate } from './validate.js'
|
|
4
4
|
|
|
@@ -66,18 +66,31 @@ function getDefaultChildren (schemaFragment, type) {
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @param {Children} defaultChildren
|
|
69
|
-
* @param {PartialChildren}
|
|
69
|
+
* @param {PartialChildren | undefined} partialChildren
|
|
70
|
+
* @param {(text: string) => string} markdown
|
|
70
71
|
* @returns {Children}
|
|
71
72
|
*/
|
|
72
|
-
function getChildren (defaultChildren, partialChildren) {
|
|
73
|
+
function getChildren (defaultChildren, partialChildren, markdown) {
|
|
73
74
|
if (!partialChildren) return defaultChildren
|
|
74
75
|
let compI = 0
|
|
76
|
+
let slotI = 0
|
|
75
77
|
return partialChildren.map(partialChild => {
|
|
76
78
|
if (typeof partialChild === 'string') { // simple string/key referencing a known child
|
|
77
79
|
const matchingDefaultChild = defaultChildren.find(c => c.key === partialChild)
|
|
78
80
|
if (!matchingDefaultChild) throw new Error(`unknown child "${partialChild}"`)
|
|
79
81
|
return matchingDefaultChild
|
|
82
|
+
} else if (Array.isArray(partialChild)) {
|
|
83
|
+
compI++
|
|
84
|
+
return {
|
|
85
|
+
comp: 'section',
|
|
86
|
+
key: `$comp-${compI}`,
|
|
87
|
+
children: getChildren(defaultChildren, partialChild, markdown)
|
|
88
|
+
}
|
|
80
89
|
} else {
|
|
90
|
+
if ('slots' in partialChild && !isPartialChildSlot(partialChild)) {
|
|
91
|
+
partialChild.slots = normalizePartialSlots(partialChild.slots, markdown)
|
|
92
|
+
}
|
|
93
|
+
if ('cols' in partialChild) partialChild.cols = normalizePartialCols(partialChild.cols)
|
|
81
94
|
if (partialChild.if) partialChild.if = normalizeExpression(partialChild.if)
|
|
82
95
|
if (typeof partialChild.cols === 'number') partialChild.cols = { sm: partialChild.cols }
|
|
83
96
|
if (typeof partialChild.cols === 'object' && partialChild.cols.xs === undefined) partialChild.cols.xs = 12
|
|
@@ -85,15 +98,25 @@ function getChildren (defaultChildren, partialChildren) {
|
|
|
85
98
|
const matchingDefaultChild = defaultChildren.find(c => c.key === partialChild.key)
|
|
86
99
|
if (!matchingDefaultChild) throw new Error(`unknown child "${partialChild.key}"`)
|
|
87
100
|
return /** @type {Child} */ (partialChild)
|
|
88
|
-
} else { // a
|
|
101
|
+
} else if (isPartialChildSlot(partialChild)) { // a slot defined as a child
|
|
102
|
+
/** @type {Child} */
|
|
103
|
+
slotI++
|
|
104
|
+
return {
|
|
105
|
+
key: `$slot-${slotI}`,
|
|
106
|
+
comp: 'slot',
|
|
107
|
+
cols: normalizePartialCols(partialChild.cols),
|
|
108
|
+
slots: normalizePartialSlots({ component: partialChild }, markdown)
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
89
111
|
const child = partialChild
|
|
90
112
|
if (isPartialChildComposite(child)) {
|
|
113
|
+
// a composite component definition, not directly related to a known child
|
|
91
114
|
if (!child.comp) child.comp = 'section'
|
|
92
|
-
child.children = getChildren(defaultChildren, child.children)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
115
|
+
child.children = getChildren(defaultChildren, child.children, markdown)
|
|
116
|
+
if (!('key' in partialChild)) {
|
|
117
|
+
compI++
|
|
118
|
+
child.key = `$comp-${compI}`
|
|
119
|
+
}
|
|
97
120
|
}
|
|
98
121
|
return /** @type {Child} */ (child)
|
|
99
122
|
}
|
|
@@ -109,6 +132,7 @@ function getChildren (defaultChildren, partialChildren) {
|
|
|
109
132
|
* @returns {import('./index.js').ComponentName}
|
|
110
133
|
*/
|
|
111
134
|
function getDefaultComp (partial, schemaFragment, type, schemaChild) {
|
|
135
|
+
if (partial.slots?.component) return 'slot'
|
|
112
136
|
const hasSimpleType = type && ['string', 'integer', 'number'].includes(type)
|
|
113
137
|
if (schemaChild === 'oneOf') return 'one-of-select'
|
|
114
138
|
if (schemaChild === 'patternProperties') return 'list'
|
|
@@ -191,6 +215,46 @@ function normalizeExpression (expression, defaultType = 'js-eval', defaultDataAl
|
|
|
191
215
|
else return { pure: defaultPure, type: defaultType, dataAlias: defaultDataAlias, ...expression }
|
|
192
216
|
}
|
|
193
217
|
|
|
218
|
+
/**
|
|
219
|
+
* @param {PartialCompObject['slots']} partialSlots
|
|
220
|
+
* @param {(text: string) => string} markdown
|
|
221
|
+
* @returns {import('./normalized-layout/types.js').Slots | undefined}
|
|
222
|
+
*/
|
|
223
|
+
function normalizePartialSlots (partialSlots, markdown) {
|
|
224
|
+
if (!partialSlots) return
|
|
225
|
+
/** @type {import('./normalized-layout/types.js').Slots} */
|
|
226
|
+
const slots = {}
|
|
227
|
+
for (const [name, slot] of Object.entries(partialSlots)) {
|
|
228
|
+
if (typeof slot === 'string') {
|
|
229
|
+
if (['before', 'after'].includes(name)) {
|
|
230
|
+
slots[name] = { markdown: markdown(slot).trim() }
|
|
231
|
+
} else {
|
|
232
|
+
slots[name] = { name: slot }
|
|
233
|
+
}
|
|
234
|
+
} else if (isPartialSlotText(slot)) {
|
|
235
|
+
slots[name] = { text: slot.text }
|
|
236
|
+
} else if (isPartialSlotName(slot)) {
|
|
237
|
+
slots[name] = { name: slot.name }
|
|
238
|
+
} else if (isPartialSlotMarkdown(slot)) {
|
|
239
|
+
slots[name] = { markdown: markdown(slot.markdown).trim() }
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return slots
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @param {PartialCompObject['cols']} partialCols
|
|
247
|
+
* @returns {import('./normalized-layout/types.js').ColsObj | undefined}
|
|
248
|
+
*/
|
|
249
|
+
function normalizePartialCols (partialCols) {
|
|
250
|
+
if (typeof partialCols === 'number') {
|
|
251
|
+
return { xs: 12, sm: partialCols }
|
|
252
|
+
}
|
|
253
|
+
if (typeof partialCols === 'object') {
|
|
254
|
+
return { xs: 12, ...partialCols }
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
194
258
|
/**
|
|
195
259
|
* @param {SchemaFragment} schemaFragment
|
|
196
260
|
* @returns {import('./index.js').PartialSelectItem[] | null}
|
|
@@ -299,7 +363,7 @@ function getCompObject (key, layoutKeyword, schemaFragment, type, nullable, sche
|
|
|
299
363
|
if (nullable) partial.nullable = nullable
|
|
300
364
|
|
|
301
365
|
if (component.composite) {
|
|
302
|
-
const children = getChildren(getDefaultChildren(schemaFragment, type), partial.children)
|
|
366
|
+
const children = getChildren(getDefaultChildren(schemaFragment, type), partial.children, markdown)
|
|
303
367
|
partial.children = children
|
|
304
368
|
if (!('title' in partial)) {
|
|
305
369
|
if (children.length === 1 && children[0].key === '$patternProperties') {
|
|
@@ -311,7 +375,7 @@ function getCompObject (key, layoutKeyword, schemaFragment, type, nullable, sche
|
|
|
311
375
|
} else if (partial.comp === 'list') {
|
|
312
376
|
if (schemaChild === 'patternProperties') {
|
|
313
377
|
if (!('title' in partial)) {
|
|
314
|
-
const children = getChildren(getDefaultChildren(schemaFragment, type), partial.children)
|
|
378
|
+
const children = getChildren(getDefaultChildren(schemaFragment, type), partial.children, markdown)
|
|
315
379
|
if (children.length === 1 && children[0].key === '$patternProperties') {
|
|
316
380
|
partial.title = schemaFragment.title ?? null
|
|
317
381
|
}
|
|
@@ -330,7 +394,7 @@ function getCompObject (key, layoutKeyword, schemaFragment, type, nullable, sche
|
|
|
330
394
|
partial.listEditMode = partial.listEditMode ?? (itemsType === 'object' ? 'inline-single' : 'inline')
|
|
331
395
|
partial.listActions = partial.listActions ?? ['add', 'edit', 'delete', 'duplicate', 'sort']
|
|
332
396
|
}
|
|
333
|
-
} else {
|
|
397
|
+
} else if (partial.comp !== 'slot') {
|
|
334
398
|
if (!('label' in partial) && !schemaChild) {
|
|
335
399
|
partial.label = schemaFragment.title ?? ('' + key)
|
|
336
400
|
}
|
|
@@ -442,21 +506,7 @@ function getCompObject (key, layoutKeyword, schemaFragment, type, nullable, sche
|
|
|
442
506
|
partial.format = 'date-time'
|
|
443
507
|
}
|
|
444
508
|
|
|
445
|
-
if (partial.slots)
|
|
446
|
-
for (const [name, slot] of Object.entries(partial.slots)) {
|
|
447
|
-
if (typeof slot === 'string') {
|
|
448
|
-
if (['before', 'after'].includes(name)) {
|
|
449
|
-
partial.slots[name] = { markdown: slot }
|
|
450
|
-
} else {
|
|
451
|
-
partial.slots[name] = { name: slot }
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
const slotObj = partial.slots[name]
|
|
455
|
-
if (isPartialSlotMarkdown(slotObj)) {
|
|
456
|
-
slotObj.markdown = markdown(slotObj.markdown).trim()
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
509
|
+
if (partial.slots) partial.slots = normalizePartialSlots(partial.slots, markdown)
|
|
460
510
|
|
|
461
511
|
if (schemaFragment.description) {
|
|
462
512
|
if (component.composite && !!partial.title && useDescription.includes('subtitle')) {
|
|
@@ -464,16 +514,19 @@ function getCompObject (key, layoutKeyword, schemaFragment, type, nullable, sche
|
|
|
464
514
|
partial.subtitle = schemaFragment.description
|
|
465
515
|
}
|
|
466
516
|
} else if (!component.composite && useDescription.includes('hint')) {
|
|
467
|
-
partial.hint
|
|
468
|
-
|
|
469
|
-
|
|
517
|
+
if (partial.hint === undefined) {
|
|
518
|
+
partial.hint = schemaFragment.description
|
|
519
|
+
}
|
|
520
|
+
} else if (schemaChild !== 'oneOf' && useDescription.includes('help')) {
|
|
521
|
+
if (partial.help === undefined) {
|
|
522
|
+
partial.help = schemaFragment.description
|
|
523
|
+
}
|
|
470
524
|
}
|
|
471
525
|
}
|
|
472
526
|
if (partial.help) partial.help = markdown(partial.help).trim()
|
|
473
527
|
if (partial.subtitle) partial.subtitle = markdown(partial.subtitle).trim()
|
|
474
528
|
|
|
475
|
-
if (
|
|
476
|
-
if (typeof partial.cols === 'object' && partial.cols.xs === undefined) partial.cols.xs = 12
|
|
529
|
+
if ('cols' in partial) partial.cols = normalizePartialCols(partial.cols)
|
|
477
530
|
|
|
478
531
|
const validateComponent = getComponentValidate(component)
|
|
479
532
|
if (!validateComponent(partial)) {
|
|
@@ -10,7 +10,9 @@ import {ajv} from '../validate.js'
|
|
|
10
10
|
* @typedef {import('./types.js').GetItemsFetch} GetItemsFetch
|
|
11
11
|
* @typedef {import('./types.js').Child} Child
|
|
12
12
|
* @typedef {import('./types.js').Children} Children
|
|
13
|
+
* @typedef {import('./types.js').ChildSlot} ChildSlot
|
|
13
14
|
* @typedef {import('./types.js').CompositeCompObject} CompositeCompObject
|
|
15
|
+
* @typedef {import('./types.js').SlotCompObject} SlotCompObject
|
|
14
16
|
* @typedef {import('./types.js').ItemsBasedCompObject} ItemsBasedCompObject
|
|
15
17
|
* @typedef {import('./types.js').FocusableCompObject} FocusableCompObject
|
|
16
18
|
* @typedef {import('./types.js').GetItems} GetItems
|
|
@@ -20,6 +22,7 @@ import {ajv} from '../validate.js'
|
|
|
20
22
|
* @typedef {import('./types.js').StateNodeOptionsBase} StateNodeOptionsBase
|
|
21
23
|
* @typedef {import('./types.js').StateNodePropsLib} StateNodePropsLib
|
|
22
24
|
* @typedef {import('./types.js').Slot} Slot
|
|
25
|
+
* @typedef {import('./types.js').Slots} Slots
|
|
23
26
|
* @typedef {{ errors: any, (layoutKeyword: any): layoutKeyword is NormalizedLayout }} ValidateNormalizedLayout
|
|
24
27
|
*/
|
|
25
28
|
|
|
@@ -38,8 +41,13 @@ export function isCompObject (layout) {
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
/** @type {(child: Child) => child is Child & CompositeCompObject} */
|
|
41
|
-
export function
|
|
42
|
-
return 'comp' in child
|
|
44
|
+
export function childIsCompositeCompObject (child) {
|
|
45
|
+
return 'comp' in child && 'children' in child
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** @type {(child: Child) => child is Child & SlotCompObject} */
|
|
49
|
+
export function childIsSlotCompObject (child) {
|
|
50
|
+
return 'comp' in child && child.comp === 'slot'
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
/** @type {(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>) => layout is CompositeCompObject} */
|
|
@@ -76,25 +76,7 @@ export default {
|
|
|
76
76
|
"$ref": "#/$defs/expression"
|
|
77
77
|
},
|
|
78
78
|
"slots": {
|
|
79
|
-
"
|
|
80
|
-
"allOf": [
|
|
81
|
-
{
|
|
82
|
-
"$ref": "#/$defs/state-node-slots-lib"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"properties": {
|
|
86
|
-
"before": {
|
|
87
|
-
"$ref": "#/$defs/slot"
|
|
88
|
-
},
|
|
89
|
-
"after": {
|
|
90
|
-
"$ref": "#/$defs/slot"
|
|
91
|
-
},
|
|
92
|
-
"component": {
|
|
93
|
-
"$ref": "#/$defs/slot"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]
|
|
79
|
+
"$ref": "#/$defs/slots"
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
82
|
},
|
|
@@ -132,6 +114,26 @@ export default {
|
|
|
132
114
|
}
|
|
133
115
|
]
|
|
134
116
|
},
|
|
117
|
+
"slot-comp-object": {
|
|
118
|
+
"allOf": [
|
|
119
|
+
{
|
|
120
|
+
"$ref": "#/$defs/base-comp-object"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "object",
|
|
124
|
+
"required": [
|
|
125
|
+
"comp",
|
|
126
|
+
"slots"
|
|
127
|
+
],
|
|
128
|
+
"properties": {
|
|
129
|
+
"comp": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"const": "slot"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
135
137
|
"simple-comp-object": {
|
|
136
138
|
"allOf": [
|
|
137
139
|
{
|
|
@@ -150,7 +152,10 @@ export default {
|
|
|
150
152
|
"type": "string"
|
|
151
153
|
},
|
|
152
154
|
"hint": {
|
|
153
|
-
"type":
|
|
155
|
+
"type": [
|
|
156
|
+
"string",
|
|
157
|
+
"null"
|
|
158
|
+
]
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
}
|
|
@@ -243,6 +248,9 @@ export default {
|
|
|
243
248
|
},
|
|
244
249
|
"if": {
|
|
245
250
|
"$ref": "#/$defs/expression"
|
|
251
|
+
},
|
|
252
|
+
"slots": {
|
|
253
|
+
"$ref": "#/$defs/slots"
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
},
|
|
@@ -277,6 +285,38 @@ export default {
|
|
|
277
285
|
},
|
|
278
286
|
"if": {
|
|
279
287
|
"$ref": "#/$defs/expression"
|
|
288
|
+
},
|
|
289
|
+
"slots": {
|
|
290
|
+
"$ref": "#/$defs/slots"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"child-slot": {
|
|
295
|
+
"type": "object",
|
|
296
|
+
"required": [
|
|
297
|
+
"key",
|
|
298
|
+
"comp",
|
|
299
|
+
"slots"
|
|
300
|
+
],
|
|
301
|
+
"additionalProperties": false,
|
|
302
|
+
"properties": {
|
|
303
|
+
"key": {
|
|
304
|
+
"type": [
|
|
305
|
+
"string",
|
|
306
|
+
"integer"
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
"cols": {
|
|
310
|
+
"$ref": "#/$defs/cols-obj"
|
|
311
|
+
},
|
|
312
|
+
"comp": {
|
|
313
|
+
"const": "slot"
|
|
314
|
+
},
|
|
315
|
+
"if": {
|
|
316
|
+
"$ref": "#/$defs/expression"
|
|
317
|
+
},
|
|
318
|
+
"slots": {
|
|
319
|
+
"$ref": "#/$defs/slots"
|
|
280
320
|
}
|
|
281
321
|
}
|
|
282
322
|
},
|
|
@@ -289,6 +329,9 @@ export default {
|
|
|
289
329
|
},
|
|
290
330
|
{
|
|
291
331
|
"$ref": "#/$defs/child-composite"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"$ref": "#/$defs/child-slot"
|
|
292
335
|
}
|
|
293
336
|
]
|
|
294
337
|
},
|
|
@@ -492,6 +535,27 @@ export default {
|
|
|
492
535
|
}
|
|
493
536
|
]
|
|
494
537
|
},
|
|
538
|
+
"slots": {
|
|
539
|
+
"type": "object",
|
|
540
|
+
"allOf": [
|
|
541
|
+
{
|
|
542
|
+
"$ref": "#/$defs/state-node-slots-lib"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"properties": {
|
|
546
|
+
"before": {
|
|
547
|
+
"$ref": "#/$defs/slot"
|
|
548
|
+
},
|
|
549
|
+
"after": {
|
|
550
|
+
"$ref": "#/$defs/slot"
|
|
551
|
+
},
|
|
552
|
+
"component": {
|
|
553
|
+
"$ref": "#/$defs/slot"
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
]
|
|
558
|
+
},
|
|
495
559
|
"state-node-options-base": {
|
|
496
560
|
"type": "object",
|
|
497
561
|
"allOf": [
|
|
@@ -39,19 +39,7 @@
|
|
|
39
39
|
"cols": {"$ref": "#/$defs/cols-obj"},
|
|
40
40
|
"props": {"$ref": "#/$defs/state-node-props-lib"},
|
|
41
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
|
-
}
|
|
42
|
+
"slots": {"$ref": "#/$defs/slots"}
|
|
55
43
|
}
|
|
56
44
|
},
|
|
57
45
|
"composite-comp-object": {
|
|
@@ -69,6 +57,18 @@
|
|
|
69
57
|
}
|
|
70
58
|
]
|
|
71
59
|
},
|
|
60
|
+
"slot-comp-object": {
|
|
61
|
+
"allOf": [
|
|
62
|
+
{"$ref": "#/$defs/base-comp-object"},
|
|
63
|
+
{
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["comp", "slots"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"comp": {"type": "string", "const": "slot"}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
72
|
"simple-comp-object": {
|
|
73
73
|
"allOf": [
|
|
74
74
|
{"$ref": "#/$defs/base-comp-object"},
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"properties": {
|
|
79
79
|
"comp": {"type": "string"},
|
|
80
80
|
"label": {"type": "string"},
|
|
81
|
-
"hint": {"type": "string"}
|
|
81
|
+
"hint": {"type": ["string", "null"]}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
]
|
|
@@ -131,7 +131,8 @@
|
|
|
131
131
|
"properties": {
|
|
132
132
|
"key": {"type": ["string", "integer"]},
|
|
133
133
|
"cols": {"$ref": "#/$defs/cols-obj"},
|
|
134
|
-
"if": {"$ref": "#/$defs/expression"}
|
|
134
|
+
"if": {"$ref": "#/$defs/expression"},
|
|
135
|
+
"slots": {"$ref": "#/$defs/slots"}
|
|
135
136
|
}
|
|
136
137
|
},
|
|
137
138
|
"child-composite": {
|
|
@@ -145,19 +146,29 @@
|
|
|
145
146
|
"title": {"type": "string"},
|
|
146
147
|
"subtitle": {"type": "string"},
|
|
147
148
|
"children": {"$ref": "#/$defs/children"},
|
|
148
|
-
"if": {"$ref": "#/$defs/expression"}
|
|
149
|
+
"if": {"$ref": "#/$defs/expression"},
|
|
150
|
+
"slots": {"$ref": "#/$defs/slots"}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"child-slot": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"required": ["key", "comp", "slots"],
|
|
156
|
+
"additionalProperties": false,
|
|
157
|
+
"properties": {
|
|
158
|
+
"key": {"type": ["string", "integer"]},
|
|
159
|
+
"cols": {"$ref": "#/$defs/cols-obj"},
|
|
160
|
+
"comp": {"const": "slot"},
|
|
161
|
+
"if": {"$ref": "#/$defs/expression"},
|
|
162
|
+
"slots": {"$ref": "#/$defs/slots"}
|
|
149
163
|
}
|
|
150
164
|
},
|
|
151
165
|
"child": {
|
|
152
166
|
"title": "Child",
|
|
153
167
|
"type": "object",
|
|
154
168
|
"oneOf": [
|
|
155
|
-
{
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
{
|
|
159
|
-
"$ref": "#/$defs/child-composite"
|
|
160
|
-
}
|
|
169
|
+
{"$ref": "#/$defs/child-ref"},
|
|
170
|
+
{"$ref": "#/$defs/child-composite"},
|
|
171
|
+
{"$ref": "#/$defs/child-slot"}
|
|
161
172
|
]
|
|
162
173
|
},
|
|
163
174
|
"children": {
|
|
@@ -281,6 +292,19 @@
|
|
|
281
292
|
}
|
|
282
293
|
]
|
|
283
294
|
},
|
|
295
|
+
"slots": {
|
|
296
|
+
"type": "object",
|
|
297
|
+
"allOf": [
|
|
298
|
+
{"$ref": "#/$defs/state-node-slots-lib"},
|
|
299
|
+
{
|
|
300
|
+
"properties": {
|
|
301
|
+
"before": {"$ref": "#/$defs/slot"},
|
|
302
|
+
"after": {"$ref": "#/$defs/slot"},
|
|
303
|
+
"component": {"$ref": "#/$defs/slot"}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
},
|
|
284
308
|
"state-node-options-base": {
|
|
285
309
|
"type": "object",
|
|
286
310
|
"allOf": [
|
|
@@ -31,6 +31,16 @@ export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {
|
|
|
31
31
|
* via the `definition` "cols".
|
|
32
32
|
*/
|
|
33
33
|
export type Cols = number;
|
|
34
|
+
/**
|
|
35
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
36
|
+
* via the `definition` "slots".
|
|
37
|
+
*/
|
|
38
|
+
export type Slots = StateNodeSlotsLib & {
|
|
39
|
+
before?: Slot;
|
|
40
|
+
after?: Slot;
|
|
41
|
+
component?: Slot;
|
|
42
|
+
[k: string]: unknown;
|
|
43
|
+
};
|
|
34
44
|
/**
|
|
35
45
|
* This interface was referenced by `StateNodeSlotsLib`'s JSON-Schema definition
|
|
36
46
|
* via the `patternProperty` ".*".
|
|
@@ -63,12 +73,20 @@ export type CompositeCompObject = BaseCompObject & {
|
|
|
63
73
|
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
64
74
|
* via the `definition` "child".
|
|
65
75
|
*/
|
|
66
|
-
export type Child = ChildRef | ChildComposite;
|
|
76
|
+
export type Child = ChildRef | ChildComposite | ChildSlot;
|
|
67
77
|
/**
|
|
68
78
|
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
69
79
|
* via the `definition` "children".
|
|
70
80
|
*/
|
|
71
81
|
export type Children = Child[];
|
|
82
|
+
/**
|
|
83
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
84
|
+
* via the `definition` "slot-comp-object".
|
|
85
|
+
*/
|
|
86
|
+
export type SlotCompObject = BaseCompObject & {
|
|
87
|
+
comp: "slot";
|
|
88
|
+
[k: string]: unknown;
|
|
89
|
+
};
|
|
72
90
|
/**
|
|
73
91
|
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
74
92
|
* via the `definition` "simple-comp-object".
|
|
@@ -76,7 +94,7 @@ export type Children = Child[];
|
|
|
76
94
|
export type SimpleCompObject = BaseCompObject & {
|
|
77
95
|
comp: string;
|
|
78
96
|
label?: string;
|
|
79
|
-
hint?: string;
|
|
97
|
+
hint?: string | null;
|
|
80
98
|
[k: string]: unknown;
|
|
81
99
|
};
|
|
82
100
|
/**
|
|
@@ -157,12 +175,7 @@ export interface BaseCompObject {
|
|
|
157
175
|
cols?: ColsObj;
|
|
158
176
|
props?: StateNodePropsLib;
|
|
159
177
|
getProps?: Expression;
|
|
160
|
-
slots?:
|
|
161
|
-
before?: Slot;
|
|
162
|
-
after?: Slot;
|
|
163
|
-
component?: Slot;
|
|
164
|
-
[k: string]: unknown;
|
|
165
|
-
};
|
|
178
|
+
slots?: Slots;
|
|
166
179
|
[k: string]: unknown;
|
|
167
180
|
}
|
|
168
181
|
/**
|
|
@@ -229,6 +242,7 @@ export interface ChildRef {
|
|
|
229
242
|
key: string | number;
|
|
230
243
|
cols?: ColsObj;
|
|
231
244
|
if?: Expression;
|
|
245
|
+
slots?: Slots;
|
|
232
246
|
}
|
|
233
247
|
/**
|
|
234
248
|
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
@@ -242,6 +256,18 @@ export interface ChildComposite {
|
|
|
242
256
|
subtitle?: string;
|
|
243
257
|
children: Children;
|
|
244
258
|
if?: Expression;
|
|
259
|
+
slots?: Slots;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
263
|
+
* via the `definition` "child-slot".
|
|
264
|
+
*/
|
|
265
|
+
export interface ChildSlot {
|
|
266
|
+
key: string | number;
|
|
267
|
+
cols?: ColsObj;
|
|
268
|
+
comp: "slot";
|
|
269
|
+
if?: Expression;
|
|
270
|
+
slots: Slots;
|
|
245
271
|
}
|
|
246
272
|
/**
|
|
247
273
|
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.js"],"names":[],"mappings":"AAwOA;;;GAGG;AACH,8CAHW,OAAO,aAAa,EAAE,aAAa,GACjC,GAAG,CAgCf;AA1QD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,oDAAoD;AACpD,iCADW,OAAO,aAAa,EAAE,aAAa,EAAE,CA6M/C;sBArOY,OAAO,YAAY,EAAE,OAAO;qBAC5B,OAAO,YAAY,EAAE,MAAM;2BAC3B,OAAO,YAAY,EAAE,YAAY;wBACjC,OAAO,YAAY,EAAE,SAAS;uBAC9B,OAAO,YAAY,EAAE,QAAQ;0BAC7B,OAAO,YAAY,EAAE,WAAW;qBAChC,OAAO,YAAY,EAAE,MAAM;uBAC3B,OAAO,YAAY,EAAE,QAAQ;qBAC7B,OAAO,YAAY,EAAE,MAAM;yBAC3B,OAAO,YAAY,EAAE,UAAU;yBAC/B,OAAO,YAAY,EAAE,UAAU;6BAC/B,OAAO,YAAY,EAAE,cAAc;0BACnC,OAAO,YAAY,EAAE,WAAW;0BAChC,OAAO,YAAY,EAAE,WAAW;mBAChC,OAAO,YAAY,EAAE,IAAI;2BACzB,OAAO,YAAY,EAAE,YAAY;8BACjC,OAAO,YAAY,EAAE,eAAe;sBACpC,OAAO,YAAY,EAAE,OAAO;mBAC5B,OAAO,YAAY,EAAE,IAAI;uBACzB,OAAO,YAAY,EAAE,QAAQ;wBAC7B,OAAO,YAAY,EAAE,SAAS;mBAC9B,OAAO,YAAY,EAAE,IAAI"}
|