@formspec/build 0.1.0-alpha.22 → 0.1.0-alpha.23

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 (153) hide show
  1. package/README.md +9 -4
  2. package/dist/analyzer/class-analyzer.d.ts +1 -1
  3. package/dist/analyzer/class-analyzer.d.ts.map +1 -1
  4. package/dist/analyzer/jsdoc-constraints.d.ts +1 -1
  5. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
  6. package/dist/analyzer/tsdoc-parser.d.ts +1 -1
  7. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
  8. package/dist/browser.cjs +5 -4
  9. package/dist/browser.cjs.map +1 -1
  10. package/dist/browser.js +4 -3
  11. package/dist/browser.js.map +1 -1
  12. package/dist/build-alpha.d.ts +836 -0
  13. package/dist/build-beta.d.ts +836 -0
  14. package/dist/build-internal.d.ts +836 -0
  15. package/dist/build.d.ts +157 -538
  16. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +2 -1
  17. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -1
  18. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +1 -1
  19. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
  20. package/dist/cli.cjs +82 -126
  21. package/dist/cli.cjs.map +1 -1
  22. package/dist/cli.js +72 -116
  23. package/dist/cli.js.map +1 -1
  24. package/dist/generators/class-schema.d.ts +20 -3
  25. package/dist/generators/class-schema.d.ts.map +1 -1
  26. package/dist/generators/mixed-authoring.d.ts +3 -2
  27. package/dist/generators/mixed-authoring.d.ts.map +1 -1
  28. package/dist/index.cjs +79 -127
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.ts +4 -12
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +72 -101
  33. package/dist/index.js.map +1 -1
  34. package/dist/internals.cjs +77 -15
  35. package/dist/internals.cjs.map +1 -1
  36. package/dist/internals.d.ts +2 -1
  37. package/dist/internals.d.ts.map +1 -1
  38. package/dist/internals.js +69 -7
  39. package/dist/internals.js.map +1 -1
  40. package/dist/json-schema/generator.d.ts +8 -4
  41. package/dist/json-schema/generator.d.ts.map +1 -1
  42. package/dist/json-schema/ir-generator.d.ts +4 -4
  43. package/dist/json-schema/ir-generator.d.ts.map +1 -1
  44. package/dist/json-schema/schema.d.ts +2 -2
  45. package/dist/json-schema/types.d.ts +6 -6
  46. package/dist/ui-schema/ir-generator.d.ts +1 -1
  47. package/dist/ui-schema/ir-generator.d.ts.map +1 -1
  48. package/dist/ui-schema/schema.d.ts +28 -28
  49. package/dist/ui-schema/types.d.ts +152 -3
  50. package/dist/ui-schema/types.d.ts.map +1 -1
  51. package/dist/validate/constraint-validator.d.ts +1 -1
  52. package/dist/validate/constraint-validator.d.ts.map +1 -1
  53. package/package.json +8 -8
  54. package/dist/__tests__/alias-chain-propagation.test.d.ts +0 -9
  55. package/dist/__tests__/alias-chain-propagation.test.d.ts.map +0 -1
  56. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +0 -2
  57. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +0 -1
  58. package/dist/__tests__/class-schema.test.d.ts +0 -2
  59. package/dist/__tests__/class-schema.test.d.ts.map +0 -1
  60. package/dist/__tests__/cli.test.d.ts +0 -2
  61. package/dist/__tests__/cli.test.d.ts.map +0 -1
  62. package/dist/__tests__/constraint-validator.test.d.ts +0 -2
  63. package/dist/__tests__/constraint-validator.test.d.ts.map +0 -1
  64. package/dist/__tests__/date-extension.integration.test.d.ts +0 -2
  65. package/dist/__tests__/date-extension.integration.test.d.ts.map +0 -1
  66. package/dist/__tests__/edge-cases.test.d.ts +0 -7
  67. package/dist/__tests__/edge-cases.test.d.ts.map +0 -1
  68. package/dist/__tests__/extension-api.test.d.ts +0 -2
  69. package/dist/__tests__/extension-api.test.d.ts.map +0 -1
  70. package/dist/__tests__/extension-runtime.integration.test.d.ts +0 -2
  71. package/dist/__tests__/extension-runtime.integration.test.d.ts.map +0 -1
  72. package/dist/__tests__/fixtures/alias-chains.d.ts +0 -37
  73. package/dist/__tests__/fixtures/alias-chains.d.ts.map +0 -1
  74. package/dist/__tests__/fixtures/class-schema-regressions.d.ts +0 -86
  75. package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +0 -1
  76. package/dist/__tests__/fixtures/edge-cases.d.ts +0 -132
  77. package/dist/__tests__/fixtures/edge-cases.d.ts.map +0 -1
  78. package/dist/__tests__/fixtures/example-a-builtins.d.ts +0 -31
  79. package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +0 -1
  80. package/dist/__tests__/fixtures/example-date-extension.d.ts +0 -12
  81. package/dist/__tests__/fixtures/example-date-extension.d.ts.map +0 -1
  82. package/dist/__tests__/fixtures/example-interface-types.d.ts +0 -107
  83. package/dist/__tests__/fixtures/example-interface-types.d.ts.map +0 -1
  84. package/dist/__tests__/fixtures/example-numeric-extension.d.ts +0 -20
  85. package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +0 -1
  86. package/dist/__tests__/fixtures/extension-forms.d.ts +0 -7
  87. package/dist/__tests__/fixtures/extension-forms.d.ts.map +0 -1
  88. package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +0 -31
  89. package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +0 -1
  90. package/dist/__tests__/fixtures/named-primitive-aliases.d.ts +0 -15
  91. package/dist/__tests__/fixtures/named-primitive-aliases.d.ts.map +0 -1
  92. package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts +0 -14
  93. package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts.map +0 -1
  94. package/dist/__tests__/fixtures/sample-forms.d.ts +0 -65
  95. package/dist/__tests__/fixtures/sample-forms.d.ts.map +0 -1
  96. package/dist/__tests__/generate-schemas.test.d.ts +0 -2
  97. package/dist/__tests__/generate-schemas.test.d.ts.map +0 -1
  98. package/dist/__tests__/generator.test.d.ts +0 -2
  99. package/dist/__tests__/generator.test.d.ts.map +0 -1
  100. package/dist/__tests__/guards.test.d.ts +0 -2
  101. package/dist/__tests__/guards.test.d.ts.map +0 -1
  102. package/dist/__tests__/integration.test.d.ts +0 -8
  103. package/dist/__tests__/integration.test.d.ts.map +0 -1
  104. package/dist/__tests__/ir-analyzer.test.d.ts +0 -11
  105. package/dist/__tests__/ir-analyzer.test.d.ts.map +0 -1
  106. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +0 -12
  107. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +0 -1
  108. package/dist/__tests__/ir-json-schema-generator.test.d.ts +0 -11
  109. package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +0 -1
  110. package/dist/__tests__/ir-ui-schema-generator.test.d.ts +0 -2
  111. package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +0 -1
  112. package/dist/__tests__/mixed-authoring.test.d.ts +0 -2
  113. package/dist/__tests__/mixed-authoring.test.d.ts.map +0 -1
  114. package/dist/__tests__/numeric-extension.integration.test.d.ts +0 -2
  115. package/dist/__tests__/numeric-extension.integration.test.d.ts.map +0 -1
  116. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +0 -9
  117. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +0 -1
  118. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +0 -9
  119. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +0 -1
  120. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +0 -19
  121. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +0 -1
  122. package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts +0 -19
  123. package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts.map +0 -1
  124. package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts +0 -6
  125. package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts.map +0 -1
  126. package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts +0 -17
  127. package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts.map +0 -1
  128. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +0 -13
  129. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +0 -1
  130. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +0 -9
  131. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +0 -1
  132. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +0 -28
  133. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +0 -1
  134. package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts +0 -9
  135. package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts.map +0 -1
  136. package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts +0 -6
  137. package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts.map +0 -1
  138. package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts +0 -19
  139. package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts.map +0 -1
  140. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +0 -12
  141. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +0 -1
  142. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +0 -9
  143. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +0 -1
  144. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +0 -19
  145. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +0 -1
  146. package/dist/__tests__/parity/parity.test.d.ts +0 -18
  147. package/dist/__tests__/parity/parity.test.d.ts.map +0 -1
  148. package/dist/__tests__/parity/utils.d.ts +0 -152
  149. package/dist/__tests__/parity/utils.d.ts.map +0 -1
  150. package/dist/__tests__/path-target-parser.test.d.ts +0 -9
  151. package/dist/__tests__/path-target-parser.test.d.ts.map +0 -1
  152. package/dist/__tests__/write-schemas.test.d.ts +0 -2
  153. package/dist/__tests__/write-schemas.test.d.ts.map +0 -1
