import { ParsedSchema } from "../../schema/index.js"; import { FormatFlags } from "../../schema/to-string.js"; import { ReactNode } from "react"; import { FieldKey } from "@fumari/stf"; //#region src/components/playground/schema.d.ts interface SchemaContextType extends SchemaScope { docRoot: Exclude; } export interface SchemaScope { /** * show write only fields */ writeOnly: boolean; /** * show read only fields */ readOnly: boolean; } type UnionField = 'anyOf' | 'oneOf'; export interface FieldInfo { selectedType?: string; oneOf: number; /** * The actual field that represents union members. */ unionField?: UnionField; } export declare const anyFields: { type: string[]; items: true; additionalProperties: true; }; export declare function SchemaProvider({ readOnly, writeOnly, docRoot, children }: SchemaContextType & { children: ReactNode; }): import("react").JSX.Element; export declare function useSchemaContext(): SchemaContextType; /** * A hook to store dynamic info of a field, such as selected schema of `oneOf`. * * @param fieldName - field name of form. * @param schema - The **resolved** JSON Schema to generate initial values. * @param depth - The depth to avoid duplicated field name with same schema (e.g. nested `oneOf`). */ export declare function useFieldInfo(fieldName: FieldKey, schema: Exclude, depth?: number): { info: FieldInfo; schema: Exclude; updateInfo: (value: Partial) => void; }; export declare function useSchemaUtils(): { generateDefault(schema: ParsedSchema): unknown; schemaToString(value: ParsedSchema, flags?: FormatFlags): string; }; /** * dereference & merge `allOf`. */ export declare function useResolvedSchema(raw: ParsedSchema): Exclude; //#endregion