@tempots/beatui 0.68.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/{ar-aMLQTGVh.js → ar-BbgpGwJp.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +106 -105
  4. package/dist/beatui.css +401 -0
  5. package/dist/beatui.tailwind.css +401 -0
  6. package/dist/{de-DBFOC44R.js → de-R7lPfyZ4.js} +1 -1
  7. package/dist/deep-merge-CQQCMLwG.js +1636 -0
  8. package/dist/deep-merge-DZxfgKqX.cjs +1 -0
  9. package/dist/duration-input-D-SIoDoo.cjs +1 -0
  10. package/dist/duration-input-DKxZ6OCa.js +277 -0
  11. package/dist/{es-C4xOThaT.js → es-DV0Jr_BZ.js} +1 -1
  12. package/dist/{fa-B7X_xydY.js → fa-DXvHejs9.js} +1 -1
  13. package/dist/{fr-AmjzbxN_.js → fr-D8FOMX0o.js} +1 -1
  14. package/dist/{he-DY-9yiOC.js → he-B19Qsx-u.js} +1 -1
  15. package/dist/{hi-Clkyp5Fu.js → hi-DozFnE3b.js} +1 -1
  16. package/dist/{index-GLoRnI6r.js → index-CYb1YxDX.js} +1 -1
  17. package/dist/{index-CzuXAuLZ.js → index-DdpYvBeh.js} +3 -3
  18. package/dist/index.cjs.js +4 -4
  19. package/dist/index.es.js +2830 -3079
  20. package/dist/{it-BC32WmGF.js → it-But8uzNi.js} +1 -1
  21. package/dist/{ja-JNSZS_Hv.js → ja-DkwTnFdU.js} +1 -1
  22. package/dist/json-schema/index.cjs.js +6 -6
  23. package/dist/json-schema/index.es.js +3459 -3333
  24. package/dist/json-structure/index.cjs.js +1 -0
  25. package/dist/json-structure/index.es.js +3157 -0
  26. package/dist/{ko-B8l0TJp0.js → ko-Cqv-IjhX.js} +1 -1
  27. package/dist/modal-5P9mU_a4.cjs +1 -0
  28. package/dist/{modal-DJWj5M5e.js → modal-MofsfmAe.js} +2 -2
  29. package/dist/{nl-BpYESHP8.js → nl-YSiU3rFI.js} +1 -1
  30. package/dist/notice-Cqq8g17n.js +209 -0
  31. package/dist/notice-DP209Ed8.cjs +1 -0
  32. package/dist/{pl-_sWhGdrs.js → pl-DXmHc2Nh.js} +1 -1
  33. package/dist/prosemirror/index.es.js +1 -1
  34. package/dist/{pt-BmiQvHUz.js → pt-Bf3z_-26.js} +1 -1
  35. package/dist/{ru-DacnqexG.js → ru-Sy00qUeG.js} +1 -1
  36. package/dist/tailwind/vite-plugin.es.js +1 -0
  37. package/dist/{toolbar-Bk5-22ln.js → toolbar-C_Ec0_XC.js} +1 -1
  38. package/dist/{tr-BSS5b_v6.js → tr-BDxG3qd6.js} +1 -1
  39. package/dist/{translations-zGwuSQWQ.js → translations-BmsRhth7.js} +1 -1
  40. package/dist/{translations-BUTBIDsS.js → translations-DQxouiBG.js} +24 -24
  41. package/dist/types/components/form/index.d.ts +1 -0
  42. package/dist/types/components/form/utils/deep-merge.d.ts +27 -0
  43. package/dist/types/components/form/utils/index.d.ts +1 -0
  44. package/dist/types/components/json-schema/controls/generic-control.d.ts +2 -1
  45. package/dist/types/components/json-schema/controls/shared-utils.d.ts +17 -1
  46. package/dist/types/components/json-schema/index.d.ts +2 -0
  47. package/dist/types/components/json-schema/json-schema-form.d.ts +25 -3
  48. package/dist/types/components/json-schema/schema-context.d.ts +3 -0
  49. package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
  50. package/dist/types/components/json-schema/widgets/widget-customization.d.ts +55 -0
  51. package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
  52. package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
  53. package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
  54. package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
  55. package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
  56. package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
  57. package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
  58. package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
  59. package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
  60. package/dist/types/components/json-structure/controls/index.d.ts +21 -0
  61. package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
  62. package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
  63. package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
  64. package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
  65. package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
  66. package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
  67. package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
  68. package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
  69. package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
  70. package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
  71. package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
  72. package/dist/types/components/json-structure/index.d.ts +25 -0
  73. package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
  74. package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
  75. package/dist/types/components/json-structure/structure-context.d.ts +176 -0
  76. package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
  77. package/dist/types/components/json-structure/structure-types.d.ts +173 -0
  78. package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
  79. package/dist/types/components/json-structure/validation/index.d.ts +5 -0
  80. package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
  81. package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
  82. package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
  83. package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
  84. package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
  85. package/dist/types/index.d.ts +1 -0
  86. package/dist/types/json-structure/index.d.ts +9 -0
  87. package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
  88. package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
  89. package/dist/use-form-DVJXMMoN.cjs +2 -0
  90. package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
  91. package/dist/widget-customization-29Hl2gKT.js +1171 -0
  92. package/dist/widget-customization-BXiewbt-.cjs +1 -0
  93. package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
  94. package/package.json +10 -2
  95. package/dist/modal-D_paG9Sr.cjs +0 -1
  96. package/dist/notice-CgT9ma2m.cjs +0 -2
  97. package/dist/utils-7JQljUYX.js +0 -2554
  98. package/dist/utils-CPtkOy9f.cjs +0 -1
@@ -30,6 +30,8 @@ export interface WidgetRegistration<T = unknown> {
30
30
  priority?: number;
31
31
  /** Whether this widget can be used as a fallback */
32
32
  canFallback?: boolean;
33
+ /** Custom matcher function for widget selection */
34
+ matcher?: (ctx: SchemaContext) => boolean;
33
35
  }
34
36
  /**
35
37
  * Widget customization configuration from x:ui
@@ -59,6 +61,29 @@ export interface WidgetCustomization {
59
61
  else?: WidgetCustomization;
60
62
  };
61
63
  }
64
+ /**
65
+ * Custom widget registration for form-scoped widgets
66
+ */
67
+ export interface CustomWidgetRegistration<T = unknown> {
68
+ /** Widget name */
69
+ name: string;
70
+ /** Widget factory function */
71
+ factory: WidgetFactory<T>;
72
+ /** Widget display name */
73
+ displayName?: string;
74
+ /** Widget description */
75
+ description?: string;
76
+ /** Supported JSON Schema types */
77
+ supportedTypes?: string[];
78
+ /** Widget priority (higher = preferred, default: 50) */
79
+ priority?: number;
80
+ /** Custom matcher function for widget selection */
81
+ matcher?: (ctx: SchemaContext) => boolean;
82
+ }
83
+ /**
84
+ * Array of custom widget registrations for the customWidgets option
85
+ */
86
+ export type CustomWidgets = CustomWidgetRegistration[];
62
87
  /**
63
88
  * Widget registry for managing custom widgets
64
89
  */
@@ -118,3 +143,33 @@ export declare function registerEnhancedWidgets(registry?: WidgetRegistry): void
118
143
  * Helper to register a simple widget
119
144
  */
120
145
  export declare function registerWidget<T = unknown>(name: string, factory: WidgetFactory<T>, options?: Partial<WidgetRegistration<T>>, registry?: WidgetRegistry): void;
146
+ /**
147
+ * Create a custom widget registration that matches by explicit x:ui widget name
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * forXUI('fancy-email', myEmailWidget)
152
+ * // Matches schema: { type: 'string', 'x:ui': 'fancy-email' }
153
+ * ```
154
+ */
155
+ export declare function forXUI<T = unknown>(widgetName: string, factory: WidgetFactory<T>, options?: Partial<Omit<CustomWidgetRegistration<T>, 'name' | 'factory' | 'matcher'>>): CustomWidgetRegistration<T>;
156
+ /**
157
+ * Create a custom widget registration that matches by schema format
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * forFormat('email', myEmailWidget)
162
+ * // Matches ANY schema with: { format: 'email' }
163
+ * ```
164
+ */
165
+ export declare function forFormat<T = unknown>(format: string, factory: WidgetFactory<T>, options?: Partial<Omit<CustomWidgetRegistration<T>, 'factory' | 'matcher'>>): CustomWidgetRegistration<T>;
166
+ /**
167
+ * Create a custom widget registration that matches by type + format combination
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * forTypeAndFormat('string', 'uuid', myUuidWidget)
172
+ * // Matches schema: { type: 'string', format: 'uuid' }
173
+ * ```
174
+ */
175
+ export declare function forTypeAndFormat<T = unknown>(type: string, format: string, factory: WidgetFactory<T>, options?: Partial<Omit<CustomWidgetRegistration<T>, 'factory' | 'matcher'>>): CustomWidgetRegistration<T>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Any Control for JSON Structure
3
+ *
4
+ * Handles any type with JSON textarea
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for any type (JSON textarea)
11
+ */
12
+ export declare function StructureAnyControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<unknown>;
15
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Array Control for JSON Structure
3
+ *
4
+ * Handles array type with items definition and minItems/maxItems constraints
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { ArrayController } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for array type
11
+ */
12
+ export declare function StructureArrayControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: ArrayController<unknown[]>;
15
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Binary Control for JSON Structure
3
+ *
4
+ * Handles binary type with FileInput
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for binary type
11
+ */
12
+ export declare function StructureBinaryControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<File | undefined>;
15
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Boolean Control for JSON Structure
3
+ *
4
+ * Handles boolean type with CheckboxInput
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for boolean type
11
+ */
12
+ export declare function StructureBooleanControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<boolean | null>;
15
+ }): Renderable;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Choice Control for JSON Structure
3
+ *
4
+ * Handles choice type (tagged unions) with:
5
+ * - Dropdown to select which variant to use
6
+ * - Appropriate fields for selected variant
7
+ * - Optional discriminator property support
8
+ * - Tagged union serialization: { choiceName: variantValue }
9
+ */
10
+ import { Renderable } from '@tempots/dom';
11
+ import type { StructureContext } from '../structure-context';
12
+ import { type Controller } from '../../form';
13
+ /**
14
+ * Control for choice type (tagged unions)
15
+ */
16
+ export declare function StructureChoiceControl({ ctx, controller, }: {
17
+ ctx: StructureContext;
18
+ controller: Controller<unknown>;
19
+ }): Renderable;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Decimal Control for JSON Structure
3
+ *
4
+ * Handles float, double, and decimal types with NumberInput
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ import type { FloatType } from '../structure-types';
10
+ /**
11
+ * Control for float/double/decimal types
12
+ */
13
+ export declare function StructureDecimalControl({ ctx, controller, floatType, }: {
14
+ ctx: StructureContext;
15
+ controller: Controller<number | null>;
16
+ floatType: FloatType;
17
+ }): Renderable;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Deprecation utilities for JSON Structure controls
3
+ *
4
+ * Helper functions for displaying deprecation indicators on deprecated fields
5
+ */
6
+ import { type TNode } from '@tempots/dom';
7
+ /**
8
+ * Create a deprecation indicator badge
9
+ */
10
+ export declare function DeprecationBadge(): TNode;
11
+ /**
12
+ * Wrap label with deprecation indicator if field is deprecated
13
+ */
14
+ export declare function withDeprecationBadge(label: string | undefined, isDeprecated: boolean): TNode;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Enum and Const Controls for JSON Structure
3
+ *
4
+ * Handles enum selection and const value display
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for enum schemas
11
+ */
12
+ export declare function StructureEnumControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<unknown>;
15
+ }): Renderable;
16
+ /**
17
+ * Control for const schemas
18
+ */
19
+ export declare function StructureConstControl({ ctx, controller, }: {
20
+ ctx: StructureContext;
21
+ controller: Controller<unknown>;
22
+ }): Renderable;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Generic Control Dispatcher
3
+ *
4
+ * Routes to appropriate control based on type definition.
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ import type { JSONStructureSchema } from '../structure-types';
10
+ import type { WidgetRegistry } from '../widgets/widget-registry';
11
+ /**
12
+ * Props for the generic control
13
+ */
14
+ export interface GenericControlProps<T = unknown> {
15
+ controller: Controller<T>;
16
+ ctx: StructureContext;
17
+ }
18
+ /**
19
+ * Generic control dispatcher that routes to appropriate control based on type
20
+ */
21
+ export declare function StructureGenericControl<T>({ ctx, controller, }: GenericControlProps<T>): Renderable;
22
+ /**
23
+ * Main entry point for JSON Structure controls
24
+ */
25
+ export declare function StructureControl<T>({ schema, controller, widgetRegistry, readOnly, locale, }: {
26
+ schema: JSONStructureSchema;
27
+ controller: Controller<T>;
28
+ widgetRegistry?: WidgetRegistry;
29
+ readOnly?: boolean;
30
+ locale?: string;
31
+ }): Renderable;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Controls module exports
3
+ */
4
+ export * from './generic-control';
5
+ export * from './string-control';
6
+ export * from './boolean-control';
7
+ export * from './integer-control';
8
+ export * from './decimal-control';
9
+ export * from './uuid-control';
10
+ export * from './temporal-control';
11
+ export * from './uri-control';
12
+ export * from './binary-control';
13
+ export * from './any-control';
14
+ export * from './object-control';
15
+ export * from './array-control';
16
+ export * from './set-control';
17
+ export * from './map-control';
18
+ export * from './tuple-control';
19
+ export * from './choice-control';
20
+ export * from './enum-const-controls';
21
+ export * from './union-control';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Integer Control for JSON Structure
3
+ *
4
+ * Handles all integer types (int8/16/32/64/128, uint8/16/32/64/128)
5
+ * with appropriate Number or BigInt inputs
6
+ */
7
+ import { Renderable } from '@tempots/dom';
8
+ import { type Controller } from '../../form';
9
+ import type { StructureContext } from '../structure-context';
10
+ import { type IntegerType } from '../structure-types';
11
+ /**
12
+ * Control for integer types
13
+ */
14
+ export declare function StructureIntegerControl({ ctx, controller, intType, }: {
15
+ ctx: StructureContext;
16
+ controller: Controller<number | bigint | null>;
17
+ intType: IntegerType;
18
+ }): Renderable;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Map Control for JSON Structure
3
+ *
4
+ * Handles map type with key-value pairs and minProperties/maxProperties constraints
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { ObjectController } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for map type (key-value pairs)
11
+ */
12
+ export declare function StructureMapControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: ObjectController<{
15
+ [key: string]: unknown;
16
+ }>;
17
+ }): Renderable;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Object Control for JSON Structure
3
+ *
4
+ * Handles object type with properties and additionalProperties support
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { ObjectController } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for object type
11
+ */
12
+ export declare function StructureObjectControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: ObjectController<{
15
+ [key: string]: unknown;
16
+ }>;
17
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Set Control for JSON Structure
3
+ *
4
+ * Handles set type with items definition, uniqueness validation, and minItems/maxItems constraints
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { ArrayController } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for set type (array with uniqueness enforcement)
11
+ */
12
+ export declare function StructureSetControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: ArrayController<unknown[]>;
15
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * String Control for JSON Structure
3
+ *
4
+ * Handles string type with TextInput
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for string type
11
+ */
12
+ export declare function StructureStringControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<string | undefined>;
15
+ }): Renderable;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Temporal Control for JSON Structure
3
+ *
4
+ * Handles date, datetime, time, and duration types with appropriate temporal inputs
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ import type { TemporalType } from '../structure-types';
10
+ import { Temporal } from '@js-temporal/polyfill';
11
+ /**
12
+ * Control for temporal types (date, datetime, time, duration)
13
+ */
14
+ export declare function StructureTemporalControl({ ctx, controller, temporalType, }: {
15
+ ctx: StructureContext;
16
+ controller: Controller<Temporal.PlainDate | Temporal.PlainDateTime | Temporal.PlainTime | Temporal.Duration | null>;
17
+ temporalType: TemporalType;
18
+ }): Renderable;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Tuple Control for JSON Structure
3
+ *
4
+ * Handles tuple type with fixed-length ordered elements.
5
+ * Each element has a named definition, but serializes to a JSON array in the specified order.
6
+ */
7
+ import { Renderable } from '@tempots/dom';
8
+ import { ArrayController } from '../../form';
9
+ import type { StructureContext } from '../structure-context';
10
+ /**
11
+ * Control for tuple type
12
+ *
13
+ * Tuples are fixed-length arrays where each position has a specific type.
14
+ * The `tuple` array defines the order of elements by referencing keys in `properties`.
15
+ */
16
+ export declare function StructureTupleControl({ ctx, controller, }: {
17
+ ctx: StructureContext;
18
+ controller: ArrayController<unknown[]>;
19
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Union Control for JSON Structure
3
+ *
4
+ * Handles union types (type arrays) like ["string", "number"] or ["string", "null"]
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for union type definitions
11
+ */
12
+ export declare function StructureUnionControl<T>({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<T>;
15
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * URI Control for JSON Structure
3
+ *
4
+ * Handles uri type with URLInput
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for uri type
11
+ */
12
+ export declare function StructureUriControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<string | undefined>;
15
+ }): Renderable;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * UUID Control for JSON Structure
3
+ *
4
+ * Handles uuid type with UUIDInput
5
+ */
6
+ import { Renderable } from '@tempots/dom';
7
+ import { type Controller } from '../../form';
8
+ import type { StructureContext } from '../structure-context';
9
+ /**
10
+ * Control for uuid type
11
+ */
12
+ export declare function StructureUuidControl({ ctx, controller, }: {
13
+ ctx: StructureContext;
14
+ controller: Controller<string | undefined>;
15
+ }): Renderable;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * $extends Inheritance Utilities for JSON Structure
3
+ *
4
+ * Handles resolution of $extends inheritance within JSON Structure schemas.
5
+ */
6
+ import type { JSONStructureSchema, TypeDefinition } from './structure-types';
7
+ import { RefResolver } from './ref-utils';
8
+ /**
9
+ * Result of resolving inheritance
10
+ */
11
+ export interface InheritanceResult {
12
+ /** The merged type definition with all inherited properties */
13
+ merged: TypeDefinition;
14
+ /** Chain of base types (from most base to most derived) */
15
+ inheritanceChain: string[];
16
+ /** Any errors encountered during resolution */
17
+ errors: InheritanceError[];
18
+ }
19
+ export interface InheritanceError {
20
+ path: string;
21
+ message: string;
22
+ }
23
+ /**
24
+ * Resolve $extends for a type definition
25
+ *
26
+ * Properties are merged with derived type taking precedence over base types.
27
+ * For multiple inheritance, types are processed left-to-right with later
28
+ * types taking precedence.
29
+ */
30
+ export declare function resolveExtends(definition: TypeDefinition, schema: JSONStructureSchema, _refResolver?: RefResolver): InheritanceResult;
31
+ /**
32
+ * Create an extends resolver for a schema (convenience function)
33
+ */
34
+ export declare function createExtendsResolver(schema: JSONStructureSchema): {
35
+ resolve: (definition: TypeDefinition) => InheritanceResult;
36
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * JSON Structure Form Components
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export * from './structure-types';
7
+ export { StructureContext, createStructureContext } from './structure-context';
8
+ export type { StructureContextOptions, StructureContextUpdates, } from './structure-context';
9
+ export { resolveRef, resolveTypeReference, parseRefPath, RefResolver, createRefResolver, } from './ref-utils';
10
+ export { resolveExtends, createExtendsResolver } from './extends-utils';
11
+ export type { InheritanceResult, InheritanceError } from './extends-utils';
12
+ export { StructureGenericControl, StructureControl, } from './controls/generic-control';
13
+ export type { GenericControlProps } from './controls/generic-control';
14
+ export { createValidator, validate } from './validation/sdk-validator';
15
+ export type { ValidationResult, ValidatorOptions, StructureValidator, } from './validation/sdk-validator';
16
+ export { formatValidationError, formatValidationErrors, groupErrorsByPath, getErrorsForPath, hasErrorsAtPath, getChildErrors, } from './validation/error-transform';
17
+ export type { RawValidationError, FormattedValidationError, } from './validation/error-transform';
18
+ export { DefaultWidgetRegistry, getGlobalWidgetRegistry, setGlobalWidgetRegistry, createWidgetRegistry, forType, forFormat, forTypeAndFormat, forMatcher, } from './widgets/widget-registry';
19
+ export type { WidgetProps, WidgetFactory, WidgetRegistration, ResolvedWidget, WidgetRegistry, WidgetRegistrationOptions, } from './widgets/widget-registry';
20
+ export { resolveWidget, getWidgetOptions, getExplicitWidgetName, hasCustomWidget, resolveWidgetWithOverride, mergeWidgetOptions, } from './widgets/widget-utils';
21
+ export type { WidgetOptions } from './widgets/widget-utils';
22
+ export { registerDefaultWidgets, hasDefaultWidgets, ensureDefaultWidgets, } from './widgets/default-widgets';
23
+ export { extractStructureDefaults } from './structure-defaults';
24
+ export { JSONStructureForm } from './json-structure-form';
25
+ export type { JSONStructureFormProps, ValidationMode, } from './json-structure-form';
@@ -0,0 +1,96 @@
1
+ /**
2
+ * JSON Structure Form Component
3
+ *
4
+ * Main form component for JSON Structure schema-based forms.
5
+ * Provides validation, error handling, and form state management.
6
+ */
7
+ import { Value, Renderable } from '@tempots/dom';
8
+ import { Controller, ControllerValidation } from '../form';
9
+ import { FormattedValidationError } from './validation/error-transform';
10
+ import type { JSONStructureSchema } from './structure-types';
11
+ import type { WidgetRegistry } from './widgets/widget-registry';
12
+ /**
13
+ * Validation mode for the form
14
+ * - 'onSubmit': Validate only when form is submitted
15
+ * - 'onTouched': Validate fields after they are touched
16
+ * - 'eager': Validate fields as they change
17
+ */
18
+ export type ValidationMode = 'onSubmit' | 'onTouched' | 'eager';
19
+ /**
20
+ * Props for JSONStructureForm component
21
+ */
22
+ export interface JSONStructureFormProps<T> {
23
+ /** The JSON Structure schema to render as a form */
24
+ schema: JSONStructureSchema;
25
+ /**
26
+ * Initial value for the form data.
27
+ *
28
+ * When omitted, the form will be auto-populated from schema defaults:
29
+ * - `default` property values (highest priority)
30
+ * - First item from `examples` array (fallback)
31
+ * - Empty object for object schemas (last resort)
32
+ *
33
+ * When provided, schema defaults are merged with the provided value
34
+ * (provided values take precedence) unless `applySchemaDefaults` is false.
35
+ */
36
+ initialValue?: Value<T>;
37
+ /** Validation behavior - when to validate the form */
38
+ validationMode?: ValidationMode;
39
+ /** Debounce delay in milliseconds for validation */
40
+ validateDebounceMs?: number;
41
+ /** Optional widget registry for custom widgets */
42
+ widgetRegistry?: WidgetRegistry;
43
+ /** Make all fields read-only */
44
+ readOnly?: boolean;
45
+ /** Locale for internationalization */
46
+ locale?: string;
47
+ /** Called when form value changes */
48
+ onChange?: (value: T) => void;
49
+ /** Called when validation runs */
50
+ onValidate?: (errors: FormattedValidationError[]) => void;
51
+ /**
52
+ * Whether to automatically populate form values from schema defaults.
53
+ * When true, extracts `default` values (with `examples[0]` as fallback)
54
+ * from the schema and merges them with the provided initialValue.
55
+ * Provided values take precedence over schema defaults.
56
+ *
57
+ * @default true
58
+ */
59
+ applySchemaDefaults?: boolean;
60
+ }
61
+ /**
62
+ * JSON Structure Form Component
63
+ *
64
+ * Renders a complete form based on a JSON Structure schema with validation.
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * JSONStructureForm(
69
+ * {
70
+ * schema: mySchema,
71
+ * initialValue: prop(initialData),
72
+ * validationMode: 'onTouched',
73
+ * },
74
+ * ({ Form, controller, setStatus }) => {
75
+ * return html.form(
76
+ * on.submit(async (e) => {
77
+ * e.preventDefault()
78
+ * // Validate and submit
79
+ * const value = controller.signal.value
80
+ * // ... handle submission
81
+ * }),
82
+ * Form,
83
+ * html.button(
84
+ * attr.type('submit'),
85
+ * 'Submit'
86
+ * )
87
+ * )
88
+ * }
89
+ * )
90
+ * ```
91
+ */
92
+ export declare function JSONStructureForm<T>({ schema, initialValue, validationMode, validateDebounceMs, widgetRegistry, readOnly, locale, onChange, onValidate, applySchemaDefaults, }: JSONStructureFormProps<T>, fn: ({ Form, controller, setStatus, }: {
93
+ Form: Renderable;
94
+ controller: Controller<T>;
95
+ setStatus: (result: ControllerValidation) => void;
96
+ }) => Renderable): Renderable;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * $ref Resolution Utilities for JSON Structure
3
+ *
4
+ * Handles resolution of $ref references within JSON Structure schemas.
5
+ */
6
+ import type { JSONStructureSchema, TypeDefinition, Namespace, TypeReference } from './structure-types';
7
+ /**
8
+ * Parse a $ref path into segments
9
+ * Examples:
10
+ * "#/definitions/Address" -> ["definitions", "Address"]
11
+ * "#/definitions/Types/Email" -> ["definitions", "Types", "Email"]
12
+ * "Address" -> ["definitions", "Address"] (shorthand)
13
+ */
14
+ export declare function parseRefPath(ref: string): string[];
15
+ /**
16
+ * Resolve a $ref path to its definition within the schema
17
+ */
18
+ export declare function resolveRefPath(schema: JSONStructureSchema, segments: string[]): TypeDefinition | Namespace | undefined;
19
+ /**
20
+ * Resolve a $ref string to its type definition
21
+ */
22
+ export declare function resolveRef(ref: string, schema: JSONStructureSchema): TypeDefinition | undefined;
23
+ /**
24
+ * Resolve a TypeReference object to its type definition
25
+ */
26
+ export declare function resolveTypeReference(ref: TypeReference, schema: JSONStructureSchema): TypeDefinition | undefined;
27
+ /**
28
+ * Check if a definition contains a $ref and resolve it if so
29
+ * Returns the resolved definition merged with any sibling properties
30
+ */
31
+ export declare function resolveDefinitionRef(definition: TypeDefinition, schema: JSONStructureSchema): TypeDefinition;
32
+ /**
33
+ * Track visited refs to detect circular references
34
+ */
35
+ export declare class RefResolver {
36
+ private readonly schema;
37
+ private readonly visited;
38
+ constructor(schema: JSONStructureSchema);
39
+ /**
40
+ * Resolve a reference, tracking visited refs to prevent infinite loops
41
+ */
42
+ resolve(ref: string): TypeDefinition | undefined;
43
+ /**
44
+ * Resolve a type definition, handling any $ref in its type specifier
45
+ */
46
+ resolveDefinition(definition: TypeDefinition): TypeDefinition;
47
+ /**
48
+ * Reset the visited tracking (use between independent resolution calls)
49
+ */
50
+ reset(): void;
51
+ }
52
+ /**
53
+ * Create a ref resolver for a schema
54
+ */
55
+ export declare function createRefResolver(schema: JSONStructureSchema): RefResolver;