@formspec/build 0.1.0-alpha.5 → 0.1.0-alpha.50

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.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +238 -93
  3. package/dist/analyzer/class-analyzer.d.ts +135 -0
  4. package/dist/analyzer/class-analyzer.d.ts.map +1 -0
  5. package/dist/analyzer/jsdoc-constraints.d.ts +53 -0
  6. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -0
  7. package/dist/analyzer/program.d.ts +97 -0
  8. package/dist/analyzer/program.d.ts.map +1 -0
  9. package/dist/analyzer/tsdoc-parser.d.ts +124 -0
  10. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
  11. package/dist/browser.cjs +2212 -0
  12. package/dist/browser.cjs.map +1 -0
  13. package/dist/browser.d.ts +74 -0
  14. package/dist/browser.d.ts.map +1 -0
  15. package/dist/browser.js +2167 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/build-alpha.d.ts +2408 -0
  18. package/dist/build-beta.d.ts +2408 -0
  19. package/dist/build-internal.d.ts +2408 -0
  20. package/dist/build.d.ts +2209 -151
  21. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +22 -0
  22. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
  23. package/dist/canonicalize/index.d.ts +8 -0
  24. package/dist/canonicalize/index.d.ts.map +1 -0
  25. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +38 -0
  26. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
  27. package/dist/cli.cjs +7111 -0
  28. package/dist/cli.cjs.map +1 -0
  29. package/dist/cli.js +7070 -103
  30. package/dist/cli.js.map +1 -1
  31. package/dist/extensions/index.d.ts +8 -0
  32. package/dist/extensions/index.d.ts.map +1 -0
  33. package/dist/extensions/registry.d.ts +142 -0
  34. package/dist/extensions/registry.d.ts.map +1 -0
  35. package/dist/extensions/resolve-custom-type.d.ts +37 -0
  36. package/dist/extensions/resolve-custom-type.d.ts.map +1 -0
  37. package/dist/extensions/symbol-registry.d.ts +33 -0
  38. package/dist/extensions/symbol-registry.d.ts.map +1 -0
  39. package/dist/extensions/ts-type-utils.d.ts +40 -0
  40. package/dist/extensions/ts-type-utils.d.ts.map +1 -0
  41. package/dist/generators/class-schema.d.ts +392 -0
  42. package/dist/generators/class-schema.d.ts.map +1 -0
  43. package/dist/generators/discovered-schema.d.ts +152 -0
  44. package/dist/generators/discovered-schema.d.ts.map +1 -0
  45. package/dist/generators/method-schema.d.ts +72 -0
  46. package/dist/generators/method-schema.d.ts.map +1 -0
  47. package/dist/generators/mixed-authoring.d.ts +52 -0
  48. package/dist/generators/mixed-authoring.d.ts.map +1 -0
  49. package/dist/index.cjs +6786 -0
  50. package/dist/index.cjs.map +1 -0
  51. package/dist/index.d.ts +51 -8
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +6751 -107
  54. package/dist/index.js.map +1 -1
  55. package/dist/internals.cjs +5736 -0
  56. package/dist/internals.cjs.map +1 -0
  57. package/dist/internals.d.ts +32 -0
  58. package/dist/internals.d.ts.map +1 -0
  59. package/dist/internals.js +5706 -0
  60. package/dist/internals.js.map +1 -0
  61. package/dist/json-schema/generator.d.ts +32 -6
  62. package/dist/json-schema/generator.d.ts.map +1 -1
  63. package/dist/json-schema/ir-generator.d.ts +149 -0
  64. package/dist/json-schema/ir-generator.d.ts.map +1 -0
  65. package/dist/json-schema/schema.d.ts +23 -0
  66. package/dist/json-schema/schema.d.ts.map +1 -0
  67. package/dist/json-schema/types.d.ts +76 -2
  68. package/dist/json-schema/types.d.ts.map +1 -1
  69. package/dist/metadata/collision-guards.d.ts +3 -0
  70. package/dist/metadata/collision-guards.d.ts.map +1 -0
  71. package/dist/metadata/index.d.ts +7 -0
  72. package/dist/metadata/index.d.ts.map +1 -0
  73. package/dist/metadata/policy.d.ts +12 -0
  74. package/dist/metadata/policy.d.ts.map +1 -0
  75. package/dist/metadata/resolve.d.ts +21 -0
  76. package/dist/metadata/resolve.d.ts.map +1 -0
  77. package/dist/static-build.d.ts +61 -0
  78. package/dist/static-build.d.ts.map +1 -0
  79. package/dist/ui-schema/generator.d.ts +18 -2
  80. package/dist/ui-schema/generator.d.ts.map +1 -1
  81. package/dist/ui-schema/ir-generator.d.ts +54 -0
  82. package/dist/ui-schema/ir-generator.d.ts.map +1 -0
  83. package/dist/ui-schema/schema.d.ts +429 -0
  84. package/dist/ui-schema/schema.d.ts.map +1 -0
  85. package/dist/ui-schema/types.d.ts +179 -35
  86. package/dist/ui-schema/types.d.ts.map +1 -1
  87. package/dist/validate/constraint-validator.d.ts +85 -0
  88. package/dist/validate/constraint-validator.d.ts.map +1 -0
  89. package/dist/validate/index.d.ts +9 -0
  90. package/dist/validate/index.d.ts.map +1 -0
  91. package/package.json +30 -11
  92. package/dist/__tests__/cli.test.d.ts +0 -2
  93. package/dist/__tests__/cli.test.d.ts.map +0 -1
  94. package/dist/__tests__/cli.test.js +0 -178
  95. package/dist/__tests__/cli.test.js.map +0 -1
  96. package/dist/__tests__/edge-cases.test.d.ts +0 -7
  97. package/dist/__tests__/edge-cases.test.d.ts.map +0 -1
  98. package/dist/__tests__/edge-cases.test.js +0 -217
  99. package/dist/__tests__/edge-cases.test.js.map +0 -1
  100. package/dist/__tests__/generator.test.d.ts +0 -2
  101. package/dist/__tests__/generator.test.d.ts.map +0 -1
  102. package/dist/__tests__/generator.test.js +0 -234
  103. package/dist/__tests__/generator.test.js.map +0 -1
  104. package/dist/__tests__/integration.test.d.ts +0 -8
  105. package/dist/__tests__/integration.test.d.ts.map +0 -1
  106. package/dist/__tests__/integration.test.js +0 -163
  107. package/dist/__tests__/integration.test.js.map +0 -1
  108. package/dist/__tests__/write-schemas.test.d.ts +0 -2
  109. package/dist/__tests__/write-schemas.test.d.ts.map +0 -1
  110. package/dist/__tests__/write-schemas.test.js +0 -196
  111. package/dist/__tests__/write-schemas.test.js.map +0 -1
  112. package/dist/json-schema/generator.js +0 -167
  113. package/dist/json-schema/generator.js.map +0 -1
  114. package/dist/json-schema/types.js +0 -7
  115. package/dist/json-schema/types.js.map +0 -1
  116. package/dist/ui-schema/generator.js +0 -150
  117. package/dist/ui-schema/generator.js.map +0 -1
  118. package/dist/ui-schema/types.js +0 -8
  119. package/dist/ui-schema/types.js.map +0 -1
