@tempots/beatui 0.69.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 (93) 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 +2852 -3104
  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 +3099 -2961
  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/index.d.ts +1 -0
  45. package/dist/types/components/json-schema/json-schema-form.d.ts +22 -3
  46. package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
  47. package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
  48. package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
  49. package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
  50. package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
  51. package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
  52. package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
  53. package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
  54. package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
  55. package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
  56. package/dist/types/components/json-structure/controls/index.d.ts +21 -0
  57. package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
  58. package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
  59. package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
  60. package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
  61. package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
  62. package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
  63. package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
  64. package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
  65. package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
  66. package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
  67. package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
  68. package/dist/types/components/json-structure/index.d.ts +25 -0
  69. package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
  70. package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
  71. package/dist/types/components/json-structure/structure-context.d.ts +176 -0
  72. package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
  73. package/dist/types/components/json-structure/structure-types.d.ts +173 -0
  74. package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
  75. package/dist/types/components/json-structure/validation/index.d.ts +5 -0
  76. package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
  77. package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
  78. package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
  79. package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
  80. package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
  81. package/dist/types/json-structure/index.d.ts +9 -0
  82. package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
  83. package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
  84. package/dist/use-form-DVJXMMoN.cjs +2 -0
  85. package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
  86. package/dist/widget-customization-29Hl2gKT.js +1171 -0
  87. package/dist/widget-customization-BXiewbt-.cjs +1 -0
  88. package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
  89. package/package.json +10 -2
  90. package/dist/modal-D_paG9Sr.cjs +0 -1
  91. package/dist/notice-CgT9ma2m.cjs +0 -2
  92. package/dist/widget-customization-BcbRhAAR.cjs +0 -1
  93. package/dist/widget-customization-D6Y_Qm7o.js +0 -2788
