import type Ajv from 'ajv'; import type { Signal } from '@tempots/dom'; import type { JSONSchemaDefinition, JSONSchemaType, SchemaConflict, NotViolation } from './schema-types'; import type { WidgetRegistry } from './widgets/widget-customization'; import type { ControllerValidation } from '../form/controller/controller-validation'; import type { ValidationMode } from '../form/controller/union-controller'; export type { JSONSchema, JSONSchemaDefinition, JSONSchemaType, SchemaConflict, AllOfMergeResult, NotViolation, } from './schema-types'; export { mergeAllOf } from './schema-merge'; export { evaluateNotViolation, composeEffectiveObjectSchema, evaluateIfThenElseOverlay, getEvaluatedProperties, hasConditionalFeatures, } from './schema-conditionals'; export type SchemaContextOptions = { schema: JSONSchemaDefinition; definition: JSONSchemaDefinition; horizontal: boolean; path: ReadonlyArray; ajv?: Ajv; isPropertyRequired?: boolean; suppressLabel?: boolean; schemaConflicts?: readonly SchemaConflict[]; notViolations?: readonly NotViolation[]; widgetRegistry?: WidgetRegistry; /** * Function to set the form's validation status. * Available for custom widgets that need to perform their own validation. */ setStatus?: (status: ControllerValidation) => void; /** * Signal containing the entire form's current value. * Useful for cross-field validation or conditional rendering. */ formValue?: Signal; /** * Current validation mode ('eager', 'onTouched', 'onSubmit'). * Custom widgets may want to behave differently based on this. */ validationMode?: ValidationMode; /** * Signal indicating whether the form is currently submitting. * Widgets should typically disable during submission. */ submitting?: Signal; }; export declare class SchemaContext { readonly schema: JSONSchemaDefinition; readonly definition: JSONSchemaDefinition; readonly horizontal: boolean; readonly path: ReadonlyArray; readonly ajv: Ajv | undefined; readonly isPropertyRequired: boolean; readonly suppressLabel: boolean; readonly schemaConflicts: readonly SchemaConflict[]; readonly notViolations: readonly NotViolation[]; readonly widgetRegistry: WidgetRegistry | undefined; /** * Function to set the form's validation status. * Available for custom widgets that need to perform their own validation. */ readonly setStatus: ((status: ControllerValidation) => void) | undefined; /** * Signal containing the entire form's current value. * Useful for cross-field validation or conditional rendering. */ readonly formValue: Signal | undefined; /** * Current validation mode ('eager', 'onTouched', 'onSubmit'). * Custom widgets may want to behave differently based on this. */ readonly validationMode: ValidationMode | undefined; /** * Signal indicating whether the form is currently submitting. * Widgets should typically disable during submission. */ readonly submitting: Signal | undefined; constructor(options: SchemaContextOptions); readonly with: (options: Partial) => SchemaContext; readonly append: (segment: PropertyKey) => SchemaContext; get isRoot(): boolean; get name(): string | undefined; get widgetName(): string; get widgetLabel(): string | undefined; readonly hasRequiredProperty: (name: string) => boolean; get nullable(): any; get isNullable(): boolean; /** * Determines if this property is optional (can be absent from parent object). * This is different from nullable - optional means the key can be missing, * while nullable means the value can be explicitly null. */ get isOptional(): boolean; /** * Determines if this property should show a presence toggle. * Optional properties that are not at the root level should have presence toggles, * but primitive values that allow null should use nullable controls instead. */ get shouldShowPresenceToggle(): boolean; /** * Determines if this schema represents a primitive type (string, number, boolean, null). */ get isPrimitive(): boolean; /** * Determines if this property is marked as readOnly. */ get isReadOnly(): boolean; /** * Determines if this property is marked as writeOnly. */ get isWriteOnly(): boolean; /** * Determines if this property is marked as deprecated. */ get isDeprecated(): boolean; /** * Checks if readOnly should be ignored based on x:ui.ignoreReadOnly. */ get shouldIgnoreReadOnly(): boolean; /** * Checks if writeOnly should be shown based on x:ui.showWriteOnly. */ get shouldShowWriteOnly(): boolean; get anyOf(): SchemaContext[] | undefined; get oneOf(): SchemaContext[] | undefined; get allOf(): SchemaContext[] | undefined; readonly hasType: (type: JSONSchemaType) => boolean; readonly hasEnumValue: (value: unknown) => boolean; readonly hasConstValue: (value: unknown) => boolean; get description(): string | undefined; get examples(): unknown[] | undefined; get default(): unknown; }