@json-layout/vocabulary 0.13.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.
- package/package.json +5 -5
- package/src/components/compile-types.js +61 -0
- package/src/components/index.js +226 -0
- package/src/components/types.ts +378 -0
- package/src/index.js +3 -0
- package/src/layout-keyword/index.js +9 -2
- package/src/layout-keyword/schema.js +67 -62
- package/src/layout-keyword/schema.json +35 -50
- package/src/layout-keyword/types.ts +111 -42
- package/src/normalize.js +93 -54
- package/src/normalized-layout/index.js +18 -64
- package/src/normalized-layout/schema.js +247 -766
- package/src/normalized-layout/schema.json +128 -329
- package/src/normalized-layout/types.ts +165 -234
- package/src/types.ts +11 -0
- package/src/validate.js +42 -0
- package/types/components/compile-types.d.ts +13 -0
- package/types/components/compile-types.d.ts.map +1 -0
- package/types/components/index.d.ts +52 -0
- package/types/components/index.d.ts.map +1 -0
- package/types/components/types.d.ts +329 -0
- package/types/components/types.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/layout-keyword/index.d.ts +6 -1
- package/types/layout-keyword/index.d.ts.map +1 -1
- package/types/layout-keyword/schema.d.ts +43 -26
- package/types/layout-keyword/types.d.ts +111 -18
- package/types/layout-keyword/types.d.ts.map +1 -1
- package/types/normalize.d.ts +3 -2
- package/types/normalize.d.ts.map +1 -1
- package/types/normalized-layout/index.d.ts +19 -65
- package/types/normalized-layout/index.d.ts.map +1 -1
- package/types/normalized-layout/schema.d.ts +181 -531
- package/types/normalized-layout/types.d.ts +165 -209
- package/types/normalized-layout/types.d.ts.map +1 -1
- package/types/types.d.ts +10 -0
- package/types/types.d.ts.map +1 -1
- package/types/validate.d.ts +8 -0
- package/types/validate.d.ts.map +1 -0
- package/src/layout-keyword/validate.js +0 -2
- package/src/normalized-layout/validate.js +0 -3
- package/types/layout-keyword/validate.d.ts +0 -23
- package/types/layout-keyword/validate.d.ts.map +0 -1
- package/types/normalized-layout/validate.d.ts +0 -23
- package/types/normalized-layout/validate.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-layout/vocabulary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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": {
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"test:
|
|
20
|
+
"test:only": "node --test --test-only test/*.spec.js",
|
|
21
21
|
"test": "node --test test/*.spec.js",
|
|
22
|
-
"build": "run-s clean build:
|
|
22
|
+
"build": "run-s clean build:types build:tsc",
|
|
23
23
|
"clean": "rm -rf ./types && rm -f src/*/types.ts && rm -f src/*/validate.js",
|
|
24
|
-
"build:
|
|
24
|
+
"build:types": "node scripts/compile-types.js",
|
|
25
25
|
"build:tsc": "tsc -p tsconfig.build.json",
|
|
26
26
|
"lint": "eslint . --fix",
|
|
27
27
|
"watch:schemas": "node --watch scripts/compile-schemas.js",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/debug": "^4.1.7",
|
|
53
53
|
"ajv": "^8.12.0",
|
|
54
|
-
"json-schema-to-typescript": "^
|
|
54
|
+
"json-schema-to-typescript": "^14.0.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { compile as compileTs } from 'json-schema-to-typescript'
|
|
2
|
+
import normalizedLayoutSchema from '../normalized-layout/schema.js'
|
|
3
|
+
|
|
4
|
+
const localResolver = {
|
|
5
|
+
order: 1,
|
|
6
|
+
/**
|
|
7
|
+
* @param {{ url: string }} file
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
canRead (file) {
|
|
11
|
+
return file.url === normalizedLayoutSchema.$id
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* @param {{ url: string }} file
|
|
15
|
+
* @param {(err: any, doc?: any) => void} callback
|
|
16
|
+
*/
|
|
17
|
+
async read (/** @type {{ url: string }} */file, callback) {
|
|
18
|
+
const clonedSchema = JSON.parse(JSON.stringify(normalizedLayoutSchema))
|
|
19
|
+
delete clonedSchema.$id
|
|
20
|
+
callback(null, clonedSchema)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const compileTsOptions = {
|
|
25
|
+
bannerComment: '',
|
|
26
|
+
declareExternallyReferenced: false,
|
|
27
|
+
$refOptions: { resolve: { local: localResolver } }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} from
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
export function getComponentTypesCodeImport (from) {
|
|
35
|
+
return `import type {
|
|
36
|
+
BaseCompObject,
|
|
37
|
+
CompositeCompObject,
|
|
38
|
+
SimpleCompObject,
|
|
39
|
+
FocusableCompObject,
|
|
40
|
+
ItemsBasedCompObject,
|
|
41
|
+
Expression,
|
|
42
|
+
Children,
|
|
43
|
+
GetItems,
|
|
44
|
+
SelectItems
|
|
45
|
+
} from '${from}'\n`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {any} schema
|
|
50
|
+
* @param {string} key
|
|
51
|
+
* @param {boolean} standalone
|
|
52
|
+
* @returns {Promise<string>}
|
|
53
|
+
*/
|
|
54
|
+
export async function getComponentTypesCode (schema, key, standalone = true) {
|
|
55
|
+
let typesCode = ''
|
|
56
|
+
if (standalone) {
|
|
57
|
+
typesCode += getComponentTypesCodeImport('@json-layout/vocabulary/normalized-layout/types.js')
|
|
58
|
+
}
|
|
59
|
+
typesCode += await compileTs(schema, key, compileTsOptions)
|
|
60
|
+
return typesCode
|
|
61
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.js').Section} Section
|
|
3
|
+
* @typedef {import('./types.js').Select} Select
|
|
4
|
+
* @typedef {import('./types.js').Autocomplete} Autocomplete
|
|
5
|
+
* @typedef {import('./types.js').TextField} TextField
|
|
6
|
+
* @typedef {import('./types.js').Textarea} Textarea
|
|
7
|
+
* @typedef {import('./types.js').NumberField} NumberField
|
|
8
|
+
* @typedef {import('./types.js').Slider} Slider
|
|
9
|
+
* @typedef {import('./types.js').Checkbox} Checkbox
|
|
10
|
+
* @typedef {import('./types.js').Switch} Switch
|
|
11
|
+
* @typedef {import('./types.js').DatePicker} DatePicker
|
|
12
|
+
* @typedef {import('./types.js').TimePicker} TimePicker
|
|
13
|
+
* @typedef {import('./types.js').DateTimePicker} DateTimePicker
|
|
14
|
+
* @typedef {import('./types.js').ColorPicker} ColorPicker
|
|
15
|
+
* @typedef {import('./types.js').OneOfSelect} OneOfSelect
|
|
16
|
+
* @typedef {import('./types.js').Tabs} Tabs
|
|
17
|
+
* @typedef {import('./types.js').VerticalTabs} VerticalTabs
|
|
18
|
+
* @typedef {import('./types.js').ExpansionPanels} ExpansionPanels
|
|
19
|
+
* @typedef {import('./types.js').Stepper} Stepper
|
|
20
|
+
* @typedef {import('./types.js').List} List
|
|
21
|
+
* @typedef {import('./types.js').Combobox} Combobox
|
|
22
|
+
* @typedef {import('./types.js').FileInput} FileInput
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** @type {import('../types.js').ComponentInfo[]} */
|
|
26
|
+
export const standardComponents = [
|
|
27
|
+
{
|
|
28
|
+
name: 'none'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'section',
|
|
32
|
+
composite: true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'tabs',
|
|
36
|
+
composite: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'vertical-tabs',
|
|
40
|
+
composite: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'expansion-panels',
|
|
44
|
+
composite: true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'stepper',
|
|
48
|
+
composite: true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'list',
|
|
52
|
+
schema: {
|
|
53
|
+
required: ['listEditMode', 'listActions'],
|
|
54
|
+
properties: {
|
|
55
|
+
title: { type: 'string' },
|
|
56
|
+
listEditMode: { type: 'string', enum: ['inline', 'inline-single', 'menu', 'dialog'] },
|
|
57
|
+
listActions: { type: 'array', items: { type: 'string', enum: ['add', 'edit', 'delete', 'sort', 'duplicate'] } },
|
|
58
|
+
itemTitle: { $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/expression' },
|
|
59
|
+
itemSubtitle: { $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/expression' },
|
|
60
|
+
messages: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
additionalProperties: false,
|
|
63
|
+
properties: {
|
|
64
|
+
addItem: { type: 'string' },
|
|
65
|
+
delete: { type: 'string' },
|
|
66
|
+
edit: { type: 'string' },
|
|
67
|
+
duplicate: { type: 'string' },
|
|
68
|
+
sort: { type: 'string' }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'text-field',
|
|
76
|
+
shouldDebounce: true,
|
|
77
|
+
focusable: true,
|
|
78
|
+
emitsBlur: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'textarea',
|
|
82
|
+
shouldDebounce: true,
|
|
83
|
+
focusable: true,
|
|
84
|
+
emitsBlur: true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'number-field',
|
|
88
|
+
shouldDebounce: true,
|
|
89
|
+
focusable: true,
|
|
90
|
+
emitsBlur: true,
|
|
91
|
+
schema: {
|
|
92
|
+
properties: {
|
|
93
|
+
step: { type: 'number' },
|
|
94
|
+
min: { type: 'number' },
|
|
95
|
+
max: { type: 'number' }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'checkbox'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'switch'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'slider',
|
|
107
|
+
schema: {
|
|
108
|
+
properties: {
|
|
109
|
+
step: { type: 'number' },
|
|
110
|
+
min: { type: 'number' },
|
|
111
|
+
max: { type: 'number' }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'date-picker',
|
|
117
|
+
schema: {
|
|
118
|
+
properties: {
|
|
119
|
+
min: { type: 'string', format: 'date' },
|
|
120
|
+
max: { type: 'string', format: 'date' },
|
|
121
|
+
format: { type: 'string', enum: ['date', 'date-time'], default: 'date' }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'date-time-picker',
|
|
127
|
+
schema: {
|
|
128
|
+
properties: {
|
|
129
|
+
min: { type: 'string', format: 'date-time' },
|
|
130
|
+
max: { type: 'string', format: 'date-time' }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'time-picker',
|
|
136
|
+
schema: {
|
|
137
|
+
properties: {
|
|
138
|
+
min: { type: 'string', format: 'time' },
|
|
139
|
+
max: { type: 'string', format: 'time' }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'color-picker'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'select',
|
|
148
|
+
focusable: true,
|
|
149
|
+
itemsBased: true,
|
|
150
|
+
multipleCompat: true
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'autocomplete',
|
|
154
|
+
focusable: true,
|
|
155
|
+
itemsBased: true,
|
|
156
|
+
multipleCompat: true
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'combobox',
|
|
160
|
+
focusable: true,
|
|
161
|
+
itemsBased: true,
|
|
162
|
+
multipleCompat: true
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'number-combobox',
|
|
166
|
+
focusable: true,
|
|
167
|
+
itemsBased: true,
|
|
168
|
+
multipleCompat: true,
|
|
169
|
+
schema: {
|
|
170
|
+
properties: {
|
|
171
|
+
step: { type: 'number' },
|
|
172
|
+
min: { type: 'number' },
|
|
173
|
+
max: { type: 'number' }
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'file-input',
|
|
179
|
+
focusable: true,
|
|
180
|
+
multipleCompat: true,
|
|
181
|
+
schema: {
|
|
182
|
+
properties: {
|
|
183
|
+
accept: { type: 'string' }
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'one-of-select'
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @param {import('../types.js').ComponentInfo} component
|
|
194
|
+
* @returns {any}
|
|
195
|
+
*/
|
|
196
|
+
export function getComponentSchema (component) {
|
|
197
|
+
/** @type {any} */
|
|
198
|
+
const schema = {
|
|
199
|
+
type: 'object',
|
|
200
|
+
title: component.name,
|
|
201
|
+
$id: `https://json-layout.github.io/component/${component.name}#`,
|
|
202
|
+
unevaluatedProperties: false,
|
|
203
|
+
allOf: [
|
|
204
|
+
{ properties: { comp: { const: component.name } } },
|
|
205
|
+
{ $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/base-comp-object' }
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
if (component.composite) {
|
|
209
|
+
schema.allOf.push({ $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/composite-comp-object' })
|
|
210
|
+
} else {
|
|
211
|
+
schema.allOf.push({ $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/simple-comp-object' })
|
|
212
|
+
}
|
|
213
|
+
if (component.focusable) {
|
|
214
|
+
schema.allOf.push({ $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/focusable-comp-object' })
|
|
215
|
+
}
|
|
216
|
+
if (component.itemsBased) {
|
|
217
|
+
schema.allOf.push({ $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/items-based-comp-object' })
|
|
218
|
+
}
|
|
219
|
+
if (component.multipleCompat) {
|
|
220
|
+
schema.allOf.push({ $ref: 'https://json-layout.github.io/normalized-layout-keyword#/$defs/multiple-compat-comp-object' })
|
|
221
|
+
}
|
|
222
|
+
if (component.schema) {
|
|
223
|
+
schema.allOf.push(component.schema)
|
|
224
|
+
}
|
|
225
|
+
return schema
|
|
226
|
+
}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BaseCompObject,
|
|
3
|
+
CompositeCompObject,
|
|
4
|
+
SimpleCompObject,
|
|
5
|
+
FocusableCompObject,
|
|
6
|
+
ItemsBasedCompObject,
|
|
7
|
+
Expression,
|
|
8
|
+
Children,
|
|
9
|
+
GetItems,
|
|
10
|
+
SelectItems
|
|
11
|
+
} from '../normalized-layout/types.js'
|
|
12
|
+
export type None = {
|
|
13
|
+
comp?: "none";
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
} & BaseCompObject &
|
|
16
|
+
(BaseCompObject & {
|
|
17
|
+
comp: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
[k: string]: unknown;
|
|
20
|
+
});
|
|
21
|
+
export type Section = {
|
|
22
|
+
comp?: "section";
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
} & BaseCompObject &
|
|
25
|
+
(BaseCompObject & {
|
|
26
|
+
comp: string;
|
|
27
|
+
title?: string | null;
|
|
28
|
+
subtitle?: string | null;
|
|
29
|
+
children: Children;
|
|
30
|
+
[k: string]: unknown;
|
|
31
|
+
});
|
|
32
|
+
export type Tabs = {
|
|
33
|
+
comp?: "tabs";
|
|
34
|
+
[k: string]: unknown;
|
|
35
|
+
} & BaseCompObject &
|
|
36
|
+
(BaseCompObject & {
|
|
37
|
+
comp: string;
|
|
38
|
+
title?: string | null;
|
|
39
|
+
subtitle?: string | null;
|
|
40
|
+
children: Children;
|
|
41
|
+
[k: string]: unknown;
|
|
42
|
+
});
|
|
43
|
+
export type VerticalTabs = {
|
|
44
|
+
comp?: "vertical-tabs";
|
|
45
|
+
[k: string]: unknown;
|
|
46
|
+
} & BaseCompObject &
|
|
47
|
+
(BaseCompObject & {
|
|
48
|
+
comp: string;
|
|
49
|
+
title?: string | null;
|
|
50
|
+
subtitle?: string | null;
|
|
51
|
+
children: Children;
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
});
|
|
54
|
+
export type ExpansionPanels = {
|
|
55
|
+
comp?: "expansion-panels";
|
|
56
|
+
[k: string]: unknown;
|
|
57
|
+
} & BaseCompObject &
|
|
58
|
+
(BaseCompObject & {
|
|
59
|
+
comp: string;
|
|
60
|
+
title?: string | null;
|
|
61
|
+
subtitle?: string | null;
|
|
62
|
+
children: Children;
|
|
63
|
+
[k: string]: unknown;
|
|
64
|
+
});
|
|
65
|
+
export type Stepper = {
|
|
66
|
+
comp?: "stepper";
|
|
67
|
+
[k: string]: unknown;
|
|
68
|
+
} & BaseCompObject &
|
|
69
|
+
(BaseCompObject & {
|
|
70
|
+
comp: string;
|
|
71
|
+
title?: string | null;
|
|
72
|
+
subtitle?: string | null;
|
|
73
|
+
children: Children;
|
|
74
|
+
[k: string]: unknown;
|
|
75
|
+
});
|
|
76
|
+
export type List = {
|
|
77
|
+
comp?: "list";
|
|
78
|
+
[k: string]: unknown;
|
|
79
|
+
} & BaseCompObject &
|
|
80
|
+
(BaseCompObject & {
|
|
81
|
+
comp: string;
|
|
82
|
+
label?: string;
|
|
83
|
+
[k: string]: unknown;
|
|
84
|
+
}) & {
|
|
85
|
+
title?: string;
|
|
86
|
+
listEditMode: "inline" | "inline-single" | "menu" | "dialog";
|
|
87
|
+
listActions: ("add" | "edit" | "delete" | "sort" | "duplicate")[];
|
|
88
|
+
itemTitle?: Expression;
|
|
89
|
+
itemSubtitle?: Expression;
|
|
90
|
+
messages?: {
|
|
91
|
+
addItem?: string;
|
|
92
|
+
delete?: string;
|
|
93
|
+
edit?: string;
|
|
94
|
+
duplicate?: string;
|
|
95
|
+
sort?: string;
|
|
96
|
+
};
|
|
97
|
+
[k: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
export type TextField = {
|
|
100
|
+
comp?: "text-field";
|
|
101
|
+
[k: string]: unknown;
|
|
102
|
+
} & BaseCompObject &
|
|
103
|
+
(BaseCompObject & {
|
|
104
|
+
comp: string;
|
|
105
|
+
label?: string;
|
|
106
|
+
[k: string]: unknown;
|
|
107
|
+
}) &
|
|
108
|
+
(BaseCompObject & {
|
|
109
|
+
comp: string;
|
|
110
|
+
label?: string;
|
|
111
|
+
autofocus?: boolean;
|
|
112
|
+
[k: string]: unknown;
|
|
113
|
+
});
|
|
114
|
+
export type Textarea = {
|
|
115
|
+
comp?: "textarea";
|
|
116
|
+
[k: string]: unknown;
|
|
117
|
+
} & BaseCompObject &
|
|
118
|
+
(BaseCompObject & {
|
|
119
|
+
comp: string;
|
|
120
|
+
label?: string;
|
|
121
|
+
[k: string]: unknown;
|
|
122
|
+
}) &
|
|
123
|
+
(BaseCompObject & {
|
|
124
|
+
comp: string;
|
|
125
|
+
label?: string;
|
|
126
|
+
autofocus?: boolean;
|
|
127
|
+
[k: string]: unknown;
|
|
128
|
+
});
|
|
129
|
+
export type NumberField = {
|
|
130
|
+
comp?: "number-field";
|
|
131
|
+
[k: string]: unknown;
|
|
132
|
+
} & BaseCompObject &
|
|
133
|
+
(BaseCompObject & {
|
|
134
|
+
comp: string;
|
|
135
|
+
label?: string;
|
|
136
|
+
[k: string]: unknown;
|
|
137
|
+
}) &
|
|
138
|
+
(BaseCompObject & {
|
|
139
|
+
comp: string;
|
|
140
|
+
label?: string;
|
|
141
|
+
autofocus?: boolean;
|
|
142
|
+
[k: string]: unknown;
|
|
143
|
+
}) & {
|
|
144
|
+
step?: number;
|
|
145
|
+
min?: number;
|
|
146
|
+
max?: number;
|
|
147
|
+
[k: string]: unknown;
|
|
148
|
+
};
|
|
149
|
+
export type Checkbox = {
|
|
150
|
+
comp?: "checkbox";
|
|
151
|
+
[k: string]: unknown;
|
|
152
|
+
} & BaseCompObject &
|
|
153
|
+
(BaseCompObject & {
|
|
154
|
+
comp: string;
|
|
155
|
+
label?: string;
|
|
156
|
+
[k: string]: unknown;
|
|
157
|
+
});
|
|
158
|
+
export type Switch = {
|
|
159
|
+
comp?: "switch";
|
|
160
|
+
[k: string]: unknown;
|
|
161
|
+
} & BaseCompObject &
|
|
162
|
+
(BaseCompObject & {
|
|
163
|
+
comp: string;
|
|
164
|
+
label?: string;
|
|
165
|
+
[k: string]: unknown;
|
|
166
|
+
});
|
|
167
|
+
export type Slider = {
|
|
168
|
+
comp?: "slider";
|
|
169
|
+
[k: string]: unknown;
|
|
170
|
+
} & BaseCompObject &
|
|
171
|
+
(BaseCompObject & {
|
|
172
|
+
comp: string;
|
|
173
|
+
label?: string;
|
|
174
|
+
[k: string]: unknown;
|
|
175
|
+
}) & {
|
|
176
|
+
step?: number;
|
|
177
|
+
min?: number;
|
|
178
|
+
max?: number;
|
|
179
|
+
[k: string]: unknown;
|
|
180
|
+
};
|
|
181
|
+
export type DatePicker = {
|
|
182
|
+
comp?: "date-picker";
|
|
183
|
+
[k: string]: unknown;
|
|
184
|
+
} & BaseCompObject &
|
|
185
|
+
(BaseCompObject & {
|
|
186
|
+
comp: string;
|
|
187
|
+
label?: string;
|
|
188
|
+
[k: string]: unknown;
|
|
189
|
+
}) & {
|
|
190
|
+
min?: string;
|
|
191
|
+
max?: string;
|
|
192
|
+
format?: "date" | "date-time";
|
|
193
|
+
[k: string]: unknown;
|
|
194
|
+
};
|
|
195
|
+
export type DateTimePicker = {
|
|
196
|
+
comp?: "date-time-picker";
|
|
197
|
+
[k: string]: unknown;
|
|
198
|
+
} & BaseCompObject &
|
|
199
|
+
(BaseCompObject & {
|
|
200
|
+
comp: string;
|
|
201
|
+
label?: string;
|
|
202
|
+
[k: string]: unknown;
|
|
203
|
+
}) & {
|
|
204
|
+
min?: string;
|
|
205
|
+
max?: string;
|
|
206
|
+
[k: string]: unknown;
|
|
207
|
+
};
|
|
208
|
+
export type TimePicker = {
|
|
209
|
+
comp?: "time-picker";
|
|
210
|
+
[k: string]: unknown;
|
|
211
|
+
} & BaseCompObject &
|
|
212
|
+
(BaseCompObject & {
|
|
213
|
+
comp: string;
|
|
214
|
+
label?: string;
|
|
215
|
+
[k: string]: unknown;
|
|
216
|
+
}) & {
|
|
217
|
+
min?: string;
|
|
218
|
+
max?: string;
|
|
219
|
+
[k: string]: unknown;
|
|
220
|
+
};
|
|
221
|
+
export type ColorPicker = {
|
|
222
|
+
comp?: "color-picker";
|
|
223
|
+
[k: string]: unknown;
|
|
224
|
+
} & BaseCompObject &
|
|
225
|
+
(BaseCompObject & {
|
|
226
|
+
comp: string;
|
|
227
|
+
label?: string;
|
|
228
|
+
[k: string]: unknown;
|
|
229
|
+
});
|
|
230
|
+
export type Select = {
|
|
231
|
+
comp?: "select";
|
|
232
|
+
[k: string]: unknown;
|
|
233
|
+
} & BaseCompObject &
|
|
234
|
+
(BaseCompObject & {
|
|
235
|
+
comp: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
[k: string]: unknown;
|
|
238
|
+
}) &
|
|
239
|
+
(BaseCompObject & {
|
|
240
|
+
comp: string;
|
|
241
|
+
label?: string;
|
|
242
|
+
autofocus?: boolean;
|
|
243
|
+
[k: string]: unknown;
|
|
244
|
+
}) &
|
|
245
|
+
(BaseCompObject & {
|
|
246
|
+
comp: string;
|
|
247
|
+
items?: SelectItems;
|
|
248
|
+
getItems?: GetItems;
|
|
249
|
+
multiple?: boolean;
|
|
250
|
+
separator?: string;
|
|
251
|
+
[k: string]: unknown;
|
|
252
|
+
}) &
|
|
253
|
+
(BaseCompObject & {
|
|
254
|
+
comp: string;
|
|
255
|
+
multiple?: boolean;
|
|
256
|
+
[k: string]: unknown;
|
|
257
|
+
});
|
|
258
|
+
export type Autocomplete = {
|
|
259
|
+
comp?: "autocomplete";
|
|
260
|
+
[k: string]: unknown;
|
|
261
|
+
} & BaseCompObject &
|
|
262
|
+
(BaseCompObject & {
|
|
263
|
+
comp: string;
|
|
264
|
+
label?: string;
|
|
265
|
+
[k: string]: unknown;
|
|
266
|
+
}) &
|
|
267
|
+
(BaseCompObject & {
|
|
268
|
+
comp: string;
|
|
269
|
+
label?: string;
|
|
270
|
+
autofocus?: boolean;
|
|
271
|
+
[k: string]: unknown;
|
|
272
|
+
}) &
|
|
273
|
+
(BaseCompObject & {
|
|
274
|
+
comp: string;
|
|
275
|
+
items?: SelectItems;
|
|
276
|
+
getItems?: GetItems;
|
|
277
|
+
multiple?: boolean;
|
|
278
|
+
separator?: string;
|
|
279
|
+
[k: string]: unknown;
|
|
280
|
+
}) &
|
|
281
|
+
(BaseCompObject & {
|
|
282
|
+
comp: string;
|
|
283
|
+
multiple?: boolean;
|
|
284
|
+
[k: string]: unknown;
|
|
285
|
+
});
|
|
286
|
+
export type Combobox = {
|
|
287
|
+
comp?: "combobox";
|
|
288
|
+
[k: string]: unknown;
|
|
289
|
+
} & BaseCompObject &
|
|
290
|
+
(BaseCompObject & {
|
|
291
|
+
comp: string;
|
|
292
|
+
label?: string;
|
|
293
|
+
[k: string]: unknown;
|
|
294
|
+
}) &
|
|
295
|
+
(BaseCompObject & {
|
|
296
|
+
comp: string;
|
|
297
|
+
label?: string;
|
|
298
|
+
autofocus?: boolean;
|
|
299
|
+
[k: string]: unknown;
|
|
300
|
+
}) &
|
|
301
|
+
(BaseCompObject & {
|
|
302
|
+
comp: string;
|
|
303
|
+
items?: SelectItems;
|
|
304
|
+
getItems?: GetItems;
|
|
305
|
+
multiple?: boolean;
|
|
306
|
+
separator?: string;
|
|
307
|
+
[k: string]: unknown;
|
|
308
|
+
}) &
|
|
309
|
+
(BaseCompObject & {
|
|
310
|
+
comp: string;
|
|
311
|
+
multiple?: boolean;
|
|
312
|
+
[k: string]: unknown;
|
|
313
|
+
});
|
|
314
|
+
export type NumberCombobox = {
|
|
315
|
+
comp?: "number-combobox";
|
|
316
|
+
[k: string]: unknown;
|
|
317
|
+
} & BaseCompObject &
|
|
318
|
+
(BaseCompObject & {
|
|
319
|
+
comp: string;
|
|
320
|
+
label?: string;
|
|
321
|
+
[k: string]: unknown;
|
|
322
|
+
}) &
|
|
323
|
+
(BaseCompObject & {
|
|
324
|
+
comp: string;
|
|
325
|
+
label?: string;
|
|
326
|
+
autofocus?: boolean;
|
|
327
|
+
[k: string]: unknown;
|
|
328
|
+
}) &
|
|
329
|
+
(BaseCompObject & {
|
|
330
|
+
comp: string;
|
|
331
|
+
items?: SelectItems;
|
|
332
|
+
getItems?: GetItems;
|
|
333
|
+
multiple?: boolean;
|
|
334
|
+
separator?: string;
|
|
335
|
+
[k: string]: unknown;
|
|
336
|
+
}) &
|
|
337
|
+
(BaseCompObject & {
|
|
338
|
+
comp: string;
|
|
339
|
+
multiple?: boolean;
|
|
340
|
+
[k: string]: unknown;
|
|
341
|
+
}) & {
|
|
342
|
+
step?: number;
|
|
343
|
+
min?: number;
|
|
344
|
+
max?: number;
|
|
345
|
+
[k: string]: unknown;
|
|
346
|
+
};
|
|
347
|
+
export type FileInput = {
|
|
348
|
+
comp?: "file-input";
|
|
349
|
+
[k: string]: unknown;
|
|
350
|
+
} & BaseCompObject &
|
|
351
|
+
(BaseCompObject & {
|
|
352
|
+
comp: string;
|
|
353
|
+
label?: string;
|
|
354
|
+
[k: string]: unknown;
|
|
355
|
+
}) &
|
|
356
|
+
(BaseCompObject & {
|
|
357
|
+
comp: string;
|
|
358
|
+
label?: string;
|
|
359
|
+
autofocus?: boolean;
|
|
360
|
+
[k: string]: unknown;
|
|
361
|
+
}) &
|
|
362
|
+
(BaseCompObject & {
|
|
363
|
+
comp: string;
|
|
364
|
+
multiple?: boolean;
|
|
365
|
+
[k: string]: unknown;
|
|
366
|
+
}) & {
|
|
367
|
+
accept?: string;
|
|
368
|
+
[k: string]: unknown;
|
|
369
|
+
};
|
|
370
|
+
export type OneOfSelect = {
|
|
371
|
+
comp?: "one-of-select";
|
|
372
|
+
[k: string]: unknown;
|
|
373
|
+
} & BaseCompObject &
|
|
374
|
+
(BaseCompObject & {
|
|
375
|
+
comp: string;
|
|
376
|
+
label?: string;
|
|
377
|
+
[k: string]: unknown;
|
|
378
|
+
});
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/** @typedef {import("./types.js").SchemaFragment} SchemaFragment */
|
|
2
|
+
/** @typedef {import("./types.js").ComponentInfo} ComponentInfo */
|
|
3
|
+
|
|
2
4
|
export * from './layout-keyword/index.js'
|
|
3
5
|
export * from './normalized-layout/index.js'
|
|
6
|
+
export * from './components/index.js'
|
|
4
7
|
export { normalizeLayoutFragment, getSchemaFragmentType } from './normalize.js'
|