import { Schema, SchemaProp, SchemaType, SchemaPropTypes, SchemaProps, SchemaTypes, SchemaPropTypeMap } from '@based/schema'; import { ComponentType, ReactNode } from 'react'; export type SchemaComponent = (data: BasedNode | BasedNode[], schemaProp: UiSchemaProp, schema: UiSchema) => ReactNode; export type SchemaPropsToComponentMap = Record; export type BasedNode = { id: number; } & Record; export type UiMeta = { title?: string; width?: number; align?: 'left' | 'center' | 'right'; render?: (value: any, values?: BasedNode) => ReactNode; renderAs?: ComponentType<{ name: string; schemaProp: any; value: any; onChange?: (value: any, name: string) => void; }>; hide?: boolean; note?: { title: string; description: string; }; default?: unknown; key?: any; props?: UiPropsInput>; }; type StripId = Omit; type ExpandEnumArrayResolved = T extends readonly (infer E)[] ? Omit & { type: 'enum'; enum: E[]; } : never; type NormalizePropResolved = T extends { type?: 'object'; props: infer P; } ? Omit & { props: UiPropsResolved

; } : T extends { type?: 'set'; items: infer I; } ? Omit & { items: UiSchemaProp; } : T extends SchemaPropTypes ? SchemaPropTypeMap[T] : T extends readonly any[] ? ExpandEnumArrayResolved : T; type WithUiMetaResolved = X extends object ? X & UiMeta : UiMeta; export type UiSchemaProp = WithUiMetaResolved>; export type OverrideUiSchemaProps = Record>; type UiPropsResolved

= { [K in Exclude]: UiSchemaProp; }; type ExpandEnumArrayInput = T extends readonly (infer E)[] ? (Omit & { type: 'enum'; enum: E[]; }) | T : never; type NormalizePropInput = T extends { type?: 'object'; props: infer P; } ? Omit & { props: UiPropsInput

; } : T extends { type?: 'set'; items: infer I; } ? Omit & { items: NormalizePropInput; } : T extends SchemaPropTypes ? SchemaPropTypeMap[T] | T : T extends readonly any[] ? ExpandEnumArrayInput : T; type WithUiMetaInput = X extends object ? X & UiMeta : X & UiMeta; type UiPropsInput

= { [K in Exclude]: WithUiMetaInput>; }; export type UiSchemaType = { key?: any; prop?: UiSchemaProp; } & ((T extends { props: infer P; } ? Omit & { props: UiPropsInput

; } : never) | (T extends SchemaProps ? UiPropsInput : never)); export type UiSchemaTypes = { [K in Exclude]: UiSchemaType; } & { _root?: never; }; type NonStrictTypes = SchemaTypes; type NonStrictProps = SchemaProps; export type UiSchema = Omit & { types?: UiSchemaTypes; props?: UiPropsInput>; }; export {};