package/dist/build.d.ts CHANGED
@@ -23,17 +23,39 @@
23
23
  * @packageDocumentation
24
24
  */
25
25
 
26
- import type { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
27
- import type { ConstraintTagRegistration } from '@formspec/core';
28
- import type { CustomAnnotationRegistration } from '@formspec/core';
29
- import type { CustomConstraintRegistration } from '@formspec/core';
30
- import type { CustomTypeRegistration } from '@formspec/core';
31
- import type { ExtensionDefinition } from '@formspec/core';
32
- import type { FormElement } from '@formspec/core';
33
- import type { FormIR } from '@formspec/core';
34
- import type { FormSpec } from '@formspec/core';
35
- import type { JsonValue } from '@formspec/core';
36
- import { z } from 'zod';
26
+ import { AnyField } from '@formspec/core';
27
+ import { ArrayField } from '@formspec/core';
28
+ import { BooleanField } from '@formspec/core';
29
+ import { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
30
+ import { BuiltinConstraintName } from '@formspec/core';
31
+ import { Conditional } from '@formspec/core';
32
+ import { ConstraintSemanticRole } from '@formspec/core';
33
+ import { ConstraintTagRegistration } from '@formspec/core';
34
+ import { CustomAnnotationRegistration } from '@formspec/core';
35
+ import { CustomConstraintRegistration } from '@formspec/core';
36
+ import { CustomTypeRegistration } from '@formspec/core';
37
+ import { DynamicEnumField } from '@formspec/core';
38
+ import { DynamicSchemaField } from '@formspec/core';
39
+ import { EnumOption } from '@formspec/core';
40
+ import { EnumOptionValue } from '@formspec/core';
41
+ import { ExtensionApplicableType } from '@formspec/core';
42
+ import { ExtensionDefinition } from '@formspec/core';
43
+ import { ExtensionPayloadValue } from '@formspec/core';
44
+ import { ExtensionTypeKind } from '@formspec/core';
45
+ import { FormElement } from '@formspec/core';
46
+ import { FormSpec } from '@formspec/core';
47
+ import { Group } from '@formspec/core';
48
+ import { NumberField } from '@formspec/core';
49
+ import { ObjectField } from '@formspec/core';
50
+ import { StaticEnumField } from '@formspec/core';
51
+ import { TextField } from '@formspec/core';
52
+ import { VocabularyKeywordRegistration } from '@formspec/core';
53
+
54
+ export { AnyField }
55
+
56
+ export { ArrayField }
57
+
58
+ export { BooleanField }
37
59
 
38
60
  /**
39
61
  * Builds both JSON Schema and UI Schema from a FormSpec.
@@ -97,7 +119,7 @@ export declare function buildMixedAuthoringSchemas(options: BuildMixedAuthoringS
97
119
  *
98
120
  * @public
99
121
  */
100
- export declare interface BuildMixedAuthoringSchemasOptions extends GenerateJsonSchemaFromIROptions {
122
+ export declare interface BuildMixedAuthoringSchemasOptions extends StaticSchemaGenerationOptions {
101
123
  /** Path to the TypeScript source file. */
102
124
  readonly filePath: string;
103
125
  /** Name of the class, interface, or type alias to analyze. */
@@ -118,163 +140,57 @@ export declare interface BuildResult {
118
140
  readonly uiSchema: UISchema;
119
141
  }
120
142
 
143
+ export { BuiltinConstraintBroadeningRegistration }
144
+
145
+ export { BuiltinConstraintName }
146
+
121
147
  /**
122
148
  * A Categorization element (tab-based layout).
123
149
  *
124
150
  * @public
125
151
  */
126
152
  export declare interface Categorization {
127
- type: "Categorization";
128
- elements: Category[];
129
- label?: string | undefined;
130
- rule?: Rule | undefined;
131
- options?: Record<string, unknown> | undefined;
132
- [k: string]: unknown;
153
+ readonly type: "Categorization";
154
+ readonly elements: Category[];
155
+ readonly label?: string | undefined;
156
+ readonly rule?: Rule | undefined;
157
+ readonly options?: Record<string, unknown> | undefined;
158
+ readonly [k: string]: unknown;
133
159
  }
134
160
 
135
- /**
136
- * Zod schema for a categorization element.
137
- *
138
- * @public
139
- */
140
- export declare const categorizationSchema: z.ZodType<Categorization>;
141
-
142
161
  /**
143
162
  * A Category element, used inside a Categorization layout.
144
163
  *
145
164
  * @public
146
165
  */
147
166
  export declare interface Category {
148
- type: "Category";
149
- label: string;
150
- elements: UISchemaElement[];
151
- rule?: Rule | undefined;
152
- options?: Record<string, unknown> | undefined;
153
- [k: string]: unknown;
167
+ readonly type: "Category";
168
+ readonly label: string;
169
+ readonly elements: UISchemaElement[];
170
+ readonly rule?: Rule | undefined;
171
+ readonly options?: Record<string, unknown> | undefined;
172
+ readonly [k: string]: unknown;
154
173
  }
155
174
 
156
- /**
157
- * Zod schema for a category element.
158
- *
159
- * @public
160
- */
161
- export declare const categorySchema: z.ZodType<Category>;
175
+ export { Conditional }
162
176
 
163
- /**
164
- * Generated schemas for a class.
165
- *
166
- * @public
167
- */
168
- export declare interface ClassSchemas {
169
- /** JSON Schema 2020-12 for validation */
170
- jsonSchema: JsonSchema2020;
171
- /** JSON Forms UI Schema for rendering */
172
- uiSchema: UISchema;
173
- }
177
+ export { ConstraintSemanticRole }
174
178
 
175
- /**
176
- * A Control element that binds to a JSON Schema property.
177
- *
178
- * @public
179
- */
180
- export declare type ControlElement = z.infer<typeof controlSchema>;
179
+ export { ConstraintTagRegistration }
181
180
 
182
181
  /**
183
- * Zod schema for a Control element.
182
+ * A Control element that binds to a JSON Schema property.
184
183
  *
185
184
  * @public
186
185
  */
187
- export declare const controlSchema: z.ZodObject<{
188
- type: z.ZodLiteral<"Control">;
189
- scope: z.ZodString;
190
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
191
- rule: z.ZodOptional<z.ZodObject<{
192
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
193
- condition: z.ZodObject<{
194
- scope: z.ZodString;
195
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
196
- }, "strict", z.ZodTypeAny, {
197
- schema: RuleConditionSchema;
198
- scope: string;
199
- }, {
200
- schema: RuleConditionSchema;
201
- scope: string;
202
- }>;
203
- }, "strict", z.ZodTypeAny, {
204
- condition: {
205
- schema: RuleConditionSchema;
206
- scope: string;
207
- };
208
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
209
- }, {
210
- condition: {
211
- schema: RuleConditionSchema;
212
- scope: string;
213
- };
214
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
215
- }>>;
216
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
217
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
218
- type: z.ZodLiteral<"Control">;
219
- scope: z.ZodString;
220
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
221
- rule: z.ZodOptional<z.ZodObject<{
222
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
223
- condition: z.ZodObject<{
224
- scope: z.ZodString;
225
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
226
- }, "strict", z.ZodTypeAny, {
227
- schema: RuleConditionSchema;
228
- scope: string;
229
- }, {
230
- schema: RuleConditionSchema;
231
- scope: string;
232
- }>;
233
- }, "strict", z.ZodTypeAny, {
234
- condition: {
235
- schema: RuleConditionSchema;
236
- scope: string;
237
- };
238
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
239
- }, {
240
- condition: {
241
- schema: RuleConditionSchema;
242
- scope: string;
243
- };
244
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
245
- }>>;
246
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
247
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
248
- type: z.ZodLiteral<"Control">;
249
- scope: z.ZodString;
250
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
251
- rule: z.ZodOptional<z.ZodObject<{
252
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
253
- condition: z.ZodObject<{
254
- scope: z.ZodString;
255
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
256
- }, "strict", z.ZodTypeAny, {
257
- schema: RuleConditionSchema;
258
- scope: string;
259
- }, {
260
- schema: RuleConditionSchema;
261
- scope: string;
262
- }>;
263
- }, "strict", z.ZodTypeAny, {
264
- condition: {
265
- schema: RuleConditionSchema;
266
- scope: string;
267
- };
268
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
269
- }, {
270
- condition: {
271
- schema: RuleConditionSchema;
272
- scope: string;
273
- };
274
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
275
- }>>;
276
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
277
- }, z.ZodTypeAny, "passthrough">>;
186
+ export declare interface ControlElement {
187
+ readonly type: "Control";
188
+ readonly scope: string;
189
+ readonly label?: string | false | undefined;
190
+ readonly rule?: Rule | undefined;
191
+ readonly options?: Record<string, unknown> | undefined;
192
+ readonly [k: string]: unknown;
193
+ }
278
194
 
279
195
  /**
280
196
  * Creates an extension registry from a list of extension definitions.
@@ -291,12 +207,26 @@ export declare const controlSchema: z.ZodObject<{
291
207
  */
292
208
  export declare function createExtensionRegistry(extensions: readonly ExtensionDefinition[]): ExtensionRegistry;
293
209
 
294
- /**
295
- * JSON Schema with FormSpec extension properties for arbitrary `x-formspec-*` keys.
296
- *
297
- * @public
298
- */
299
- export declare type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;
210
+ export { CustomAnnotationRegistration }
211
+
212
+ export { CustomConstraintRegistration }
213
+
214
+ export { CustomTypeRegistration }
215
+
216
+ export { DynamicEnumField }
217
+
218
+ export { DynamicSchemaField }
219
+
220
+ export { EnumOption }
221
+
222
+ export { EnumOptionValue }
223
+
224
+ /* Excluded from this release type: ExtendedJSONSchema7 */
225
+ export { ExtensionApplicableType }
226
+
227
+ export { ExtensionDefinition }
228
+
229
+ export { ExtensionPayloadValue }
300
230
 
301
231
  /**
302
232
  * A registry of extensions that provides lookup by fully-qualified ID.
@@ -357,19 +287,20 @@ export declare interface ExtensionRegistry {
357
287
  findAnnotation(annotationId: string): CustomAnnotationRegistration | undefined;
358
288
  }
359
289
 
360
- /**
361
- * Extension properties for custom FormSpec constraint tags.
362
- *
363
- * @public
364
- */
365
- export declare type FormSpecSchemaExtensions = Record<`x-formspec-${string}`, unknown>;
290
+ export { ExtensionTypeKind }
291
+
292
+ export { FormElement }
293
+
294
+ export { FormSpec }
295
+
296
+ /* Excluded from this release type: FormSpecSchemaExtensions */
366
297
 
367
298
  /**
368
299
  * Options for generating schemas from a decorated class.
369
300
  *
370
301
  * @public
371
302
  */
372
- export declare interface GenerateFromClassOptions extends GenerateJsonSchemaFromIROptions {
303
+ export declare interface GenerateFromClassOptions extends StaticSchemaGenerationOptions {
373
304
  /** Path to the TypeScript source file */
374
305
  filePath: string;
375
306
  /** Class name to analyze */
@@ -421,78 +352,18 @@ export declare interface GenerateFromClassResult {
421
352
  export declare function generateJsonSchema<E extends readonly FormElement[]>(form: FormSpec<E>, options?: GenerateJsonSchemaOptions): JsonSchema2020;
422
353
 
423
354
  /**
424
- * Generates a JSON Schema 2020-12 object from a canonical FormIR.
425
- *
426
- * Groups and conditionals are flattened — they influence UI layout but do not
427
- * affect the data schema. All fields appear at the level they would occupy in
428
- * the output data.
429
- *
430
- * Named types in the `typeRegistry` are emitted as `$defs` entries and
431
- * referenced via `$ref` (per PP7 — high-fidelity output).
432
- *
433
- * @example
434
- * ```typescript
435
- * import { canonicalizeDSL } from "./canonicalize/index.js";
436
- * import { generateJsonSchemaFromIR } from "./json-schema/ir-generator.js";
437
- * import { formspec, field } from "@formspec/dsl";
438
- *
439
- * const form = formspec(
440
- * field.text("name", { label: "Name", required: true }),
441
- * field.number("age", { min: 0 }),
442
- * );
443
- * const ir = canonicalizeDSL(form);
444
- * const schema = generateJsonSchemaFromIR(ir);
445
- * // {
446
- * // $schema: "https://json-schema.org/draft/2020-12/schema",
447
- * // type: "object",
448
- * // properties: {
449
- * // name: { type: "string", title: "Name" },
450
- * // age: { type: "number", minimum: 0 }
451
- * // },
452
- * // required: ["name"]
453
- * // }
454
- * ```
455
- *
456
- * Advanced API — most consumers should use `generateJsonSchema()` or
457
- * `buildFormSchemas()`, which canonicalize form definitions automatically.
458
- * Callers of this function are responsible for providing pre-canonicalized IR.
459
- *
460
- * @param ir - The canonical FormIR produced by a canonicalizer
461
- * @returns A plain JSON-serializable JSON Schema 2020-12 object
462
- *
463
- * @public
464
- */
465
- export declare function generateJsonSchemaFromIR(ir: FormIR, options?: GenerateJsonSchemaFromIROptions): JsonSchema2020;
466
-
467
- /**
468
- * Options for generating JSON Schema from a canonical FormIR.
355
+ * Options for generating JSON Schema from a Chain DSL form.
469
356
  *
470
357
  * @public
471
358
  */
472
- export declare interface GenerateJsonSchemaFromIROptions {
359
+ export declare interface GenerateJsonSchemaOptions {
473
360
  /**
474
- * Registry used to resolve custom types, constraints, and annotations.
475
- *
476
- * JSON Schema generation throws when custom IR nodes are present without a
477
- * matching registration in this registry.
478
- */
479
- readonly extensionRegistry?: ExtensionRegistry | undefined;
480
- /**
481
- * Vendor prefix passed to extension `toJsonSchema` hooks.
361
+ * Vendor prefix for emitted extension keywords.
482
362
  * @defaultValue "x-formspec"
483
363
  */
484
364
  readonly vendorPrefix?: string | undefined;
485
365
  }
486
366
 
487
- /**
488
- * Options for generating JSON Schema from a Chain DSL form.
489
- *
490
- * These options are forwarded to the IR-based JSON Schema generator.
491
- *
492
- * @public
493
- */
494
- export declare type GenerateJsonSchemaOptions = GenerateJsonSchemaFromIROptions;
495
-
496
367
  /**
497
368
  * Generates JSON Schema and UI Schema from a named TypeScript
498
369
  * type — a decorated class, an interface with TSDoc tags, or a type alias.
@@ -544,7 +415,7 @@ export declare function generateSchemasFromClass(options: GenerateFromClassOptio
544
415
  *
545
416
  * @public
546
417
  */
547
- export declare interface GenerateSchemasOptions extends GenerateJsonSchemaFromIROptions {
418
+ export declare interface GenerateSchemasOptions extends StaticSchemaGenerationOptions {
548
419
  /** Path to the TypeScript source file */
549
420
  filePath: string;
550
421
  /** Name of the exported class, interface, or type alias to analyze */
@@ -599,18 +470,7 @@ export declare interface GenerateSchemasOptions extends GenerateJsonSchemaFromIR
599
470
  */
600
471
  export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>): UISchema;
601
472
 
602
- /**
603
- * Reads a FormSpec extension property from a JSON Schema node.
604
- *
605
- * Accepts any schema object — `JSONSchema7`, `JsonSchema2020`, `ExtendedJSONSchema7`, etc.
606
- *
607
- * @param schema - Any JSON Schema node
608
- * @param key - Extension key (must start with `x-formspec-`)
609
- * @returns The extension value, or `undefined` if not present
610
- *
611
- * @public
612
- */
613
- export declare function getSchemaExtension(schema: object, key: `x-formspec-${string}`): unknown;
473
+ export { Group }
614
474
 
615
475
  /**
616
476
  * A group element with a label.
@@ -618,41 +478,27 @@ export declare function getSchemaExtension(schema: object, key: `x-formspec-${st
618
478
  * @public
619
479
  */
620
480
  export declare interface GroupLayout {
621
- type: "Group";
622
- label: string;
623
- elements: UISchemaElement[];
624
- rule?: Rule | undefined;
625
- options?: Record<string, unknown> | undefined;
626
- [k: string]: unknown;
481
+ readonly type: "Group";
482
+ readonly label: string;
483
+ readonly elements: UISchemaElement[];
484
+ readonly rule?: Rule | undefined;
485
+ readonly options?: Record<string, unknown> | undefined;
486
+ readonly [k: string]: unknown;
627
487
  }
628
488
 
629
- /**
630
- * Zod schema for a group layout element.
631
- *
632
- * @public
633
- */
634
- export declare const groupLayoutSchema: z.ZodType<GroupLayout>;
635
-
636
489
  /**
637
490
  * A horizontal layout element.
638
491
  *
639
492
  * @public
640
493
  */
641
494
  export declare interface HorizontalLayout {
642
- type: "HorizontalLayout";
643
- elements: UISchemaElement[];
644
- rule?: Rule | undefined;
645
- options?: Record<string, unknown> | undefined;
646
- [k: string]: unknown;
495
+ readonly type: "HorizontalLayout";
496
+ readonly elements: UISchemaElement[];
497
+ readonly rule?: Rule | undefined;
498
+ readonly options?: Record<string, unknown> | undefined;
499
+ readonly [k: string]: unknown;
647
500
  }
648
501
 
649
- /**
650
- * Zod schema for a horizontal layout element.
651
- *
652
- * @public
653
- */
654
- export declare const horizontalLayoutSchema: z.ZodType<HorizontalLayout>;
655
-
656
502
  /**
657
503
  * A JSON Schema 2020-12 document, sub-schema, or keyword collection.
658
504
  *
@@ -671,7 +517,7 @@ export declare interface JsonSchema2020 {
671
517
  items?: JsonSchema2020;
672
518
  additionalProperties?: boolean | JsonSchema2020;
673
519
  enum?: readonly (string | number)[];
674
- const?: JsonValue;
520
+ const?: unknown;
675
521
  allOf?: readonly JsonSchema2020[];
676
522
  oneOf?: readonly JsonSchema2020[];
677
523
  anyOf?: readonly JsonSchema2020[];
@@ -694,186 +540,22 @@ export declare interface JsonSchema2020 {
694
540
  [key: `x-${string}`]: unknown;
695
541
  }
696
542
 
697
- /**
698
- * A JSON Schema definition (legacy subset used by Zod validator and types.ts).
699
- *
700
- * @public
701
- */
702
- export declare interface JSONSchema7 {
703
- $schema?: string;
704
- $id?: string;
705
- $ref?: string;
706
- title?: string;
707
- description?: string;
708
- deprecated?: boolean;
709
- type?: JSONSchemaType | JSONSchemaType[];
710
- minLength?: number;
711
- maxLength?: number;
712
- pattern?: string;
713
- minimum?: number;
714
- maximum?: number;
715
- exclusiveMinimum?: number;
716
- exclusiveMaximum?: number;
717
- enum?: readonly (string | number | boolean | null)[];
718
- const?: string | number | boolean | null;
719
- properties?: Record<string, JSONSchema7>;
720
- required?: string[];
721
- additionalProperties?: boolean | JSONSchema7;
722
- items?: JSONSchema7 | JSONSchema7[];
723
- minItems?: number;
724
- maxItems?: number;
725
- allOf?: JSONSchema7[];
726
- anyOf?: JSONSchema7[];
727
- oneOf?: JSONSchema7[];
728
- not?: JSONSchema7;
729
- if?: JSONSchema7;
730
- then?: JSONSchema7;
731
- else?: JSONSchema7;
732
- format?: string;
733
- default?: unknown;
734
- /**
735
- * Data source key for dynamic enum fields.
736
- * Indicates that options should be fetched from a registered resolver.
737
- */
738
- "x-formspec-source"?: string;
739
- /**
740
- * Field names whose values are needed to fetch dynamic enum options.
741
- * Used for dependent/cascading dropdowns.
742
- */
743
- "x-formspec-params"?: readonly string[];
744
- /**
745
- * Schema source identifier for dynamic schema fields.
746
- * Indicates that the schema should be loaded dynamically at runtime.
747
- */
748
- "x-formspec-schemaSource"?: string;
749
- }
750
-
751
- /**
752
- * Zod schema for the legacy JSON Schema 7 subset used by `@formspec/build`.
753
- *
754
- * @public
755
- */
756
- export declare const jsonSchema7Schema: z.ZodType<JSONSchema7>;
757
-
758
- /**
759
- * JSON Schema type definitions.
760
- *
761
- * These types are a subset of JSON Schema sufficient for form generation.
762
- */
763
- /**
764
- * JSON Schema primitive types.
765
- *
766
- * @public
767
- */
768
- export declare type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
543
+ /* Excluded from this release type: JSONSchema7 */
769
544
 
770
- /**
771
- * Zod schema for JSON Schema primitive type strings.
772
- *
773
- * @public
774
- */
775
- export declare const jsonSchemaTypeSchema: z.ZodEnum<["string", "number", "integer", "boolean", "object", "array", "null"]>;
545
+ /* Excluded from this release type: JSONSchemaType */
776
546
 
777
547
  /**
778
548
  * A Label element for displaying static text.
779
549
  *
780
550
  * @public
781
551
  */
782
- export declare type LabelElement = z.infer<typeof labelElementSchema>;
783
-
784
- /**
785
- * Zod schema for a Label element.
786
- *
787
- * @public
788
- */
789
- export declare const labelElementSchema: z.ZodObject<{
790
- type: z.ZodLiteral<"Label">;
791
- text: z.ZodString;
792
- rule: z.ZodOptional<z.ZodObject<{
793
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
794
- condition: z.ZodObject<{
795
- scope: z.ZodString;
796
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
797
- }, "strict", z.ZodTypeAny, {
798
- schema: RuleConditionSchema;
799
- scope: string;
800
- }, {
801
- schema: RuleConditionSchema;
802
- scope: string;
803
- }>;
804
- }, "strict", z.ZodTypeAny, {
805
- condition: {
806
- schema: RuleConditionSchema;
807
- scope: string;
808
- };
809
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
810
- }, {
811
- condition: {
812
- schema: RuleConditionSchema;
813
- scope: string;
814
- };
815
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
816
- }>>;
817
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
818
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
819
- type: z.ZodLiteral<"Label">;
820
- text: z.ZodString;
821
- rule: z.ZodOptional<z.ZodObject<{
822
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
823
- condition: z.ZodObject<{
824
- scope: z.ZodString;
825
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
826
- }, "strict", z.ZodTypeAny, {
827
- schema: RuleConditionSchema;
828
- scope: string;
829
- }, {
830
- schema: RuleConditionSchema;
831
- scope: string;
832
- }>;
833
- }, "strict", z.ZodTypeAny, {
834
- condition: {
835
- schema: RuleConditionSchema;
836
- scope: string;
837
- };
838
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
839
- }, {
840
- condition: {
841
- schema: RuleConditionSchema;
842
- scope: string;
843
- };
844
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
845
- }>>;
846
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
847
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
848
- type: z.ZodLiteral<"Label">;
849
- text: z.ZodString;
850
- rule: z.ZodOptional<z.ZodObject<{
851
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
852
- condition: z.ZodObject<{
853
- scope: z.ZodString;
854
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
855
- }, "strict", z.ZodTypeAny, {
856
- schema: RuleConditionSchema;
857
- scope: string;
858
- }, {
859
- schema: RuleConditionSchema;
860
- scope: string;
861
- }>;
862
- }, "strict", z.ZodTypeAny, {
863
- condition: {
864
- schema: RuleConditionSchema;
865
- scope: string;
866
- };
867
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
868
- }, {
869
- condition: {
870
- schema: RuleConditionSchema;
871
- scope: string;
872
- };
873
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
874
- }>>;
875
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
876
- }, z.ZodTypeAny, "passthrough">>;
552
+ export declare interface LabelElement {
553
+ readonly type: "Label";
554
+ readonly text: string;
555
+ readonly rule?: Rule | undefined;
556
+ readonly options?: Record<string, unknown> | undefined;
557
+ readonly [k: string]: unknown;
558
+ }
877
559
 
878
560
  /**
879
561
  * Result of generating schemas from a mixed-authoring composition.
@@ -887,12 +569,19 @@ export declare interface MixedAuthoringSchemas {
887
569
  readonly uiSchema: UISchema;
888
570
  }
889
571
 
572
+ export { NumberField }
573
+
574
+ export { ObjectField }
575
+
890
576
  /**
891
577
  * Rule for conditional element visibility/enablement.
892
578
  *
893
579
  * @public
894
580
  */
895
- export declare type Rule = z.infer<typeof ruleSchema>;
581
+ export declare interface Rule {
582
+ readonly effect: RuleEffect;
583
+ readonly condition: SchemaBasedCondition;
584
+ }
896
585
 
897
586
  /**
898
587
  * JSON Schema subset used in rule conditions.
@@ -915,94 +604,50 @@ export declare interface RuleConditionSchema {
915
604
  }
916
605
 
917
606
  /**
918
- * Zod schema for the rule-condition JSON Schema subset.
607
+ * JSON Forms UI Schema type definitions.
919
608
  *
920
- * @public
921
- */
922
- export declare const ruleConditionSchema: z.ZodType<RuleConditionSchema>;
923
-
924
- /**
925
- * Rule effect types for conditional visibility.
609
+ * These are the consumer-facing TypeScript shapes. Runtime validation remains
610
+ * defined separately in `./schema.ts`.
926
611
  *
927
- * @public
928
- */
929
- export declare type RuleEffect = z.infer<typeof ruleEffectSchema>;
930
-
931
- /**
932
- * Zod schema for rule effect values.
933
- *
934
- * @public
612
+ * See: https://jsonforms.io/docs/uischema/
935
613
  */
936
- export declare const ruleEffectSchema: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
937
-
938
614
  /**
939
- * Zod schema for a UI Schema rule.
615
+ * Rule effect types for conditional visibility.
940
616
  *
941
617
  * @public
942
618
  */
943
- export declare const ruleSchema: z.ZodObject<{
944
- effect: z.ZodEnum<["SHOW", "HIDE", "ENABLE", "DISABLE"]>;
945
- condition: z.ZodObject<{
946
- scope: z.ZodString;
947
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
948
- }, "strict", z.ZodTypeAny, {
949
- schema: RuleConditionSchema;
950
- scope: string;
951
- }, {
952
- schema: RuleConditionSchema;
953
- scope: string;
954
- }>;
955
- }, "strict", z.ZodTypeAny, {
956
- condition: {
957
- schema: RuleConditionSchema;
958
- scope: string;
959
- };
960
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
961
- }, {
962
- condition: {
963
- schema: RuleConditionSchema;
964
- scope: string;
965
- };
966
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
967
- }>;
619
+ export declare type RuleEffect = "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
968
620
 
969
621
  /**
970
622
  * Condition for a rule.
971
623
  *
972
624
  * @public
973
625
  */
974
- export declare type SchemaBasedCondition = z.infer<typeof schemaBasedConditionSchema>;
626
+ export declare interface SchemaBasedCondition {
627
+ readonly scope: string;
628
+ readonly schema: RuleConditionSchema;
629
+ }
975
630
 
976
- /**
977
- * Zod schema for a schema-based rule condition.
978
- *
979
- * @public
980
- */
981
- export declare const schemaBasedConditionSchema: z.ZodObject<{
982
- scope: z.ZodString;
983
- schema: z.ZodType<RuleConditionSchema, z.ZodTypeDef, RuleConditionSchema>;
984
- }, "strict", z.ZodTypeAny, {
985
- schema: RuleConditionSchema;
986
- scope: string;
987
- }, {
988
- schema: RuleConditionSchema;
989
- scope: string;
990
- }>;
631
+ export { StaticEnumField }
991
632
 
992
633
  /**
993
- * Sets a FormSpec extension property on a JSON Schema node.
994
- *
995
- * Use this to safely add `x-formspec-*` properties to any schema,
996
- * including nested schemas typed as `JSONSchema7` (which don't carry
997
- * the extension index signature).
998
- *
999
- * @param schema - Any JSON Schema node
1000
- * @param key - Extension key (must start with `x-formspec-`)
1001
- * @param value - Extension value
634
+ * Shared options for schema generation flows that support custom extensions.
1002
635
  *
1003
636
  * @public
1004
637
  */
1005
- export declare function setSchemaExtension(schema: object, key: `x-formspec-${string}`, value: unknown): void;
638
+ export declare interface StaticSchemaGenerationOptions {
639
+ /**
640
+ * Registry used to resolve custom types, constraints, and annotations.
641
+ */
642
+ readonly extensionRegistry?: ExtensionRegistry | undefined;
643
+ /**
644
+ * Vendor prefix for emitted extension keywords.
645
+ * @defaultValue "x-formspec"
646
+ */
647
+ readonly vendorPrefix?: string | undefined;
648
+ }
649
+
650
+ export { TextField }
1006
651
 
1007
652
  /**
1008
653
  * Root UI Schema (always a layout — not a Control, Category, or Label).
@@ -1034,33 +679,12 @@ export declare interface UISchemaElementBase {
1034
679
  options?: Record<string, unknown>;
1035
680
  }
1036
681
 
1037
- /**
1038
- * Zod schema for any UI Schema element.
1039
- *
1040
- * @public
1041
- */
1042
- export declare const uiSchemaElementSchema: z.ZodType<UISchemaElement>;
1043
-
1044
682
  /**
1045
683
  * UI Schema element types.
1046
684
  *
1047
685
  * @public
1048
686
  */
1049
- export declare type UISchemaElementType = z.infer<typeof uiSchemaElementTypeSchema>;
1050
-
1051
- /**
1052
- * Zod schema for UI Schema element type strings.
1053
- *
1054
- * @public
1055
- */
1056
- export declare const uiSchemaElementTypeSchema: z.ZodEnum<["Control", "VerticalLayout", "HorizontalLayout", "Group", "Categorization", "Category", "Label"]>;
1057
-
1058
- /**
1059
- * Zod schema for the root UI Schema (layout types only).
1060
- *
1061
- * @public
1062
- */
1063
- export declare const uiSchemaSchema: z.ZodType<UISchema>;
687
+ export declare type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category" | "Label";
1064
688
 
1065
689
  /**
1066
690
  * A vertical layout element.
@@ -1068,19 +692,14 @@ export declare const uiSchemaSchema: z.ZodType<UISchema>;
1068
692
  * @public
1069
693
  */
1070
694
  export declare interface VerticalLayout {
1071
- type: "VerticalLayout";
1072
- elements: UISchemaElement[];
1073
- rule?: Rule | undefined;
1074
- options?: Record<string, unknown> | undefined;
1075
- [k: string]: unknown;
695
+ readonly type: "VerticalLayout";
696
+ readonly elements: UISchemaElement[];
697
+ readonly rule?: Rule | undefined;
698
+ readonly options?: Record<string, unknown> | undefined;
699
+ readonly [k: string]: unknown;
1076
700
  }
1077
701
 
1078
- /**
1079
- * Zod schema for a vertical layout element.
1080
- *
1081
- * @public
1082
- */
1083
- export declare const verticalLayoutSchema: z.ZodType<VerticalLayout>;
702
+ export { VocabularyKeywordRegistration }
1084
703
 
1085
704
  /**
1086
705
  * Builds and writes both JSON Schema and UI Schema files to disk.
@@ -1120,7 +739,7 @@ export declare function writeSchemas<E extends readonly FormElement[]>(form: For
1120
739
  *
1121
740
  * @public
1122
741
  */
1123
- export declare interface WriteSchemasOptions extends GenerateJsonSchemaFromIROptions {
742
+ export declare interface WriteSchemasOptions extends GenerateJsonSchemaOptions {
1124
743
  /** Output directory for the schema files */
1125
744
  readonly outDir: string;
1126
745
  /** Base name for the output files (without extension). Defaults to "schema" */