@@ -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;
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Structure Context
3
+ *
4
+ * Immutable context object threaded through the form rendering tree.
5
+ * Provides access to schema, definition, path, and computed properties.
6
+ */
7
+ import type { JSONStructureSchema, TypeDefinition, TypeKeyword, Altnames } from './structure-types';
8
+ import { RefResolver } from './ref-utils';
9
+ import type { WidgetRegistry } from './widgets/widget-registry';
10
+ /**
11
+ * Options for creating a StructureContext
12
+ */
13
+ export interface StructureContextOptions {
14
+ /** Root schema document */
15
+ schema: JSONStructureSchema;
16
+ /** Current type definition being rendered */
17
+ definition: TypeDefinition;
18
+ /** Path from root to current position */
19
+ path: ReadonlyArray<PropertyKey>;
20
+ /** Form-level read-only mode */
21
+ readOnly?: boolean;
22
+ /** Locale for altnames resolution */
23
+ locale?: string;
24
+ /** Custom widget registry */
25
+ widgetRegistry?: WidgetRegistry;
26
+ /** Whether this property is required by parent */
27
+ isPropertyRequired?: boolean;
28
+ /** Whether to suppress label rendering */
29
+ suppressLabel?: boolean;
30
+ /** Shared ref resolver for the schema */
31
+ refResolver?: RefResolver;
32
+ }
33
+ /**
34
+ * Updates that can be passed to context.with()
35
+ */
36
+ export interface StructureContextUpdates {
37
+ definition?: TypeDefinition;
38
+ path?: ReadonlyArray<PropertyKey>;
39
+ readOnly?: boolean;
40
+ locale?: string;
41
+ widgetRegistry?: WidgetRegistry;
42
+ isPropertyRequired?: boolean;
43
+ suppressLabel?: boolean;
44
+ }
45
+ /**
46
+ * Immutable context for JSON Structure form rendering
47
+ */
48
+ export declare class StructureContext {
49
+ readonly schema: JSONStructureSchema;
50
+ readonly definition: TypeDefinition;
51
+ readonly path: ReadonlyArray<PropertyKey>;
52
+ readonly readOnly: boolean;
53
+ readonly locale: string | undefined;
54
+ readonly widgetRegistry: WidgetRegistry | undefined;
55
+ readonly isPropertyRequired: boolean;
56
+ readonly suppressLabel: boolean;
57
+ private readonly refResolver;
58
+ constructor(options: StructureContextOptions);
59
+ /**
60
+ * Create a new context with updated fields
61
+ */
62
+ with(updates: StructureContextUpdates): StructureContext;
63
+ /**
64
+ * Create a child context by appending to the path
65
+ */
66
+ append(segment: PropertyKey): StructureContext;
67
+ /**
68
+ * Check if this is the root context
69
+ */
70
+ get isRoot(): boolean;
71
+ /**
72
+ * Get the property name (last segment of path)
73
+ */
74
+ get name(): string | undefined;
75
+ /**
76
+ * Get the widget name (dot-separated path)
77
+ */
78
+ get widgetName(): string;
79
+ /**
80
+ * Get the resolved type(s) from the definition
81
+ */
82
+ get resolvedType(): TypeKeyword | TypeKeyword[] | null;
83
+ /**
84
+ * Get the primary type (first non-null type)
85
+ */
86
+ get primaryType(): TypeKeyword | null;
87
+ /**
88
+ * Check if this type is nullable
89
+ */
90
+ get isNullable(): boolean;
91
+ /**
92
+ * Check if this is a required field
93
+ */
94
+ get isRequired(): boolean;
95
+ /**
96
+ * Check if this is an optional field (can be absent)
97
+ */
98
+ get isOptional(): boolean;
99
+ /**
100
+ * Check if this field is deprecated
101
+ */
102
+ get isDeprecated(): boolean;
103
+ /**
104
+ * Check if this type is abstract
105
+ */
106
+ get isAbstract(): boolean;
107
+ /**
108
+ * Check if this is a primitive type
109
+ */
110
+ get isPrimitive(): boolean;
111
+ /**
112
+ * Get the description from the definition
113
+ */
114
+ get description(): string | undefined;
115
+ /**
116
+ * Get examples from the definition
117
+ */
118
+ get examples(): unknown[] | undefined;
119
+ /**
120
+ * Get the default value from the definition
121
+ */
122
+ get defaultValue(): unknown;
123
+ /**
124
+ * Get the unit for numeric values
125
+ */
126
+ get unit(): string | undefined;
127
+ /**
128
+ * Get the currency for monetary values
129
+ */
130
+ get currency(): string | undefined;
131
+ /**
132
+ * Get the label for this field
133
+ *
134
+ * Resolution order:
135
+ * 1. Locale-specific altname (if locale is set)
136
+ * 2. Definition name
137
+ * 3. Humanized path name
138
+ */
139
+ get label(): string;
140
+ /**
141
+ * Get altnames from the definition
142
+ */
143
+ get altnames(): Altnames | undefined;
144
+ /**
145
+ * Get the JSON path string (for validation error matching)
146
+ */
147
+ get jsonPath(): string;
148
+ /**
149
+ * Resolve a $ref using the shared resolver
150
+ */
151
+ resolveRef(ref: string): TypeDefinition | undefined;
152
+ /**
153
+ * Check if this definition has an enum constraint
154
+ */
155
+ get hasEnum(): boolean;
156
+ /**
157
+ * Get enum values if present
158
+ */
159
+ get enumValues(): unknown[] | undefined;
160
+ /**
161
+ * Check if this definition has a const constraint
162
+ */
163
+ get hasConst(): boolean;
164
+ /**
165
+ * Get const value if present
166
+ */
167
+ get constValue(): unknown;
168
+ /**
169
+ * Get string format if defined (for string types)
170
+ */
171
+ get format(): string | undefined;
172
+ }
173
+ /**
174
+ * Create a root context from a schema
175
+ */
176
+ export declare function createStructureContext(schema: JSONStructureSchema, options?: Partial<Omit<StructureContextOptions, 'schema' | 'definition' | 'path'>>): StructureContext;