@@ -0,0 +1,429 @@
1
+ /**
2
+ * Zod schemas for JSON Forms UI Schema.
3
+ *
4
+ * These schemas are the source of truth for UI Schema validation.
5
+ * TypeScript types are derived from these schemas via `z.infer<>`.
6
+ *
7
+ * @see https://jsonforms.io/docs/uischema/
8
+ */
9
+ import { z } from "zod";
10
+ import type { UISchema } from "./types.js";
11
+ /**
12
+ * Zod schema for rule effect values.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare const ruleEffectSchema: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
17
+ /**
18
+ * Rule effect types for conditional visibility.
19
+ *
20
+ * @internal
21
+ */
22
+ export type RuleEffect = z.infer<typeof ruleEffectSchema>;
23
+ /**
24
+ * Zod schema for UI Schema element type strings.
25
+ *
26
+ * @internal
27
+ */
28
+ export declare const uiSchemaElementTypeSchema: z.ZodEnum<["Control", "VerticalLayout", "HorizontalLayout", "Group", "Categorization", "Category", "Label"]>;
29
+ /**
30
+ * UI Schema element types.
31
+ *
32
+ * @internal
33
+ */
34
+ export type UISchemaElementType = z.infer<typeof uiSchemaElementTypeSchema>;
35
+ /**
36
+ * JSON Schema subset used in rule conditions.
37
+ *
38
+ * @internal
39
+ */
40
+ export interface RuleConditionSchema {
41
+ const?: unknown;
42
+ enum?: readonly unknown[];
43
+ type?: string;
44
+ not?: RuleConditionSchema;
45
+ minimum?: number;
46
+ maximum?: number;
47
+ exclusiveMinimum?: number;
48
+ exclusiveMaximum?: number;
49
+ minLength?: number;
50
+ properties?: Record<string, RuleConditionSchema>;
51
+ required?: string[];
52
+ allOf?: RuleConditionSchema[];
53
+ }
54
+ /**
55
+ * Zod schema for the rule-condition JSON Schema subset.
56
+ *
57
+ * @internal
58
+ */
59
+ export declare const ruleConditionSchema: z.ZodType<RuleConditionSchema>;
60
+ /**
61
+ * Zod schema for a schema-based rule condition.
62
+ *
63
+ * @internal
64
+ */
65
+ export declare const schemaBasedConditionSchema: z.ZodObject<{
66
+ scope: z.ZodString;
67
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
68
+ }, "strict", z.ZodTypeAny, {
69
+ schema: RuleConditionSchema;
70
+ scope: string;
71
+ }, {
72
+ schema: RuleConditionSchema;
73
+ scope: string;
74
+ }>;
75
+ /**
76
+ * Condition for a rule.
77
+ *
78
+ * @internal
79
+ */
80
+ export type SchemaBasedCondition = z.infer<typeof schemaBasedConditionSchema>;
81
+ /**
82
+ * Zod schema for a UI Schema rule.
83
+ *
84
+ * @internal
85
+ */
86
+ export declare const ruleSchema: z.ZodObject<{
87
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
88
+ condition: z.ZodObject<{
89
+ scope: z.ZodString;
90
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
91
+ }, "strict", z.ZodTypeAny, {
92
+ schema: RuleConditionSchema;
93
+ scope: string;
94
+ }, {
95
+ schema: RuleConditionSchema;
96
+ scope: string;
97
+ }>;
98
+ }, "strict", z.ZodTypeAny, {
99
+ condition: {
100
+ schema: RuleConditionSchema;
101
+ scope: string;
102
+ };
103
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
104
+ }, {
105
+ condition: {
106
+ schema: RuleConditionSchema;
107
+ scope: string;
108
+ };
109
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
110
+ }>;
111
+ /**
112
+ * Rule for conditional element visibility/enablement.
113
+ *
114
+ * @internal
115
+ */
116
+ export type Rule = z.infer<typeof ruleSchema>;
117
+ /**
118
+ * Union of all UI Schema element types.
119
+ *
120
+ * @internal
121
+ */
122
+ export type UISchemaElement = ControlElement | VerticalLayout | HorizontalLayout | GroupLayout | Categorization | Category | LabelElement;
123
+ /**
124
+ * Zod schema for any UI Schema element.
125
+ *
126
+ * @internal
127
+ */
128
+ export declare const uiSchemaElementSchema: z.ZodType<UISchemaElement>;
129
+ /**
130
+ * Zod schema for a Control element.
131
+ *
132
+ * @internal
133
+ */
134
+ export declare const controlSchema: z.ZodObject<{
135
+ type: z.ZodLiteral<"Control">;
136
+ scope: z.ZodString;
137
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
138
+ rule: z.ZodOptional<z.ZodObject<{
139
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
140
+ condition: z.ZodObject<{
141
+ scope: z.ZodString;
142
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
143
+ }, "strict", z.ZodTypeAny, {
144
+ schema: RuleConditionSchema;
145
+ scope: string;
146
+ }, {
147
+ schema: RuleConditionSchema;
148
+ scope: string;
149
+ }>;
150
+ }, "strict", z.ZodTypeAny, {
151
+ condition: {
152
+ schema: RuleConditionSchema;
153
+ scope: string;
154
+ };
155
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
156
+ }, {
157
+ condition: {
158
+ schema: RuleConditionSchema;
159
+ scope: string;
160
+ };
161
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
162
+ }>>;
163
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
164
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
165
+ type: z.ZodLiteral<"Control">;
166
+ scope: z.ZodString;
167
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
168
+ rule: z.ZodOptional<z.ZodObject<{
169
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
170
+ condition: z.ZodObject<{
171
+ scope: z.ZodString;
172
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
173
+ }, "strict", z.ZodTypeAny, {
174
+ schema: RuleConditionSchema;
175
+ scope: string;
176
+ }, {
177
+ schema: RuleConditionSchema;
178
+ scope: string;
179
+ }>;
180
+ }, "strict", z.ZodTypeAny, {
181
+ condition: {
182
+ schema: RuleConditionSchema;
183
+ scope: string;
184
+ };
185
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
186
+ }, {
187
+ condition: {
188
+ schema: RuleConditionSchema;
189
+ scope: string;
190
+ };
191
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
192
+ }>>;
193
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
194
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
195
+ type: z.ZodLiteral<"Control">;
196
+ scope: z.ZodString;
197
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
198
+ rule: z.ZodOptional<z.ZodObject<{
199
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
200
+ condition: z.ZodObject<{
201
+ scope: z.ZodString;
202
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
203
+ }, "strict", z.ZodTypeAny, {
204
+ schema: RuleConditionSchema;
205
+ scope: string;
206
+ }, {
207
+ schema: RuleConditionSchema;
208
+ scope: string;
209
+ }>;
210
+ }, "strict", z.ZodTypeAny, {
211
+ condition: {
212
+ schema: RuleConditionSchema;
213
+ scope: string;
214
+ };
215
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
216
+ }, {
217
+ condition: {
218
+ schema: RuleConditionSchema;
219
+ scope: string;
220
+ };
221
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
222
+ }>>;
223
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
224
+ }, z.ZodTypeAny, "passthrough">>;
225
+ /**
226
+ * A Control element that binds to a JSON Schema property.
227
+ *
228
+ * @internal
229
+ */
230
+ export type ControlElement = z.infer<typeof controlSchema>;
231
+ /**
232
+ * A vertical layout element.
233
+ *
234
+ * @internal
235
+ */
236
+ export interface VerticalLayout {
237
+ type: "VerticalLayout";
238
+ elements: UISchemaElement[];
239
+ rule?: Rule | undefined;
240
+ options?: Record<string, unknown> | undefined;
241
+ [k: string]: unknown;
242
+ }
243
+ /**
244
+ * Zod schema for a vertical layout element.
245
+ *
246
+ * @internal
247
+ */
248
+ export declare const verticalLayoutSchema: z.ZodType<VerticalLayout>;
249
+ /**
250
+ * A horizontal layout element.
251
+ *
252
+ * @internal
253
+ */
254
+ export interface HorizontalLayout {
255
+ type: "HorizontalLayout";
256
+ elements: UISchemaElement[];
257
+ rule?: Rule | undefined;
258
+ options?: Record<string, unknown> | undefined;
259
+ [k: string]: unknown;
260
+ }
261
+ /**
262
+ * Zod schema for a horizontal layout element.
263
+ *
264
+ * @internal
265
+ */
266
+ export declare const horizontalLayoutSchema: z.ZodType<HorizontalLayout>;
267
+ /**
268
+ * A group element with a label.
269
+ *
270
+ * @internal
271
+ */
272
+ export interface GroupLayout {
273
+ type: "Group";
274
+ label: string;
275
+ elements: UISchemaElement[];
276
+ rule?: Rule | undefined;
277
+ options?: Record<string, unknown> | undefined;
278
+ [k: string]: unknown;
279
+ }
280
+ /**
281
+ * Zod schema for a group layout element.
282
+ *
283
+ * @internal
284
+ */
285
+ export declare const groupLayoutSchema: z.ZodType<GroupLayout>;
286
+ /**
287
+ * A Category element, used inside a Categorization layout.
288
+ *
289
+ * @internal
290
+ */
291
+ export interface Category {
292
+ type: "Category";
293
+ label: string;
294
+ elements: UISchemaElement[];
295
+ rule?: Rule | undefined;
296
+ options?: Record<string, unknown> | undefined;
297
+ [k: string]: unknown;
298
+ }
299
+ /**
300
+ * Zod schema for a category element.
301
+ *
302
+ * @internal
303
+ */
304
+ export declare const categorySchema: z.ZodType<Category>;
305
+ /**
306
+ * A Categorization element (tab-based layout).
307
+ *
308
+ * @internal
309
+ */
310
+ export interface Categorization {
311
+ type: "Categorization";
312
+ elements: Category[];
313
+ label?: string | undefined;
314
+ rule?: Rule | undefined;
315
+ options?: Record<string, unknown> | undefined;
316
+ [k: string]: unknown;
317
+ }
318
+ /**
319
+ * Zod schema for a categorization element.
320
+ *
321
+ * @internal
322
+ */
323
+ export declare const categorizationSchema: z.ZodType<Categorization>;
324
+ /**
325
+ * Zod schema for a Label element.
326
+ *
327
+ * @internal
328
+ */
329
+ export declare const labelElementSchema: z.ZodObject<{
330
+ type: z.ZodLiteral<"Label">;
331
+ text: z.ZodString;
332
+ rule: z.ZodOptional<z.ZodObject<{
333
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
334
+ condition: z.ZodObject<{
335
+ scope: z.ZodString;
336
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
337
+ }, "strict", z.ZodTypeAny, {
338
+ schema: RuleConditionSchema;
339
+ scope: string;
340
+ }, {
341
+ schema: RuleConditionSchema;
342
+ scope: string;
343
+ }>;
344
+ }, "strict", z.ZodTypeAny, {
345
+ condition: {
346
+ schema: RuleConditionSchema;
347
+ scope: string;
348
+ };
349
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
350
+ }, {
351
+ condition: {
352
+ schema: RuleConditionSchema;
353
+ scope: string;
354
+ };
355
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
356
+ }>>;
357
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
358
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
359
+ type: z.ZodLiteral<"Label">;
360
+ text: z.ZodString;
361
+ rule: z.ZodOptional<z.ZodObject<{
362
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
363
+ condition: z.ZodObject<{
364
+ scope: z.ZodString;
365
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
366
+ }, "strict", z.ZodTypeAny, {
367
+ schema: RuleConditionSchema;
368
+ scope: string;
369
+ }, {
370
+ schema: RuleConditionSchema;
371
+ scope: string;
372
+ }>;
373
+ }, "strict", z.ZodTypeAny, {
374
+ condition: {
375
+ schema: RuleConditionSchema;
376
+ scope: string;
377
+ };
378
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
379
+ }, {
380
+ condition: {
381
+ schema: RuleConditionSchema;
382
+ scope: string;
383
+ };
384
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
385
+ }>>;
386
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
387
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
388
+ type: z.ZodLiteral<"Label">;
389
+ text: z.ZodString;
390
+ rule: z.ZodOptional<z.ZodObject<{
391
+ effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
392
+ condition: z.ZodObject<{
393
+ scope: z.ZodString;
394
+ schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
395
+ }, "strict", z.ZodTypeAny, {
396
+ schema: RuleConditionSchema;
397
+ scope: string;
398
+ }, {
399
+ schema: RuleConditionSchema;
400
+ scope: string;
401
+ }>;
402
+ }, "strict", z.ZodTypeAny, {
403
+ condition: {
404
+ schema: RuleConditionSchema;
405
+ scope: string;
406
+ };
407
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
408
+ }, {
409
+ condition: {
410
+ schema: RuleConditionSchema;
411
+ scope: string;
412
+ };
413
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
414
+ }>>;
415
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
416
+ }, z.ZodTypeAny, "passthrough">>;
417
+ /**
418
+ * A Label element for displaying static text.
419
+ *
420
+ * @internal
421
+ */
422
+ export type LabelElement = z.infer<typeof labelElementSchema>;
423
+ /**
424
+ * Zod schema for the root UI Schema (layout types only).
425
+ *
426
+ * @public
427
+ */
428
+ export declare const uiSchema: z.ZodType<UISchema>;
429
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/ui-schema/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAa3C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,kDAAgD,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,8GAQpC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAS5E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,C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W,cAAc;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9C,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAU1D,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAOf,CAAC;AAEjB;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAM9D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAEjB,CAAC"}
@@ -1,87 +1,231 @@
1
1
  /**
2
2
  * JSON Forms UI Schema type definitions.
3
3
  *
4
- * These types define the UI layout structure for JSON Forms.
4
+ * These are the consumer-facing TypeScript shapes. Runtime validation remains
5
+ * defined separately in `./schema.ts`.
6
+ *
5
7
  * See: https://jsonforms.io/docs/uischema/
6
8
  */
