import { j as WalkedField, w as SchemaMeta } from "../types-BBQaEPfE.mjs"; import { t as Diagnostic } from "../diagnostics-mftUZI7c.mjs"; import { r as SchemaIoSide } from "../adapter-ktQaheWB.mjs"; import { t as SchemaError } from "../errors-DbaI04x2.mjs"; import { f as RejectUnrepresentableZod } from "../typeInference-Y8tNEQJk.mjs"; import { a as InferredValue, i as InferredOutputValue, n as InferSchemaValue, r as InferredInputValue, t as InferFields } from "../inferValue-eAnh50EM.mjs"; import { SolidComponentResolver, SolidWidgetMap } from "./types.mjs"; import { JSX } from "solid-js"; //#region src/solid/SchemaComponent.d.ts /** * Provide a theme resolver and scoped widgets to every * `` rendered inside the subtree. * * Wrap an application (or a region of it) with `` so a * single resolver — typically a custom Solid `SolidComponentResolver` * — drives every schema render. Without a provider the headless * resolver is used. * * @group Components * @example * ```tsx * import { SchemaProvider, SchemaComponent } from "schema-components/solid/SchemaComponent"; * * * * * ``` */ declare function SchemaProvider(props: { resolver: SolidComponentResolver; widgets?: SolidWidgetMap; children: JSX.Element; }): JSX.Element; /** * Props accepted by {@link SchemaComponent}. * * Mirrors `react/SchemaComponent`'s `SchemaComponentProps` shape — the * generic parameters carry the inferred schema shape through to * `value`, `onChange`, and `fields` so a typed `schema` prop drives * typed props on the rest of the component. * * @group Components */ interface SchemaComponentProps { /** Zod schema, JSON Schema object, or OpenAPI document. */ schema: RejectUnrepresentableZod; /** For OpenAPI: a ref string like `"#/components/schemas/User"`. */ schemaRef?: SchemaRef; /** Which side of every transform / pipe / codec to render. */ io?: Mode; /** Current value to render — typed against the schema's inferred shape. */ value?: InferSchemaValue; /** Called when the value changes; receives the next value. */ onChange?: (value: InferSchemaValue) => void; /** Run `safeParse` / `safeEncode` on change and route errors. */ validate?: boolean; /** Called with the validation error when validation fails. */ onValidationError?: (error: unknown) => void; /** Called when schema normalisation or rendering fails. */ onError?: (error: SchemaError) => void; /** Called with each diagnostic emitted during schema processing. */ onDiagnostic?: (diagnostic: Diagnostic) => void; /** When true, any diagnostic becomes a thrown error. */ strict?: boolean; /** Per-field meta overrides — nested object mirroring schema shape. */ fields?: InferFields; /** Meta overrides applied to the root schema. */ meta?: SchemaMeta; /** Convenience: sets readOnly on all fields. */ readOnly?: boolean; /** Convenience: sets writeOnly on all fields. */ writeOnly?: boolean; /** Convenience: sets description on the root. */ description?: string; /** Instance-scoped widgets — override context and global widgets. */ widgets?: SolidWidgetMap; /** * Prefix used for every input `id` / label `for` in this component * subtree. Defaults to a per-instance value from `createUniqueId()` * so multiple `` instances on the same page never * collide. Override for deterministic ids in screenshot tests. */ idPrefix?: string; } /** * Append a child path suffix to a parent path. When the suffix is * omitted (e.g. transparent wrappers like union options) the parent * path is returned unchanged so the child inherits the parent's id. * * Bracketed array indices like `"[0]"` append directly so `tags` + * `"[0]"` becomes `tags[0]` rather than `tags.[0]` — matching the * canonical form used by every shared id helper in `core/idPath.ts`. */ declare function joinPath(parent: string, suffix: string | undefined): string; /** * Normalise a `createUniqueId()` value into a DOM-id-safe prefix. * Solid's `createUniqueId()` already returns a usable id, but consumers * may also pass a label-derived string. Replace any run of * non-alphanumeric characters with a single hyphen and trim leading * and trailing hyphens. */ declare function sanitisePrefix(value: string): string; /** * Render a single walked field through the resolved widget / resolver / * headless pipeline. Used internally by {@link SchemaComponent} and * exported so other Solid-side components (e.g. theme adapters) can * dispatch into the same fallback chain. */ declare function renderField(tree: WalkedField, value: unknown, onChange: (v: unknown) => void, userResolver: SolidComponentResolver | undefined, renderChild: (tree: WalkedField, value: unknown, onChange: (v: unknown) => void, pathSuffix?: string) => JSX.Element, path: string, instanceWidgets?: SolidWidgetMap, contextWidgets?: SolidWidgetMap, depth?: number): JSX.Element; /** * Render an editable (or read-only) UI from a Zod schema, JSON Schema, * or OpenAPI document. * * Auto-detects the input format, normalises to JSON Schema via the * shared adapter, walks the JSON Schema tree, and delegates per-field * rendering to the {@link SolidComponentResolver} supplied via * {@link SchemaProvider} — falling back to the headless renderer when * no provider is present. * * Pass `readOnly` to render a presentational view instead of inputs. * * @group Components * @example * ```tsx * import { z } from "zod"; * import { SchemaComponent } from "schema-components/solid/SchemaComponent"; * * const userSchema = z.object({ name: z.string(), email: z.email() }); * * * ``` */ declare function SchemaComponent(props: SchemaComponentProps): JSX.Element; //#endregion export { type InferFields, type InferredInputValue, type InferredOutputValue, type InferredValue, SchemaComponent, SchemaComponentProps, SchemaProvider, joinPath, renderField, sanitisePrefix };