@golemui/gui-mcp 0.14.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/README.md +104 -0
- package/index.d.ts +1 -0
- package/index.js +2165 -0
- package/package.json +44 -0
package/index.js
ADDED
|
@@ -0,0 +1,2165 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import Ajv2020 from "ajv/dist/2020.js";
|
|
9
|
+
import addFormats from "ajv-formats";
|
|
10
|
+
const SUPPORTED_STRING_FORMATS = /* @__PURE__ */ new Set([
|
|
11
|
+
"email",
|
|
12
|
+
"hostname",
|
|
13
|
+
"ipv4",
|
|
14
|
+
"ipv6",
|
|
15
|
+
"url",
|
|
16
|
+
"uuid",
|
|
17
|
+
"date",
|
|
18
|
+
"time",
|
|
19
|
+
"date-time",
|
|
20
|
+
"duration"
|
|
21
|
+
]);
|
|
22
|
+
function buildStringValidator(s, required2) {
|
|
23
|
+
const v = { type: "string" };
|
|
24
|
+
let used = false;
|
|
25
|
+
if (required2) {
|
|
26
|
+
v.required = true;
|
|
27
|
+
used = true;
|
|
28
|
+
}
|
|
29
|
+
if (typeof s.minLength === "number") {
|
|
30
|
+
v.minLength = s.minLength;
|
|
31
|
+
used = true;
|
|
32
|
+
}
|
|
33
|
+
if (typeof s.maxLength === "number") {
|
|
34
|
+
v.maxLength = s.maxLength;
|
|
35
|
+
used = true;
|
|
36
|
+
}
|
|
37
|
+
if (typeof s.pattern === "string") {
|
|
38
|
+
v.pattern = s.pattern;
|
|
39
|
+
used = true;
|
|
40
|
+
}
|
|
41
|
+
if (typeof s.format === "string" && SUPPORTED_STRING_FORMATS.has(s.format)) {
|
|
42
|
+
if (s.format !== "date" && s.format !== "date-time") {
|
|
43
|
+
v.format = s.format;
|
|
44
|
+
used = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (s.const !== void 0) {
|
|
48
|
+
v.const = s.const;
|
|
49
|
+
used = true;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(s.enum)) {
|
|
52
|
+
v.enum = s.enum;
|
|
53
|
+
used = true;
|
|
54
|
+
}
|
|
55
|
+
return used ? v : void 0;
|
|
56
|
+
}
|
|
57
|
+
function buildNumberValidator(s, required2, t) {
|
|
58
|
+
const v = { type: t };
|
|
59
|
+
let used = false;
|
|
60
|
+
if (required2) {
|
|
61
|
+
v.required = true;
|
|
62
|
+
used = true;
|
|
63
|
+
}
|
|
64
|
+
if (typeof s.minimum === "number") {
|
|
65
|
+
v.minimum = s.minimum;
|
|
66
|
+
used = true;
|
|
67
|
+
}
|
|
68
|
+
if (typeof s.maximum === "number") {
|
|
69
|
+
v.maximum = s.maximum;
|
|
70
|
+
used = true;
|
|
71
|
+
}
|
|
72
|
+
if (typeof s.exclusiveMinimum === "number") {
|
|
73
|
+
v.exclusiveMinimum = s.exclusiveMinimum;
|
|
74
|
+
used = true;
|
|
75
|
+
}
|
|
76
|
+
if (typeof s.exclusiveMaximum === "number") {
|
|
77
|
+
v.exclusiveMaximum = s.exclusiveMaximum;
|
|
78
|
+
used = true;
|
|
79
|
+
}
|
|
80
|
+
if (typeof s.multipleOf === "number") {
|
|
81
|
+
v.multipleOf = s.multipleOf;
|
|
82
|
+
used = true;
|
|
83
|
+
}
|
|
84
|
+
return used ? v : void 0;
|
|
85
|
+
}
|
|
86
|
+
function buildBooleanValidator(s, required2) {
|
|
87
|
+
const v = { type: "boolean" };
|
|
88
|
+
let used = false;
|
|
89
|
+
if (required2) {
|
|
90
|
+
v.required = true;
|
|
91
|
+
used = true;
|
|
92
|
+
}
|
|
93
|
+
if (s.const !== void 0) {
|
|
94
|
+
v.const = s.const;
|
|
95
|
+
used = true;
|
|
96
|
+
}
|
|
97
|
+
return used ? v : void 0;
|
|
98
|
+
}
|
|
99
|
+
const SECRET_HINTS = /(password|secret|api[_-]?key|token)/i;
|
|
100
|
+
const LONG_TEXT_MIN_LENGTH = 200;
|
|
101
|
+
const SELECT_THRESHOLD = 6;
|
|
102
|
+
function jsonSchemaToGui(schema, opts = {}) {
|
|
103
|
+
const unmapped = [];
|
|
104
|
+
const root = unwrap(schema);
|
|
105
|
+
const fields = [];
|
|
106
|
+
if (root.type === "object" || root.properties) {
|
|
107
|
+
const required2 = new Set(root.required ?? []);
|
|
108
|
+
for (const [name, propSchema] of Object.entries(root.properties ?? {})) {
|
|
109
|
+
const widget = mapProperty(name, unwrap(propSchema), required2.has(name), "", unmapped);
|
|
110
|
+
if (widget) fields.push(widget);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
unmapped.push({
|
|
114
|
+
path: "",
|
|
115
|
+
reason: "Top-level JSON Schema is not an object — only object schemas map to forms."
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
if (opts.submitAction !== false) {
|
|
119
|
+
fields.push({
|
|
120
|
+
kind: "action",
|
|
121
|
+
type: "button",
|
|
122
|
+
actionType: "submit",
|
|
123
|
+
label: opts.submitLabel ?? "Submit",
|
|
124
|
+
props: { variant: "filled" }
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const wrapped = opts.layout && opts.layout !== "vertical" ? [
|
|
128
|
+
{
|
|
129
|
+
kind: "layout",
|
|
130
|
+
type: opts.layout === "grid" ? "grid" : "flex",
|
|
131
|
+
props: opts.layout === "grid" ? { columnGap: 12, rowGap: 12 } : { direction: "row", gap: 12 },
|
|
132
|
+
children: fields
|
|
133
|
+
}
|
|
134
|
+
] : fields;
|
|
135
|
+
return {
|
|
136
|
+
formDefinition: { form: wrapped },
|
|
137
|
+
unmapped
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function unwrap(schema) {
|
|
141
|
+
if (schema.oneOf?.length === 2) {
|
|
142
|
+
const nonNull = schema.oneOf.find((s) => s.type !== "null");
|
|
143
|
+
if (nonNull) return { ...nonNull, ...stripBranches(schema) };
|
|
144
|
+
}
|
|
145
|
+
if (schema.anyOf?.length === 2) {
|
|
146
|
+
const nonNull = schema.anyOf.find((s) => s.type !== "null");
|
|
147
|
+
if (nonNull) return { ...nonNull, ...stripBranches(schema) };
|
|
148
|
+
}
|
|
149
|
+
return schema;
|
|
150
|
+
}
|
|
151
|
+
function stripBranches(s) {
|
|
152
|
+
const { oneOf: oneOf2, anyOf, ...rest } = s;
|
|
153
|
+
return rest;
|
|
154
|
+
}
|
|
155
|
+
function mapProperty(name, schema, required2, parentPath, unmapped) {
|
|
156
|
+
const path = parentPath ? `${parentPath}.${name}` : name;
|
|
157
|
+
const label = humanLabel(schema.title ?? name);
|
|
158
|
+
const t = Array.isArray(schema.type) ? schema.type.find((x) => x !== "null") : schema.type;
|
|
159
|
+
if (Array.isArray(schema.enum) && schema.enum.every((v) => typeof v === "string")) {
|
|
160
|
+
return buildEnumField(path, name, label, schema, required2);
|
|
161
|
+
}
|
|
162
|
+
switch (t) {
|
|
163
|
+
case "string":
|
|
164
|
+
return buildStringField(path, name, label, schema, required2);
|
|
165
|
+
case "number":
|
|
166
|
+
case "integer":
|
|
167
|
+
return buildNumberField(path, label, schema, required2, t);
|
|
168
|
+
case "boolean":
|
|
169
|
+
return buildBooleanField(path, label, schema, required2);
|
|
170
|
+
case "object":
|
|
171
|
+
return buildObjectGroup(path, name, label, schema, unmapped);
|
|
172
|
+
case "array":
|
|
173
|
+
return buildArrayField(path, name, label, schema, required2, unmapped);
|
|
174
|
+
default:
|
|
175
|
+
unmapped.push({
|
|
176
|
+
path,
|
|
177
|
+
reason: `Unsupported JSON Schema type \`${schema.type ?? "undefined"}\`.`
|
|
178
|
+
});
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function buildStringField(path, name, label, schema, required2) {
|
|
183
|
+
const validator = buildStringValidator(schema, required2);
|
|
184
|
+
const isSecret = SECRET_HINTS.test(name);
|
|
185
|
+
const isLong = (schema.maxLength ?? 0) >= LONG_TEXT_MIN_LENGTH;
|
|
186
|
+
if (schema.format === "date") {
|
|
187
|
+
return cleanFields({ kind: "input", type: "dateInput", path, label, validator });
|
|
188
|
+
}
|
|
189
|
+
if (schema.format === "date-time") {
|
|
190
|
+
return cleanFields({ kind: "input", type: "datePicker", path, label, validator });
|
|
191
|
+
}
|
|
192
|
+
if (isSecret) {
|
|
193
|
+
return cleanFields({ kind: "input", type: "password", path, label, validator });
|
|
194
|
+
}
|
|
195
|
+
if (isLong) {
|
|
196
|
+
return cleanFields({
|
|
197
|
+
kind: "input",
|
|
198
|
+
type: "textarea",
|
|
199
|
+
path,
|
|
200
|
+
label,
|
|
201
|
+
validator,
|
|
202
|
+
props: schema.description ? { hint: schema.description } : void 0
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return cleanFields({
|
|
206
|
+
kind: "input",
|
|
207
|
+
type: "textinput",
|
|
208
|
+
path,
|
|
209
|
+
label,
|
|
210
|
+
validator,
|
|
211
|
+
props: schema.description ? { hint: schema.description } : void 0
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function buildEnumField(path, name, label, schema, required2) {
|
|
215
|
+
const values = schema.enum ?? [];
|
|
216
|
+
const validator = required2 ? { type: "string", required: true, enum: values } : { type: "string", enum: values };
|
|
217
|
+
if (values.length <= SELECT_THRESHOLD) {
|
|
218
|
+
return cleanFields({
|
|
219
|
+
kind: "input",
|
|
220
|
+
type: "select",
|
|
221
|
+
path,
|
|
222
|
+
label,
|
|
223
|
+
validator,
|
|
224
|
+
props: {
|
|
225
|
+
options: values.map((v) => ({ label: humanLabel(v), value: v }))
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return cleanFields({
|
|
230
|
+
kind: "input",
|
|
231
|
+
type: "dropdown",
|
|
232
|
+
path,
|
|
233
|
+
label,
|
|
234
|
+
validator,
|
|
235
|
+
props: {
|
|
236
|
+
labelField: "label",
|
|
237
|
+
valueField: "value",
|
|
238
|
+
items: values.map((v) => ({ label: humanLabel(v), value: v }))
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function buildNumberField(path, label, schema, required2, t) {
|
|
243
|
+
const validator = buildNumberValidator(schema, required2, t);
|
|
244
|
+
return cleanFields({
|
|
245
|
+
kind: "input",
|
|
246
|
+
type: "number",
|
|
247
|
+
path,
|
|
248
|
+
label,
|
|
249
|
+
validator,
|
|
250
|
+
props: schema.description ? { hint: schema.description } : void 0
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function buildBooleanField(path, label, schema, required2) {
|
|
254
|
+
const validator = buildBooleanValidator(schema, required2);
|
|
255
|
+
return cleanFields({ kind: "input", type: "checkbox", path, label, validator });
|
|
256
|
+
}
|
|
257
|
+
function buildObjectGroup(path, _name, _label, schema, unmapped) {
|
|
258
|
+
const required2 = new Set(schema.required ?? []);
|
|
259
|
+
const children = [];
|
|
260
|
+
for (const [childName, childSchema] of Object.entries(schema.properties ?? {})) {
|
|
261
|
+
const w = mapProperty(childName, unwrap(childSchema), required2.has(childName), path, unmapped);
|
|
262
|
+
if (w) children.push(w);
|
|
263
|
+
}
|
|
264
|
+
if (!children.length) {
|
|
265
|
+
unmapped.push({ path, reason: "Object has no mappable properties." });
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
kind: "layout",
|
|
270
|
+
type: "flex",
|
|
271
|
+
props: { direction: "column", gap: 8 },
|
|
272
|
+
children
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function buildArrayField(path, _name, label, schema, required2, unmapped) {
|
|
276
|
+
const items = schema.items ? unwrap(schema.items) : void 0;
|
|
277
|
+
if (!items) {
|
|
278
|
+
unmapped.push({ path, reason: "Array without `items` schema cannot be mapped." });
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
if (items.type === "object") {
|
|
282
|
+
const templateChildren = [];
|
|
283
|
+
const required22 = new Set(items.required ?? []);
|
|
284
|
+
const childParent = `${path}.items`;
|
|
285
|
+
for (const [childName, childSchema] of Object.entries(items.properties ?? {})) {
|
|
286
|
+
const w = mapProperty(childName, unwrap(childSchema), required22.has(childName), childParent, unmapped);
|
|
287
|
+
if (w) templateChildren.push(w);
|
|
288
|
+
}
|
|
289
|
+
if (!templateChildren.length) {
|
|
290
|
+
unmapped.push({ path, reason: "Array of objects has no mappable item properties." });
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
kind: "input",
|
|
295
|
+
type: "repeater",
|
|
296
|
+
path,
|
|
297
|
+
label,
|
|
298
|
+
props: {
|
|
299
|
+
addLabel: `Add ${singular(label).toLowerCase()}`,
|
|
300
|
+
removeLabel: "Remove",
|
|
301
|
+
template: {
|
|
302
|
+
kind: "layout",
|
|
303
|
+
type: "flex",
|
|
304
|
+
props: { direction: "column", gap: 8 },
|
|
305
|
+
children: templateChildren
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
if (items.type === "string" || items.type === "number" || items.type === "integer") {
|
|
311
|
+
const validator = buildArrayValidator(schema, required2);
|
|
312
|
+
return cleanFields({
|
|
313
|
+
kind: "input",
|
|
314
|
+
type: "tags",
|
|
315
|
+
path,
|
|
316
|
+
label,
|
|
317
|
+
validator,
|
|
318
|
+
props: schema.description ? { placeholder: "Add and press Enter", hint: schema.description } : { placeholder: "Add and press Enter" }
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
unmapped.push({
|
|
322
|
+
path,
|
|
323
|
+
reason: "Array shape is not mappable (only arrays of objects → repeater, or arrays of strings/numbers → tags)."
|
|
324
|
+
});
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
function buildArrayValidator(s, required2) {
|
|
328
|
+
const v = { type: "array" };
|
|
329
|
+
let used = false;
|
|
330
|
+
if (required2) {
|
|
331
|
+
v.required = true;
|
|
332
|
+
used = true;
|
|
333
|
+
}
|
|
334
|
+
if (typeof s.minItems === "number") {
|
|
335
|
+
v.minItems = s.minItems;
|
|
336
|
+
used = true;
|
|
337
|
+
}
|
|
338
|
+
if (typeof s.maxItems === "number") {
|
|
339
|
+
v.maxItems = s.maxItems;
|
|
340
|
+
used = true;
|
|
341
|
+
}
|
|
342
|
+
if (s.uniqueItems === true) {
|
|
343
|
+
v.uniqueItems = true;
|
|
344
|
+
used = true;
|
|
345
|
+
}
|
|
346
|
+
return used ? v : void 0;
|
|
347
|
+
}
|
|
348
|
+
function humanLabel(name) {
|
|
349
|
+
if (!name) return "";
|
|
350
|
+
return name.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (c) => c.toUpperCase());
|
|
351
|
+
}
|
|
352
|
+
function singular(label) {
|
|
353
|
+
if (label.endsWith("ies") && label.length > 3) return label.slice(0, -3) + "y";
|
|
354
|
+
if (label.endsWith("s") && !label.endsWith("ss")) return label.slice(0, -1);
|
|
355
|
+
return label;
|
|
356
|
+
}
|
|
357
|
+
function cleanFields(o) {
|
|
358
|
+
for (const k of Object.keys(o)) {
|
|
359
|
+
if (o[k] === void 0) delete o[k];
|
|
360
|
+
}
|
|
361
|
+
return o;
|
|
362
|
+
}
|
|
363
|
+
const $schema$u = "https://json-schema.org/draft/2020-12/schema";
|
|
364
|
+
const $id$u = "https://golemui.com/schemas/common.schema.json";
|
|
365
|
+
const title$u = "Golem Common Definitions";
|
|
366
|
+
const $defs$t = { "reactiveExpression": { "type": "string", "description": "A reactive expression string. Use `$form` to access form data e.g. `$form.termsAccepted === true`" }, "dotPath": { "type": "string", "description": "A dot-separated path to a property in the form data" }, "dateRange": { "type": "object", "description": "A single date range used by calendar/date-picker widgets to mark days as disabled.", "properties": { "start": { "type": "string" }, "end": { "type": "string" } }, "required": ["start"], "additionalProperties": false }, "uid": { "type": "string", "description": "Unique identifier for the widget" }, "localizable": { "oneOf": [{ "type": "string" }, { "type": "object", "properties": { "key": { "type": "string" }, "default": { "type": "string" }, "params": { "type": "object" } }, "required": ["key"], "additionalProperties": false }] }, "include": { "oneOf": [{ "type": "object", "properties": { "in": { "type": "array", "items": { "type": "string" } } }, "required": ["in"], "additionalProperties": false }, { "type": "object", "properties": { "when": { "$ref": "#/$defs/reactiveExpression" } }, "required": ["when"], "additionalProperties": false }] }, "exclude": { "oneOf": [{ "type": "object", "properties": { "from": { "type": "array", "items": { "type": "string" } } }, "required": ["from"], "additionalProperties": false }, { "type": "object", "properties": { "when": { "$ref": "#/$defs/reactiveExpression" } }, "required": ["when"], "additionalProperties": false }] }, "boolOrWhen": { "oneOf": [{ "type": "boolean" }, { "type": "object", "properties": { "when": { "$ref": "#/$defs/reactiveExpression" } }, "required": ["when"], "additionalProperties": false }] }, "on": { "type": "object", "properties": { "load": { "type": "string" }, "click": { "type": "string" }, "change": { "type": "string" }, "filter": { "type": "string" }, "blur": { "type": "string" } }, "patternProperties": { "^load\\.[^.]+$": { "type": "string" }, "^click\\.[^.]+$": { "type": "string" }, "^change\\.[^.]+$": { "type": "string" }, "^filter\\.[^.]+$": { "type": "string" }, "^blur\\.[^.]+$": { "type": "string" } }, "additionalProperties": false }, "baseWidget": { "type": "object", "properties": { "$schema": { "type": "string" }, "uid": { "$ref": "#/$defs/uid" }, "type": { "type": "string" }, "size": { "type": "number" }, "include": { "$ref": "#/$defs/include" }, "exclude": { "$ref": "#/$defs/exclude" } }, "required": ["type"] } };
|
|
367
|
+
const commonSchema = {
|
|
368
|
+
$schema: $schema$u,
|
|
369
|
+
$id: $id$u,
|
|
370
|
+
title: title$u,
|
|
371
|
+
$defs: $defs$t
|
|
372
|
+
};
|
|
373
|
+
const $schema$t = "https://json-schema.org/draft/2020-12/schema";
|
|
374
|
+
const $id$t = "https://golemui.com/schemas/form.schema.json";
|
|
375
|
+
const title$t = "Golem Form DSL";
|
|
376
|
+
const type$r = "object";
|
|
377
|
+
const properties$r = { "$schema": { "type": "string" }, "states": { "type": "object", "additionalProperties": { "$ref": "common.schema.json#/$defs/reactiveExpression" } }, "form": { "type": "array", "items": { "$ref": "#/$defs/formWidget" } }, "autocomplete": { "type": "string" } };
|
|
378
|
+
const required$r = ["form"];
|
|
379
|
+
const additionalProperties = false;
|
|
380
|
+
const $defs$s = { "chunkRef": { "type": "object", "properties": { "$ref": { "type": "string" } }, "required": ["$ref"], "additionalProperties": false }, "formWidget": { "oneOf": [{ "$ref": "./components/accordion.schema.json" }, { "$ref": "./components/alert.schema.json" }, { "$ref": "./components/button.schema.json" }, { "$ref": "./components/calendar.schema.json" }, { "$ref": "./components/checkbox.schema.json" }, { "$ref": "./components/currency.schema.json" }, { "$ref": "./components/dateinput.schema.json" }, { "$ref": "./components/datepicker.schema.json" }, { "$ref": "./components/dropdown.schema.json" }, { "$ref": "./components/list.schema.json" }, { "$ref": "./components/markdown.schema.json" }, { "$ref": "./components/markdowntext.schema.json" }, { "$ref": "./components/number.schema.json" }, { "$ref": "./components/password.schema.json" }, { "$ref": "./components/radiogroup.schema.json" }, { "$ref": "./components/rangecalendar.schema.json" }, { "$ref": "./components/rangedateinput.schema.json" }, { "$ref": "./components/rangedatepicker.schema.json" }, { "$ref": "./components/repeater.schema.json" }, { "$ref": "./components/select.schema.json" }, { "$ref": "./components/flex.schema.json" }, { "$ref": "./components/grid.schema.json" }, { "$ref": "./components/tabs.schema.json" }, { "$ref": "./components/tags.schema.json" }, { "$ref": "./components/textarea.schema.json" }, { "$ref": "./components/textinput.schema.json" }, { "$ref": "./components/toggle.schema.json" }, { "$ref": "#/$defs/chunkRef" }] } };
|
|
381
|
+
const formSchema = {
|
|
382
|
+
$schema: $schema$t,
|
|
383
|
+
$id: $id$t,
|
|
384
|
+
title: title$t,
|
|
385
|
+
type: type$r,
|
|
386
|
+
properties: properties$r,
|
|
387
|
+
required: required$r,
|
|
388
|
+
additionalProperties,
|
|
389
|
+
$defs: $defs$s
|
|
390
|
+
};
|
|
391
|
+
const $schema$s = "https://json-schema.org/draft/2020-12/schema";
|
|
392
|
+
const $id$s = "https://golemui.com/schemas/layout-widget.schema.json";
|
|
393
|
+
const title$s = "Golem Layout Widget";
|
|
394
|
+
const oneOf = [{ "$ref": "./components/accordion.schema.json" }, { "$ref": "./components/flex.schema.json" }, { "$ref": "./components/grid.schema.json" }, { "$ref": "./components/tabs.schema.json" }];
|
|
395
|
+
const layoutWidgetSchema = {
|
|
396
|
+
$schema: $schema$s,
|
|
397
|
+
$id: $id$s,
|
|
398
|
+
title: title$s,
|
|
399
|
+
oneOf
|
|
400
|
+
};
|
|
401
|
+
const $schema$r = "https://json-schema.org/draft/2020-12/schema";
|
|
402
|
+
const $id$r = "https://golemui.com/schemas/validators.schema.json";
|
|
403
|
+
const title$r = "GolemUI Validator Definitions";
|
|
404
|
+
const $defs$r = { "localizable": { "$ref": "./common.schema.json#/$defs/localizable" }, "stringValidator": { "type": "object", "properties": { "type": { "const": "string" }, "required": { "type": "boolean" }, "minLength": { "type": "number" }, "maxLength": { "type": "number" }, "pattern": { "type": "string", "description": "A regular expression pattern the value must match" }, "format": { "type": "string", "enum": ["email", "hostname", "ipv4", "ipv6", "url", "uuid", "date", "time", "date-time", "duration"] }, "const": {}, "enum": { "type": "array" }, "messages": { "type": "object", "properties": { "invalid": { "$ref": "#/$defs/localizable" }, "required": { "$ref": "#/$defs/localizable" }, "minLength": { "$ref": "#/$defs/localizable" }, "maxLength": { "$ref": "#/$defs/localizable" }, "pattern": { "$ref": "#/$defs/localizable" }, "format": { "$ref": "#/$defs/localizable" }, "enum": { "$ref": "#/$defs/localizable" }, "const": { "$ref": "#/$defs/localizable" } }, "additionalProperties": false } }, "required": ["type"], "additionalProperties": false }, "numberValidator": { "type": "object", "properties": { "type": { "type": "string", "enum": ["number", "integer"] }, "required": { "type": "boolean" }, "minimum": { "type": "number" }, "maximum": { "type": "number" }, "exclusiveMinimum": { "type": "number" }, "exclusiveMaximum": { "type": "number" }, "multipleOf": { "type": "number" }, "const": {}, "enum": { "type": "array" }, "messages": { "type": "object", "properties": { "invalid": { "$ref": "#/$defs/localizable" }, "minimum": { "$ref": "#/$defs/localizable" }, "maximum": { "$ref": "#/$defs/localizable" }, "exclusiveMinimum": { "$ref": "#/$defs/localizable" }, "exclusiveMaximum": { "$ref": "#/$defs/localizable" }, "multipleOf": { "$ref": "#/$defs/localizable" }, "enum": { "$ref": "#/$defs/localizable" }, "const": { "$ref": "#/$defs/localizable" } }, "additionalProperties": false } }, "required": ["type"], "additionalProperties": false }, "booleanValidator": { "type": "object", "properties": { "type": { "const": "boolean" }, "required": { "type": "boolean" }, "const": {}, "messages": { "type": "object", "properties": { "invalid": { "$ref": "#/$defs/localizable" }, "const": { "$ref": "#/$defs/localizable" } }, "additionalProperties": false } }, "required": ["type"], "additionalProperties": false }, "arrayValidator": { "type": "object", "properties": { "type": { "const": "array" }, "required": { "type": "boolean" }, "minItems": { "type": "number" }, "maxItems": { "type": "number" }, "uniqueItems": { "type": "boolean" }, "messages": { "type": "object", "properties": { "invalid": { "$ref": "#/$defs/localizable" }, "required": { "$ref": "#/$defs/localizable" }, "minItems": { "$ref": "#/$defs/localizable" }, "maxItems": { "$ref": "#/$defs/localizable" } }, "additionalProperties": false } }, "required": ["type"], "additionalProperties": false }, "customValidator": { "type": "object", "properties": { "type": { "const": "custom" }, "required": { "type": "boolean" } }, "required": ["type"], "additionalProperties": true }, "validator": { "oneOf": [{ "$ref": "#/$defs/stringValidator" }, { "$ref": "#/$defs/numberValidator" }, { "$ref": "#/$defs/booleanValidator" }, { "$ref": "#/$defs/arrayValidator" }, { "$ref": "#/$defs/customValidator" }] } };
|
|
405
|
+
const validatorsSchema = {
|
|
406
|
+
$schema: $schema$r,
|
|
407
|
+
$id: $id$r,
|
|
408
|
+
title: title$r,
|
|
409
|
+
$defs: $defs$r
|
|
410
|
+
};
|
|
411
|
+
const $schema$q = "https://json-schema.org/draft/2020-12/schema";
|
|
412
|
+
const $id$q = "https://golemui.com/schemas/components/accordion.schema.json";
|
|
413
|
+
const title$q = "Accordion Widget";
|
|
414
|
+
const type$q = "object";
|
|
415
|
+
const $defs$q = { "singleOpenProp": { "type": "boolean" }, "defaultOpenProp": { "type": "object", "additionalProperties": { "type": "boolean" }, "minProperties": 1 }, "renderModeProp": { "enum": ["all", "activeOnly"] }, "sectionsProp": { "type": "array", "minItems": 1, "items": { "type": "object", "properties": { "label": { "$ref": "../common.schema.json#/$defs/localizable" }, "uid": { "type": "string" } }, "required": ["label", "uid"], "additionalProperties": false } } };
|
|
416
|
+
const allOf$q = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
417
|
+
const properties$q = { "kind": { "const": "layout" }, "type": { "const": "accordion" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "children": { "type": "array", "minItems": 1, "items": { "$ref": "../form.schema.json#/$defs/formWidget" } }, "props": { "type": "object", "properties": { "singleOpen": { "$ref": "#/$defs/singleOpenProp" }, "defaultOpen": { "$ref": "#/$defs/defaultOpenProp" }, "renderMode": { "$ref": "#/$defs/renderModeProp" }, "sections": { "$ref": "#/$defs/sectionsProp" } }, "required": ["sections"], "patternProperties": { "^singleOpen\\.[^.]+$": { "$ref": "#/$defs/singleOpenProp" }, "^defaultOpen\\.[^.]+$": { "$ref": "#/$defs/defaultOpenProp" }, "^renderMode\\.[^.]+$": { "$ref": "#/$defs/renderModeProp" }, "^sections\\.[^.]+$": { "$ref": "#/$defs/sectionsProp" } }, "additionalProperties": false } };
|
|
418
|
+
const required$q = ["kind", "type", "children", "props"];
|
|
419
|
+
const unevaluatedProperties$q = false;
|
|
420
|
+
const accordion = {
|
|
421
|
+
$schema: $schema$q,
|
|
422
|
+
$id: $id$q,
|
|
423
|
+
title: title$q,
|
|
424
|
+
type: type$q,
|
|
425
|
+
$defs: $defs$q,
|
|
426
|
+
allOf: allOf$q,
|
|
427
|
+
properties: properties$q,
|
|
428
|
+
required: required$q,
|
|
429
|
+
unevaluatedProperties: unevaluatedProperties$q
|
|
430
|
+
};
|
|
431
|
+
const $schema$p = "https://json-schema.org/draft/2020-12/schema";
|
|
432
|
+
const $id$p = "https://golemui.com/schemas/components/alert.schema.json";
|
|
433
|
+
const title$p = "Alert Widget";
|
|
434
|
+
const type$p = "object";
|
|
435
|
+
const $defs$p = { "textProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "levelProp": { "enum": ["default", "info", "success", "warning", "error"] } };
|
|
436
|
+
const allOf$p = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
437
|
+
const properties$p = { "kind": { "const": "display" }, "type": { "const": "alert" }, "props": { "type": "object", "properties": { "text": { "$ref": "#/$defs/textProp" }, "level": { "$ref": "#/$defs/levelProp" } }, "patternProperties": { "^text\\.[^.]+$": { "$ref": "#/$defs/textProp" }, "^level\\.[^.]+$": { "$ref": "#/$defs/levelProp" } }, "required": ["text"], "additionalProperties": false } };
|
|
438
|
+
const required$p = ["kind", "type", "props"];
|
|
439
|
+
const unevaluatedProperties$p = false;
|
|
440
|
+
const alert = {
|
|
441
|
+
$schema: $schema$p,
|
|
442
|
+
$id: $id$p,
|
|
443
|
+
title: title$p,
|
|
444
|
+
type: type$p,
|
|
445
|
+
$defs: $defs$p,
|
|
446
|
+
allOf: allOf$p,
|
|
447
|
+
properties: properties$p,
|
|
448
|
+
required: required$p,
|
|
449
|
+
unevaluatedProperties: unevaluatedProperties$p
|
|
450
|
+
};
|
|
451
|
+
const $schema$o = "https://json-schema.org/draft/2020-12/schema";
|
|
452
|
+
const $id$o = "https://golemui.com/schemas/components/button.schema.json";
|
|
453
|
+
const title$o = "Button Widget";
|
|
454
|
+
const type$o = "object";
|
|
455
|
+
const $defs$o = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "variantProp": { "enum": ["filled", "outlined", "link"] } };
|
|
456
|
+
const allOf$o = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
457
|
+
const properties$o = { "kind": { "const": "action" }, "type": { "const": "button" }, "actionType": { "enum": ["button", "submit"] }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "props": { "type": "object", "properties": { "variant": { "$ref": "#/$defs/variantProp" }, "icon": { "type": "string" }, "iconPosition": { "enum": ["left", "right"] } }, "patternProperties": { "^variant\\.[^.]+$": { "$ref": "#/$defs/variantProp" } }, "additionalProperties": false } };
|
|
458
|
+
const patternProperties$k = { "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" } };
|
|
459
|
+
const required$o = ["kind", "type"];
|
|
460
|
+
const unevaluatedProperties$o = false;
|
|
461
|
+
const button = {
|
|
462
|
+
$schema: $schema$o,
|
|
463
|
+
$id: $id$o,
|
|
464
|
+
title: title$o,
|
|
465
|
+
type: type$o,
|
|
466
|
+
$defs: $defs$o,
|
|
467
|
+
allOf: allOf$o,
|
|
468
|
+
properties: properties$o,
|
|
469
|
+
patternProperties: patternProperties$k,
|
|
470
|
+
required: required$o,
|
|
471
|
+
unevaluatedProperties: unevaluatedProperties$o
|
|
472
|
+
};
|
|
473
|
+
const $schema$n = "https://json-schema.org/draft/2020-12/schema";
|
|
474
|
+
const $id$n = "https://golemui.com/schemas/components/calendar.schema.json";
|
|
475
|
+
const title$n = "Calendar Widget";
|
|
476
|
+
const type$n = "object";
|
|
477
|
+
const $defs$n = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "prevMonthIconProp": { "type": "string" }, "nextMonthIconProp": { "type": "string" }, "prevMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "nextMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "dayFormatProp": { "enum": ["numeric", "2-digit"] }, "weekdayFormatProp": { "enum": ["short", "long", "narrow"] }, "monthFormatProp": { "enum": ["numeric", "2-digit", "long", "short", "narrow"] }, "minDateProp": { "type": "string" }, "maxDateProp": { "type": "string" }, "numberOfMonthsProp": { "type": "number" }, "disabledRangesProp": { "type": "array", "items": { "$ref": "../common.schema.json#/$defs/dateRange" } } };
|
|
478
|
+
const allOf$n = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
479
|
+
const properties$n = { "kind": { "const": "input" }, "type": { "const": "calendar" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "prevMonthIcon": { "$ref": "#/$defs/prevMonthIconProp" }, "nextMonthIcon": { "$ref": "#/$defs/nextMonthIconProp" }, "prevMonthAriaLabel": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "nextMonthAriaLabel": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "dayFormat": { "$ref": "#/$defs/dayFormatProp" }, "weekdayFormat": { "$ref": "#/$defs/weekdayFormatProp" }, "monthFormat": { "$ref": "#/$defs/monthFormatProp" }, "minDate": { "$ref": "#/$defs/minDateProp" }, "maxDate": { "$ref": "#/$defs/maxDateProp" }, "numberOfMonths": { "$ref": "#/$defs/numberOfMonthsProp" }, "disabledRanges": { "$ref": "#/$defs/disabledRangesProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^prevMonthIcon\\.[^.]+$": { "$ref": "#/$defs/prevMonthIconProp" }, "^nextMonthIcon\\.[^.]+$": { "$ref": "#/$defs/nextMonthIconProp" }, "^prevMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "^nextMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "^dayFormat\\.[^.]+$": { "$ref": "#/$defs/dayFormatProp" }, "^weekdayFormat\\.[^.]+$": { "$ref": "#/$defs/weekdayFormatProp" }, "^monthFormat\\.[^.]+$": { "$ref": "#/$defs/monthFormatProp" }, "^minDate\\.[^.]+$": { "$ref": "#/$defs/minDateProp" }, "^maxDate\\.[^.]+$": { "$ref": "#/$defs/maxDateProp" }, "^numberOfMonths\\.[^.]+$": { "$ref": "#/$defs/numberOfMonthsProp" }, "^disabledRanges\\.[^.]+$": { "$ref": "#/$defs/disabledRangesProp" } }, "additionalProperties": false } };
|
|
480
|
+
const patternProperties$j = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
481
|
+
const required$n = ["kind", "type", "path"];
|
|
482
|
+
const unevaluatedProperties$n = false;
|
|
483
|
+
const calendar = {
|
|
484
|
+
$schema: $schema$n,
|
|
485
|
+
$id: $id$n,
|
|
486
|
+
title: title$n,
|
|
487
|
+
type: type$n,
|
|
488
|
+
$defs: $defs$n,
|
|
489
|
+
allOf: allOf$n,
|
|
490
|
+
properties: properties$n,
|
|
491
|
+
patternProperties: patternProperties$j,
|
|
492
|
+
required: required$n,
|
|
493
|
+
unevaluatedProperties: unevaluatedProperties$n
|
|
494
|
+
};
|
|
495
|
+
const $schema$m = "https://json-schema.org/draft/2020-12/schema";
|
|
496
|
+
const $id$m = "https://golemui.com/schemas/components/checkbox.schema.json";
|
|
497
|
+
const title$m = "Checkbox Widget";
|
|
498
|
+
const type$m = "object";
|
|
499
|
+
const $defs$m = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "checkboxPositionProp": { "enum": ["left", "right"], "default": "left" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" } };
|
|
500
|
+
const allOf$m = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
501
|
+
const properties$m = { "kind": { "const": "input" }, "type": { "const": "checkbox" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "boolean" }, "props": { "type": "object", "properties": { "checkboxPosition": { "$ref": "#/$defs/checkboxPositionProp" }, "hint": { "$ref": "#/$defs/hintProp" } }, "patternProperties": { "^checkboxPosition\\.[^.]+$": { "$ref": "#/$defs/checkboxPositionProp" }, "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" } }, "additionalProperties": false } };
|
|
502
|
+
const patternProperties$i = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
503
|
+
const required$m = ["kind", "type", "path"];
|
|
504
|
+
const unevaluatedProperties$m = false;
|
|
505
|
+
const checkbox = {
|
|
506
|
+
$schema: $schema$m,
|
|
507
|
+
$id: $id$m,
|
|
508
|
+
title: title$m,
|
|
509
|
+
type: type$m,
|
|
510
|
+
$defs: $defs$m,
|
|
511
|
+
allOf: allOf$m,
|
|
512
|
+
properties: properties$m,
|
|
513
|
+
patternProperties: patternProperties$i,
|
|
514
|
+
required: required$m,
|
|
515
|
+
unevaluatedProperties: unevaluatedProperties$m
|
|
516
|
+
};
|
|
517
|
+
const $schema$l = "https://json-schema.org/draft/2020-12/schema";
|
|
518
|
+
const $id$l = "https://golemui.com/schemas/components/currency.schema.json";
|
|
519
|
+
const title$l = "Currency Widget";
|
|
520
|
+
const type$l = "object";
|
|
521
|
+
const $defs$l = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "currencyProp": { "type": "string" }, "stepProp": { "type": "number" }, "maximumFractionDigitsProp": { "type": "number" }, "minimumFractionDigitsProp": { "type": "number" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "autocompleteProp": { "type": "string" } };
|
|
522
|
+
const allOf$l = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
523
|
+
const properties$l = { "kind": { "const": "input" }, "type": { "const": "currency" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "number" }, "props": { "type": "object", "properties": { "currency": { "$ref": "#/$defs/currencyProp" }, "step": { "$ref": "#/$defs/stepProp" }, "maximumFractionDigits": { "$ref": "#/$defs/maximumFractionDigitsProp" }, "minimumFractionDigits": { "$ref": "#/$defs/minimumFractionDigitsProp" }, "hint": { "$ref": "#/$defs/hintProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^currency\\.[^.]+$": { "$ref": "#/$defs/currencyProp" }, "^step\\.[^.]+$": { "$ref": "#/$defs/stepProp" }, "^maximumFractionDigits\\.[^.]+$": { "$ref": "#/$defs/maximumFractionDigitsProp" }, "^minimumFractionDigits\\.[^.]+$": { "$ref": "#/$defs/minimumFractionDigitsProp" }, "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
524
|
+
const patternProperties$h = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
525
|
+
const required$l = ["kind", "type", "path"];
|
|
526
|
+
const unevaluatedProperties$l = false;
|
|
527
|
+
const currency = {
|
|
528
|
+
$schema: $schema$l,
|
|
529
|
+
$id: $id$l,
|
|
530
|
+
title: title$l,
|
|
531
|
+
type: type$l,
|
|
532
|
+
$defs: $defs$l,
|
|
533
|
+
allOf: allOf$l,
|
|
534
|
+
properties: properties$l,
|
|
535
|
+
patternProperties: patternProperties$h,
|
|
536
|
+
required: required$l,
|
|
537
|
+
unevaluatedProperties: unevaluatedProperties$l
|
|
538
|
+
};
|
|
539
|
+
const $schema$k = "https://json-schema.org/draft/2020-12/schema";
|
|
540
|
+
const $id$k = "https://golemui.com/schemas/components/dateinput.schema.json";
|
|
541
|
+
const title$k = "DateInput Widget";
|
|
542
|
+
const type$k = "object";
|
|
543
|
+
const $defs$k = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" } };
|
|
544
|
+
const allOf$k = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
545
|
+
const properties$k = { "kind": { "const": "input" }, "type": { "const": "dateInput" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "icon": { "$ref": "#/$defs/iconProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" } }, "additionalProperties": false } };
|
|
546
|
+
const patternProperties$g = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
547
|
+
const required$k = ["kind", "type", "path"];
|
|
548
|
+
const unevaluatedProperties$k = false;
|
|
549
|
+
const dateinput = {
|
|
550
|
+
$schema: $schema$k,
|
|
551
|
+
$id: $id$k,
|
|
552
|
+
title: title$k,
|
|
553
|
+
type: type$k,
|
|
554
|
+
$defs: $defs$k,
|
|
555
|
+
allOf: allOf$k,
|
|
556
|
+
properties: properties$k,
|
|
557
|
+
patternProperties: patternProperties$g,
|
|
558
|
+
required: required$k,
|
|
559
|
+
unevaluatedProperties: unevaluatedProperties$k
|
|
560
|
+
};
|
|
561
|
+
const $schema$j = "https://json-schema.org/draft/2020-12/schema";
|
|
562
|
+
const $id$j = "https://golemui.com/schemas/components/datepicker.schema.json";
|
|
563
|
+
const title$j = "DatePicker Widget";
|
|
564
|
+
const type$j = "object";
|
|
565
|
+
const $defs$j = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "prevMonthIconProp": { "type": "string" }, "nextMonthIconProp": { "type": "string" }, "prevMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "nextMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "dayFormatProp": { "enum": ["numeric", "2-digit"] }, "weekdayFormatProp": { "enum": ["short", "long", "narrow"] }, "monthFormatProp": { "enum": ["numeric", "2-digit", "long", "short", "narrow"] }, "minDateProp": { "type": "string" }, "maxDateProp": { "type": "string" }, "numberOfMonthsProp": { "type": "number" }, "disabledRangesProp": { "type": "array", "items": { "$ref": "../common.schema.json#/$defs/dateRange" } } };
|
|
566
|
+
const allOf$j = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
567
|
+
const properties$j = { "kind": { "const": "input" }, "type": { "const": "datePicker" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "prevMonthIcon": { "$ref": "#/$defs/prevMonthIconProp" }, "nextMonthIcon": { "$ref": "#/$defs/nextMonthIconProp" }, "prevMonthAriaLabel": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "nextMonthAriaLabel": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "dayFormat": { "$ref": "#/$defs/dayFormatProp" }, "weekdayFormat": { "$ref": "#/$defs/weekdayFormatProp" }, "monthFormat": { "$ref": "#/$defs/monthFormatProp" }, "minDate": { "$ref": "#/$defs/minDateProp" }, "maxDate": { "$ref": "#/$defs/maxDateProp" }, "numberOfMonths": { "$ref": "#/$defs/numberOfMonthsProp" }, "disabledRanges": { "$ref": "#/$defs/disabledRangesProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^prevMonthIcon\\.[^.]+$": { "$ref": "#/$defs/prevMonthIconProp" }, "^nextMonthIcon\\.[^.]+$": { "$ref": "#/$defs/nextMonthIconProp" }, "^prevMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "^nextMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "^dayFormat\\.[^.]+$": { "$ref": "#/$defs/dayFormatProp" }, "^weekdayFormat\\.[^.]+$": { "$ref": "#/$defs/weekdayFormatProp" }, "^monthFormat\\.[^.]+$": { "$ref": "#/$defs/monthFormatProp" }, "^minDate\\.[^.]+$": { "$ref": "#/$defs/minDateProp" }, "^maxDate\\.[^.]+$": { "$ref": "#/$defs/maxDateProp" }, "^numberOfMonths\\.[^.]+$": { "$ref": "#/$defs/numberOfMonthsProp" }, "^disabledRanges\\.[^.]+$": { "$ref": "#/$defs/disabledRangesProp" } }, "additionalProperties": false } };
|
|
568
|
+
const patternProperties$f = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
569
|
+
const required$j = ["kind", "type", "path"];
|
|
570
|
+
const unevaluatedProperties$j = false;
|
|
571
|
+
const datepicker = {
|
|
572
|
+
$schema: $schema$j,
|
|
573
|
+
$id: $id$j,
|
|
574
|
+
title: title$j,
|
|
575
|
+
type: type$j,
|
|
576
|
+
$defs: $defs$j,
|
|
577
|
+
allOf: allOf$j,
|
|
578
|
+
properties: properties$j,
|
|
579
|
+
patternProperties: patternProperties$f,
|
|
580
|
+
required: required$j,
|
|
581
|
+
unevaluatedProperties: unevaluatedProperties$j
|
|
582
|
+
};
|
|
583
|
+
const $schema$i = "https://json-schema.org/draft/2020-12/schema";
|
|
584
|
+
const $id$i = "https://golemui.com/schemas/components/dropdown.schema.json";
|
|
585
|
+
const title$i = "Dropdown Widget";
|
|
586
|
+
const type$i = "object";
|
|
587
|
+
const $defs$i = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "itemsProp": { "type": "array", "description": "Items are either primitive values (string/number) or arbitrary record objects (paired with `labelField`/`valueField`/`itemRenderer` for custom rendering). Note: widget templates inside items are only supported on `repeater`, not here.", "items": { "type": ["string", "number", "object"] } }, "labelFieldProp": { "type": "string" }, "valueFieldProp": { "type": "string" }, "searchFieldsProp": { "type": "array", "items": { "type": "string" } }, "heightProp": { "type": "number" }, "itemHeightProp": { "type": "number" }, "itemRendererProp": { "type": "string" }, "inputDebounceProp": { "type": "number" }, "autocompleteProp": { "type": "string" } };
|
|
588
|
+
const allOf$i = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
589
|
+
const properties$i = { "kind": { "const": "input" }, "type": { "const": "dropdown" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "required": ["items"], "properties": { "placeholder": { "$ref": "#/$defs/placeholderProp" }, "hint": { "$ref": "#/$defs/hintProp" }, "items": { "$ref": "#/$defs/itemsProp" }, "labelField": { "$ref": "#/$defs/labelFieldProp" }, "valueField": { "$ref": "#/$defs/valueFieldProp" }, "searchFields": { "$ref": "#/$defs/searchFieldsProp" }, "height": { "$ref": "#/$defs/heightProp" }, "itemHeight": { "$ref": "#/$defs/itemHeightProp" }, "itemRenderer": { "$ref": "#/$defs/itemRendererProp" }, "inputDebounce": { "$ref": "#/$defs/inputDebounceProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^items\\.[^.]+$": { "$ref": "#/$defs/itemsProp" }, "^labelField\\.[^.]+$": { "$ref": "#/$defs/labelFieldProp" }, "^valueField\\.[^.]+$": { "$ref": "#/$defs/valueFieldProp" }, "^searchFields\\.[^.]+$": { "$ref": "#/$defs/searchFieldsProp" }, "^height\\.[^.]+$": { "$ref": "#/$defs/heightProp" }, "^itemHeight\\.[^.]+$": { "$ref": "#/$defs/itemHeightProp" }, "^itemRenderer\\.[^.]+$": { "$ref": "#/$defs/itemRendererProp" }, "^inputDebounce\\.[^.]+$": { "$ref": "#/$defs/inputDebounceProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
590
|
+
const patternProperties$e = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
591
|
+
const required$i = ["kind", "type", "path", "props"];
|
|
592
|
+
const unevaluatedProperties$i = false;
|
|
593
|
+
const dropdown = {
|
|
594
|
+
$schema: $schema$i,
|
|
595
|
+
$id: $id$i,
|
|
596
|
+
title: title$i,
|
|
597
|
+
type: type$i,
|
|
598
|
+
$defs: $defs$i,
|
|
599
|
+
allOf: allOf$i,
|
|
600
|
+
properties: properties$i,
|
|
601
|
+
patternProperties: patternProperties$e,
|
|
602
|
+
required: required$i,
|
|
603
|
+
unevaluatedProperties: unevaluatedProperties$i
|
|
604
|
+
};
|
|
605
|
+
const $schema$h = "https://json-schema.org/draft/2020-12/schema";
|
|
606
|
+
const $id$h = "https://golemui.com/schemas/components/flex.schema.json";
|
|
607
|
+
const title$h = "Flex Widget";
|
|
608
|
+
const type$h = "object";
|
|
609
|
+
const $defs$h = { "directionProp": { "enum": ["row", "row-reverse", "column", "column-reverse"] }, "justifyProp": { "enum": ["center", "start", "end", "stretch"] }, "alignProp": { "enum": ["center", "start", "end", "space-between", "space-around", "space-evenly"] }, "gapProp": { "type": "number" } };
|
|
610
|
+
const allOf$h = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
611
|
+
const properties$h = { "kind": { "const": "layout" }, "type": { "const": "flex" }, "children": { "type": "array", "minItems": 1, "items": { "$ref": "../form.schema.json#/$defs/formWidget" } }, "props": { "type": "object", "properties": { "direction": { "$ref": "#/$defs/directionProp" }, "justify": { "$ref": "#/$defs/justifyProp" }, "align": { "$ref": "#/$defs/alignProp" }, "gap": { "$ref": "#/$defs/gapProp" } }, "patternProperties": { "^direction\\.[^.]+$": { "$ref": "#/$defs/directionProp" }, "^justify\\.[^.]+$": { "$ref": "#/$defs/justifyProp" }, "^align\\.[^.]+$": { "$ref": "#/$defs/alignProp" }, "^gap\\.[^.]+$": { "$ref": "#/$defs/gapProp" } }, "additionalProperties": false } };
|
|
612
|
+
const required$h = ["kind", "type", "children"];
|
|
613
|
+
const unevaluatedProperties$h = false;
|
|
614
|
+
const flex = {
|
|
615
|
+
$schema: $schema$h,
|
|
616
|
+
$id: $id$h,
|
|
617
|
+
title: title$h,
|
|
618
|
+
type: type$h,
|
|
619
|
+
$defs: $defs$h,
|
|
620
|
+
allOf: allOf$h,
|
|
621
|
+
properties: properties$h,
|
|
622
|
+
required: required$h,
|
|
623
|
+
unevaluatedProperties: unevaluatedProperties$h
|
|
624
|
+
};
|
|
625
|
+
const $schema$g = "https://json-schema.org/draft/2020-12/schema";
|
|
626
|
+
const $id$g = "https://golemui.com/schemas/components/grid.schema.json";
|
|
627
|
+
const title$g = "Grid Widget";
|
|
628
|
+
const type$g = "object";
|
|
629
|
+
const $defs$g = { "directionProp": { "enum": ["row", "column"] }, "columnGapProp": { "type": "number" }, "rowGapProp": { "type": "number" }, "autoFitProp": { "type": "boolean" }, "alignProp": { "enum": ["center", "start", "end", "space-between", "space-around", "space-evenly", "stretch"] }, "justifyProp": { "enum": ["center", "start", "end", "stretch"] } };
|
|
630
|
+
const allOf$g = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
631
|
+
const properties$g = { "kind": { "const": "layout" }, "type": { "const": "grid" }, "children": { "type": "array", "minItems": 1, "items": { "$ref": "../form.schema.json#/$defs/formWidget" } }, "props": { "type": "object", "properties": { "direction": { "$ref": "#/$defs/directionProp" }, "columnGap": { "$ref": "#/$defs/columnGapProp" }, "rowGap": { "$ref": "#/$defs/rowGapProp" }, "autoFit": { "$ref": "#/$defs/autoFitProp" }, "align": { "$ref": "#/$defs/alignProp" }, "justify": { "$ref": "#/$defs/justifyProp" } }, "patternProperties": { "^direction\\.[^.]+$": { "$ref": "#/$defs/directionProp" }, "^columnGap\\.[^.]+$": { "$ref": "#/$defs/columnGapProp" }, "^rowGap\\.[^.]+$": { "$ref": "#/$defs/rowGapProp" }, "^autoFit\\.[^.]+$": { "$ref": "#/$defs/autoFitProp" }, "^align\\.[^.]+$": { "$ref": "#/$defs/alignProp" }, "^justify\\.[^.]+$": { "$ref": "#/$defs/justifyProp" } }, "additionalProperties": false } };
|
|
632
|
+
const required$g = ["kind", "type", "children"];
|
|
633
|
+
const unevaluatedProperties$g = false;
|
|
634
|
+
const grid = {
|
|
635
|
+
$schema: $schema$g,
|
|
636
|
+
$id: $id$g,
|
|
637
|
+
title: title$g,
|
|
638
|
+
type: type$g,
|
|
639
|
+
$defs: $defs$g,
|
|
640
|
+
allOf: allOf$g,
|
|
641
|
+
properties: properties$g,
|
|
642
|
+
required: required$g,
|
|
643
|
+
unevaluatedProperties: unevaluatedProperties$g
|
|
644
|
+
};
|
|
645
|
+
const $schema$f = "https://json-schema.org/draft/2020-12/schema";
|
|
646
|
+
const $id$f = "https://golemui.com/schemas/components/list.schema.json";
|
|
647
|
+
const title$f = "List Widget";
|
|
648
|
+
const type$f = "object";
|
|
649
|
+
const $defs$f = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "itemsProp": { "type": "array", "description": "Items are either primitive values (string/number) or arbitrary record objects (paired with `labelField`/`valueField`/`itemRenderer` for custom rendering). Note: widget templates inside items are only supported on `repeater`, not here.", "items": { "type": ["string", "number", "object"] } }, "labelFieldProp": { "type": "string" }, "valueFieldProp": { "type": "string" }, "heightProp": { "type": "number" }, "itemHeightProp": { "type": "number" }, "itemRendererProp": { "type": "string" } };
|
|
650
|
+
const allOf$f = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
651
|
+
const properties$f = { "kind": { "const": "input" }, "type": { "const": "list" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "items": { "$ref": "#/$defs/itemsProp" }, "labelField": { "$ref": "#/$defs/labelFieldProp" }, "valueField": { "$ref": "#/$defs/valueFieldProp" }, "height": { "$ref": "#/$defs/heightProp" }, "itemHeight": { "$ref": "#/$defs/itemHeightProp" }, "itemRenderer": { "$ref": "#/$defs/itemRendererProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^items\\.[^.]+$": { "$ref": "#/$defs/itemsProp" }, "^labelField\\.[^.]+$": { "$ref": "#/$defs/labelFieldProp" }, "^valueField\\.[^.]+$": { "$ref": "#/$defs/valueFieldProp" }, "^height\\.[^.]+$": { "$ref": "#/$defs/heightProp" }, "^itemHeight\\.[^.]+$": { "$ref": "#/$defs/itemHeightProp" }, "^itemRenderer\\.[^.]+$": { "$ref": "#/$defs/itemRendererProp" } }, "additionalProperties": false } };
|
|
652
|
+
const patternProperties$d = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
653
|
+
const required$f = ["kind", "type", "path"];
|
|
654
|
+
const unevaluatedProperties$f = false;
|
|
655
|
+
const list = {
|
|
656
|
+
$schema: $schema$f,
|
|
657
|
+
$id: $id$f,
|
|
658
|
+
title: title$f,
|
|
659
|
+
type: type$f,
|
|
660
|
+
$defs: $defs$f,
|
|
661
|
+
allOf: allOf$f,
|
|
662
|
+
properties: properties$f,
|
|
663
|
+
patternProperties: patternProperties$d,
|
|
664
|
+
required: required$f,
|
|
665
|
+
unevaluatedProperties: unevaluatedProperties$f
|
|
666
|
+
};
|
|
667
|
+
const $schema$e = "https://json-schema.org/draft/2020-12/schema";
|
|
668
|
+
const $id$e = "https://golemui.com/schemas/components/markdown.schema.json";
|
|
669
|
+
const title$e = "Markdown Widget";
|
|
670
|
+
const type$e = "object";
|
|
671
|
+
const $defs$e = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "counterModeProp": { "enum": ["remaining", "current"] }, "minimumHeightProp": { "type": "number" }, "autoGrowProp": { "type": "boolean" }, "defaultOpenPreviewProp": { "type": "boolean" }, "maxLengthProp": { "type": "number" }, "toolsProp": { "type": "array", "items": { "enum": ["H", "B", "I", "Q", "L", "OL", "UL", "|"] } }, "splitViewTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "headingTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "boldTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "italicTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "strikethroughTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "quoteTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "linkTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "orderedListTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "unorderedListTitleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "autocompleteProp": { "type": "string" } };
|
|
672
|
+
const allOf$e = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
673
|
+
const properties$e = { "kind": { "const": "input" }, "type": { "const": "markdown" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "string" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "counterMode": { "$ref": "#/$defs/counterModeProp" }, "minimumHeight": { "$ref": "#/$defs/minimumHeightProp" }, "autoGrow": { "$ref": "#/$defs/autoGrowProp" }, "defaultOpenPreview": { "$ref": "#/$defs/defaultOpenPreviewProp" }, "maxLength": { "$ref": "#/$defs/maxLengthProp" }, "tools": { "$ref": "#/$defs/toolsProp" }, "splitViewTitle": { "$ref": "#/$defs/splitViewTitleProp" }, "headingTitle": { "$ref": "#/$defs/headingTitleProp" }, "boldTitle": { "$ref": "#/$defs/boldTitleProp" }, "italicTitle": { "$ref": "#/$defs/italicTitleProp" }, "strikethroughTitle": { "$ref": "#/$defs/strikethroughTitleProp" }, "quoteTitle": { "$ref": "#/$defs/quoteTitleProp" }, "linkTitle": { "$ref": "#/$defs/linkTitleProp" }, "orderedListTitle": { "$ref": "#/$defs/orderedListTitleProp" }, "unorderedListTitle": { "$ref": "#/$defs/unorderedListTitleProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^counterMode\\.[^.]+$": { "$ref": "#/$defs/counterModeProp" }, "^minimumHeight\\.[^.]+$": { "$ref": "#/$defs/minimumHeightProp" }, "^autoGrow\\.[^.]+$": { "$ref": "#/$defs/autoGrowProp" }, "^defaultOpenPreview\\.[^.]+$": { "$ref": "#/$defs/defaultOpenPreviewProp" }, "^maxLength\\.[^.]+$": { "$ref": "#/$defs/maxLengthProp" }, "^tools\\.[^.]+$": { "$ref": "#/$defs/toolsProp" }, "^splitViewTitle\\.[^.]+$": { "$ref": "#/$defs/splitViewTitleProp" }, "^headingTitle\\.[^.]+$": { "$ref": "#/$defs/headingTitleProp" }, "^boldTitle\\.[^.]+$": { "$ref": "#/$defs/boldTitleProp" }, "^italicTitle\\.[^.]+$": { "$ref": "#/$defs/italicTitleProp" }, "^strikethroughTitle\\.[^.]+$": { "$ref": "#/$defs/strikethroughTitleProp" }, "^quoteTitle\\.[^.]+$": { "$ref": "#/$defs/quoteTitleProp" }, "^linkTitle\\.[^.]+$": { "$ref": "#/$defs/linkTitleProp" }, "^orderedListTitle\\.[^.]+$": { "$ref": "#/$defs/orderedListTitleProp" }, "^unorderedListTitle\\.[^.]+$": { "$ref": "#/$defs/unorderedListTitleProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
674
|
+
const patternProperties$c = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
675
|
+
const required$e = ["kind", "type", "path"];
|
|
676
|
+
const unevaluatedProperties$e = false;
|
|
677
|
+
const markdown = {
|
|
678
|
+
$schema: $schema$e,
|
|
679
|
+
$id: $id$e,
|
|
680
|
+
title: title$e,
|
|
681
|
+
type: type$e,
|
|
682
|
+
$defs: $defs$e,
|
|
683
|
+
allOf: allOf$e,
|
|
684
|
+
properties: properties$e,
|
|
685
|
+
patternProperties: patternProperties$c,
|
|
686
|
+
required: required$e,
|
|
687
|
+
unevaluatedProperties: unevaluatedProperties$e
|
|
688
|
+
};
|
|
689
|
+
const $schema$d = "https://json-schema.org/draft/2020-12/schema";
|
|
690
|
+
const $id$d = "https://golemui.com/schemas/components/markdowntext.schema.json";
|
|
691
|
+
const title$d = "MarkdownText Widget";
|
|
692
|
+
const type$d = "object";
|
|
693
|
+
const $defs$d = { "mdProp": { "$ref": "../common.schema.json#/$defs/localizable" } };
|
|
694
|
+
const allOf$d = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
695
|
+
const properties$d = { "kind": { "const": "display" }, "type": { "const": "markdownText" }, "props": { "type": "object", "properties": { "md": { "$ref": "#/$defs/mdProp" } }, "patternProperties": { "^md\\.[^.]+$": { "$ref": "#/$defs/mdProp" } }, "required": ["md"], "additionalProperties": false } };
|
|
696
|
+
const required$d = ["kind", "type", "props"];
|
|
697
|
+
const unevaluatedProperties$d = false;
|
|
698
|
+
const markdowntext = {
|
|
699
|
+
$schema: $schema$d,
|
|
700
|
+
$id: $id$d,
|
|
701
|
+
title: title$d,
|
|
702
|
+
type: type$d,
|
|
703
|
+
$defs: $defs$d,
|
|
704
|
+
allOf: allOf$d,
|
|
705
|
+
properties: properties$d,
|
|
706
|
+
required: required$d,
|
|
707
|
+
unevaluatedProperties: unevaluatedProperties$d
|
|
708
|
+
};
|
|
709
|
+
const $schema$c = "https://json-schema.org/draft/2020-12/schema";
|
|
710
|
+
const $id$c = "https://golemui.com/schemas/components/number.schema.json";
|
|
711
|
+
const title$c = "Number Widget";
|
|
712
|
+
const type$c = "object";
|
|
713
|
+
const $defs$c = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "stepProp": { "type": "number" }, "minimumProp": { "type": "number" }, "maximumProp": { "type": "number" }, "autoGrowProp": { "type": "boolean" }, "autocompleteProp": { "type": "string" } };
|
|
714
|
+
const allOf$c = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
715
|
+
const properties$c = { "kind": { "const": "input" }, "type": { "const": "number" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "number" }, "props": { "type": "object", "properties": { "placeholder": { "$ref": "#/$defs/placeholderProp" }, "hint": { "$ref": "#/$defs/hintProp" }, "step": { "$ref": "#/$defs/stepProp" }, "minimum": { "$ref": "#/$defs/minimumProp" }, "maximum": { "$ref": "#/$defs/maximumProp" }, "autoGrow": { "$ref": "#/$defs/autoGrowProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^step\\.[^.]+$": { "$ref": "#/$defs/stepProp" }, "^minimum\\.[^.]+$": { "$ref": "#/$defs/minimumProp" }, "^maximum\\.[^.]+$": { "$ref": "#/$defs/maximumProp" }, "^autoGrow\\.[^.]+$": { "$ref": "#/$defs/autoGrowProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
716
|
+
const patternProperties$b = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
717
|
+
const required$c = ["kind", "type", "path"];
|
|
718
|
+
const unevaluatedProperties$c = false;
|
|
719
|
+
const numberWidget = {
|
|
720
|
+
$schema: $schema$c,
|
|
721
|
+
$id: $id$c,
|
|
722
|
+
title: title$c,
|
|
723
|
+
type: type$c,
|
|
724
|
+
$defs: $defs$c,
|
|
725
|
+
allOf: allOf$c,
|
|
726
|
+
properties: properties$c,
|
|
727
|
+
patternProperties: patternProperties$b,
|
|
728
|
+
required: required$c,
|
|
729
|
+
unevaluatedProperties: unevaluatedProperties$c
|
|
730
|
+
};
|
|
731
|
+
const $schema$b = "https://json-schema.org/draft/2020-12/schema";
|
|
732
|
+
const $id$b = "https://golemui.com/schemas/components/password.schema.json";
|
|
733
|
+
const title$b = "Password Widget";
|
|
734
|
+
const type$b = "object";
|
|
735
|
+
const $defs$b = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "showPasswordIconProp": { "type": "string" }, "hidePasswordIconProp": { "type": "string" }, "showPasswordLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "hidePasswordLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "autocompleteProp": { "type": "string" } };
|
|
736
|
+
const allOf$b = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
737
|
+
const properties$b = { "kind": { "const": "input" }, "type": { "const": "password" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "string" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "showPasswordIcon": { "$ref": "#/$defs/showPasswordIconProp" }, "hidePasswordIcon": { "$ref": "#/$defs/hidePasswordIconProp" }, "showPasswordLabel": { "$ref": "#/$defs/showPasswordLabelProp" }, "hidePasswordLabel": { "$ref": "#/$defs/hidePasswordLabelProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^showPasswordIcon\\.[^.]+$": { "$ref": "#/$defs/showPasswordIconProp" }, "^hidePasswordIcon\\.[^.]+$": { "$ref": "#/$defs/hidePasswordIconProp" }, "^showPasswordLabel\\.[^.]+$": { "$ref": "#/$defs/showPasswordLabelProp" }, "^hidePasswordLabel\\.[^.]+$": { "$ref": "#/$defs/hidePasswordLabelProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
738
|
+
const patternProperties$a = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
739
|
+
const required$b = ["kind", "type", "path"];
|
|
740
|
+
const unevaluatedProperties$b = false;
|
|
741
|
+
const password = {
|
|
742
|
+
$schema: $schema$b,
|
|
743
|
+
$id: $id$b,
|
|
744
|
+
title: title$b,
|
|
745
|
+
type: type$b,
|
|
746
|
+
$defs: $defs$b,
|
|
747
|
+
allOf: allOf$b,
|
|
748
|
+
properties: properties$b,
|
|
749
|
+
patternProperties: patternProperties$a,
|
|
750
|
+
required: required$b,
|
|
751
|
+
unevaluatedProperties: unevaluatedProperties$b
|
|
752
|
+
};
|
|
753
|
+
const $schema$a = "https://json-schema.org/draft/2020-12/schema";
|
|
754
|
+
const $id$a = "https://golemui.com/schemas/components/radiogroup.schema.json";
|
|
755
|
+
const title$a = "RadioGroup Widget";
|
|
756
|
+
const type$a = "object";
|
|
757
|
+
const $defs$a = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "optionsProp": { "type": "array", "description": "Options may be primitive values (string/number), structured `{ label, value }` records, or arbitrary objects (paired with `labelField`/`valueField` for custom rendering).", "items": { "type": ["string", "number", "object"] } }, "labelFieldProp": { "type": "string" }, "valueFieldProp": { "type": "string" }, "directionProp": { "enum": ["row", "column"], "default": "column" } };
|
|
758
|
+
const allOf$a = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
759
|
+
const properties$a = { "kind": { "const": "input" }, "type": { "const": "radiogroup" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "options": { "$ref": "#/$defs/optionsProp" }, "labelField": { "$ref": "#/$defs/labelFieldProp" }, "valueField": { "$ref": "#/$defs/valueFieldProp" }, "direction": { "$ref": "#/$defs/directionProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^options\\.[^.]+$": { "$ref": "#/$defs/optionsProp" }, "^labelField\\.[^.]+$": { "$ref": "#/$defs/labelFieldProp" }, "^valueField\\.[^.]+$": { "$ref": "#/$defs/valueFieldProp" }, "^direction\\.[^.]+$": { "$ref": "#/$defs/directionProp" } }, "additionalProperties": false } };
|
|
760
|
+
const patternProperties$9 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
761
|
+
const required$a = ["kind", "type", "path"];
|
|
762
|
+
const unevaluatedProperties$a = false;
|
|
763
|
+
const radiogroup = {
|
|
764
|
+
$schema: $schema$a,
|
|
765
|
+
$id: $id$a,
|
|
766
|
+
title: title$a,
|
|
767
|
+
type: type$a,
|
|
768
|
+
$defs: $defs$a,
|
|
769
|
+
allOf: allOf$a,
|
|
770
|
+
properties: properties$a,
|
|
771
|
+
patternProperties: patternProperties$9,
|
|
772
|
+
required: required$a,
|
|
773
|
+
unevaluatedProperties: unevaluatedProperties$a
|
|
774
|
+
};
|
|
775
|
+
const $schema$9 = "https://json-schema.org/draft/2020-12/schema";
|
|
776
|
+
const $id$9 = "https://golemui.com/schemas/components/rangecalendar.schema.json";
|
|
777
|
+
const title$9 = "RangeCalendar Widget";
|
|
778
|
+
const type$9 = "object";
|
|
779
|
+
const $defs$9 = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "prevMonthIconProp": { "type": "string" }, "nextMonthIconProp": { "type": "string" }, "prevMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "nextMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "removePillAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "dayFormatProp": { "enum": ["numeric", "2-digit"] }, "weekdayFormatProp": { "enum": ["short", "long", "narrow"] }, "monthFormatProp": { "enum": ["numeric", "2-digit", "long", "short", "narrow"] }, "minDateProp": { "type": "string" }, "maxDateProp": { "type": "string" }, "numberOfMonthsProp": { "type": "number" }, "disabledRangesProp": { "type": "array", "items": { "$ref": "../common.schema.json#/$defs/dateRange" } } };
|
|
780
|
+
const allOf$9 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
781
|
+
const properties$9 = { "kind": { "const": "input" }, "type": { "const": "rangeCalendar" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "prevMonthIcon": { "$ref": "#/$defs/prevMonthIconProp" }, "nextMonthIcon": { "$ref": "#/$defs/nextMonthIconProp" }, "prevMonthAriaLabel": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "nextMonthAriaLabel": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "removePillAriaLabel": { "$ref": "#/$defs/removePillAriaLabelProp" }, "dayFormat": { "$ref": "#/$defs/dayFormatProp" }, "weekdayFormat": { "$ref": "#/$defs/weekdayFormatProp" }, "monthFormat": { "$ref": "#/$defs/monthFormatProp" }, "minDate": { "$ref": "#/$defs/minDateProp" }, "maxDate": { "$ref": "#/$defs/maxDateProp" }, "numberOfMonths": { "$ref": "#/$defs/numberOfMonthsProp" }, "disabledRanges": { "$ref": "#/$defs/disabledRangesProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^prevMonthIcon\\.[^.]+$": { "$ref": "#/$defs/prevMonthIconProp" }, "^nextMonthIcon\\.[^.]+$": { "$ref": "#/$defs/nextMonthIconProp" }, "^prevMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "^nextMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "^removePillAriaLabel\\.[^.]+$": { "$ref": "#/$defs/removePillAriaLabelProp" }, "^dayFormat\\.[^.]+$": { "$ref": "#/$defs/dayFormatProp" }, "^weekdayFormat\\.[^.]+$": { "$ref": "#/$defs/weekdayFormatProp" }, "^monthFormat\\.[^.]+$": { "$ref": "#/$defs/monthFormatProp" }, "^minDate\\.[^.]+$": { "$ref": "#/$defs/minDateProp" }, "^maxDate\\.[^.]+$": { "$ref": "#/$defs/maxDateProp" }, "^numberOfMonths\\.[^.]+$": { "$ref": "#/$defs/numberOfMonthsProp" }, "^disabledRanges\\.[^.]+$": { "$ref": "#/$defs/disabledRangesProp" } }, "additionalProperties": false } };
|
|
782
|
+
const patternProperties$8 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
783
|
+
const required$9 = ["kind", "type", "path"];
|
|
784
|
+
const unevaluatedProperties$9 = false;
|
|
785
|
+
const rangecalendar = {
|
|
786
|
+
$schema: $schema$9,
|
|
787
|
+
$id: $id$9,
|
|
788
|
+
title: title$9,
|
|
789
|
+
type: type$9,
|
|
790
|
+
$defs: $defs$9,
|
|
791
|
+
allOf: allOf$9,
|
|
792
|
+
properties: properties$9,
|
|
793
|
+
patternProperties: patternProperties$8,
|
|
794
|
+
required: required$9,
|
|
795
|
+
unevaluatedProperties: unevaluatedProperties$9
|
|
796
|
+
};
|
|
797
|
+
const $schema$8 = "https://json-schema.org/draft/2020-12/schema";
|
|
798
|
+
const $id$8 = "https://golemui.com/schemas/components/rangedateinput.schema.json";
|
|
799
|
+
const title$8 = "RangeDateInput Widget";
|
|
800
|
+
const type$8 = "object";
|
|
801
|
+
const $defs$8 = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "separatorProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "removePillAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "startDateAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "endDateAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" } };
|
|
802
|
+
const allOf$8 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
803
|
+
const properties$8 = { "kind": { "const": "input" }, "type": { "const": "rangeDateInput" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "separator": { "$ref": "#/$defs/separatorProp" }, "removePillAriaLabel": { "$ref": "#/$defs/removePillAriaLabelProp" }, "startDateAriaLabel": { "$ref": "#/$defs/startDateAriaLabelProp" }, "endDateAriaLabel": { "$ref": "#/$defs/endDateAriaLabelProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^separator\\.[^.]+$": { "$ref": "#/$defs/separatorProp" }, "^removePillAriaLabel\\.[^.]+$": { "$ref": "#/$defs/removePillAriaLabelProp" }, "^startDateAriaLabel\\.[^.]+$": { "$ref": "#/$defs/startDateAriaLabelProp" }, "^endDateAriaLabel\\.[^.]+$": { "$ref": "#/$defs/endDateAriaLabelProp" } }, "additionalProperties": false } };
|
|
804
|
+
const patternProperties$7 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
805
|
+
const required$8 = ["kind", "type", "path"];
|
|
806
|
+
const unevaluatedProperties$8 = false;
|
|
807
|
+
const rangedateinput = {
|
|
808
|
+
$schema: $schema$8,
|
|
809
|
+
$id: $id$8,
|
|
810
|
+
title: title$8,
|
|
811
|
+
type: type$8,
|
|
812
|
+
$defs: $defs$8,
|
|
813
|
+
allOf: allOf$8,
|
|
814
|
+
properties: properties$8,
|
|
815
|
+
patternProperties: patternProperties$7,
|
|
816
|
+
required: required$8,
|
|
817
|
+
unevaluatedProperties: unevaluatedProperties$8
|
|
818
|
+
};
|
|
819
|
+
const $schema$7 = "https://json-schema.org/draft/2020-12/schema";
|
|
820
|
+
const $id$7 = "https://golemui.com/schemas/components/rangedatepicker.schema.json";
|
|
821
|
+
const title$7 = "RangeDatePicker Widget";
|
|
822
|
+
const type$7 = "object";
|
|
823
|
+
const $defs$7 = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "separatorProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "removePillAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "startDateAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "endDateAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "prevMonthIconProp": { "type": "string" }, "nextMonthIconProp": { "type": "string" }, "prevMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "nextMonthAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "dayFormatProp": { "enum": ["numeric", "2-digit"] }, "weekdayFormatProp": { "enum": ["short", "long", "narrow"] }, "monthFormatProp": { "enum": ["numeric", "2-digit", "long", "short", "narrow"] }, "minDateProp": { "type": "string" }, "maxDateProp": { "type": "string" }, "numberOfMonthsProp": { "type": "number" }, "disabledRangesProp": { "type": "array", "items": { "$ref": "../common.schema.json#/$defs/dateRange" } } };
|
|
824
|
+
const allOf$7 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
825
|
+
const properties$7 = { "kind": { "const": "input" }, "type": { "const": "rangeDatePicker" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "separator": { "$ref": "#/$defs/separatorProp" }, "removePillAriaLabel": { "$ref": "#/$defs/removePillAriaLabelProp" }, "startDateAriaLabel": { "$ref": "#/$defs/startDateAriaLabelProp" }, "endDateAriaLabel": { "$ref": "#/$defs/endDateAriaLabelProp" }, "prevMonthIcon": { "$ref": "#/$defs/prevMonthIconProp" }, "nextMonthIcon": { "$ref": "#/$defs/nextMonthIconProp" }, "prevMonthAriaLabel": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "nextMonthAriaLabel": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "dayFormat": { "$ref": "#/$defs/dayFormatProp" }, "weekdayFormat": { "$ref": "#/$defs/weekdayFormatProp" }, "monthFormat": { "$ref": "#/$defs/monthFormatProp" }, "minDate": { "$ref": "#/$defs/minDateProp" }, "maxDate": { "$ref": "#/$defs/maxDateProp" }, "numberOfMonths": { "$ref": "#/$defs/numberOfMonthsProp" }, "disabledRanges": { "$ref": "#/$defs/disabledRangesProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^separator\\.[^.]+$": { "$ref": "#/$defs/separatorProp" }, "^removePillAriaLabel\\.[^.]+$": { "$ref": "#/$defs/removePillAriaLabelProp" }, "^startDateAriaLabel\\.[^.]+$": { "$ref": "#/$defs/startDateAriaLabelProp" }, "^endDateAriaLabel\\.[^.]+$": { "$ref": "#/$defs/endDateAriaLabelProp" }, "^prevMonthIcon\\.[^.]+$": { "$ref": "#/$defs/prevMonthIconProp" }, "^nextMonthIcon\\.[^.]+$": { "$ref": "#/$defs/nextMonthIconProp" }, "^prevMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/prevMonthAriaLabelProp" }, "^nextMonthAriaLabel\\.[^.]+$": { "$ref": "#/$defs/nextMonthAriaLabelProp" }, "^dayFormat\\.[^.]+$": { "$ref": "#/$defs/dayFormatProp" }, "^weekdayFormat\\.[^.]+$": { "$ref": "#/$defs/weekdayFormatProp" }, "^monthFormat\\.[^.]+$": { "$ref": "#/$defs/monthFormatProp" }, "^minDate\\.[^.]+$": { "$ref": "#/$defs/minDateProp" }, "^maxDate\\.[^.]+$": { "$ref": "#/$defs/maxDateProp" }, "^numberOfMonths\\.[^.]+$": { "$ref": "#/$defs/numberOfMonthsProp" }, "^disabledRanges\\.[^.]+$": { "$ref": "#/$defs/disabledRangesProp" } }, "additionalProperties": false } };
|
|
826
|
+
const patternProperties$6 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
827
|
+
const required$7 = ["kind", "type", "path"];
|
|
828
|
+
const unevaluatedProperties$7 = false;
|
|
829
|
+
const rangedatepicker = {
|
|
830
|
+
$schema: $schema$7,
|
|
831
|
+
$id: $id$7,
|
|
832
|
+
title: title$7,
|
|
833
|
+
type: type$7,
|
|
834
|
+
$defs: $defs$7,
|
|
835
|
+
allOf: allOf$7,
|
|
836
|
+
properties: properties$7,
|
|
837
|
+
patternProperties: patternProperties$6,
|
|
838
|
+
required: required$7,
|
|
839
|
+
unevaluatedProperties: unevaluatedProperties$7
|
|
840
|
+
};
|
|
841
|
+
const $schema$6 = "https://json-schema.org/draft/2020-12/schema";
|
|
842
|
+
const $id$6 = "https://golemui.com/schemas/components/repeater.schema.json";
|
|
843
|
+
const title$6 = "Repeater Widget";
|
|
844
|
+
const type$6 = "object";
|
|
845
|
+
const $defs$6 = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "addLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "removeLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "limitProp": { "type": "number" }, "templateProp": { "$ref": "../layout-widget.schema.json" }, "titleProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "addButtonIconProp": { "type": "string" }, "removeButtonIconProp": { "type": "string" } };
|
|
846
|
+
const allOf$6 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
847
|
+
const properties$6 = { "kind": { "const": "input" }, "type": { "const": "repeater" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "addLabel": { "$ref": "#/$defs/addLabelProp" }, "removeLabel": { "$ref": "#/$defs/removeLabelProp" }, "limit": { "$ref": "#/$defs/limitProp" }, "template": { "$ref": "#/$defs/templateProp" }, "title": { "$ref": "#/$defs/titleProp" }, "addButtonIcon": { "$ref": "#/$defs/addButtonIconProp" }, "removeButtonIcon": { "$ref": "#/$defs/removeButtonIconProp" } }, "required": ["template"], "patternProperties": { "^addLabel\\.[^.]+$": { "$ref": "#/$defs/addLabelProp" }, "^removeLabel\\.[^.]+$": { "$ref": "#/$defs/removeLabelProp" }, "^limit\\.[^.]+$": { "$ref": "#/$defs/limitProp" }, "^template\\.[^.]+$": { "$ref": "#/$defs/templateProp" }, "^title\\.[^.]+$": { "$ref": "#/$defs/titleProp" }, "^addButtonIcon\\.[^.]+$": { "$ref": "#/$defs/addButtonIconProp" }, "^removeButtonIcon\\.[^.]+$": { "$ref": "#/$defs/removeButtonIconProp" } }, "additionalProperties": false } };
|
|
848
|
+
const patternProperties$5 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
849
|
+
const required$6 = ["kind", "type", "path", "props"];
|
|
850
|
+
const unevaluatedProperties$6 = false;
|
|
851
|
+
const repeater = {
|
|
852
|
+
$schema: $schema$6,
|
|
853
|
+
$id: $id$6,
|
|
854
|
+
title: title$6,
|
|
855
|
+
type: type$6,
|
|
856
|
+
$defs: $defs$6,
|
|
857
|
+
allOf: allOf$6,
|
|
858
|
+
properties: properties$6,
|
|
859
|
+
patternProperties: patternProperties$5,
|
|
860
|
+
required: required$6,
|
|
861
|
+
unevaluatedProperties: unevaluatedProperties$6
|
|
862
|
+
};
|
|
863
|
+
const $schema$5 = "https://json-schema.org/draft/2020-12/schema";
|
|
864
|
+
const $id$5 = "https://golemui.com/schemas/components/select.schema.json";
|
|
865
|
+
const title$5 = "Select Widget";
|
|
866
|
+
const type$5 = "object";
|
|
867
|
+
const $defs$5 = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "optionsProp": { "type": "array", "description": "Options may be primitive values (string/number), structured `{ label, value }` records, or arbitrary objects (paired with `labelField`/`valueField` for custom rendering).", "items": { "type": ["string", "number", "object"] } }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "labelFieldProp": { "type": "string" }, "valueFieldProp": { "type": "string" }, "autocompleteProp": { "type": "string" } };
|
|
868
|
+
const allOf$5 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
869
|
+
const properties$5 = { "kind": { "const": "input" }, "type": { "const": "select" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "options": { "$ref": "#/$defs/optionsProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "labelField": { "$ref": "#/$defs/labelFieldProp" }, "valueField": { "$ref": "#/$defs/valueFieldProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^options\\.[^.]+$": { "$ref": "#/$defs/optionsProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^labelField\\.[^.]+$": { "$ref": "#/$defs/labelFieldProp" }, "^valueField\\.[^.]+$": { "$ref": "#/$defs/valueFieldProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
870
|
+
const patternProperties$4 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
871
|
+
const required$5 = ["kind", "type", "path"];
|
|
872
|
+
const unevaluatedProperties$5 = false;
|
|
873
|
+
const select = {
|
|
874
|
+
$schema: $schema$5,
|
|
875
|
+
$id: $id$5,
|
|
876
|
+
title: title$5,
|
|
877
|
+
type: type$5,
|
|
878
|
+
$defs: $defs$5,
|
|
879
|
+
allOf: allOf$5,
|
|
880
|
+
properties: properties$5,
|
|
881
|
+
patternProperties: patternProperties$4,
|
|
882
|
+
required: required$5,
|
|
883
|
+
unevaluatedProperties: unevaluatedProperties$5
|
|
884
|
+
};
|
|
885
|
+
const $schema$4 = "https://json-schema.org/draft/2020-12/schema";
|
|
886
|
+
const $id$4 = "https://golemui.com/schemas/components/tabs.schema.json";
|
|
887
|
+
const title$4 = "Tabs Widget";
|
|
888
|
+
const type$4 = "object";
|
|
889
|
+
const $defs$4 = { "defaultOpenProp": { "type": "string" }, "renderModeProp": { "enum": ["all", "activeOnly"] }, "tabsProp": { "type": "array", "minItems": 1, "items": { "type": "object", "properties": { "label": { "$ref": "../common.schema.json#/$defs/localizable" }, "uid": { "type": "string" } }, "required": ["label", "uid"], "additionalProperties": false } } };
|
|
890
|
+
const allOf$4 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
891
|
+
const properties$4 = { "kind": { "const": "layout" }, "type": { "const": "tabs" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "children": { "type": "array", "minItems": 1, "items": { "$ref": "../form.schema.json#/$defs/formWidget" } }, "props": { "type": "object", "properties": { "defaultOpen": { "$ref": "#/$defs/defaultOpenProp" }, "renderMode": { "$ref": "#/$defs/renderModeProp" }, "tabs": { "$ref": "#/$defs/tabsProp" } }, "required": ["tabs"], "patternProperties": { "^defaultOpen\\.[^.]+$": { "$ref": "#/$defs/defaultOpenProp" }, "^renderMode\\.[^.]+$": { "$ref": "#/$defs/renderModeProp" }, "^tabs\\.[^.]+$": { "$ref": "#/$defs/tabsProp" } }, "additionalProperties": false } };
|
|
892
|
+
const required$4 = ["kind", "type", "children", "props"];
|
|
893
|
+
const unevaluatedProperties$4 = false;
|
|
894
|
+
const tabs = {
|
|
895
|
+
$schema: $schema$4,
|
|
896
|
+
$id: $id$4,
|
|
897
|
+
title: title$4,
|
|
898
|
+
type: type$4,
|
|
899
|
+
$defs: $defs$4,
|
|
900
|
+
allOf: allOf$4,
|
|
901
|
+
properties: properties$4,
|
|
902
|
+
required: required$4,
|
|
903
|
+
unevaluatedProperties: unevaluatedProperties$4
|
|
904
|
+
};
|
|
905
|
+
const $schema$3 = "https://json-schema.org/draft/2020-12/schema";
|
|
906
|
+
const $id$3 = "https://golemui.com/schemas/components/tags.schema.json";
|
|
907
|
+
const title$3 = "Tags Widget";
|
|
908
|
+
const type$3 = "object";
|
|
909
|
+
const $defs$3 = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "separatorsProp": { "type": "array", "items": { "type": "string" } }, "allowDuplicatesProp": { "type": "boolean" }, "trimProp": { "type": "boolean" }, "limitProp": { "type": "number" }, "removeAriaLabelProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "removeIconProp": { "type": "string" } };
|
|
910
|
+
const allOf$3 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
911
|
+
const properties$3 = { "kind": { "const": "input" }, "type": { "const": "tags" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "array", "items": { "type": "string" } }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "separators": { "$ref": "#/$defs/separatorsProp" }, "allowDuplicates": { "$ref": "#/$defs/allowDuplicatesProp" }, "trim": { "$ref": "#/$defs/trimProp" }, "limit": { "$ref": "#/$defs/limitProp" }, "removeAriaLabel": { "$ref": "#/$defs/removeAriaLabelProp" }, "removeIcon": { "$ref": "#/$defs/removeIconProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^separators\\.[^.]+$": { "$ref": "#/$defs/separatorsProp" }, "^allowDuplicates\\.[^.]+$": { "$ref": "#/$defs/allowDuplicatesProp" }, "^trim\\.[^.]+$": { "$ref": "#/$defs/trimProp" }, "^limit\\.[^.]+$": { "$ref": "#/$defs/limitProp" }, "^removeAriaLabel\\.[^.]+$": { "$ref": "#/$defs/removeAriaLabelProp" }, "^removeIcon\\.[^.]+$": { "$ref": "#/$defs/removeIconProp" } }, "additionalProperties": false } };
|
|
912
|
+
const patternProperties$3 = { "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
913
|
+
const required$3 = ["kind", "type", "path"];
|
|
914
|
+
const unevaluatedProperties$3 = false;
|
|
915
|
+
const tags = {
|
|
916
|
+
$schema: $schema$3,
|
|
917
|
+
$id: $id$3,
|
|
918
|
+
title: title$3,
|
|
919
|
+
type: type$3,
|
|
920
|
+
$defs: $defs$3,
|
|
921
|
+
allOf: allOf$3,
|
|
922
|
+
properties: properties$3,
|
|
923
|
+
patternProperties: patternProperties$3,
|
|
924
|
+
required: required$3,
|
|
925
|
+
unevaluatedProperties: unevaluatedProperties$3
|
|
926
|
+
};
|
|
927
|
+
const $schema$2 = "https://json-schema.org/draft/2020-12/schema";
|
|
928
|
+
const $id$2 = "https://golemui.com/schemas/components/textarea.schema.json";
|
|
929
|
+
const title$2 = "TextArea Widget";
|
|
930
|
+
const type$2 = "object";
|
|
931
|
+
const $defs$2 = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "counterModeProp": { "enum": ["remaining", "current"] }, "minimumHeightProp": { "type": "number" }, "autoGrowProp": { "type": "boolean" }, "maxLengthProp": { "type": "number" }, "autocompleteProp": { "type": "string" } };
|
|
932
|
+
const allOf$2 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
933
|
+
const properties$2 = { "kind": { "const": "input" }, "type": { "const": "textarea" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "string" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "counterMode": { "$ref": "#/$defs/counterModeProp" }, "minimumHeight": { "$ref": "#/$defs/minimumHeightProp" }, "autoGrow": { "$ref": "#/$defs/autoGrowProp" }, "maxLength": { "$ref": "#/$defs/maxLengthProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^counterMode\\.[^.]+$": { "$ref": "#/$defs/counterModeProp" }, "^minimumHeight\\.[^.]+$": { "$ref": "#/$defs/minimumHeightProp" }, "^autoGrow\\.[^.]+$": { "$ref": "#/$defs/autoGrowProp" }, "^maxLength\\.[^.]+$": { "$ref": "#/$defs/maxLengthProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
934
|
+
const patternProperties$2 = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
935
|
+
const required$2 = ["kind", "type", "path"];
|
|
936
|
+
const unevaluatedProperties$2 = false;
|
|
937
|
+
const textarea = {
|
|
938
|
+
$schema: $schema$2,
|
|
939
|
+
$id: $id$2,
|
|
940
|
+
title: title$2,
|
|
941
|
+
type: type$2,
|
|
942
|
+
$defs: $defs$2,
|
|
943
|
+
allOf: allOf$2,
|
|
944
|
+
properties: properties$2,
|
|
945
|
+
patternProperties: patternProperties$2,
|
|
946
|
+
required: required$2,
|
|
947
|
+
unevaluatedProperties: unevaluatedProperties$2
|
|
948
|
+
};
|
|
949
|
+
const $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
950
|
+
const $id$1 = "https://golemui.com/schemas/components/textinput.schema.json";
|
|
951
|
+
const title$1 = "TextInput Widget";
|
|
952
|
+
const type$1 = "object";
|
|
953
|
+
const $defs$1 = { "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "placeholderProp": { "$ref": "../common.schema.json#/$defs/localizable" }, "iconProp": { "type": "string" }, "autocompleteProp": { "type": "string" } };
|
|
954
|
+
const allOf$1 = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
955
|
+
const properties$1 = { "kind": { "const": "input" }, "type": { "const": "textinput" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "string" }, "props": { "type": "object", "properties": { "hint": { "$ref": "#/$defs/hintProp" }, "placeholder": { "$ref": "#/$defs/placeholderProp" }, "icon": { "$ref": "#/$defs/iconProp" }, "autocomplete": { "$ref": "#/$defs/autocompleteProp" } }, "patternProperties": { "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { "$ref": "#/$defs/placeholderProp" }, "^icon\\.[^.]+$": { "$ref": "#/$defs/iconProp" }, "^autocomplete\\.[^.]+$": { "$ref": "#/$defs/autocompleteProp" } }, "additionalProperties": false } };
|
|
956
|
+
const patternProperties$1 = { "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
957
|
+
const required$1 = ["kind", "type", "path"];
|
|
958
|
+
const unevaluatedProperties$1 = false;
|
|
959
|
+
const textinput = {
|
|
960
|
+
$schema: $schema$1,
|
|
961
|
+
$id: $id$1,
|
|
962
|
+
title: title$1,
|
|
963
|
+
type: type$1,
|
|
964
|
+
$defs: $defs$1,
|
|
965
|
+
allOf: allOf$1,
|
|
966
|
+
properties: properties$1,
|
|
967
|
+
patternProperties: patternProperties$1,
|
|
968
|
+
required: required$1,
|
|
969
|
+
unevaluatedProperties: unevaluatedProperties$1
|
|
970
|
+
};
|
|
971
|
+
const $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
972
|
+
const $id = "https://golemui.com/schemas/components/toggle.schema.json";
|
|
973
|
+
const title = "Toggle Widget";
|
|
974
|
+
const type = "object";
|
|
975
|
+
const $defs = { "labelDef": { "$ref": "../common.schema.json#/$defs/localizable" }, "disabledDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "readonlyDef": { "$ref": "../common.schema.json#/$defs/boolOrWhen" }, "togglePositionProp": { "enum": ["left", "right"], "default": "left" }, "hintProp": { "$ref": "../common.schema.json#/$defs/localizable" } };
|
|
976
|
+
const allOf = [{ "$ref": "../common.schema.json#/$defs/baseWidget" }];
|
|
977
|
+
const properties = { "kind": { "const": "input" }, "type": { "const": "toggle" }, "path": { "$ref": "../common.schema.json#/$defs/dotPath" }, "label": { "$ref": "#/$defs/labelDef" }, "disabled": { "$ref": "#/$defs/disabledDef" }, "readonly": { "$ref": "#/$defs/readonlyDef" }, "on": { "$ref": "../common.schema.json#/$defs/on" }, "validator": { "$ref": "../validators.schema.json#/$defs/validator" }, "defaultValue": { "type": "boolean" }, "props": { "type": "object", "properties": { "togglePosition": { "$ref": "#/$defs/togglePositionProp" }, "hint": { "$ref": "#/$defs/hintProp" } }, "patternProperties": { "^togglePosition\\.[^.]+$": { "$ref": "#/$defs/togglePositionProp" }, "^hint\\.[^.]+$": { "$ref": "#/$defs/hintProp" } }, "additionalProperties": false } };
|
|
978
|
+
const patternProperties = { "^label\\.[^.]+$": { "$ref": "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { "$ref": "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { "$ref": "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { "$ref": "../validators.schema.json#/$defs/validator" } };
|
|
979
|
+
const required = ["kind", "type", "path"];
|
|
980
|
+
const unevaluatedProperties = false;
|
|
981
|
+
const toggle = {
|
|
982
|
+
$schema,
|
|
983
|
+
$id,
|
|
984
|
+
title,
|
|
985
|
+
type,
|
|
986
|
+
$defs,
|
|
987
|
+
allOf,
|
|
988
|
+
properties,
|
|
989
|
+
patternProperties,
|
|
990
|
+
required,
|
|
991
|
+
unevaluatedProperties
|
|
992
|
+
};
|
|
993
|
+
const COMMON_SCHEMA = commonSchema;
|
|
994
|
+
const FORM_SCHEMA = formSchema;
|
|
995
|
+
const LAYOUT_WIDGET_SCHEMA = layoutWidgetSchema;
|
|
996
|
+
const VALIDATORS_SCHEMA = validatorsSchema;
|
|
997
|
+
const COMPONENT_SCHEMAS = {
|
|
998
|
+
accordion,
|
|
999
|
+
alert,
|
|
1000
|
+
button,
|
|
1001
|
+
calendar,
|
|
1002
|
+
checkbox,
|
|
1003
|
+
currency,
|
|
1004
|
+
dateInput: dateinput,
|
|
1005
|
+
datePicker: datepicker,
|
|
1006
|
+
dropdown,
|
|
1007
|
+
flex,
|
|
1008
|
+
grid,
|
|
1009
|
+
list,
|
|
1010
|
+
markdown,
|
|
1011
|
+
markdownText: markdowntext,
|
|
1012
|
+
number: numberWidget,
|
|
1013
|
+
password,
|
|
1014
|
+
radiogroup,
|
|
1015
|
+
rangeCalendar: rangecalendar,
|
|
1016
|
+
rangeDateInput: rangedateinput,
|
|
1017
|
+
rangeDatePicker: rangedatepicker,
|
|
1018
|
+
repeater,
|
|
1019
|
+
select,
|
|
1020
|
+
tabs,
|
|
1021
|
+
tags,
|
|
1022
|
+
textarea,
|
|
1023
|
+
textinput,
|
|
1024
|
+
toggle
|
|
1025
|
+
};
|
|
1026
|
+
const ALL_SCHEMAS = [
|
|
1027
|
+
COMMON_SCHEMA,
|
|
1028
|
+
VALIDATORS_SCHEMA,
|
|
1029
|
+
LAYOUT_WIDGET_SCHEMA,
|
|
1030
|
+
...Object.values(COMPONENT_SCHEMAS),
|
|
1031
|
+
FORM_SCHEMA
|
|
1032
|
+
];
|
|
1033
|
+
let cachedAjv = null;
|
|
1034
|
+
let cachedFormValidator = null;
|
|
1035
|
+
function buildAjv() {
|
|
1036
|
+
const ajv = new Ajv2020({
|
|
1037
|
+
allErrors: true,
|
|
1038
|
+
strict: false,
|
|
1039
|
+
verbose: true
|
|
1040
|
+
});
|
|
1041
|
+
addFormats(ajv);
|
|
1042
|
+
for (const schema of ALL_SCHEMAS) {
|
|
1043
|
+
if (typeof schema.$id === "string" && !ajv.getSchema(schema.$id)) {
|
|
1044
|
+
ajv.addSchema(schema);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return ajv;
|
|
1048
|
+
}
|
|
1049
|
+
function getAjv() {
|
|
1050
|
+
if (!cachedAjv) {
|
|
1051
|
+
cachedAjv = buildAjv();
|
|
1052
|
+
}
|
|
1053
|
+
return cachedAjv;
|
|
1054
|
+
}
|
|
1055
|
+
function getFormValidator() {
|
|
1056
|
+
if (!cachedFormValidator) {
|
|
1057
|
+
cachedFormValidator = getAjv().compile(FORM_SCHEMA);
|
|
1058
|
+
}
|
|
1059
|
+
return cachedFormValidator;
|
|
1060
|
+
}
|
|
1061
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1062
|
+
const validatorBranchCache = /* @__PURE__ */ new Map();
|
|
1063
|
+
const VALIDATOR_TYPE_TO_DEF = {
|
|
1064
|
+
string: "stringValidator",
|
|
1065
|
+
number: "numberValidator",
|
|
1066
|
+
integer: "numberValidator",
|
|
1067
|
+
boolean: "booleanValidator",
|
|
1068
|
+
array: "arrayValidator",
|
|
1069
|
+
custom: "customValidator"
|
|
1070
|
+
};
|
|
1071
|
+
function getValidatorBranches() {
|
|
1072
|
+
return Object.keys(VALIDATOR_TYPE_TO_DEF);
|
|
1073
|
+
}
|
|
1074
|
+
function getValidatorBranchValidator(validatorType) {
|
|
1075
|
+
const defKey = VALIDATOR_TYPE_TO_DEF[validatorType];
|
|
1076
|
+
if (!defKey) return null;
|
|
1077
|
+
if (validatorBranchCache.has(defKey)) return validatorBranchCache.get(defKey);
|
|
1078
|
+
const defs = VALIDATORS_SCHEMA.$defs ?? {};
|
|
1079
|
+
const branch = defs[defKey];
|
|
1080
|
+
if (!branch) return null;
|
|
1081
|
+
const cloned = {
|
|
1082
|
+
...JSON.parse(JSON.stringify(branch)),
|
|
1083
|
+
$defs: JSON.parse(JSON.stringify(defs))
|
|
1084
|
+
};
|
|
1085
|
+
rewriteRefs(cloned, VALIDATORS_SCHEMA.$id);
|
|
1086
|
+
const ajv = getAjv();
|
|
1087
|
+
const v = ajv.compile(cloned);
|
|
1088
|
+
validatorBranchCache.set(defKey, v);
|
|
1089
|
+
return v;
|
|
1090
|
+
}
|
|
1091
|
+
function getShallowWidgetValidator(widgetType) {
|
|
1092
|
+
if (cache.has(widgetType)) return cache.get(widgetType);
|
|
1093
|
+
const schema = COMPONENT_SCHEMAS[widgetType];
|
|
1094
|
+
if (!schema) return null;
|
|
1095
|
+
const shallow = makeShallow(schema, schema.$id);
|
|
1096
|
+
const ajv = getAjv();
|
|
1097
|
+
const validator = ajv.compile(shallow);
|
|
1098
|
+
cache.set(widgetType, validator);
|
|
1099
|
+
return validator;
|
|
1100
|
+
}
|
|
1101
|
+
function makeShallow(schema, baseId) {
|
|
1102
|
+
const cloned = JSON.parse(JSON.stringify(schema));
|
|
1103
|
+
rewriteRefs(cloned, baseId);
|
|
1104
|
+
delete cloned["$id"];
|
|
1105
|
+
const props = cloned["properties"] ?? {};
|
|
1106
|
+
if (props["children"]) {
|
|
1107
|
+
props["children"] = { type: "array" };
|
|
1108
|
+
}
|
|
1109
|
+
if (props["validator"]) {
|
|
1110
|
+
props["validator"] = { type: "object" };
|
|
1111
|
+
}
|
|
1112
|
+
const patternProps = cloned["patternProperties"];
|
|
1113
|
+
if (patternProps) {
|
|
1114
|
+
for (const key of Object.keys(patternProps)) {
|
|
1115
|
+
if (key.startsWith("^validator\\.")) {
|
|
1116
|
+
patternProps[key] = { type: "object" };
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
const propsField = props["props"];
|
|
1121
|
+
if (propsField?.properties?.["template"]) {
|
|
1122
|
+
propsField.properties["template"] = { type: "object" };
|
|
1123
|
+
}
|
|
1124
|
+
return cloned;
|
|
1125
|
+
}
|
|
1126
|
+
function rewriteRefs(node, baseId) {
|
|
1127
|
+
if (node === null || typeof node !== "object") return;
|
|
1128
|
+
if (Array.isArray(node)) {
|
|
1129
|
+
for (const item of node) rewriteRefs(item, baseId);
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
const obj = node;
|
|
1133
|
+
if (typeof obj["$ref"] === "string") {
|
|
1134
|
+
const ref = obj["$ref"];
|
|
1135
|
+
if (!ref.startsWith("http") && !ref.startsWith("#")) {
|
|
1136
|
+
try {
|
|
1137
|
+
obj["$ref"] = new URL(ref, baseId).href;
|
|
1138
|
+
} catch {
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
for (const v of Object.values(obj)) rewriteRefs(v, baseId);
|
|
1143
|
+
}
|
|
1144
|
+
const STRING_FORMATS = ["email", "hostname", "ipv4", "ipv6", "url", "uuid", "date", "time", "date-time", "duration"];
|
|
1145
|
+
const WIDGET_TYPES = Object.keys(COMPONENT_SCHEMAS);
|
|
1146
|
+
function levenshtein(a, b) {
|
|
1147
|
+
if (a === b) return 0;
|
|
1148
|
+
if (!a.length) return b.length;
|
|
1149
|
+
if (!b.length) return a.length;
|
|
1150
|
+
let prev = new Array(b.length + 1);
|
|
1151
|
+
let curr = new Array(b.length + 1);
|
|
1152
|
+
for (let j = 0; j <= b.length; j++) prev[j] = j;
|
|
1153
|
+
for (let i = 1; i <= a.length; i++) {
|
|
1154
|
+
curr[0] = i;
|
|
1155
|
+
for (let j = 1; j <= b.length; j++) {
|
|
1156
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
1157
|
+
const del = (prev[j] ?? 0) + 1;
|
|
1158
|
+
const ins = (curr[j - 1] ?? 0) + 1;
|
|
1159
|
+
const sub = (prev[j - 1] ?? 0) + cost;
|
|
1160
|
+
curr[j] = Math.min(del, ins, sub);
|
|
1161
|
+
}
|
|
1162
|
+
[prev, curr] = [curr, prev];
|
|
1163
|
+
}
|
|
1164
|
+
return prev[b.length] ?? 0;
|
|
1165
|
+
}
|
|
1166
|
+
function nearest(target, candidates) {
|
|
1167
|
+
let best;
|
|
1168
|
+
let bestDist = Infinity;
|
|
1169
|
+
for (const c of candidates) {
|
|
1170
|
+
const d = levenshtein(target.toLowerCase(), c.toLowerCase());
|
|
1171
|
+
if (d < bestDist) {
|
|
1172
|
+
bestDist = d;
|
|
1173
|
+
best = c;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return bestDist <= Math.max(2, Math.floor(target.length / 2)) ? best : void 0;
|
|
1177
|
+
}
|
|
1178
|
+
function suggestForAdditional(propertyName, instancePath) {
|
|
1179
|
+
if (/\/validator(\/|$)/.test(instancePath)) {
|
|
1180
|
+
const validatorKeys = ["type", "required", "minLength", "maxLength", "minimum", "maximum", "pattern", "format", "const", "enum", "messages", "minItems", "maxItems", "uniqueItems", "multipleOf", "exclusiveMinimum", "exclusiveMaximum"];
|
|
1181
|
+
const guess = nearest(propertyName, validatorKeys);
|
|
1182
|
+
if (guess && guess !== propertyName) return `Did you mean \`${guess}\`?`;
|
|
1183
|
+
return void 0;
|
|
1184
|
+
}
|
|
1185
|
+
return void 0;
|
|
1186
|
+
}
|
|
1187
|
+
function suggestForEnum(value, allowed) {
|
|
1188
|
+
if (typeof value !== "string") return void 0;
|
|
1189
|
+
const stringAllowed = allowed.filter((v) => typeof v === "string");
|
|
1190
|
+
if (!stringAllowed.length) return void 0;
|
|
1191
|
+
const guess = nearest(value, stringAllowed);
|
|
1192
|
+
if (guess) return `Did you mean \`${guess}\`? Allowed values: ${stringAllowed.map((v) => `\`${v}\``).join(", ")}.`;
|
|
1193
|
+
return `Allowed values: ${stringAllowed.map((v) => `\`${v}\``).join(", ")}.`;
|
|
1194
|
+
}
|
|
1195
|
+
const VALIDATOR_TYPES = ["string", "number", "integer", "boolean", "array", "custom"];
|
|
1196
|
+
function suggestForConst(value, allowed, instancePath) {
|
|
1197
|
+
if (typeof value !== "string" || typeof allowed !== "string") return void 0;
|
|
1198
|
+
if (/^\/form\/\d+(?:\/children\/\d+)*(?:\/props\/template)?\/type$/.test(instancePath)) {
|
|
1199
|
+
const guess = nearest(value, WIDGET_TYPES);
|
|
1200
|
+
return guess ? `Did you mean \`type: '${guess}'\`?` : `Valid widget types: ${WIDGET_TYPES.map((v) => `\`${v}\``).join(", ")}.`;
|
|
1201
|
+
}
|
|
1202
|
+
if (instancePath.endsWith("/validator/type")) {
|
|
1203
|
+
const guess = nearest(value, VALIDATOR_TYPES);
|
|
1204
|
+
return guess ? `Did you mean \`type: '${guess}'\`?` : `Allowed validator types: ${VALIDATOR_TYPES.map((v) => `\`${v}\``).join(", ")}.`;
|
|
1205
|
+
}
|
|
1206
|
+
return void 0;
|
|
1207
|
+
}
|
|
1208
|
+
function describe(value) {
|
|
1209
|
+
if (value === null) return "null";
|
|
1210
|
+
if (Array.isArray(value)) return "array";
|
|
1211
|
+
if (typeof value === "object") return "object";
|
|
1212
|
+
return JSON.stringify(value);
|
|
1213
|
+
}
|
|
1214
|
+
function formatAjvErrors(errors, dataRoot) {
|
|
1215
|
+
if (!errors?.length) return { errors: [], warnings: [] };
|
|
1216
|
+
const collapsed = dataRoot !== void 0 ? collapseOneOfErrors(errors, dataRoot) : { errors, warnings: [] };
|
|
1217
|
+
const filtered = collapsed.errors;
|
|
1218
|
+
const out = [];
|
|
1219
|
+
for (const err2 of filtered) {
|
|
1220
|
+
const path = err2.instancePath || "/";
|
|
1221
|
+
let message = err2.message ?? "invalid value";
|
|
1222
|
+
let suggestion;
|
|
1223
|
+
switch (err2.keyword) {
|
|
1224
|
+
case "additionalProperties":
|
|
1225
|
+
case "unevaluatedProperties": {
|
|
1226
|
+
const prop = err2.params.additionalProperty;
|
|
1227
|
+
if (prop) {
|
|
1228
|
+
message = `Unknown property \`${prop}\` at \`${path}\``;
|
|
1229
|
+
suggestion = suggestForAdditional(prop, path);
|
|
1230
|
+
}
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
case "required": {
|
|
1234
|
+
const prop = err2.params.missingProperty;
|
|
1235
|
+
if (prop) {
|
|
1236
|
+
message = `Missing required property \`${prop}\` at \`${path}\``;
|
|
1237
|
+
}
|
|
1238
|
+
break;
|
|
1239
|
+
}
|
|
1240
|
+
case "enum": {
|
|
1241
|
+
const allowed = err2.params.allowedValues ?? [];
|
|
1242
|
+
const v = describe(err2.data);
|
|
1243
|
+
message = `Value ${v} at \`${path}\` is not one of the allowed values`;
|
|
1244
|
+
suggestion = suggestForEnum(err2.data, allowed);
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
case "const": {
|
|
1248
|
+
const allowed = err2.params.allowedValue;
|
|
1249
|
+
message = `Expected \`${describe(allowed)}\` at \`${path}\`, got \`${describe(err2.data)}\``;
|
|
1250
|
+
suggestion = suggestForConst(err2.data, allowed, path);
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
case "type": {
|
|
1254
|
+
const expected = err2.params.type;
|
|
1255
|
+
message = `Expected type ${Array.isArray(expected) ? expected.join("|") : expected} at \`${path}\`, got ${describe(err2.data)}`;
|
|
1256
|
+
break;
|
|
1257
|
+
}
|
|
1258
|
+
case "oneOf":
|
|
1259
|
+
case "anyOf": {
|
|
1260
|
+
message = `Value at \`${path}\` does not match any allowed variant`;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
default:
|
|
1264
|
+
message = `${err2.message ?? "invalid value"} at \`${path}\``;
|
|
1265
|
+
}
|
|
1266
|
+
if (path.endsWith("/validator/format") && err2.keyword === "enum") {
|
|
1267
|
+
suggestion = `Allowed string formats: ${STRING_FORMATS.map((f) => `\`${f}\``).join(", ")}.`;
|
|
1268
|
+
}
|
|
1269
|
+
out.push({
|
|
1270
|
+
path,
|
|
1271
|
+
message,
|
|
1272
|
+
suggestion,
|
|
1273
|
+
keyword: err2.keyword,
|
|
1274
|
+
params: err2.params
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
return { errors: dedupe(out), warnings: collapsed.warnings };
|
|
1278
|
+
}
|
|
1279
|
+
function extractWidgetPath(instancePath) {
|
|
1280
|
+
const m = instancePath.match(/^(\/form\/\d+(?:\/children\/\d+)*)/);
|
|
1281
|
+
return m ? m[1] : null;
|
|
1282
|
+
}
|
|
1283
|
+
function pickIntendedBranch(widget) {
|
|
1284
|
+
if (!widget || typeof widget !== "object") return null;
|
|
1285
|
+
const w = widget;
|
|
1286
|
+
const widgetType = typeof w.type === "string" ? w.type : void 0;
|
|
1287
|
+
const widgetKind = typeof w.kind === "string" ? w.kind : void 0;
|
|
1288
|
+
if (widgetType && COMPONENT_SCHEMAS[widgetType]) {
|
|
1289
|
+
return { $id: COMPONENT_SCHEMAS[widgetType].$id, type: widgetType };
|
|
1290
|
+
}
|
|
1291
|
+
if (!widgetType) return null;
|
|
1292
|
+
const kindMatched = Object.entries(COMPONENT_SCHEMAS).filter(([, schema]) => {
|
|
1293
|
+
const k = schema["properties"]?.["kind"]?.const;
|
|
1294
|
+
return k === widgetKind;
|
|
1295
|
+
});
|
|
1296
|
+
const pool = kindMatched.length ? kindMatched : Object.entries(COMPONENT_SCHEMAS);
|
|
1297
|
+
const candidateTypes = pool.map(([t]) => t);
|
|
1298
|
+
const match = nearest(widgetType, candidateTypes);
|
|
1299
|
+
if (!match) return null;
|
|
1300
|
+
return { $id: COMPONENT_SCHEMAS[match].$id, type: match };
|
|
1301
|
+
}
|
|
1302
|
+
function collapseOneOfErrors(errors, dataRoot) {
|
|
1303
|
+
const topLevel = [];
|
|
1304
|
+
for (const err2 of errors) {
|
|
1305
|
+
if (extractWidgetPath(err2.instancePath) === null) topLevel.push(err2);
|
|
1306
|
+
}
|
|
1307
|
+
const widgetErrors = [];
|
|
1308
|
+
const warnings = [];
|
|
1309
|
+
const form = dataRoot?.form;
|
|
1310
|
+
if (Array.isArray(form)) {
|
|
1311
|
+
form.forEach((widget, i) => {
|
|
1312
|
+
collectWidgetErrors(widget, `/form/${i}`, widgetErrors, warnings);
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
return { errors: [...topLevel, ...widgetErrors], warnings };
|
|
1316
|
+
}
|
|
1317
|
+
function collectWidgetErrors(widget, widgetPath, out, warnings) {
|
|
1318
|
+
const intended = pickIntendedBranch(widget);
|
|
1319
|
+
if (!intended) {
|
|
1320
|
+
const widgetType = widget?.type;
|
|
1321
|
+
if (typeof widgetType !== "string" || !widgetType) {
|
|
1322
|
+
out.push(
|
|
1323
|
+
{
|
|
1324
|
+
keyword: "required",
|
|
1325
|
+
instancePath: widgetPath,
|
|
1326
|
+
schemaPath: "",
|
|
1327
|
+
params: { missingProperty: "type" },
|
|
1328
|
+
message: `Widget at ${widgetPath} is missing or has an invalid \`type\``
|
|
1329
|
+
}
|
|
1330
|
+
);
|
|
1331
|
+
} else {
|
|
1332
|
+
warnings.push({
|
|
1333
|
+
path: `${widgetPath}/type`,
|
|
1334
|
+
keyword: "customWidget",
|
|
1335
|
+
message: `Widget type \`${widgetType}\` at \`${widgetPath}\` is not a built-in GolemUI widget — assumed custom. Its props were not validated.`,
|
|
1336
|
+
suggestion: "Built-in widget types: " + Object.keys(COMPONENT_SCHEMAS).join(", ") + ". If this is intentional (a custom widget registered via the framework loader), you can ignore this warning.",
|
|
1337
|
+
params: { type: widgetType }
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
recurseIntoChildren(widget, widgetPath, out, warnings);
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
const validator = getShallowWidgetValidator(intended.type);
|
|
1344
|
+
if (validator) {
|
|
1345
|
+
validator(widget);
|
|
1346
|
+
for (const e of validator.errors ?? []) {
|
|
1347
|
+
out.push({
|
|
1348
|
+
...e,
|
|
1349
|
+
instancePath: widgetPath + e.instancePath
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
const w = widget;
|
|
1354
|
+
if (w?.validator && typeof w.validator === "object") {
|
|
1355
|
+
collectValidatorErrors(w.validator, `${widgetPath}/validator`, out);
|
|
1356
|
+
}
|
|
1357
|
+
if (widget && typeof widget === "object" && !Array.isArray(widget)) {
|
|
1358
|
+
for (const [key, value] of Object.entries(widget)) {
|
|
1359
|
+
if (key.startsWith("validator.") && value && typeof value === "object") {
|
|
1360
|
+
collectValidatorErrors(value, `${widgetPath}/${key}`, out);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
recurseIntoChildren(widget, widgetPath, out, warnings);
|
|
1365
|
+
}
|
|
1366
|
+
function recurseIntoChildren(widget, widgetPath, out, warnings) {
|
|
1367
|
+
const w = widget;
|
|
1368
|
+
if (Array.isArray(w?.children)) {
|
|
1369
|
+
w.children.forEach((child, i) => {
|
|
1370
|
+
collectWidgetErrors(child, `${widgetPath}/children/${i}`, out, warnings);
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
if (w?.type === "repeater" && w.props?.template) {
|
|
1374
|
+
collectWidgetErrors(w.props.template, `${widgetPath}/props/template`, out, warnings);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
function collectValidatorErrors(validator, path, out) {
|
|
1378
|
+
const v = validator;
|
|
1379
|
+
const t = typeof v.type === "string" ? v.type : null;
|
|
1380
|
+
const branches = getValidatorBranches();
|
|
1381
|
+
const matchedType = t && branches.includes(t) ? t : t ? nearest(t, branches) : void 0;
|
|
1382
|
+
if (!matchedType) {
|
|
1383
|
+
out.push({
|
|
1384
|
+
keyword: "enum",
|
|
1385
|
+
instancePath: `${path}/type`,
|
|
1386
|
+
schemaPath: "",
|
|
1387
|
+
params: { allowedValues: branches },
|
|
1388
|
+
message: `Validator type is not one of ${branches.join(", ")}`,
|
|
1389
|
+
data: t
|
|
1390
|
+
});
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
const compiled = getValidatorBranchValidator(matchedType);
|
|
1394
|
+
if (!compiled) return;
|
|
1395
|
+
compiled(validator);
|
|
1396
|
+
for (const e of compiled.errors ?? []) {
|
|
1397
|
+
out.push({ ...e, instancePath: path + e.instancePath });
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
function dedupe(errors) {
|
|
1401
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1402
|
+
const result = [];
|
|
1403
|
+
for (const e of errors) {
|
|
1404
|
+
const key = `${e.path}|${e.keyword}|${e.message}`;
|
|
1405
|
+
if (seen.has(key)) continue;
|
|
1406
|
+
seen.add(key);
|
|
1407
|
+
result.push(e);
|
|
1408
|
+
}
|
|
1409
|
+
return result;
|
|
1410
|
+
}
|
|
1411
|
+
function lintReactiveExpressions(formDefinition) {
|
|
1412
|
+
const findings = [];
|
|
1413
|
+
walk(formDefinition, "", findings);
|
|
1414
|
+
return findings;
|
|
1415
|
+
}
|
|
1416
|
+
function walk(node, path, out) {
|
|
1417
|
+
if (node === null || typeof node !== "object") return;
|
|
1418
|
+
if (Array.isArray(node)) {
|
|
1419
|
+
node.forEach((item, i) => walk(item, `${path}/${i}`, out));
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
const obj = node;
|
|
1423
|
+
for (const key of ["include", "exclude"]) {
|
|
1424
|
+
const child = obj[key];
|
|
1425
|
+
if (child && typeof child === "object" && "when" in child) {
|
|
1426
|
+
const expr = child.when;
|
|
1427
|
+
if (typeof expr === "string") {
|
|
1428
|
+
checkExpression(expr, `${path}/${key}/when`, out);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
if (path === "" && obj["states"] && typeof obj["states"] === "object") {
|
|
1433
|
+
for (const [name, expr] of Object.entries(obj["states"])) {
|
|
1434
|
+
if (typeof expr === "string") {
|
|
1435
|
+
checkExpression(expr, `/states/${name}`, out);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1440
|
+
if (v && typeof v === "object" && !Array.isArray(v) && "when" in v) {
|
|
1441
|
+
const expr = v.when;
|
|
1442
|
+
if (typeof expr === "string" && k !== "include" && k !== "exclude") {
|
|
1443
|
+
checkExpression(expr, `${path}/${k}/when`, out);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
if (typeof v === "object" && v !== null) {
|
|
1447
|
+
walk(v, `${path}/${k}`, out);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
function checkExpression(expr, path, out) {
|
|
1452
|
+
const trimmed = expr.trim();
|
|
1453
|
+
if (!trimmed) {
|
|
1454
|
+
out.push({ path, expression: expr, message: "Expression is empty." });
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
const stack = [];
|
|
1458
|
+
const pairs = { ")": "(", "]": "[", "}": "{" };
|
|
1459
|
+
for (const ch of trimmed) {
|
|
1460
|
+
if ("([{".includes(ch)) stack.push(ch);
|
|
1461
|
+
else if (")]}".includes(ch)) {
|
|
1462
|
+
if (stack.pop() !== pairs[ch]) {
|
|
1463
|
+
out.push({
|
|
1464
|
+
path,
|
|
1465
|
+
expression: expr,
|
|
1466
|
+
message: `Unbalanced \`${ch}\` in reactive expression.`
|
|
1467
|
+
});
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
if (stack.length) {
|
|
1473
|
+
out.push({
|
|
1474
|
+
path,
|
|
1475
|
+
expression: expr,
|
|
1476
|
+
message: `Unclosed \`${stack[stack.length - 1]}\` in reactive expression.`
|
|
1477
|
+
});
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
if (!/\$form\b|\$meta\b|\$item\b|\$index\b/.test(trimmed)) {
|
|
1481
|
+
out.push({
|
|
1482
|
+
path,
|
|
1483
|
+
expression: expr,
|
|
1484
|
+
message: "Expression does not reference `$form`, `$meta`, `$item`, or `$index`.",
|
|
1485
|
+
suggestion: "GolemUI expressions read form data via `$form.fieldName` or form metadata via `$meta.key`. Did you forget the prefix?"
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
if (/(?<![=!<>])=(?![=>])/.test(trimmed)) {
|
|
1489
|
+
out.push({
|
|
1490
|
+
path,
|
|
1491
|
+
expression: expr,
|
|
1492
|
+
message: "Expression contains a single `=` (assignment). Reactive expressions are read-only.",
|
|
1493
|
+
suggestion: "Use `===` for equality comparison."
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
if (/(?<![&])&(?![&])/.test(trimmed) || /(?<![|])\|(?![|])/.test(trimmed)) {
|
|
1497
|
+
out.push({
|
|
1498
|
+
path,
|
|
1499
|
+
expression: expr,
|
|
1500
|
+
message: "Expression contains a single `&` or `|` (bitwise).",
|
|
1501
|
+
suggestion: "Use `&&` for logical AND, `||` for logical OR."
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
if (/(?<![=!])==(?!=)/.test(trimmed) || /(?<![!])!=(?!=)/.test(trimmed)) {
|
|
1505
|
+
out.push({
|
|
1506
|
+
path,
|
|
1507
|
+
expression: expr,
|
|
1508
|
+
message: "Expression uses loose equality (`==` or `!=`).",
|
|
1509
|
+
suggestion: "Use strict equality `===` / `!==` to avoid type coercion (e.g. `$form.x !== undefined` rather than `$form.x != null`)."
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
if (/(?<![=!])!\s*\$(?:form|meta|item|index)\b/.test(trimmed)) {
|
|
1513
|
+
out.push({
|
|
1514
|
+
path,
|
|
1515
|
+
expression: expr,
|
|
1516
|
+
message: "Expression negates a `$form`/`$meta`/`$item`/`$index` reference (relies on truthy/falsy coercion).",
|
|
1517
|
+
suggestion: 'Form data values can be `undefined`. Pick the case you actually mean and write it explicitly — `$form.x === undefined`, `$form.x === null`, `$form.x === 0`, `$form.x === ""` — instead of `!$form.x`.'
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
const refChainRe = /\$(?:form|meta|item|index)((?:\.[\w?]+)*)/g;
|
|
1521
|
+
let chainFlagged = false;
|
|
1522
|
+
let chainMatch;
|
|
1523
|
+
while ((chainMatch = refChainRe.exec(trimmed)) !== null) {
|
|
1524
|
+
const chain = chainMatch[1];
|
|
1525
|
+
if (!chain) continue;
|
|
1526
|
+
const segments = chain.split(".").filter(Boolean);
|
|
1527
|
+
let unsafe = false;
|
|
1528
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
1529
|
+
const segment = segments[i];
|
|
1530
|
+
if (!segment || !segment.endsWith("?")) {
|
|
1531
|
+
unsafe = true;
|
|
1532
|
+
break;
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
if (unsafe && !chainFlagged) {
|
|
1536
|
+
out.push({
|
|
1537
|
+
path,
|
|
1538
|
+
expression: expr,
|
|
1539
|
+
message: "Expression chains nested property access without optional chaining (e.g. `$form.user.name`).",
|
|
1540
|
+
suggestion: "Treat every nested property as possibly `undefined`. Use `?.` between segments: `$form.user?.name` instead of `$form.user.name`. The runtime throws if `$form.user` is undefined."
|
|
1541
|
+
});
|
|
1542
|
+
chainFlagged = true;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
const refOnly = /^\$(?:form|meta|item|index)(?:\.[\w?]+)*$/;
|
|
1546
|
+
const refBeforeBool = /\$(?:form|meta|item|index)(?:\.[\w?]+)*\s*(?:&&|\|\||\?(?![.?]))/;
|
|
1547
|
+
const refAfterBool = /(?:&&|\|\|)\s*\$(?:form|meta|item|index)(?:\.[\w?]+)*\s*$/;
|
|
1548
|
+
if (refOnly.test(trimmed) || refBeforeBool.test(trimmed) || refAfterBool.test(trimmed)) {
|
|
1549
|
+
out.push({
|
|
1550
|
+
path,
|
|
1551
|
+
expression: expr,
|
|
1552
|
+
message: "Expression uses `$form`/`$meta` directly as a boolean (relies on truthy/falsy coercion).",
|
|
1553
|
+
suggestion: 'Form data values can be `undefined`. Compare explicitly: `$form.x !== undefined`, `$form.x === "value"`, `$form.items?.length > 0`. For default values use nullish coalescing: `$form.x ?? defaultValue`.'
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
const refForCmpRe = /\$(?:form|meta|item)(?:\.[\w?]+)+/g;
|
|
1557
|
+
let r5Flagged = false;
|
|
1558
|
+
let cmpMatch;
|
|
1559
|
+
while ((cmpMatch = refForCmpRe.exec(trimmed)) !== null) {
|
|
1560
|
+
const start = cmpMatch.index;
|
|
1561
|
+
const end = start + cmpMatch[0].length;
|
|
1562
|
+
const before = trimmed.slice(0, start).trimEnd();
|
|
1563
|
+
const after = trimmed.slice(end).trimStart();
|
|
1564
|
+
const opAfter = /^(?:<=?|>=?|[+\-*/%])(?!=)/.test(after);
|
|
1565
|
+
const opBefore = /(?<![=!])[<>+\-*/%]$/.test(before);
|
|
1566
|
+
if (!(opAfter || opBefore)) continue;
|
|
1567
|
+
if (/&&|\|\|/.test(before)) continue;
|
|
1568
|
+
if (!r5Flagged) {
|
|
1569
|
+
out.push({
|
|
1570
|
+
path,
|
|
1571
|
+
expression: expr,
|
|
1572
|
+
message: "Expression applies a comparison or arithmetic operator to a `$form`/`$meta` reference whose leaf may be `undefined`.",
|
|
1573
|
+
suggestion: "Guard the value first: `$form.x !== undefined && $form.x > 180`. Or default it: `($form.x ?? 0) > 180`. Strict equality (`$form.x === 180`) is also safe since it evaluates to `false` when undefined."
|
|
1574
|
+
});
|
|
1575
|
+
r5Flagged = true;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
function validateFormDefinition(input) {
|
|
1580
|
+
const validate = getFormValidator();
|
|
1581
|
+
const ajvOk = validate(input.formDefinition);
|
|
1582
|
+
const { errors, warnings } = formatAjvErrors(validate.errors, input.formDefinition);
|
|
1583
|
+
const expressionWarnings = lintReactiveExpressions(input.formDefinition);
|
|
1584
|
+
if (!ajvOk && errors.length === 0 && warnings.length === 0) {
|
|
1585
|
+
errors.push({
|
|
1586
|
+
path: "/",
|
|
1587
|
+
keyword: "oneOf",
|
|
1588
|
+
message: "Form failed schema validation but no specific error could be localized. The form may contain a widget at a position the form schema does not allow, or a structural shape that our targeted validator missed. Verify each widget against its `get_widget_spec` entry."
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
return {
|
|
1592
|
+
valid: errors.length === 0,
|
|
1593
|
+
errors,
|
|
1594
|
+
warnings,
|
|
1595
|
+
expressionWarnings
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
const VALIDATE_FORM_DEFINITION_TOOL = {
|
|
1599
|
+
name: "validate_form_definition",
|
|
1600
|
+
description: "Validate a GolemUI form definition against the bundled JSON Schemas. Use this AFTER generating or modifying a form definition to guarantee it is correct before the user pastes it into their codebase. Returns `{ valid, errors, warnings, expressionWarnings }`. Hard mistakes (typos in widget `type`, missing required props, invalid validator shapes) show up in `errors` and flip `valid` to false. Likely-custom widgets (a `type` value that isn't a built-in and isn't close to one) show up in `warnings` instead — they don't affect `valid`. Reactive expressions (`include.when`, `disabled.when`, etc.) are linted separately into `expressionWarnings`.",
|
|
1601
|
+
inputSchema: {
|
|
1602
|
+
type: "object",
|
|
1603
|
+
properties: {
|
|
1604
|
+
formDefinition: {
|
|
1605
|
+
type: "object",
|
|
1606
|
+
additionalProperties: true,
|
|
1607
|
+
description: "The full GolemUI form definition object, shaped as `{ form: [...widgets], states?: {...} }`. Pass the JSON object, not a stringified version."
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1610
|
+
required: ["formDefinition"]
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
function generateFromJsonSchema(input) {
|
|
1614
|
+
const opts = {
|
|
1615
|
+
submitAction: input.submitAction,
|
|
1616
|
+
submitLabel: input.submitLabel,
|
|
1617
|
+
layout: input.layout
|
|
1618
|
+
};
|
|
1619
|
+
const { formDefinition, unmapped } = jsonSchemaToGui(input.jsonSchema, opts);
|
|
1620
|
+
const validation = validateFormDefinition({ formDefinition });
|
|
1621
|
+
return { formDefinition, unmapped, validation };
|
|
1622
|
+
}
|
|
1623
|
+
const GENERATE_FROM_JSON_SCHEMA_TOOL = {
|
|
1624
|
+
name: "generate_from_json_schema",
|
|
1625
|
+
description: "Generate a GolemUI form definition from a JSON Schema describing the form data shape (typically an API request body or a Zod-derived schema). The result is validated against the GolemUI JSON Schemas before being returned, so it is guaranteed to be syntactically correct. Anything the mapper cannot handle is reported in `unmapped` rather than silently dropped — use that list to surface remaining work to the user.",
|
|
1626
|
+
inputSchema: {
|
|
1627
|
+
type: "object",
|
|
1628
|
+
properties: {
|
|
1629
|
+
jsonSchema: {
|
|
1630
|
+
type: "object",
|
|
1631
|
+
additionalProperties: true,
|
|
1632
|
+
description: "A standard JSON Schema. The top level must be an `object` schema with a `properties` map. Supports primitive types (string/number/integer/boolean) with formats and constraints, enums, nested objects, and arrays of objects (rendered as repeaters)."
|
|
1633
|
+
},
|
|
1634
|
+
submitAction: {
|
|
1635
|
+
type: "boolean",
|
|
1636
|
+
description: "Append a submit button. Defaults to true."
|
|
1637
|
+
},
|
|
1638
|
+
submitLabel: {
|
|
1639
|
+
type: "string",
|
|
1640
|
+
description: 'Label for the submit button when `submitAction` is true. Defaults to "Submit".'
|
|
1641
|
+
},
|
|
1642
|
+
layout: {
|
|
1643
|
+
type: "string",
|
|
1644
|
+
enum: ["vertical", "horizontal", "grid"],
|
|
1645
|
+
description: "Top-level layout. Defaults to vertical (one field per row)."
|
|
1646
|
+
}
|
|
1647
|
+
},
|
|
1648
|
+
required: ["jsonSchema"]
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
const METHODS = ["get", "post", "put", "patch", "delete"];
|
|
1652
|
+
async function generateFromOpenapi(input) {
|
|
1653
|
+
if (!input.document && !input.documentUrl) {
|
|
1654
|
+
throw new Error("Provide either `document` (parsed OpenAPI object) or `documentUrl`.");
|
|
1655
|
+
}
|
|
1656
|
+
const doc = input.document ?? await fetchDoc(input.documentUrl);
|
|
1657
|
+
const resolved = findOperation(doc, input.operation);
|
|
1658
|
+
if (!resolved) {
|
|
1659
|
+
throw new Error(
|
|
1660
|
+
`Operation \`${input.operation}\` not found. Use the form "METHOD /path" (e.g. "POST /users") or an exact operationId.`
|
|
1661
|
+
);
|
|
1662
|
+
}
|
|
1663
|
+
const { method, path, operation } = resolved;
|
|
1664
|
+
let bodySchema = operation.requestBody?.content?.["application/json"]?.schema;
|
|
1665
|
+
if (bodySchema) bodySchema = derefSchema(bodySchema, doc);
|
|
1666
|
+
let assembled;
|
|
1667
|
+
if (bodySchema && (bodySchema.type === "object" || bodySchema.properties)) {
|
|
1668
|
+
assembled = bodySchema;
|
|
1669
|
+
} else if (operation.parameters?.length) {
|
|
1670
|
+
assembled = paramsToSchema(operation.parameters, doc);
|
|
1671
|
+
} else {
|
|
1672
|
+
throw new Error(
|
|
1673
|
+
`Operation \`${method.toUpperCase()} ${path}\` has no JSON request body and no parameters — nothing to render as a form.`
|
|
1674
|
+
);
|
|
1675
|
+
}
|
|
1676
|
+
const { formDefinition, unmapped } = jsonSchemaToGui(assembled, {
|
|
1677
|
+
submitAction: input.submitAction ?? true,
|
|
1678
|
+
submitLabel: input.submitLabel ?? defaultSubmitLabel(method, operation)
|
|
1679
|
+
});
|
|
1680
|
+
const validation = validateFormDefinition({ formDefinition });
|
|
1681
|
+
return {
|
|
1682
|
+
resolvedOperation: { method: method.toUpperCase(), path, operationId: operation.operationId },
|
|
1683
|
+
formDefinition,
|
|
1684
|
+
unmapped,
|
|
1685
|
+
validation
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
async function fetchDoc(url) {
|
|
1689
|
+
const res = await fetch(url);
|
|
1690
|
+
if (!res.ok) {
|
|
1691
|
+
throw new Error(`Failed to fetch OpenAPI document from ${url}: ${res.status} ${res.statusText}`);
|
|
1692
|
+
}
|
|
1693
|
+
const text = await res.text();
|
|
1694
|
+
try {
|
|
1695
|
+
return JSON.parse(text);
|
|
1696
|
+
} catch {
|
|
1697
|
+
throw new Error(
|
|
1698
|
+
`Document at ${url} is not JSON. v1 only supports JSON OpenAPI docs — convert YAML before passing.`
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
function findOperation(doc, ref) {
|
|
1703
|
+
const trimmed = ref.trim();
|
|
1704
|
+
const methodPathMatch = trimmed.match(/^([A-Za-z]+)\s+(\/\S*)$/);
|
|
1705
|
+
if (methodPathMatch) {
|
|
1706
|
+
const method = methodPathMatch[1].toLowerCase();
|
|
1707
|
+
const path = methodPathMatch[2];
|
|
1708
|
+
if (!METHODS.includes(method)) {
|
|
1709
|
+
throw new Error(`Unsupported HTTP method \`${method.toUpperCase()}\`.`);
|
|
1710
|
+
}
|
|
1711
|
+
const op = doc.paths?.[path]?.[method];
|
|
1712
|
+
if (op) return { method, path, operation: op };
|
|
1713
|
+
return null;
|
|
1714
|
+
}
|
|
1715
|
+
for (const [path, methods] of Object.entries(doc.paths ?? {})) {
|
|
1716
|
+
for (const [method, op] of Object.entries(methods)) {
|
|
1717
|
+
if (METHODS.includes(method) && op.operationId === trimmed) {
|
|
1718
|
+
return { method, path, operation: op };
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
return null;
|
|
1723
|
+
}
|
|
1724
|
+
function paramsToSchema(parameters, doc) {
|
|
1725
|
+
const properties2 = {};
|
|
1726
|
+
const required2 = [];
|
|
1727
|
+
for (const p of parameters) {
|
|
1728
|
+
const s = p.schema ? derefSchema(p.schema, doc) : { type: "string" };
|
|
1729
|
+
properties2[p.name] = { ...s, description: p.description ?? s.description };
|
|
1730
|
+
if (p.required) required2.push(p.name);
|
|
1731
|
+
}
|
|
1732
|
+
return { type: "object", properties: properties2, required: required2 };
|
|
1733
|
+
}
|
|
1734
|
+
function defaultSubmitLabel(method, op) {
|
|
1735
|
+
if (op.summary) return op.summary;
|
|
1736
|
+
const verbs = {
|
|
1737
|
+
post: "Create",
|
|
1738
|
+
put: "Update",
|
|
1739
|
+
patch: "Update",
|
|
1740
|
+
delete: "Delete",
|
|
1741
|
+
get: "Submit"
|
|
1742
|
+
};
|
|
1743
|
+
return verbs[method.toLowerCase()] ?? "Submit";
|
|
1744
|
+
}
|
|
1745
|
+
function derefSchema(schema, doc, depth = 0) {
|
|
1746
|
+
if (depth > 16) return schema;
|
|
1747
|
+
if (typeof schema.$ref === "string") {
|
|
1748
|
+
const target = resolveLocalRef(schema.$ref, doc);
|
|
1749
|
+
if (target) return derefSchema(target, doc, depth + 1);
|
|
1750
|
+
return schema;
|
|
1751
|
+
}
|
|
1752
|
+
const result = { ...schema };
|
|
1753
|
+
if (result.properties) {
|
|
1754
|
+
result.properties = Object.fromEntries(
|
|
1755
|
+
Object.entries(result.properties).map(([k, v]) => [k, derefSchema(v, doc, depth + 1)])
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
if (result.items) result.items = derefSchema(result.items, doc, depth + 1);
|
|
1759
|
+
if (result.oneOf) result.oneOf = result.oneOf.map((s) => derefSchema(s, doc, depth + 1));
|
|
1760
|
+
if (result.anyOf) result.anyOf = result.anyOf.map((s) => derefSchema(s, doc, depth + 1));
|
|
1761
|
+
return result;
|
|
1762
|
+
}
|
|
1763
|
+
function resolveLocalRef(ref, doc) {
|
|
1764
|
+
if (!ref.startsWith("#/")) return null;
|
|
1765
|
+
const parts = ref.slice(2).split("/");
|
|
1766
|
+
let cur = doc;
|
|
1767
|
+
for (const p of parts) {
|
|
1768
|
+
if (cur && typeof cur === "object") {
|
|
1769
|
+
cur = cur[p];
|
|
1770
|
+
} else {
|
|
1771
|
+
return null;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
return cur ?? null;
|
|
1775
|
+
}
|
|
1776
|
+
const GENERATE_FROM_OPENAPI_TOOL = {
|
|
1777
|
+
name: "generate_from_openapi",
|
|
1778
|
+
description: 'Generate a GolemUI form for a specific OpenAPI 3.x operation (e.g. "POST /users"). Resolves the operation\'s JSON request body, dereferences `$ref`s, then maps it to a validated form definition. Falls back to operation parameters when no request body is present. Pass either a parsed `document` or a `documentUrl` to fetch.',
|
|
1779
|
+
inputSchema: {
|
|
1780
|
+
type: "object",
|
|
1781
|
+
properties: {
|
|
1782
|
+
documentUrl: {
|
|
1783
|
+
type: "string",
|
|
1784
|
+
description: "URL of a JSON OpenAPI document. Either this or `document` is required."
|
|
1785
|
+
},
|
|
1786
|
+
document: {
|
|
1787
|
+
type: "object",
|
|
1788
|
+
additionalProperties: true,
|
|
1789
|
+
description: "Parsed OpenAPI document (JSON object). Either this or `documentUrl` is required."
|
|
1790
|
+
},
|
|
1791
|
+
operation: {
|
|
1792
|
+
type: "string",
|
|
1793
|
+
description: 'The operation to generate a form for. Either "METHOD /path" (e.g. "POST /users") or an exact operationId.'
|
|
1794
|
+
},
|
|
1795
|
+
submitAction: {
|
|
1796
|
+
type: "boolean",
|
|
1797
|
+
description: "Append a submit button. Defaults to true."
|
|
1798
|
+
},
|
|
1799
|
+
submitLabel: {
|
|
1800
|
+
type: "string",
|
|
1801
|
+
description: "Label for the submit button. Defaults to the operation summary or a verb derived from the HTTP method."
|
|
1802
|
+
}
|
|
1803
|
+
},
|
|
1804
|
+
required: ["operation"]
|
|
1805
|
+
}
|
|
1806
|
+
};
|
|
1807
|
+
const EXAMPLES = {
|
|
1808
|
+
accordion: {
|
|
1809
|
+
kind: "layout",
|
|
1810
|
+
type: "accordion",
|
|
1811
|
+
props: {
|
|
1812
|
+
sections: [
|
|
1813
|
+
{ uid: "personal", label: "Personal" },
|
|
1814
|
+
{ uid: "preferences", label: "Preferences" }
|
|
1815
|
+
]
|
|
1816
|
+
},
|
|
1817
|
+
children: [
|
|
1818
|
+
{ kind: "input", type: "textinput", path: "firstName", label: "First name" },
|
|
1819
|
+
{ kind: "input", type: "checkbox", path: "newsletter", label: "Newsletter" }
|
|
1820
|
+
]
|
|
1821
|
+
},
|
|
1822
|
+
textinput: {
|
|
1823
|
+
kind: "input",
|
|
1824
|
+
type: "textinput",
|
|
1825
|
+
path: "firstName",
|
|
1826
|
+
label: "First name",
|
|
1827
|
+
validator: { type: "string", required: true, minLength: 1 },
|
|
1828
|
+
props: { placeholder: "Jane" }
|
|
1829
|
+
},
|
|
1830
|
+
textarea: {
|
|
1831
|
+
kind: "input",
|
|
1832
|
+
type: "textarea",
|
|
1833
|
+
path: "bio",
|
|
1834
|
+
label: "Bio",
|
|
1835
|
+
props: { minimumHeight: 120, autoGrow: true }
|
|
1836
|
+
},
|
|
1837
|
+
tags: {
|
|
1838
|
+
kind: "input",
|
|
1839
|
+
type: "tags",
|
|
1840
|
+
path: "keywords",
|
|
1841
|
+
label: "Keywords",
|
|
1842
|
+
defaultValue: [],
|
|
1843
|
+
props: {
|
|
1844
|
+
placeholder: "Add a keyword and press Enter",
|
|
1845
|
+
separators: ["Enter", ","],
|
|
1846
|
+
trim: true,
|
|
1847
|
+
allowDuplicates: false,
|
|
1848
|
+
limit: 10
|
|
1849
|
+
},
|
|
1850
|
+
validator: {
|
|
1851
|
+
type: "array",
|
|
1852
|
+
minItems: 1,
|
|
1853
|
+
maxItems: 10
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
password: {
|
|
1857
|
+
kind: "input",
|
|
1858
|
+
type: "password",
|
|
1859
|
+
path: "password",
|
|
1860
|
+
label: "Password",
|
|
1861
|
+
validator: { type: "string", required: true, minLength: 8 }
|
|
1862
|
+
},
|
|
1863
|
+
number: {
|
|
1864
|
+
kind: "input",
|
|
1865
|
+
type: "number",
|
|
1866
|
+
path: "age",
|
|
1867
|
+
label: "Age",
|
|
1868
|
+
validator: { type: "integer", required: true, minimum: 0 }
|
|
1869
|
+
},
|
|
1870
|
+
currency: {
|
|
1871
|
+
kind: "input",
|
|
1872
|
+
type: "currency",
|
|
1873
|
+
path: "salary",
|
|
1874
|
+
label: "Salary",
|
|
1875
|
+
props: { currency: "USD" }
|
|
1876
|
+
},
|
|
1877
|
+
checkbox: {
|
|
1878
|
+
kind: "input",
|
|
1879
|
+
type: "checkbox",
|
|
1880
|
+
path: "termsAccepted",
|
|
1881
|
+
label: "I accept the terms",
|
|
1882
|
+
validator: { type: "boolean", required: true, const: true }
|
|
1883
|
+
},
|
|
1884
|
+
toggle: {
|
|
1885
|
+
kind: "input",
|
|
1886
|
+
type: "toggle",
|
|
1887
|
+
path: "notifications",
|
|
1888
|
+
label: "Email notifications"
|
|
1889
|
+
},
|
|
1890
|
+
dropdown: {
|
|
1891
|
+
kind: "input",
|
|
1892
|
+
type: "dropdown",
|
|
1893
|
+
path: "country",
|
|
1894
|
+
label: "Country",
|
|
1895
|
+
props: {
|
|
1896
|
+
labelField: "label",
|
|
1897
|
+
valueField: "value",
|
|
1898
|
+
items: [
|
|
1899
|
+
{ label: "United States", value: "us", flag: "🇺🇸" },
|
|
1900
|
+
{ label: "Canada", value: "ca", flag: "🇨🇦" }
|
|
1901
|
+
]
|
|
1902
|
+
}
|
|
1903
|
+
},
|
|
1904
|
+
select: {
|
|
1905
|
+
kind: "input",
|
|
1906
|
+
type: "select",
|
|
1907
|
+
path: "plan",
|
|
1908
|
+
label: "Plan",
|
|
1909
|
+
props: {
|
|
1910
|
+
options: [
|
|
1911
|
+
{ label: "Free", value: "free" },
|
|
1912
|
+
{ label: "Pro", value: "pro" }
|
|
1913
|
+
]
|
|
1914
|
+
}
|
|
1915
|
+
},
|
|
1916
|
+
radiogroup: {
|
|
1917
|
+
kind: "input",
|
|
1918
|
+
type: "radiogroup",
|
|
1919
|
+
path: "shippingSpeed",
|
|
1920
|
+
label: "Shipping",
|
|
1921
|
+
props: {
|
|
1922
|
+
options: [
|
|
1923
|
+
{ label: "Standard", value: "standard" },
|
|
1924
|
+
{ label: "Express", value: "express" }
|
|
1925
|
+
]
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
dateInput: {
|
|
1929
|
+
kind: "input",
|
|
1930
|
+
type: "dateInput",
|
|
1931
|
+
path: "birthDate",
|
|
1932
|
+
label: "Birth date"
|
|
1933
|
+
},
|
|
1934
|
+
datePicker: {
|
|
1935
|
+
kind: "input",
|
|
1936
|
+
type: "datePicker",
|
|
1937
|
+
path: "startDate",
|
|
1938
|
+
label: "Start date"
|
|
1939
|
+
},
|
|
1940
|
+
calendar: {
|
|
1941
|
+
kind: "input",
|
|
1942
|
+
type: "calendar",
|
|
1943
|
+
path: "eventDate",
|
|
1944
|
+
label: "Event date"
|
|
1945
|
+
},
|
|
1946
|
+
button: {
|
|
1947
|
+
kind: "action",
|
|
1948
|
+
type: "button",
|
|
1949
|
+
actionType: "submit",
|
|
1950
|
+
label: "Submit",
|
|
1951
|
+
props: { variant: "filled" }
|
|
1952
|
+
},
|
|
1953
|
+
alert: {
|
|
1954
|
+
kind: "display",
|
|
1955
|
+
type: "alert",
|
|
1956
|
+
props: { level: "info", text: "Heads up!" }
|
|
1957
|
+
},
|
|
1958
|
+
markdownText: {
|
|
1959
|
+
kind: "display",
|
|
1960
|
+
type: "markdownText",
|
|
1961
|
+
props: { md: "Welcome to the form." }
|
|
1962
|
+
},
|
|
1963
|
+
flex: {
|
|
1964
|
+
kind: "layout",
|
|
1965
|
+
type: "flex",
|
|
1966
|
+
props: { direction: "column", gap: 12 },
|
|
1967
|
+
children: [
|
|
1968
|
+
{
|
|
1969
|
+
kind: "input",
|
|
1970
|
+
type: "textinput",
|
|
1971
|
+
path: "firstName",
|
|
1972
|
+
label: "First name"
|
|
1973
|
+
}
|
|
1974
|
+
]
|
|
1975
|
+
},
|
|
1976
|
+
grid: {
|
|
1977
|
+
kind: "layout",
|
|
1978
|
+
type: "grid",
|
|
1979
|
+
props: { columnGap: 12, rowGap: 12 },
|
|
1980
|
+
children: [
|
|
1981
|
+
{ kind: "input", type: "textinput", path: "firstName", label: "First name" },
|
|
1982
|
+
{ kind: "input", type: "textinput", path: "lastName", label: "Last name" }
|
|
1983
|
+
]
|
|
1984
|
+
},
|
|
1985
|
+
tabs: {
|
|
1986
|
+
kind: "layout",
|
|
1987
|
+
type: "tabs",
|
|
1988
|
+
props: {
|
|
1989
|
+
tabs: [
|
|
1990
|
+
{ uid: "personal", label: "Personal" },
|
|
1991
|
+
{ uid: "address", label: "Address" }
|
|
1992
|
+
]
|
|
1993
|
+
},
|
|
1994
|
+
children: [
|
|
1995
|
+
{ kind: "input", type: "textinput", path: "firstName", label: "First name" },
|
|
1996
|
+
{ kind: "input", type: "textinput", path: "street", label: "Street" }
|
|
1997
|
+
]
|
|
1998
|
+
},
|
|
1999
|
+
repeater: {
|
|
2000
|
+
kind: "input",
|
|
2001
|
+
type: "repeater",
|
|
2002
|
+
path: "addresses",
|
|
2003
|
+
label: "Addresses",
|
|
2004
|
+
props: {
|
|
2005
|
+
addLabel: "Add address",
|
|
2006
|
+
removeLabel: "Remove",
|
|
2007
|
+
template: {
|
|
2008
|
+
kind: "layout",
|
|
2009
|
+
type: "flex",
|
|
2010
|
+
props: { direction: "column" },
|
|
2011
|
+
children: [
|
|
2012
|
+
// Child paths inside a repeater template MUST be `<repeater.path>.items.<field>` —
|
|
2013
|
+
// `items` is the reserved segment that the runtime expands per array entry.
|
|
2014
|
+
{ kind: "input", type: "textinput", path: "addresses.items.street", label: "Street" },
|
|
2015
|
+
{ kind: "input", type: "textinput", path: "addresses.items.city", label: "City" }
|
|
2016
|
+
]
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
const NOTES = {
|
|
2022
|
+
textinput: [
|
|
2023
|
+
"`path` is the dot-path into form data this field writes to.",
|
|
2024
|
+
"`validator.format` supports: `email`, `hostname`, `ipv4`, `ipv6`, `url`, `uuid`, `date`, `time`, `date-time`, `duration`."
|
|
2025
|
+
],
|
|
2026
|
+
markdownText: [
|
|
2027
|
+
"Display-only widget for rendering markdown. Can be used as a top-level form widget (inside any layout) or inside templates like `dropdown.props.items[].template`.",
|
|
2028
|
+
"The required prop is `md` (the markdown string), not `text`."
|
|
2029
|
+
],
|
|
2030
|
+
tags: [
|
|
2031
|
+
"Use `tags` for free-form arrays of primitive values (typically `string[]`) — e.g. keywords, email lists, hashtags. Backing data is `string[]`. For arrays of structured objects, use `repeater` instead.",
|
|
2032
|
+
'`props.separators` controls which keys/characters commit a new tag. Defaults emit on `Enter` and `,`; you can also include `"Tab"` or `"blur"`. `props.trim` strips whitespace from each tag; `props.allowDuplicates: false` rejects repeats; `props.limit` caps the array length.',
|
|
2033
|
+
'Validate with an `arrayValidator`: `{ type: "array", minItems, maxItems, uniqueItems }`. The `tags` widget complements that with UI-level enforcement (`allowDuplicates`, `limit`) but the validator is still authoritative for form-level required/min/max constraints.'
|
|
2034
|
+
],
|
|
2035
|
+
dropdown: [
|
|
2036
|
+
"PREFER `select` for plain label/value lists (countries, plans, sizes). `dropdown` is for richer item shapes: when each item has extra fields (icons, flags, metadata) that an `itemRenderer` or `labelField`/`valueField` can use.",
|
|
2037
|
+
'`props.items` is EITHER primitives `["one", 2, ...]` OR arbitrary objects `[{ label, value, ...extras }]`. Pair the object form with `labelField`/`valueField` to tell the dropdown which fields to render as label and which to use as the value. **Widget templates inside items (the `{template, value}` shape) are NOT supported — only `repeater` accepts widget templates.**'
|
|
2038
|
+
],
|
|
2039
|
+
select: [
|
|
2040
|
+
'`props.options[]` is the simple form: `[{ label: "United States", value: "us" }, ...]`. Use this for ANY plain text list — countries, plans, sizes, status enums. Only switch to `dropdown` if you need custom per-item rendering (icons, flags, rich layouts).',
|
|
2041
|
+
"For very large lists (>50 items) consider `dropdown` for its virtualization (`height`, `itemHeight`, `searchFields`)."
|
|
2042
|
+
],
|
|
2043
|
+
flex: ["`children` is an array of any widgets (inputs, displays, nested layouts)."],
|
|
2044
|
+
grid: ["`children` is an array of any widgets. `props.columns` controls layout."],
|
|
2045
|
+
tabs: [
|
|
2046
|
+
"Children are associated with tabs by **`uid` matching**, not by array order: each direct child must have a `uid` field at the widget level (alongside `kind`/`type`) whose string value equals one of the `props.tabs[].uid` entries. There is no `tag` property — that is not a real GolemUI field.",
|
|
2047
|
+
"Children are typically written in display order for readability, but rearranging them does not change which tab they belong to — only the `uid` string match does."
|
|
2048
|
+
],
|
|
2049
|
+
accordion: [
|
|
2050
|
+
"Children are associated with sections by **`uid` matching** (same pattern as `tabs`): each direct child must have a `uid` field at the widget level whose value equals one of the `props.sections[].uid` entries. There is no `tag` property.",
|
|
2051
|
+
"`props.defaultOpen` is a map of `{ <sectionUid>: boolean }` controlling which sections start expanded."
|
|
2052
|
+
],
|
|
2053
|
+
repeater: [
|
|
2054
|
+
"`props.template` must be a layout widget (flex/grid/tabs/accordion) whose children are the per-item fields.",
|
|
2055
|
+
'Child paths inside the template MUST follow the form `<repeater.path>.items.<fieldName>`. The `items` segment is reserved — the runtime substitutes it with the current array index per row. For example, a repeater at `path: "users"` with a child `firstName` uses `path: "users.items.firstName"`. Plain `firstName` will NOT bind to the array.',
|
|
2056
|
+
'Nested repeaters chain the convention: a repeater at `path: "teams"` whose template contains a repeater at `path: "teams.items.members"` whose children use `path: "teams.items.members.items.<field>"`.'
|
|
2057
|
+
],
|
|
2058
|
+
button: [
|
|
2059
|
+
"`actionType` controls the button's role. `actionType: \"submit\"` makes the button fire the form's `formSubmit` event natively — the host listens for it via `(formSubmit)` (Angular), `@formSubmit` (Vue), `onFormSubmit` (React), or the `form-submit` event (Lit). No custom handler needed. Use this for the primary submit button on a form.",
|
|
2060
|
+
'`actionType: "button"` (the default, can be omitted) is a regular action button. Wire it via `on.click: "<handlerName>"` where `<handlerName>` is registered in the form config\'s event handlers.'
|
|
2061
|
+
],
|
|
2062
|
+
checkbox: ["Set `validator.const: true` to require the user to tick it (e.g. terms acceptance)."]
|
|
2063
|
+
};
|
|
2064
|
+
function synthesizeExample(widgetType, schema) {
|
|
2065
|
+
const props = schema["properties"];
|
|
2066
|
+
const kindProp = props?.["kind"]?.const ?? "input";
|
|
2067
|
+
const ex = { kind: kindProp, type: widgetType };
|
|
2068
|
+
if (props?.["path"]) ex["path"] = "field";
|
|
2069
|
+
if (props?.["label"]) ex["label"] = "Field";
|
|
2070
|
+
return ex;
|
|
2071
|
+
}
|
|
2072
|
+
function getWidgetSpec(input) {
|
|
2073
|
+
const schema = COMPONENT_SCHEMAS[input.widgetType];
|
|
2074
|
+
if (!schema) {
|
|
2075
|
+
const known = Object.keys(COMPONENT_SCHEMAS).sort().join(", ");
|
|
2076
|
+
throw new Error(`Unknown widget type \`${input.widgetType}\`. Known: ${known}.`);
|
|
2077
|
+
}
|
|
2078
|
+
const props = schema["properties"];
|
|
2079
|
+
const kindProp = props?.["kind"]?.const ?? "unknown";
|
|
2080
|
+
return {
|
|
2081
|
+
widgetType: input.widgetType,
|
|
2082
|
+
schema,
|
|
2083
|
+
kind: kindProp,
|
|
2084
|
+
example: EXAMPLES[input.widgetType] ?? synthesizeExample(input.widgetType, schema),
|
|
2085
|
+
notes: NOTES[input.widgetType] ?? []
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
const GET_WIDGET_SPEC_TOOL = {
|
|
2089
|
+
name: "get_widget_spec",
|
|
2090
|
+
description: "Look up the JSON Schema and a minimal working example for a single GolemUI widget. Use this when you need to know which `props` a widget accepts, what `kind` value it uses, or what shape its `validator` takes. Cheaper than dumping the whole API into context.",
|
|
2091
|
+
inputSchema: {
|
|
2092
|
+
type: "object",
|
|
2093
|
+
properties: {
|
|
2094
|
+
widgetType: {
|
|
2095
|
+
type: "string",
|
|
2096
|
+
description: "The widget `type` constant. One of: " + Object.keys(COMPONENT_SCHEMAS).sort().map((t) => `\`${t}\``).join(", ") + "."
|
|
2097
|
+
}
|
|
2098
|
+
},
|
|
2099
|
+
required: ["widgetType"]
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
function readPackageMeta() {
|
|
2103
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
2104
|
+
for (const candidate of [join(here, "package.json"), join(here, "..", "package.json")]) {
|
|
2105
|
+
try {
|
|
2106
|
+
const pkg = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
2107
|
+
if (pkg.name && pkg.version) return { name: pkg.name, version: pkg.version };
|
|
2108
|
+
} catch {
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return { name: "@golemui/gui-mcp", version: "0.0.0" };
|
|
2112
|
+
}
|
|
2113
|
+
const { name: PKG_NAME, version: PKG_VERSION } = readPackageMeta();
|
|
2114
|
+
const TOOLS = [
|
|
2115
|
+
VALIDATE_FORM_DEFINITION_TOOL,
|
|
2116
|
+
GENERATE_FROM_JSON_SCHEMA_TOOL,
|
|
2117
|
+
GENERATE_FROM_OPENAPI_TOOL,
|
|
2118
|
+
GET_WIDGET_SPEC_TOOL
|
|
2119
|
+
];
|
|
2120
|
+
const server = new Server(
|
|
2121
|
+
{ name: PKG_NAME, version: PKG_VERSION },
|
|
2122
|
+
{ capabilities: { tools: {} } }
|
|
2123
|
+
);
|
|
2124
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
2125
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
2126
|
+
const { name, arguments: args } = request.params;
|
|
2127
|
+
try {
|
|
2128
|
+
switch (name) {
|
|
2129
|
+
case "validate_form_definition":
|
|
2130
|
+
return ok(validateFormDefinition(args));
|
|
2131
|
+
case "generate_from_json_schema":
|
|
2132
|
+
return ok(generateFromJsonSchema(args));
|
|
2133
|
+
case "generate_from_openapi":
|
|
2134
|
+
return ok(await generateFromOpenapi(args));
|
|
2135
|
+
case "get_widget_spec":
|
|
2136
|
+
return ok(getWidgetSpec(args));
|
|
2137
|
+
default:
|
|
2138
|
+
return err(`Unknown tool: ${name}`);
|
|
2139
|
+
}
|
|
2140
|
+
} catch (e) {
|
|
2141
|
+
return err(e.message);
|
|
2142
|
+
}
|
|
2143
|
+
});
|
|
2144
|
+
function ok(payload) {
|
|
2145
|
+
return {
|
|
2146
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }]
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
function err(message) {
|
|
2150
|
+
return {
|
|
2151
|
+
isError: true,
|
|
2152
|
+
content: [{ type: "text", text: message }]
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
async function main() {
|
|
2156
|
+
const transport = new StdioServerTransport();
|
|
2157
|
+
await server.connect(transport);
|
|
2158
|
+
process.stderr.write(`${PKG_NAME} v${PKG_VERSION} ready on stdio
|
|
2159
|
+
`);
|
|
2160
|
+
}
|
|
2161
|
+
main().catch((e) => {
|
|
2162
|
+
process.stderr.write(`${PKG_NAME} failed to start: ${e.stack ?? e}
|
|
2163
|
+
`);
|
|
2164
|
+
process.exit(1);
|
|
2165
|
+
});
|