7
- /**
8
- * UI Schema element types.
9
- */
10
- export type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category";
11
9
  /**
12
10
  * Rule effect types for conditional visibility.
11
+ *
12
+ * @public
13
13
  */
14
14
  export type RuleEffect = "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
15
15
  /**
16
- * JSON Schema subset for rule conditions.
16
+ * UI Schema element types.
17
+ *
18
+ * @public
19
+ */
20
+ export type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category" | "Label";
21
+ /**
22
+ * JSON Schema subset used in rule conditions.
23
+ *
24
+ * @public
17
25
  */
18
26
  export interface RuleConditionSchema {
27
+ /** Literal value the condition schema must equal. */
19
28
  const?: unknown;
29
+ /** Allowed values for the condition schema. */
20
30
  enum?: readonly unknown[];
31
+ /** JSON Schema type required by the condition schema. */
21
32
  type?: string;
33
+ /** Negated branch of the condition schema. */
34
+ not?: RuleConditionSchema;
35
+ /** Inclusive numeric lower bound in the condition schema. */
22
36
  minimum?: number;
37
+ /** Inclusive numeric upper bound in the condition schema. */
23
38
  maximum?: number;
39
+ /** Exclusive numeric lower bound in the condition schema. */
40
+ exclusiveMinimum?: number;
41
+ /** Exclusive numeric upper bound in the condition schema. */
42
+ exclusiveMaximum?: number;
43
+ /** Inclusive minimum string length in the condition schema. */
44
+ minLength?: number;
45
+ /** Nested property conditions keyed by property name. */
24
46
  properties?: Record<string, RuleConditionSchema>;
47
+ /** Property names that must be present for the condition to match. */
48
+ required?: string[];
49
+ /** Schemas that must all match for the condition to succeed. */
25
50
  allOf?: RuleConditionSchema[];
26
51
  }
