@formspec/build 0.1.0-alpha.42 → 0.1.0-alpha.43

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.
@@ -141,6 +141,28 @@ export declare interface BuildResult {
141
141
 
142
142
  export { BuiltinConstraintBroadeningRegistration }
143
143
 
144
+ /**
145
+ * Registration for mapping a built-in TSDoc tag onto a custom constraint when
146
+ * it is used on a particular custom type.
147
+ *
148
+ * @public
149
+ */
150
+ declare interface BuiltinConstraintBroadeningRegistration_2 {
151
+ /** The built-in tag being broadened, without the `@` prefix. */
152
+ readonly tagName: BuiltinConstraintName;
153
+ /** The custom constraint to emit for this built-in tag. */
154
+ readonly constraintName: string;
155
+ /** Parser from raw TSDoc text to extension payload. */
156
+ readonly parseValue: (raw: string) => ExtensionPayloadValue;
157
+ }
158
+
159
+ /**
160
+ * Type of a built-in constraint name.
161
+ *
162
+ * @public
163
+ */
164
+ declare type BuiltinConstraintName = "minimum" | "maximum" | "exclusiveMinimum" | "exclusiveMaximum" | "multipleOf" | "minLength" | "maxLength" | "minItems" | "maxItems" | "uniqueItems" | "pattern" | "const" | "enumOptions";
165
+
144
166
  /**
145
167
  * A Categorization element (tab-based layout).
146
168
  *
@@ -183,8 +205,64 @@ export declare interface Category {
183
205
 
184
206
  export { Conditional }
185
207
 
208
+ /**
209
+ * Complete constraint configuration for a FormSpec project.
210
+ *
211
+ * @public
212
+ */
213
+ declare interface ConstraintConfig {
214
+ /** Field type constraints */
215
+ fieldTypes?: FieldTypeConstraints;
216
+ /** Layout and structure constraints */
217
+ layout?: LayoutConstraints;
218
+ /** UI Schema feature constraints */
219
+ uiSchema?: UISchemaConstraints;
220
+ /** Field configuration option constraints */
221
+ fieldOptions?: FieldOptionConstraints;
222
+ /** Control options constraints */
223
+ controlOptions?: ControlOptionConstraints;
224
+ }
225
+
226
+ /**
227
+ * Semantic metadata for ordered custom constraints that should participate in
228
+ * the generic contradiction/broadening logic.
229
+ *
230
+ * @public
231
+ */
232
+ declare interface ConstraintSemanticRole {
233
+ /**
234
+ * Logical family identifier shared by related constraints, for example
235
+ * `"decimal-bound"` or `"date-bound"`.
236
+ */
237
+ readonly family: string;
238
+ /** Whether this constraint acts as a lower or upper bound. */
239
+ readonly bound: "lower" | "upper" | "exact";
240
+ /** Whether equality is allowed when comparing against the bound. */
241
+ readonly inclusive: boolean;
242
+ }
243
+
186
244
  export { ConstraintTagRegistration }
187
245
 
246
+ /**
247
+ * Declarative authoring-side registration for a custom TSDoc constraint tag.
248
+ *
249
+ * @public
250
+ */
251
+ declare interface ConstraintTagRegistration_2 {
252
+ /** Tag name without the `@` prefix, e.g. `"maxSigFig"`. */
253
+ readonly tagName: string;
254
+ /** The custom constraint that this tag should produce. */
255
+ readonly constraintName: string;
256
+ /** Parser from raw TSDoc text to JSON-serializable payload. */
257
+ readonly parseValue: (raw: string) => ExtensionPayloadValue;
258
+ /**
259
+ * Optional precise applicability predicate for the field type being parsed.
260
+ * When omitted, the target custom constraint registration controls type
261
+ * applicability during validation.
262
+ */
263
+ readonly isApplicableToType?: (type: ExtensionApplicableType) => boolean;
264
+ }
265
+
188
266
  /**
189
267
  * A Control element that binds to a JSON Schema property.
190
268
  *
@@ -205,6 +283,27 @@ export declare interface ControlElement {
205
283
  readonly [k: string]: unknown;
206
284
  }
207
285
 
286
+ /**
287
+ * Control options constraints - control which JSONForms Control.options are allowed.
288
+ * These are renderer-specific options that may not be universally supported.
289
+ *
290
+ * @public
291
+ */
292
+ declare interface ControlOptionConstraints {
293
+ /** format - renderer format hint (e.g., "radio", "textarea") */
294
+ format?: Severity;
295
+ /** readonly - read-only mode */
296
+ readonly?: Severity;
297
+ /** multi - multi-select for enums */
298
+ multi?: Severity;
299
+ /** showUnfocusedDescription - show description when unfocused */
300
+ showUnfocusedDescription?: Severity;
301
+ /** hideRequiredAsterisk - hide required indicator */
302
+ hideRequiredAsterisk?: Severity;
303
+ /** Custom control options (extensible dictionary) */
304
+ custom?: Record<string, Severity>;
305
+ }
306
+
208
307
  /**
209
308
  * Creates an extension registry from a list of extension definitions.
210
309
  *
@@ -243,10 +342,129 @@ export declare function createStaticBuildContextFromProgram(program: ts.Program,
243
342
 
244
343
  export { CustomAnnotationRegistration }
245
344
 
345
+ /**
346
+ * Registration for a custom annotation that may produce JSON Schema keywords.
347
+ *
348
+ * Custom annotations are referenced by FormSpec's internal custom-annotation nodes.
349
+ * They describe or present a field but do not affect which values are valid.
350
+ *
351
+ * @public
352
+ */
353
+ declare interface CustomAnnotationRegistration_2 {
354
+ /** The annotation name, unique within the extension. */
355
+ readonly annotationName: string;
356
+ /**
357
+ * Optionally converts the annotation value into JSON Schema keywords.
358
+ * If omitted, the annotation has no JSON Schema representation (UI-only).
359
+ */
360
+ readonly toJsonSchema?: (value: ExtensionPayloadValue, vendorPrefix: string) => Record<string, unknown>;
361
+ }
362
+
246
363
  export { CustomConstraintRegistration }
247
364
 
365
+ /**
366
+ * Registration for a custom constraint that maps to JSON Schema keywords.
367
+ *
368
+ * Custom constraints are referenced by FormSpec's internal custom-constraint nodes.
369
+ *
370
+ * @public
371
+ */
372
+ declare interface CustomConstraintRegistration_2 {
373
+ /** The constraint name, unique within the extension. */
374
+ readonly constraintName: string;
375
+ /**
376
+ * How this constraint composes with other constraints of the same kind.
377
+ * - "intersect": combine with logical AND (both must hold)
378
+ * - "override": last writer wins
379
+ */
380
+ readonly compositionRule: "intersect" | "override";
381
+ /**
382
+ * TypeNode kinds this constraint is applicable to, or `null` for any type.
383
+ * Used by the validator to emit TYPE_MISMATCH diagnostics.
384
+ */
385
+ readonly applicableTypes: readonly ExtensionApplicableType["kind"][] | null;
386
+ /**
387
+ * Optional precise type predicate used when kind-level applicability is too
388
+ * broad (for example, constraints that apply to integer-like primitives but
389
+ * not strings).
390
+ */
391
+ readonly isApplicableToType?: (type: ExtensionApplicableType) => boolean;
392
+ /**
393
+ * Optional comparator for payloads belonging to the same custom constraint.
394
+ * Return values follow the `Array.prototype.sort()` contract.
395
+ */
396
+ readonly comparePayloads?: (left: ExtensionPayloadValue, right: ExtensionPayloadValue) => number;
397
+ /**
398
+ * Optional semantic family metadata for generic contradiction/broadening
399
+ * handling across ordered constraints.
400
+ */
401
+ readonly semanticRole?: ConstraintSemanticRole;
402
+ /**
403
+ * Converts the custom constraint's payload into JSON Schema keywords.
404
+ *
405
+ * @param payload - The opaque JSON payload stored on the custom constraint node.
406
+ * @param vendorPrefix - The vendor prefix for extension keywords.
407
+ * @returns A JSON Schema fragment with the constraint keywords.
408
+ */
409
+ readonly toJsonSchema: (payload: ExtensionPayloadValue, vendorPrefix: string) => Record<string, unknown>;
410
+ /**
411
+ * When true, `toJsonSchema` may emit vocabulary keywords that do not carry
412
+ * the vendor prefix. By default, all keys returned from `toJsonSchema` must
413
+ * start with `${vendorPrefix}-`; setting this flag relaxes that check so
414
+ * the constraint can produce standard or custom vocabulary keywords such as
415
+ * `decimalMinimum`.
416
+ *
417
+ * Use this for constraints that define their own JSON Schema vocabulary
418
+ * rather than namespacing under the vendor prefix.
419
+ */
420
+ readonly emitsVocabularyKeywords?: boolean;
421
+ }
422
+
248
423
  export { CustomTypeRegistration }
249
424
 
425
+ /**
426
+ * Registration for a custom type that maps to a JSON Schema representation.
427
+ *
428
+ * Custom types are referenced by FormSpec's internal custom-type IR nodes and
429
+ * resolved to JSON Schema via `toJsonSchema` during generation.
430
+ *
431
+ * @public
432
+ */
433
+ declare interface CustomTypeRegistration_2 {
434
+ /** The type name, unique within the extension. */
435
+ readonly typeName: string;
436
+ /**
437
+ * Optional TypeScript surface names that should resolve to this custom type
438
+ * during TSDoc/class analysis. Defaults to `typeName` when omitted.
439
+ */
440
+ readonly tsTypeNames?: readonly string[];
441
+ /**
442
+ * Converts the custom type's payload into a JSON Schema fragment.
443
+ *
444
+ * @param payload - The opaque JSON payload stored on the custom type node.
445
+ * @param vendorPrefix - The vendor prefix for extension keywords (e.g., "x-stripe").
446
+ * @returns A JSON Schema fragment representing this type.
447
+ */
448
+ readonly toJsonSchema: (payload: ExtensionPayloadValue, vendorPrefix: string) => Record<string, unknown>;
449
+ /**
450
+ * Optional broadening of built-in constraint tags so they can apply to this
451
+ * custom type without modifying the core built-in constraint tables.
452
+ */
453
+ readonly builtinConstraintBroadenings?: readonly BuiltinConstraintBroadeningRegistration_2[];
454
+ }
455
+
456
+ /**
457
+ * Per-declaration metadata policy input.
458
+ *
459
+ * @public
460
+ */
461
+ declare interface DeclarationMetadataPolicyInput {
462
+ /** Policy for JSON-facing serialized names. */
463
+ readonly apiName?: MetadataValuePolicyInput | undefined;
464
+ /** Policy for human-facing labels and titles. */
465
+ readonly displayName?: MetadataValuePolicyInput | undefined;
466
+ }
467
+
250
468
  /**
251
469
  * Non-throwing schema generation result with structured diagnostics.
252
470
  *
@@ -317,6 +535,82 @@ export { DynamicEnumField }
317
535
 
318
536
  export { DynamicSchemaField }
319
537
 
538
+ /**
539
+ * Enum-member display names remain unset unless authored explicitly.
540
+ *
541
+ * @public
542
+ */
543
+ declare interface EnumMemberDisplayNameDisabledPolicyInput {
544
+ /** Leaves missing enum-member display names unresolved. */
545
+ readonly mode: "disabled";
546
+ }
547
+
548
+ /**
549
+ * Missing enum-member display names may be inferred.
550
+ *
551
+ * @public
552
+ */
553
+ declare interface EnumMemberDisplayNameInferIfMissingPolicyInput {
554
+ /** Infers an enum-member display name when it is not authored explicitly. */
555
+ readonly mode: "infer-if-missing";
556
+ /** Callback used to infer the missing display name. */
557
+ readonly infer: EnumMemberMetadataInferenceFn;
558
+ }
559
+
560
+ /**
561
+ * Enum-member display-name policy input.
562
+ *
563
+ * @public
564
+ */
565
+ declare type EnumMemberDisplayNamePolicyInput = EnumMemberDisplayNameDisabledPolicyInput | EnumMemberDisplayNameRequireExplicitPolicyInput | EnumMemberDisplayNameInferIfMissingPolicyInput;
566
+
567
+ /**
568
+ * Enum members must declare display names explicitly.
569
+ *
570
+ * @public
571
+ */
572
+ declare interface EnumMemberDisplayNameRequireExplicitPolicyInput {
573
+ /** Fails when an enum member has no authored display name. */
574
+ readonly mode: "require-explicit";
575
+ }
576
+
577
+ /**
578
+ * Build-facing context passed to enum-member metadata inference callbacks.
579
+ *
580
+ * Enum members are resolved separately from declaration-level metadata so they
581
+ * do not participate in the shared declaration-kind model used by TSDoc and
582
+ * extension metadata slots.
583
+ *
584
+ * @public
585
+ */
586
+ declare interface EnumMemberMetadataInferenceContext {
587
+ /** Authoring surface the enum originated from. */
588
+ readonly surface: MetadataAuthoringSurface;
589
+ /** Logical member identifier used for policy inference. */
590
+ readonly logicalName: string;
591
+ /** Underlying enum value before stringification. */
592
+ readonly memberValue: string | number;
593
+ /** Optional build-only context supplied by the resolver. */
594
+ readonly buildContext?: unknown;
595
+ }
596
+
597
+ /**
598
+ * Callback used to infer enum-member display names.
599
+ *
600
+ * @public
601
+ */
602
+ declare type EnumMemberMetadataInferenceFn = (context: EnumMemberMetadataInferenceContext) => string;
603
+
604
+ /**
605
+ * User-facing enum-member metadata policy input.
606
+ *
607
+ * @public
608
+ */
609
+ declare interface EnumMemberMetadataPolicyInput {
610
+ /** Policy for human-facing enum-member labels. */
611
+ readonly displayName?: EnumMemberDisplayNamePolicyInput | undefined;
612
+ }
613
+
320
614
  export { EnumOption }
321
615
 
322
616
  export { EnumOptionValue }
@@ -328,8 +622,75 @@ export { EnumOptionValue }
328
622
  */
329
623
  export declare type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;
330
624
 
625
+ /**
626
+ * A curated type shape exposed to extension applicability hooks.
627
+ *
628
+ * This intentionally exposes only the fields needed to determine tag/type
629
+ * applicability without committing the entire canonical IR as public API.
630
+ *
631
+ * @public
632
+ */
633
+ declare type ExtensionApplicableType = {
634
+ readonly kind: "primitive";
635
+ readonly primitiveKind: "string" | "number" | "integer" | "bigint" | "boolean" | "null";
636
+ } | {
637
+ readonly kind: "custom";
638
+ readonly typeId: string;
639
+ readonly payload: ExtensionPayloadValue;
640
+ } | {
641
+ readonly kind: Exclude<ExtensionTypeKind, "primitive" | "custom">;
642
+ };
643
+
331
644
  export { ExtensionDefinition }
332
645
 
646
+ /**
647
+ * A complete extension definition bundling types, constraints, annotations,
648
+ * and vocabulary keywords.
649
+ *
650
+ * @example
651
+ * ```typescript
652
+ * const monetaryExtension = defineExtension({
653
+ * extensionId: "x-stripe/monetary",
654
+ * types: [
655
+ * defineCustomType({
656
+ * typeName: "Decimal",
657
+ * toJsonSchema: (_payload, prefix) => ({
658
+ * type: "string",
659
+ * [`${prefix}-decimal`]: true,
660
+ * }),
661
+ * }),
662
+ * ],
663
+ * });
664
+ * ```
665
+ *
666
+ * @public
667
+ */
668
+ declare interface ExtensionDefinition_2 {
669
+ /** Globally unique extension identifier, e.g., "x-stripe/monetary". */
670
+ readonly extensionId: string;
671
+ /** Custom type registrations provided by this extension. */
672
+ readonly types?: readonly CustomTypeRegistration_2[];
673
+ /** Custom constraint registrations provided by this extension. */
674
+ readonly constraints?: readonly CustomConstraintRegistration_2[];
675
+ /** Authoring-side TSDoc tag registrations provided by this extension. */
676
+ readonly constraintTags?: readonly ConstraintTagRegistration_2[];
677
+ /** Metadata-slot registrations shared by build- and lint-time analysis. */
678
+ readonly metadataSlots?: readonly MetadataSlotRegistration[];
679
+ /** Custom annotation registrations provided by this extension. */
680
+ readonly annotations?: readonly CustomAnnotationRegistration_2[];
681
+ /** Vocabulary keyword registrations provided by this extension. */
682
+ readonly vocabularyKeywords?: readonly VocabularyKeywordRegistration[];
683
+ }
684
+
685
+ /**
686
+ * A JSON-serializable payload value used by extension registration hooks.
687
+ *
688
+ * @public
689
+ */
690
+ declare type ExtensionPayloadValue = null | boolean | number | string | readonly ExtensionPayloadValue[] | {
691
+ readonly [key: string]: ExtensionPayloadValue;
692
+ };
693
+
333
694
  /**
334
695
  * A registry of extensions that provides lookup by fully-qualified ID.
335
696
  *
@@ -389,10 +750,120 @@ export declare interface ExtensionRegistry {
389
750
  findAnnotation(annotationId: string): CustomAnnotationRegistration | undefined;
390
751
  }
391
752
 
753
+ /**
754
+ * Top-level type kinds that extension applicability hooks may inspect.
755
+ *
756
+ * @public
757
+ */
758
+ declare type ExtensionTypeKind = "primitive" | "enum" | "array" | "object" | "record" | "union" | "reference" | "dynamic" | "custom";
759
+
760
+ /**
761
+ * Field configuration option constraints - control which field options are allowed.
762
+ *
763
+ * @public
764
+ */
765
+ declare interface FieldOptionConstraints {
766
+ /** label - field label text */
767
+ label?: Severity;
768
+ /** placeholder - input placeholder text */
769
+ placeholder?: Severity;
770
+ /** required - whether field is required */
771
+ required?: Severity;
772
+ /** minValue - minimum value for numbers */
773
+ minValue?: Severity;
774
+ /** maxValue - maximum value for numbers */
775
+ maxValue?: Severity;
776
+ /** minItems - minimum array length */
777
+ minItems?: Severity;
778
+ /** maxItems - maximum array length */
779
+ maxItems?: Severity;
780
+ }
781
+
782
+ /**
783
+ * Field type constraints - control which field types are allowed.
784
+ * Fine-grained control over each DSL field builder.
785
+ *
786
+ * @public
787
+ */
788
+ declare interface FieldTypeConstraints {
789
+ /** field.text() - basic text input */
790
+ text?: Severity;
791
+ /** field.number() - numeric input */
792
+ number?: Severity;
793
+ /** field.boolean() - checkbox/toggle */
794
+ boolean?: Severity;
795
+ /** field.enum() with literal options */
796
+ staticEnum?: Severity;
797
+ /** field.dynamicEnum() - runtime-fetched options */
798
+ dynamicEnum?: Severity;
799
+ /** field.dynamicSchema() - runtime-fetched schema */
800
+ dynamicSchema?: Severity;
801
+ /** field.array() / field.arrayWithConfig() */
802
+ array?: Severity;
803
+ /** field.object() / field.objectWithConfig() */
804
+ object?: Severity;
805
+ }
806
+
392
807
  export { FormElement }
393
808
 
394
809
  export { FormSpec }
395
810
 
811
+ /**
812
+ * Top-level FormSpec configuration file structure.
813
+ * The .formspec.yml file uses this structure.
814
+ *
815
+ * @public
816
+ */
817
+ export declare interface FormSpecConfig {
818
+ /**
819
+ * Extension definitions providing custom types, constraints,
820
+ * annotations, and vocabulary keywords.
821
+ */
822
+ readonly extensions?: readonly ExtensionDefinition_2[];
823
+ /** Constraint surface configuration — controls which field types,
824
+ * layouts, UI features, and field/control options are allowed. */
825
+ readonly constraints?: ConstraintConfig;
826
+ /**
827
+ * Metadata inference and naming policy. Controls how apiName,
828
+ * displayName, and plural forms are derived when not authored.
829
+ */
830
+ readonly metadata?: MetadataPolicyInput_2;
831
+ /**
832
+ * Vendor prefix for extension-emitted JSON Schema keywords.
833
+ * Must start with "x-".
834
+ * @defaultValue "x-formspec"
835
+ */
836
+ readonly vendorPrefix?: string;
837
+ /**
838
+ * JSON Schema representation for static enums.
839
+ * - "enum": flat { "enum": ["a", "b"] }
840
+ * - "oneOf": { "oneOf": [{ "const": "a" }, ...] }
841
+ * @defaultValue "enum"
842
+ */
843
+ readonly enumSerialization?: "enum" | "oneOf";
844
+ /**
845
+ * Per-package configuration overrides for monorepos.
846
+ * Keys are glob patterns matched against file paths relative to
847
+ * the config file's directory. Values merge with root settings.
848
+ */
849
+ readonly packages?: Readonly<Record<string, FormSpecPackageOverride>>;
850
+ }
851
+
852
+ /**
853
+ * Per-package overrides that merge with the root config.
854
+ * Only settings that genuinely vary per package are overridable.
855
+ *
856
+ * @public
857
+ */
858
+ declare interface FormSpecPackageOverride {
859
+ /** Override constraint surface for this package. */
860
+ readonly constraints?: ConstraintConfig;
861
+ /** Override enum serialization for this package. */
862
+ readonly enumSerialization?: "enum" | "oneOf";
863
+ /** Override metadata policy for this package. */
864
+ readonly metadata?: MetadataPolicyInput_2;
865
+ }
866
+
396
867
  /**
397
868
  * Extension properties for custom FormSpec constraint tags.
398
869
  *
@@ -1091,6 +1562,222 @@ export declare interface LabelElement {
1091
1562
  readonly [k: string]: unknown;
1092
1563
  }
1093
1564
 
1565
+ /**
1566
+ * Layout and structure constraints - control grouping, conditionals, nesting.
1567
+ *
1568
+ * @public
1569
+ */
1570
+ declare interface LayoutConstraints {
1571
+ /** group() - visual grouping of fields */
1572
+ group?: Severity;
1573
+ /** when() - conditional field visibility */
1574
+ conditionals?: Severity;
1575
+ /** Maximum nesting depth for objects/arrays (0 = flat only) */
1576
+ maxNestingDepth?: number;
1577
+ }
1578
+
1579
+ /**
1580
+ * JSONForms layout type constraints.
1581
+ *
1582
+ * @public
1583
+ */
1584
+ declare interface LayoutTypeConstraints {
1585
+ /** VerticalLayout - stack elements vertically */
1586
+ VerticalLayout?: Severity;
1587
+ /** HorizontalLayout - arrange elements horizontally */
1588
+ HorizontalLayout?: Severity;
1589
+ /** Group - visual grouping with label */
1590
+ Group?: Severity;
1591
+ /** Categorization - tabbed/wizard interface */
1592
+ Categorization?: Severity;
1593
+ /** Category - individual tab/step in Categorization */
1594
+ Category?: Severity;
1595
+ }
1596
+
1597
+ /**
1598
+ * Authoring surfaces that can contribute metadata.
1599
+ *
1600
+ * @public
1601
+ */
1602
+ declare type MetadataAuthoringSurface = "tsdoc" | "chain-dsl";
1603
+
1604
+ /**
1605
+ * Declaration categories that metadata policy can target.
1606
+ *
1607
+ * @public
1608
+ */
1609
+ declare type MetadataDeclarationKind = "type" | "field" | "method";
1610
+
1611
+ /**
1612
+ * Build-facing context passed to metadata inference callbacks.
1613
+ *
1614
+ * `buildContext` is intentionally opaque so browser/runtime packages do not
1615
+ * need to depend on TypeScript compiler types.
1616
+ *
1617
+ * @public
1618
+ */
1619
+ declare interface MetadataInferenceContext {
1620
+ /** Authoring surface the metadata is being resolved for. */
1621
+ readonly surface: MetadataAuthoringSurface;
1622
+ /** Declaration kind currently being resolved. */
1623
+ readonly declarationKind: MetadataDeclarationKind;
1624
+ /** Logical identifier before any metadata policy is applied. */
1625
+ readonly logicalName: string;
1626
+ /** Optional build-only context supplied by the resolver. */
1627
+ readonly buildContext?: unknown;
1628
+ }
1629
+
1630
+ /**
1631
+ * Callback used to infer a scalar metadata value.
1632
+ *
1633
+ * @public
1634
+ */
1635
+ declare type MetadataInferenceFn = (context: MetadataInferenceContext) => string;
1636
+
1637
+ /**
1638
+ * Context passed to pluralization callbacks.
1639
+ *
1640
+ * @public
1641
+ */
1642
+ declare interface MetadataPluralizationContext extends MetadataInferenceContext {
1643
+ /** Singular value that pluralization should derive from. */
1644
+ readonly singular: string;
1645
+ }
1646
+
1647
+ /**
1648
+ * Pluralization disabled.
1649
+ *
1650
+ * @public
1651
+ */
1652
+ declare interface MetadataPluralizationDisabledPolicyInput {
1653
+ /** Disables automatic plural-value generation. */
1654
+ readonly mode?: "disabled" | undefined;
1655
+ }
1656
+
1657
+ /**
1658
+ * Callback used to derive plural metadata from a singular value.
1659
+ *
1660
+ * @public
1661
+ */
1662
+ declare type MetadataPluralizationFn = (context: MetadataPluralizationContext) => string;
1663
+
1664
+ /**
1665
+ * Pluralization may be inferred when absent.
1666
+ *
1667
+ * @public
1668
+ */
1669
+ declare interface MetadataPluralizationInferIfMissingPolicyInput {
1670
+ /** Infers plural values whenever no explicit plural is present. */
1671
+ readonly mode: "infer-if-missing";
1672
+ /** Callback that derives a plural form from the resolved singular value. */
1673
+ readonly inflect: MetadataPluralizationFn;
1674
+ }
1675
+
1676
+ /**
1677
+ * Pluralization policy input.
1678
+ *
1679
+ * @public
1680
+ */
1681
+ declare type MetadataPluralizationPolicyInput = MetadataPluralizationDisabledPolicyInput | MetadataPluralizationRequireExplicitPolicyInput | MetadataPluralizationInferIfMissingPolicyInput;
1682
+
1683
+ /**
1684
+ * Pluralization must be authored explicitly.
1685
+ *
1686
+ * @public
1687
+ */
1688
+ declare interface MetadataPluralizationRequireExplicitPolicyInput {
1689
+ /** Requires plural values to be authored directly. */
1690
+ readonly mode: "require-explicit";
1691
+ }
1692
+
1693
+ /**
1694
+ * User-facing metadata policy configuration.
1695
+ *
1696
+ * @public
1697
+ */
1698
+ declare interface MetadataPolicyInput_2 {
1699
+ /** Policy applied to named types and the analyzed root declaration. */
1700
+ readonly type?: DeclarationMetadataPolicyInput | undefined;
1701
+ /** Policy applied to fields and object properties. */
1702
+ readonly field?: DeclarationMetadataPolicyInput | undefined;
1703
+ /** Policy applied to callable/method declarations. */
1704
+ readonly method?: DeclarationMetadataPolicyInput | undefined;
1705
+ /** Policy applied to enum-member display names during build-time IR resolution. */
1706
+ readonly enumMember?: EnumMemberMetadataPolicyInput | undefined;
1707
+ }
1708
+
1709
+ /**
1710
+ * Supported qualifier registration for an extensible metadata slot.
1711
+ *
1712
+ * @public
1713
+ */
1714
+ declare interface MetadataQualifierRegistration {
1715
+ /** Qualifier text without the leading colon. */
1716
+ readonly qualifier: string;
1717
+ /**
1718
+ * Optional source qualifier to use as the base input for this qualifier's
1719
+ * inference hook. Defaults to the slot's bare/default value when omitted.
1720
+ */
1721
+ readonly sourceQualifier?: string | undefined;
1722
+ /** Optional inference hook for this qualified value. */
1723
+ readonly inferValue?: MetadataSlotInferenceFn | undefined;
1724
+ }
1725
+
1726
+ /**
1727
+ * Stable slot identifier for extensible metadata analysis.
1728
+ *
1729
+ * @public
1730
+ */
1731
+ declare type MetadataSlotId = string;
1732
+
1733
+ /**
1734
+ * Context passed to extensible metadata inference hooks.
1735
+ *
1736
+ * @public
1737
+ */
1738
+ declare interface MetadataSlotInferenceContext extends MetadataInferenceContext {
1739
+ /** Stable logical slot identifier. */
1740
+ readonly slotId: MetadataSlotId;
1741
+ /** Tag name associated with the slot, without the `@` prefix. */
1742
+ readonly tagName: string;
1743
+ /** Optional qualifier being inferred (for example `plural`). */
1744
+ readonly qualifier?: string | undefined;
1745
+ /** Resolved bare/default value used as the base input for derived qualifiers. */
1746
+ readonly baseValue?: string | undefined;
1747
+ }
1748
+
1749
+ /**
1750
+ * Callback used to infer an extensible metadata slot value.
1751
+ *
1752
+ * @public
1753
+ */
1754
+ declare type MetadataSlotInferenceFn = (context: MetadataSlotInferenceContext) => string;
1755
+
1756
+ /**
1757
+ * Extensible metadata slot definition shared across build- and lint-time analysis.
1758
+ *
1759
+ * @public
1760
+ */
1761
+ declare interface MetadataSlotRegistration {
1762
+ /** Stable logical slot identifier. */
1763
+ readonly slotId: MetadataSlotId;
1764
+ /** Tag name associated with this slot, without the `@` prefix. */
1765
+ readonly tagName: string;
1766
+ /** Declaration kinds where the slot is meaningful. */
1767
+ readonly declarationKinds: readonly MetadataDeclarationKind[];
1768
+ /** Whether a bare tag without a qualifier is supported. Defaults to true. */
1769
+ readonly allowBare?: boolean | undefined;
1770
+ /** Supported qualifiers for this slot. */
1771
+ readonly qualifiers?: readonly MetadataQualifierRegistration[] | undefined;
1772
+ /** Optional inference hook for the bare/default slot value. */
1773
+ readonly inferValue?: MetadataSlotInferenceFn | undefined;
1774
+ /**
1775
+ * Optional applicability hook for declaration-specific rules beyond
1776
+ * declaration kind. `buildContext` may carry compiler objects.
1777
+ */
1778
+ readonly isApplicable?: ((context: MetadataInferenceContext) => boolean) | undefined;
1779
+ }
1780
+
1094
1781
  /**
1095
1782
  * Supported declaration kinds for standalone metadata resolution.
1096
1783
  *
@@ -1102,6 +1789,51 @@ export declare interface LabelElement {
1102
1789
  */
1103
1790
  export declare type MetadataSourceDeclaration = SchemaSourceDeclaration | ts.MethodDeclaration | ts.FunctionDeclaration | ts.PropertyDeclaration | ts.PropertySignature;
1104
1791
 
1792
+ /**
1793
+ * Scalar metadata disabled unless provided explicitly elsewhere.
1794
+ *
1795
+ * @public
1796
+ */
1797
+ declare interface MetadataValueDisabledPolicyInput {
1798
+ /** Disables inference for this scalar metadata value. */
1799
+ readonly mode?: "disabled" | undefined;
1800
+ /** Optional policy controlling plural forms of this scalar value. */
1801
+ readonly pluralization?: MetadataPluralizationPolicyInput | undefined;
1802
+ }
1803
+
1804
+ /**
1805
+ * Scalar metadata may be inferred when missing.
1806
+ *
1807
+ * @public
1808
+ */
1809
+ declare interface MetadataValueInferIfMissingPolicyInput {
1810
+ /** Infers this scalar metadata value when it is not authored explicitly. */
1811
+ readonly mode: "infer-if-missing";
1812
+ /** Callback used to infer the missing singular value. */
1813
+ readonly infer: MetadataInferenceFn;
1814
+ /** Optional policy controlling plural forms of this scalar value. */
1815
+ readonly pluralization?: MetadataPluralizationPolicyInput | undefined;
1816
+ }
1817
+
1818
+ /**
1819
+ * Scalar metadata policy input.
1820
+ *
1821
+ * @public
1822
+ */
1823
+ declare type MetadataValuePolicyInput = MetadataValueDisabledPolicyInput | MetadataValueRequireExplicitPolicyInput | MetadataValueInferIfMissingPolicyInput;
1824
+
1825
+ /**
1826
+ * Scalar metadata must be authored explicitly.
1827
+ *
1828
+ * @public
1829
+ */
1830
+ declare interface MetadataValueRequireExplicitPolicyInput {
1831
+ /** Requires this scalar metadata value to be authored directly. */
1832
+ readonly mode: "require-explicit";
1833
+ /** Optional policy controlling plural forms of this scalar value. */
1834
+ readonly pluralization?: MetadataPluralizationPolicyInput | undefined;
1835
+ }
1836
+
1105
1837
  /**
1106
1838
  * Result of generating schemas from a mixed-authoring composition.
1107
1839
  *
@@ -1208,6 +1940,18 @@ export declare interface RuleConditionSchema {
1208
1940
  allOf?: RuleConditionSchema[];
1209
1941
  }
1210
1942
 
1943
+ /**
1944
+ * JSONForms rule constraints.
1945
+ *
1946
+ * @public
1947
+ */
1948
+ declare interface RuleConstraints {
1949
+ /** Whether rules are enabled at all */
1950
+ enabled?: Severity;
1951
+ /** Fine-grained control over rule effects */
1952
+ effects?: RuleEffectConstraints;
1953
+ }
1954
+
1211
1955
  /**
1212
1956
  * JSON Forms UI Schema type definitions.
1213
1957
  *
@@ -1223,6 +1967,22 @@ export declare interface RuleConditionSchema {
1223
1967
  */
1224
1968
  export declare type RuleEffect = "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
1225
1969
 
1970
+ /**
1971
+ * JSONForms rule effect constraints.
1972
+ *
1973
+ * @public
1974
+ */
1975
+ declare interface RuleEffectConstraints {
1976
+ /** SHOW - show element when condition is true */
1977
+ SHOW?: Severity;
1978
+ /** HIDE - hide element when condition is true */
1979
+ HIDE?: Severity;
1980
+ /** ENABLE - enable element when condition is true */
1981
+ ENABLE?: Severity;
1982
+ /** DISABLE - disable element when condition is true */
1983
+ DISABLE?: Severity;
1984
+ }
1985
+
1226
1986
  /**
1227
1987
  * Condition for a rule.
1228
1988
  *
@@ -1254,6 +2014,16 @@ export declare interface SchemaGenerationTarget {
1254
2014
  */
1255
2015
  export declare type SchemaSourceDeclaration = ts.ClassDeclaration | ts.InterfaceDeclaration | ts.TypeAliasDeclaration;
1256
2016
 
2017
+ /**
2018
+ * Severity level for constraint violations.
2019
+ * - "error": Violation fails validation
2020
+ * - "warn": Violation emits warning but passes
2021
+ * - "off": Feature is allowed (no violation)
2022
+ *
2023
+ * @public
2024
+ */
2025
+ declare type Severity = "error" | "warn" | "off";
2026
+
1257
2027
  /**
1258
2028
  * Supported compiler context for static build-time analysis workflows.
1259
2029
  *
@@ -1280,21 +2050,33 @@ export { StaticEnumField }
1280
2050
  * @public
1281
2051
  */
1282
2052
  export declare interface StaticSchemaGenerationOptions {
2053
+ /**
2054
+ * FormSpec project configuration. When provided, resolves `extensionRegistry`,
2055
+ * `vendorPrefix`, `enumSerialization`, and `metadata` from the config object.
2056
+ * Direct options take precedence over config values.
2057
+ */
2058
+ readonly config?: FormSpecConfig | undefined;
1283
2059
  /**
1284
2060
  * Registry used to resolve custom types, constraints, and annotations.
2061
+ * @deprecated Provide a `FormSpecConfig` via the `config` option instead.
1285
2062
  */
1286
2063
  readonly extensionRegistry?: ExtensionRegistry | undefined;
1287
2064
  /**
1288
2065
  * Vendor prefix for emitted extension keywords.
1289
2066
  * @defaultValue "x-formspec"
2067
+ * @deprecated Provide a `FormSpecConfig` via the `config` option instead.
1290
2068
  */
1291
2069
  readonly vendorPrefix?: string | undefined;
1292
2070
  /**
1293
2071
  * JSON Schema representation to use for static enums.
1294
2072
  * @defaultValue "enum"
2073
+ * @deprecated Provide a `FormSpecConfig` via the `config` option instead.
1295
2074
  */
1296
2075
  readonly enumSerialization?: "enum" | "oneOf";
1297
- /** Metadata resolution policy for static schema generation. */
2076
+ /**
2077
+ * Metadata resolution policy for static schema generation.
2078
+ * @deprecated Provide a `FormSpecConfig` via the `config` option instead.
2079
+ */
1298
2080
  readonly metadata?: MetadataPolicyInput | undefined;
1299
2081
  /** Discriminator-specific schema generation behavior. */
1300
2082
  readonly discriminator?: DiscriminatorResolutionOptions | undefined;
@@ -1309,6 +2091,18 @@ export { TextField }
1309
2091
  */
1310
2092
  export declare type UISchema = VerticalLayout | HorizontalLayout | GroupLayout | Categorization;
1311
2093
 
2094
+ /**
2095
+ * UI Schema feature constraints - control JSONForms-specific features.
2096
+ *
2097
+ * @public
2098
+ */
2099
+ declare interface UISchemaConstraints {
2100
+ /** Layout type constraints */
2101
+ layouts?: LayoutTypeConstraints;
2102
+ /** Rule (conditional) constraints */
2103
+ rules?: RuleConstraints;
2104
+ }
2105
+
1312
2106
  /**
1313
2107
  * Union of all UI Schema element types.
1314
2108
  *
@@ -1439,6 +2233,18 @@ export declare interface VerticalLayout {
1439
2233
  readonly [k: string]: unknown;
1440
2234
  }
1441
2235
 
2236
+ /**
2237
+ * Registration for a vocabulary keyword to include in a JSON Schema `$vocabulary` declaration.
2238
+ *
2239
+ * @public
2240
+ */
2241
+ declare interface VocabularyKeywordRegistration {
2242
+ /** The keyword name (without vendor prefix). */
2243
+ readonly keyword: string;
2244
+ /** JSON Schema that describes the valid values for this keyword. */
2245
+ readonly schema: ExtensionPayloadValue;
2246
+ }
2247
+
1442
2248
  /**
1443
2249
  * Builds and writes both JSON Schema and UI Schema files to disk.
1444
2250
  *