@json-layout/vocabulary 0.14.0 → 0.16.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 +95 -54
- package/src/normalized-layout/index.js +18 -64
- package/src/normalized-layout/schema.js +235 -762
- package/src/normalized-layout/schema.json +118 -324
- package/src/normalized-layout/types.ts +163 -233
- 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 +171 -526
- package/types/normalized-layout/types.d.ts +163 -208
- 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
|
@@ -1,51 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
transformData?: Expression;
|
|
11
|
-
nullable?: boolean;
|
|
12
|
-
help?: string;
|
|
13
|
-
cols?: ColsObj;
|
|
14
|
-
props?: StateNodePropsLib;
|
|
15
|
-
getProps?: Expression;
|
|
16
|
-
slots?: StateNodeSlotsLib & {
|
|
17
|
-
before?: Slot;
|
|
18
|
-
after?: Slot;
|
|
19
|
-
component?: Slot;
|
|
20
|
-
[k: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
[k: string]: unknown;
|
|
23
|
-
} & (
|
|
24
|
-
| None
|
|
25
|
-
| List
|
|
26
|
-
| TextField
|
|
27
|
-
| NumberField
|
|
28
|
-
| Textarea
|
|
29
|
-
| Markdown
|
|
30
|
-
| Checkbox
|
|
31
|
-
| Switch
|
|
32
|
-
| Slider
|
|
33
|
-
| DatePicker
|
|
34
|
-
| DateTimePicker
|
|
35
|
-
| TimePicker
|
|
36
|
-
| ColorPicker
|
|
37
|
-
| Combobox
|
|
38
|
-
| NumberCombobox
|
|
39
|
-
| Select
|
|
40
|
-
| Autocomplete
|
|
41
|
-
| OneOfSelect
|
|
42
|
-
| Section
|
|
43
|
-
| Tabs
|
|
44
|
-
| VerticalTabs
|
|
45
|
-
| ExpansionPanels
|
|
46
|
-
| Stepper
|
|
47
|
-
| FileInput
|
|
48
|
-
);
|
|
1
|
+
/**
|
|
2
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
3
|
+
* via the `definition` "normalized-layout".
|
|
4
|
+
*/
|
|
5
|
+
export type NormalizedLayout = SwitchStruct | BaseCompObject;
|
|
6
|
+
/**
|
|
7
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
8
|
+
* via the `definition` "state-node-options-base".
|
|
9
|
+
*/
|
|
49
10
|
export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {
|
|
50
11
|
readOnly?: boolean;
|
|
51
12
|
summary?: boolean;
|
|
@@ -64,10 +25,17 @@ export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {
|
|
|
64
25
|
readOnlyPropertiesMode?: "remove" | "hide" | "show";
|
|
65
26
|
[k: string]: unknown;
|
|
66
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
30
|
+
* via the `definition` "cols".
|
|
31
|
+
*/
|
|
67
32
|
export type Cols = number;
|
|
68
33
|
/**
|
|
69
34
|
* This interface was referenced by `StateNodeSlotsLib`'s JSON-Schema definition
|
|
70
35
|
* via the `patternProperty` ".*".
|
|
36
|
+
*
|
|
37
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
38
|
+
* via the `definition` "slot".
|
|
71
39
|
*/
|
|
72
40
|
export type Slot =
|
|
73
41
|
| {
|
|
@@ -79,7 +47,67 @@ export type Slot =
|
|
|
79
47
|
| {
|
|
80
48
|
name: string;
|
|
81
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
52
|
+
* via the `definition` "composite-comp-object".
|
|
53
|
+
*/
|
|
54
|
+
export type CompositeCompObject = BaseCompObject & {
|
|
55
|
+
comp: string;
|
|
56
|
+
title?: string | null;
|
|
57
|
+
subtitle?: string | null;
|
|
58
|
+
children: Children;
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
63
|
+
* via the `definition` "child".
|
|
64
|
+
*/
|
|
65
|
+
export type Child = ChildRef | ChildComposite;
|
|
66
|
+
/**
|
|
67
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
68
|
+
* via the `definition` "children".
|
|
69
|
+
*/
|
|
70
|
+
export type Children = Child[];
|
|
71
|
+
/**
|
|
72
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
73
|
+
* via the `definition` "simple-comp-object".
|
|
74
|
+
*/
|
|
75
|
+
export type SimpleCompObject = BaseCompObject & {
|
|
76
|
+
comp: string;
|
|
77
|
+
label?: string;
|
|
78
|
+
[k: string]: unknown;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
82
|
+
* via the `definition` "focusable-comp-object".
|
|
83
|
+
*/
|
|
84
|
+
export type FocusableCompObject = BaseCompObject & {
|
|
85
|
+
comp: string;
|
|
86
|
+
label?: string;
|
|
87
|
+
autofocus?: boolean;
|
|
88
|
+
[k: string]: unknown;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
92
|
+
* via the `definition` "items-based-comp-object".
|
|
93
|
+
*/
|
|
94
|
+
export type ItemsBasedCompObject = BaseCompObject & {
|
|
95
|
+
comp: string;
|
|
96
|
+
items?: SelectItems;
|
|
97
|
+
getItems?: GetItems;
|
|
98
|
+
multiple?: boolean;
|
|
99
|
+
separator?: string;
|
|
100
|
+
[k: string]: unknown;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
104
|
+
* via the `definition` "select-items".
|
|
105
|
+
*/
|
|
82
106
|
export type SelectItems = SelectItem[];
|
|
107
|
+
/**
|
|
108
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
109
|
+
* via the `definition` "get-items".
|
|
110
|
+
*/
|
|
83
111
|
export type GetItems = {
|
|
84
112
|
returnObjects?: boolean;
|
|
85
113
|
itemsResults?: Expression;
|
|
@@ -89,21 +117,59 @@ export type GetItems = {
|
|
|
89
117
|
itemIcon?: Expression;
|
|
90
118
|
[k: string]: unknown;
|
|
91
119
|
} & (Expression | GetItemsFetch);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
/**
|
|
121
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
122
|
+
* via the `definition` "multiple-compat-comp-object".
|
|
123
|
+
*/
|
|
124
|
+
export type MultipleCompatCompObject = BaseCompObject & {
|
|
125
|
+
comp: string;
|
|
126
|
+
multiple?: boolean;
|
|
95
127
|
[k: string]: unknown;
|
|
96
128
|
};
|
|
97
|
-
export type Child1 = unknown | CompositeCompObject;
|
|
98
|
-
export type CompositeCompObject = Section | Tabs | VerticalTabs | ExpansionPanels;
|
|
99
|
-
export type Children = Child[];
|
|
100
129
|
|
|
130
|
+
export interface HttpsJsonLayoutGithubIoNormalizedLayoutKeyword {
|
|
131
|
+
[k: string]: unknown;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
135
|
+
* via the `definition` "switch-struct".
|
|
136
|
+
*/
|
|
101
137
|
export interface SwitchStruct {
|
|
102
|
-
switch:
|
|
138
|
+
switch: BaseCompObject[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
142
|
+
* via the `definition` "base-comp-object".
|
|
143
|
+
*/
|
|
144
|
+
export interface BaseCompObject {
|
|
145
|
+
comp: string;
|
|
146
|
+
if?: Expression;
|
|
147
|
+
options?: StateNodeOptionsBase;
|
|
148
|
+
getOptions?: Expression;
|
|
149
|
+
defaultData?: unknown;
|
|
150
|
+
getDefaultData?: Expression;
|
|
151
|
+
constData?: unknown;
|
|
152
|
+
getConstData?: Expression;
|
|
153
|
+
transformData?: Expression;
|
|
154
|
+
nullable?: boolean;
|
|
155
|
+
help?: string;
|
|
156
|
+
cols?: ColsObj;
|
|
157
|
+
props?: StateNodePropsLib;
|
|
158
|
+
getProps?: Expression;
|
|
159
|
+
slots?: StateNodeSlotsLib & {
|
|
160
|
+
before?: Slot;
|
|
161
|
+
after?: Slot;
|
|
162
|
+
component?: Slot;
|
|
163
|
+
[k: string]: unknown;
|
|
164
|
+
};
|
|
165
|
+
[k: string]: unknown;
|
|
103
166
|
}
|
|
104
167
|
/**
|
|
105
168
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
106
169
|
* via the `patternProperty` ".*".
|
|
170
|
+
*
|
|
171
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
172
|
+
* via the `definition` "expression".
|
|
107
173
|
*/
|
|
108
174
|
export interface Expression {
|
|
109
175
|
type: "js-fn" | "js-eval" | "js-tpl";
|
|
@@ -112,6 +178,10 @@ export interface Expression {
|
|
|
112
178
|
ref?: number;
|
|
113
179
|
[k: string]: unknown;
|
|
114
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
183
|
+
* via the `definition` "state-node-options-base-lib".
|
|
184
|
+
*/
|
|
115
185
|
export interface StateNodeOptionsBaseLib {
|
|
116
186
|
/**
|
|
117
187
|
* This interface was referenced by `StateNodeOptionsBaseLib`'s JSON-Schema definition
|
|
@@ -119,6 +189,10 @@ export interface StateNodeOptionsBaseLib {
|
|
|
119
189
|
*/
|
|
120
190
|
[k: string]: unknown;
|
|
121
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
194
|
+
* via the `definition` "cols-obj".
|
|
195
|
+
*/
|
|
122
196
|
export interface ColsObj {
|
|
123
197
|
xs: number;
|
|
124
198
|
sm?: Cols;
|
|
@@ -127,6 +201,10 @@ export interface ColsObj {
|
|
|
127
201
|
xl?: Cols;
|
|
128
202
|
xxl?: Cols;
|
|
129
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
206
|
+
* via the `definition` "state-node-props-lib".
|
|
207
|
+
*/
|
|
130
208
|
export interface StateNodePropsLib {
|
|
131
209
|
/**
|
|
132
210
|
* This interface was referenced by `StateNodePropsLib`'s JSON-Schema definition
|
|
@@ -134,111 +212,38 @@ export interface StateNodePropsLib {
|
|
|
134
212
|
*/
|
|
135
213
|
[k: string]: unknown;
|
|
136
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
217
|
+
* via the `definition` "state-node-slots-lib".
|
|
218
|
+
*/
|
|
137
219
|
export interface StateNodeSlotsLib {
|
|
138
220
|
[k: string]: Slot;
|
|
139
221
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
export interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
listEditMode: "inline" | "inline-single" | "menu" | "dialog";
|
|
148
|
-
listActions: ("add" | "edit" | "delete" | "sort" | "duplicate")[];
|
|
149
|
-
itemTitle?: Expression;
|
|
150
|
-
itemSubtitle?: Expression;
|
|
151
|
-
messages?: {
|
|
152
|
-
addItem?: string;
|
|
153
|
-
delete?: string;
|
|
154
|
-
edit?: string;
|
|
155
|
-
duplicate?: string;
|
|
156
|
-
sort?: string;
|
|
157
|
-
};
|
|
158
|
-
[k: string]: unknown;
|
|
159
|
-
}
|
|
160
|
-
export interface TextField {
|
|
161
|
-
comp: "text-field";
|
|
162
|
-
label: string;
|
|
163
|
-
autofocus?: boolean;
|
|
164
|
-
[k: string]: unknown;
|
|
165
|
-
}
|
|
166
|
-
export interface NumberField {
|
|
167
|
-
comp: "number-field";
|
|
168
|
-
label: string;
|
|
169
|
-
autofocus?: boolean;
|
|
170
|
-
step?: number;
|
|
171
|
-
min?: number;
|
|
172
|
-
max?: number;
|
|
173
|
-
[k: string]: unknown;
|
|
174
|
-
}
|
|
175
|
-
export interface Textarea {
|
|
176
|
-
comp: "textarea";
|
|
177
|
-
label: string;
|
|
178
|
-
autofocus?: boolean;
|
|
179
|
-
[k: string]: unknown;
|
|
180
|
-
}
|
|
181
|
-
export interface Markdown {
|
|
182
|
-
comp: "markdown";
|
|
183
|
-
label: string;
|
|
184
|
-
autofocus?: boolean;
|
|
185
|
-
[k: string]: unknown;
|
|
186
|
-
}
|
|
187
|
-
export interface Checkbox {
|
|
188
|
-
comp: "checkbox";
|
|
189
|
-
label: string;
|
|
190
|
-
[k: string]: unknown;
|
|
191
|
-
}
|
|
192
|
-
export interface Switch {
|
|
193
|
-
comp: "switch";
|
|
194
|
-
label: string;
|
|
195
|
-
[k: string]: unknown;
|
|
196
|
-
}
|
|
197
|
-
export interface Slider {
|
|
198
|
-
comp: "slider";
|
|
199
|
-
label: string;
|
|
200
|
-
step?: number;
|
|
201
|
-
min: number;
|
|
202
|
-
max: number;
|
|
203
|
-
[k: string]: unknown;
|
|
204
|
-
}
|
|
205
|
-
export interface DatePicker {
|
|
206
|
-
comp: "date-picker";
|
|
207
|
-
label: string;
|
|
208
|
-
min?: string;
|
|
209
|
-
max?: string;
|
|
210
|
-
format?: "date" | "date-time";
|
|
211
|
-
[k: string]: unknown;
|
|
212
|
-
}
|
|
213
|
-
export interface DateTimePicker {
|
|
214
|
-
comp: "date-time-picker";
|
|
215
|
-
label: string;
|
|
216
|
-
min?: string;
|
|
217
|
-
max?: string;
|
|
218
|
-
[k: string]: unknown;
|
|
219
|
-
}
|
|
220
|
-
export interface TimePicker {
|
|
221
|
-
comp: "time-picker";
|
|
222
|
-
label: string;
|
|
223
|
-
min?: string;
|
|
224
|
-
max?: string;
|
|
225
|
-
[k: string]: unknown;
|
|
226
|
-
}
|
|
227
|
-
export interface ColorPicker {
|
|
228
|
-
comp: "color-picker";
|
|
229
|
-
label: string;
|
|
230
|
-
[k: string]: unknown;
|
|
222
|
+
/**
|
|
223
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
224
|
+
* via the `definition` "child-ref".
|
|
225
|
+
*/
|
|
226
|
+
export interface ChildRef {
|
|
227
|
+
key: string | number;
|
|
228
|
+
cols?: ColsObj;
|
|
231
229
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
230
|
+
/**
|
|
231
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
232
|
+
* via the `definition` "child-composite".
|
|
233
|
+
*/
|
|
234
|
+
export interface ChildComposite {
|
|
235
|
+
key: string | number;
|
|
236
|
+
cols?: ColsObj;
|
|
237
|
+
comp?: string;
|
|
238
|
+
title?: string | null;
|
|
239
|
+
subtitle?: string | null;
|
|
240
|
+
children: Children;
|
|
240
241
|
[k: string]: unknown;
|
|
241
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
245
|
+
* via the `definition` "select-item".
|
|
246
|
+
*/
|
|
242
247
|
export interface SelectItem {
|
|
243
248
|
title: string;
|
|
244
249
|
key: string;
|
|
@@ -246,6 +251,10 @@ export interface SelectItem {
|
|
|
246
251
|
icon?: string;
|
|
247
252
|
[k: string]: unknown;
|
|
248
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
256
|
+
* via the `definition` "get-items-fetch".
|
|
257
|
+
*/
|
|
249
258
|
export interface GetItemsFetch {
|
|
250
259
|
url: Expression;
|
|
251
260
|
qSearchParam?: string;
|
|
@@ -254,82 +263,3 @@ export interface GetItemsFetch {
|
|
|
254
263
|
};
|
|
255
264
|
[k: string]: unknown;
|
|
256
265
|
}
|
|
257
|
-
export interface NumberCombobox {
|
|
258
|
-
comp: "number-combobox";
|
|
259
|
-
label: string;
|
|
260
|
-
autofocus?: boolean;
|
|
261
|
-
items?: SelectItems;
|
|
262
|
-
getItems?: GetItems;
|
|
263
|
-
multiple?: boolean;
|
|
264
|
-
step?: number;
|
|
265
|
-
min?: number;
|
|
266
|
-
max?: number;
|
|
267
|
-
[k: string]: unknown;
|
|
268
|
-
}
|
|
269
|
-
export interface Select {
|
|
270
|
-
comp: "select";
|
|
271
|
-
label: string;
|
|
272
|
-
autofocus?: boolean;
|
|
273
|
-
items?: SelectItems;
|
|
274
|
-
getItems?: GetItems;
|
|
275
|
-
multiple?: boolean;
|
|
276
|
-
separator?: string;
|
|
277
|
-
[k: string]: unknown;
|
|
278
|
-
}
|
|
279
|
-
export interface Autocomplete {
|
|
280
|
-
comp: "autocomplete";
|
|
281
|
-
label: string;
|
|
282
|
-
autofocus?: boolean;
|
|
283
|
-
items?: SelectItems;
|
|
284
|
-
getItems?: GetItems;
|
|
285
|
-
multiple?: boolean;
|
|
286
|
-
separator?: string;
|
|
287
|
-
[k: string]: unknown;
|
|
288
|
-
}
|
|
289
|
-
export interface OneOfSelect {
|
|
290
|
-
comp: "one-of-select";
|
|
291
|
-
label: string;
|
|
292
|
-
[k: string]: unknown;
|
|
293
|
-
}
|
|
294
|
-
export interface Section {
|
|
295
|
-
comp: "section";
|
|
296
|
-
title?: string | null;
|
|
297
|
-
subtitle?: string | null;
|
|
298
|
-
children: Children;
|
|
299
|
-
[k: string]: unknown;
|
|
300
|
-
}
|
|
301
|
-
export interface Tabs {
|
|
302
|
-
comp: "tabs";
|
|
303
|
-
title?: string | null;
|
|
304
|
-
subtitle?: string | null;
|
|
305
|
-
children: Children;
|
|
306
|
-
[k: string]: unknown;
|
|
307
|
-
}
|
|
308
|
-
export interface VerticalTabs {
|
|
309
|
-
comp: "vertical-tabs";
|
|
310
|
-
title?: string | null;
|
|
311
|
-
subtitle?: string | null;
|
|
312
|
-
children: Children;
|
|
313
|
-
[k: string]: unknown;
|
|
314
|
-
}
|
|
315
|
-
export interface ExpansionPanels {
|
|
316
|
-
comp: "expansion-panels";
|
|
317
|
-
title?: string | null;
|
|
318
|
-
subtitle?: string | null;
|
|
319
|
-
children: Children;
|
|
320
|
-
[k: string]: unknown;
|
|
321
|
-
}
|
|
322
|
-
export interface Stepper {
|
|
323
|
-
comp: "stepper";
|
|
324
|
-
title?: string | null;
|
|
325
|
-
subtitle?: string | null;
|
|
326
|
-
children: Children;
|
|
327
|
-
[k: string]: unknown;
|
|
328
|
-
}
|
|
329
|
-
export interface FileInput {
|
|
330
|
-
comp: "file-input";
|
|
331
|
-
label: string;
|
|
332
|
-
accept?: string;
|
|
333
|
-
multiple?: boolean;
|
|
334
|
-
[k: string]: unknown;
|
|
335
|
-
}
|
package/src/types.ts
CHANGED
|
@@ -20,3 +20,14 @@ export interface SchemaFragment {
|
|
|
20
20
|
formatMaximum?: string
|
|
21
21
|
readOnly?: boolean
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
export interface ComponentInfo {
|
|
25
|
+
name: string
|
|
26
|
+
composite?: boolean
|
|
27
|
+
shouldDebounce?: boolean
|
|
28
|
+
emitsBlur?: boolean
|
|
29
|
+
focusable?: boolean
|
|
30
|
+
itemsBased?: boolean
|
|
31
|
+
multipleCompat?: boolean
|
|
32
|
+
schema?: any
|
|
33
|
+
}
|
package/src/validate.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ajvModule from 'ajv/dist/2019.js'
|
|
2
|
+
import addFormats from 'ajv-formats'
|
|
3
|
+
import ajvErrors from 'ajv-errors'
|
|
4
|
+
import layoutKeyword from './layout-keyword/schema.js'
|
|
5
|
+
import normalizedLayout from './normalized-layout/schema.js'
|
|
6
|
+
import { getComponentSchema } from './components/index.js'
|
|
7
|
+
|
|
8
|
+
// fix some broken typing of ajv
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const Ajv = /** @type {typeof ajvModule.default} */ (ajvModule)
|
|
11
|
+
|
|
12
|
+
export const ajv = new Ajv({
|
|
13
|
+
code: {
|
|
14
|
+
source: true,
|
|
15
|
+
esm: true
|
|
16
|
+
// optimize: true
|
|
17
|
+
},
|
|
18
|
+
discriminator: true,
|
|
19
|
+
allowMatchingProperties: true,
|
|
20
|
+
allowUnionTypes: true,
|
|
21
|
+
allErrors: true
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
addFormats.default(ajv)
|
|
25
|
+
ajvErrors.default(ajv)
|
|
26
|
+
|
|
27
|
+
ajv.addSchema(layoutKeyword)
|
|
28
|
+
ajv.addSchema(normalizedLayout)
|
|
29
|
+
|
|
30
|
+
/** @type {Record<string, import('ajv').ValidateFunction>} */
|
|
31
|
+
const componentsValidateCache = {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {import('./types.js').ComponentInfo} component
|
|
35
|
+
* @returns {import('ajv').ValidateFunction}
|
|
36
|
+
*/
|
|
37
|
+
export function getComponentValidate (component) {
|
|
38
|
+
if (componentsValidateCache[component.name]) return componentsValidateCache[component.name]
|
|
39
|
+
const schema = getComponentSchema(component)
|
|
40
|
+
componentsValidateCache[component.name] = ajv.compile(schema)
|
|
41
|
+
return componentsValidateCache[component.name]
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} from
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function getComponentTypesCodeImport(from: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* @param {any} schema
|
|
8
|
+
* @param {string} key
|
|
9
|
+
* @param {boolean} standalone
|
|
10
|
+
* @returns {Promise<string>}
|
|
11
|
+
*/
|
|
12
|
+
export function getComponentTypesCode(schema: any, key: string, standalone?: boolean): Promise<string>;
|
|
13
|
+
//# sourceMappingURL=compile-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-types.d.ts","sourceRoot":"","sources":["../../src/components/compile-types.js"],"names":[],"mappings":"AA6BA;;;GAGG;AACH,kDAHW,MAAM,GACJ,MAAM,CAclB;AAED;;;;;GAKG;AACH,8CALW,GAAG,OACH,MAAM,eACN,OAAO,GACL,QAAQ,MAAM,CAAC,CAS3B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('../types.js').ComponentInfo} component
|
|
3
|
+
* @returns {any}
|
|
4
|
+
*/
|
|
5
|
+
export function getComponentSchema(component: import('../types.js').ComponentInfo): any;
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('./types.js').Section} Section
|
|
8
|
+
* @typedef {import('./types.js').Select} Select
|
|
9
|
+
* @typedef {import('./types.js').Autocomplete} Autocomplete
|
|
10
|
+
* @typedef {import('./types.js').TextField} TextField
|
|
11
|
+
* @typedef {import('./types.js').Textarea} Textarea
|
|
12
|
+
* @typedef {import('./types.js').NumberField} NumberField
|
|
13
|
+
* @typedef {import('./types.js').Slider} Slider
|
|
14
|
+
* @typedef {import('./types.js').Checkbox} Checkbox
|
|
15
|
+
* @typedef {import('./types.js').Switch} Switch
|
|
16
|
+
* @typedef {import('./types.js').DatePicker} DatePicker
|
|
17
|
+
* @typedef {import('./types.js').TimePicker} TimePicker
|
|
18
|
+
* @typedef {import('./types.js').DateTimePicker} DateTimePicker
|
|
19
|
+
* @typedef {import('./types.js').ColorPicker} ColorPicker
|
|
20
|
+
* @typedef {import('./types.js').OneOfSelect} OneOfSelect
|
|
21
|
+
* @typedef {import('./types.js').Tabs} Tabs
|
|
22
|
+
* @typedef {import('./types.js').VerticalTabs} VerticalTabs
|
|
23
|
+
* @typedef {import('./types.js').ExpansionPanels} ExpansionPanels
|
|
24
|
+
* @typedef {import('./types.js').Stepper} Stepper
|
|
25
|
+
* @typedef {import('./types.js').List} List
|
|
26
|
+
* @typedef {import('./types.js').Combobox} Combobox
|
|
27
|
+
* @typedef {import('./types.js').FileInput} FileInput
|
|
28
|
+
*/
|
|
29
|
+
/** @type {import('../types.js').ComponentInfo[]} */
|
|
30
|
+
export const standardComponents: import('../types.js').ComponentInfo[];
|
|
31
|
+
export type Section = import('./types.js').Section;
|
|
32
|
+
export type Select = import('./types.js').Select;
|
|
33
|
+
export type Autocomplete = import('./types.js').Autocomplete;
|
|
34
|
+
export type TextField = import('./types.js').TextField;
|
|
35
|
+
export type Textarea = import('./types.js').Textarea;
|
|
36
|
+
export type NumberField = import('./types.js').NumberField;
|
|
37
|
+
export type Slider = import('./types.js').Slider;
|
|
38
|
+
export type Checkbox = import('./types.js').Checkbox;
|
|
39
|
+
export type Switch = import('./types.js').Switch;
|
|
40
|
+
export type DatePicker = import('./types.js').DatePicker;
|
|
41
|
+
export type TimePicker = import('./types.js').TimePicker;
|
|
42
|
+
export type DateTimePicker = import('./types.js').DateTimePicker;
|
|
43
|
+
export type ColorPicker = import('./types.js').ColorPicker;
|
|
44
|
+
export type OneOfSelect = import('./types.js').OneOfSelect;
|
|
45
|
+
export type Tabs = import('./types.js').Tabs;
|
|
46
|
+
export type VerticalTabs = import('./types.js').VerticalTabs;
|
|
47
|
+
export type ExpansionPanels = import('./types.js').ExpansionPanels;
|
|
48
|
+
export type Stepper = import('./types.js').Stepper;
|
|
49
|
+
export type List = import('./types.js').List;
|
|
50
|
+
export type Combobox = import('./types.js').Combobox;
|
|
51
|
+
export type FileInput = import('./types.js').FileInput;
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.js"],"names":[],"mappings":"AA+LA;;;GAGG;AACH,8CAHW,OAAO,aAAa,EAAE,aAAa,GACjC,GAAG,CAgCf;AAjOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,oDAAoD;AACpD,iCADW,OAAO,aAAa,EAAE,aAAa,EAAE,CAqK/C;sBA5LY,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"}
|