27
52
  /**
28
53
  * Condition for a rule.
54
+ *
55
+ * @public
29
56
  */
30
57
  export interface SchemaBasedCondition {
31
- scope: string;
32
- schema: RuleConditionSchema;
58
+ /** JSON Pointer scope the rule evaluates against. */
59
+ readonly scope: string;
60
+ /** JSON Schema fragment evaluated at the scoped location. */
61
+ readonly schema: RuleConditionSchema;
33
62
  }
34
63
  /**
35
64
  * Rule for conditional element visibility/enablement.
65
+ *
66
+ * @public
36
67
  */
37
68
  export interface Rule {
38
- effect: RuleEffect;
39
- condition: SchemaBasedCondition;
40
- }
41
- /**
42
- * Base interface for all UI Schema elements.
43
- */
44
- export interface UISchemaElementBase {
45
- type: UISchemaElementType;
46
- rule?: Rule;
47
- options?: Record<string, unknown>;
69
+ /** UI effect to apply when the rule condition matches. */
70
+ readonly effect: RuleEffect;
71
+ /** Predicate that controls when the UI effect applies. */
72
+ readonly condition: SchemaBasedCondition;
48
73
  }
49
74
  /**
50
75
  * A Control element that binds to a JSON Schema property.
76
+ *
77
+ * @public
51
78
  */
52
- export interface ControlElement extends UISchemaElementBase {
53
- type: "Control";
54
- scope: string;
55
- label?: string;
79
+ export interface ControlElement {
80
+ /** Discriminator identifying a JSON Forms control element. */
81
+ readonly type: "Control";
82
+ /** JSON Pointer scope that this control binds to. */
83
+ readonly scope: string;
84
+ /** Optional label override, or `false` to suppress the label. */
85
+ readonly label?: string | false | undefined;
86
+ /** Optional rule controlling visibility or enablement. */
87
+ readonly rule?: Rule | undefined;
88
+ /** Renderer-specific control options. */
89
+ readonly options?: Record<string, unknown> | undefined;
90
+ /** Additional renderer-specific extension properties. */
91
+ readonly [k: string]: unknown;
56
92
  }
57
93
  /**
58
94
  * A vertical layout element.
95
+ *
96
+ * @public
59
97
  */
60
- export interface VerticalLayout extends UISchemaElementBase {
61
- type: "VerticalLayout";
62
- elements: UISchemaElement[];
98
+ export interface VerticalLayout {
99
+ /** Discriminator identifying a vertical layout container. */
100
+ readonly type: "VerticalLayout";
101
+ /** Child elements rendered in vertical order. */
102
+ readonly elements: UISchemaElement[];
103
+ /** Optional rule controlling visibility or enablement. */
104
+ readonly rule?: Rule | undefined;
105
+ /** Renderer-specific layout options. */
106
+ readonly options?: Record<string, unknown> | undefined;
107
+ /** Additional renderer-specific extension properties. */
108
+ readonly [k: string]: unknown;
63
109
  }
64
110
  /**
65
111
  * A horizontal layout element.
112
+ *
113
+ * @public
66
114
  */
67
- export interface HorizontalLayout extends UISchemaElementBase {
68
- type: "HorizontalLayout";
69
- elements: UISchemaElement[];
115
+ export interface HorizontalLayout {
116
+ /** Discriminator identifying a horizontal layout container. */
117
+ readonly type: "HorizontalLayout";
118
+ /** Child elements rendered side by side. */
119
+ readonly elements: UISchemaElement[];
120
+ /** Optional rule controlling visibility or enablement. */
121
+ readonly rule?: Rule | undefined;
122
+ /** Renderer-specific layout options. */
123
+ readonly options?: Record<string, unknown> | undefined;
124
+ /** Additional renderer-specific extension properties. */
125
+ readonly [k: string]: unknown;
70
126
  }
71
127
  /**
72
128
  * A group element with a label.
129
+ *
130
+ * @public
73
131
  */
74
- export interface GroupLayout extends UISchemaElementBase {
75
- type: "Group";
76
- label: string;
77
- elements: UISchemaElement[];
132
+ export interface GroupLayout {
133
+ /** Discriminator identifying a labeled group container. */
134
+ readonly type: "Group";
135
+ /** Group label shown by compatible renderers. */
136
+ readonly label: string;
137
+ /** Child elements rendered inside the group. */
138
+ readonly elements: UISchemaElement[];
139
+ /** Optional rule controlling visibility or enablement. */
140
+ readonly rule?: Rule | undefined;
141
+ /** Renderer-specific group options. */
142
+ readonly options?: Record<string, unknown> | undefined;
143
+ /** Additional renderer-specific extension properties. */
144
+ readonly [k: string]: unknown;
145
+ }
146
+ /**
147
+ * A Category element, used inside a Categorization layout.
148
+ *
149
+ * @public
150
+ */
151
+ export interface Category {
152
+ /** Discriminator identifying a category inside a categorization layout. */
153
+ readonly type: "Category";
154
+ /** Category label shown in tabs or step navigation. */
155
+ readonly label: string;
156
+ /** Child elements rendered inside the category. */
157
+ readonly elements: UISchemaElement[];
158
+ /** Optional rule controlling visibility or enablement. */
159
+ readonly rule?: Rule | undefined;
160
+ /** Renderer-specific category options. */
161
+ readonly options?: Record<string, unknown> | undefined;
162
+ /** Additional renderer-specific extension properties. */
163
+ readonly [k: string]: unknown;
164
+ }
165
+ /**
166
+ * A Categorization element (tab-based layout).
167
+ *
168
+ * @public
169
+ */
170
+ export interface Categorization {
171
+ /** Discriminator identifying a categorization layout. */
172
+ readonly type: "Categorization";
173
+ /** Categories rendered as tabs or steps. */
174
+ readonly elements: Category[];
175
+ /** Optional label for the overall categorization container. */
176
+ readonly label?: string | undefined;
177
+ /** Optional rule controlling visibility or enablement. */
178
+ readonly rule?: Rule | undefined;
179
+ /** Renderer-specific categorization options. */
180
+ readonly options?: Record<string, unknown> | undefined;
181
+ /** Additional renderer-specific extension properties. */
182
+ readonly [k: string]: unknown;
183
+ }
184
+ /**
185
+ * A Label element for displaying static text.
186
+ *
187
+ * @public
188
+ */
189
+ export interface LabelElement {
190
+ /** Discriminator identifying a static text label element. */
191
+ readonly type: "Label";
192
+ /** Static text content rendered by the label element. */
193
+ readonly text: string;
194
+ /** Optional rule controlling visibility or enablement. */
195
+ readonly rule?: Rule | undefined;
196
+ /** Renderer-specific label options. */
197
+ readonly options?: Record<string, unknown> | undefined;
198
+ /** Additional renderer-specific extension properties. */
199
+ readonly [k: string]: unknown;
78
200
  }
79
201
  /**
80
202
  * Union of all UI Schema element types.
203
+ *
204
+ * @public
205
+ */
206
+ export type UISchemaElement = ControlElement | VerticalLayout | HorizontalLayout | GroupLayout | Categorization | Category | LabelElement;
207
+ /**
208
+ * Root UI Schema (always a layout — not a Control, Category, or Label).
209
+ *
210
+ * @public
81
211
  */
82
- export type UISchemaElement = ControlElement | VerticalLayout | HorizontalLayout | GroupLayout;
212
+ export type UISchema = VerticalLayout | HorizontalLayout | GroupLayout | Categorization;
83
213
  /**
84
- * Root UI Schema (always a layout).
214
+ * Base interface for all UI Schema elements.
215
+ *
216
+ * This is a manually maintained interface representing the common shape
217
+ * shared by all element types. It is kept as an interface (rather than
218
+ * derived from Zod) because it is the base of a discriminated union, not
219
+ * a union member itself.
220
+ *
221
+ * @public
85
222
  */
86
- export type UISchema = VerticalLayout | HorizontalLayout | GroupLayout;
223
+ export interface UISchemaElementBase {
224
+ /** Discriminator for the concrete JSON Forms element type. */
225
+ type: UISchemaElementType;
226
+ /** Optional rule controlling visibility or enablement. */
227
+ rule?: Rule;
228
+ /** Renderer-specific options shared by UI schema elements. */
229
+ options?: Record<string, unknown>;
230
+ }
87
231
  //# sourceMappingURL=types.d.ts.map