import { z } from 'zod'; import { type ParseResult } from '../../lib/zod'; import { type CopyContext } from '../../context'; import { IntrospectionTarget } from '../../introspection'; import { type ResourceResolver } from '../../resources/resolver'; import { type DeserializedRecord } from '../../serialization'; import { ControlDefinition, type Resolvable, type SchemaType } from '../definition'; import { DefaultControlInstance, type ControlInstanceArgs } from '../instance'; import { ControlDefinitionVisitor } from '../visitor'; type Config = z.infer; type DefaultConfig = Config & { format: typeof Definition.Format.WithDimensions | typeof Definition.Format.URL; }; type BaseSchema = typeof Definition.schema; type SchemaByFormat = undefined extends F ? BaseSchema['url'] : typeof Definition.Format.WithDimensions | typeof Definition.Format.URL extends F ? BaseSchema['withDimensions'] | BaseSchema['url'] : F extends typeof Definition.Format.WithDimensions ? BaseSchema['withDimensions'] : F extends typeof Definition.Format.URL ? BaseSchema['url'] : never; type Schema = SchemaByFormat; type DataType = z.infer['data']>; type ValueType = z.infer['value']>; type ResolvedValueType = z.infer['resolvedValue']>; type ReturnedSchemaType = { definition: typeof Definition.schema.definition; type: typeof Definition.schema.type; data: SchemaType>; value: SchemaType>; resolvedValue: SchemaType>; }; declare class Definition extends ControlDefinition, ValueType, ResolvedValueType> { readonly version: z.infer; private static readonly dataSignature; static readonly type: "makeswift::controls::image"; static readonly Format: { readonly URL: "makeswift::controls::image::format::url"; readonly WithDimensions: "makeswift::controls::image::format::with-dimensions"; }; static get schema(): { type: z.ZodLiteral<"makeswift::controls::image">; version: z.ZodOptional>; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; format: z.ZodOptional, z.ZodLiteral<"makeswift::controls::image::format::with-dimensions">]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }>; definition: z.ZodObject<{ type: z.ZodLiteral<"makeswift::controls::image">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; format: z.ZodOptional, z.ZodLiteral<"makeswift::controls::image::format::with-dimensions">]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }>; version: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "makeswift::controls::image"; config: { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }; version?: 1 | undefined; }, { type: "makeswift::controls::image"; config: { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }; version?: 1 | undefined; }>; url: { type: z.ZodLiteral<"makeswift::controls::image">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; format: z.ZodOptional, z.ZodLiteral<"makeswift::controls::image::format::with-dimensions">]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }>; definition: z.ZodObject<{ type: z.ZodLiteral<"makeswift::controls::image">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; format: z.ZodOptional, z.ZodLiteral<"makeswift::controls::image::format::with-dimensions">]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }>; version: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "makeswift::controls::image"; config: { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }; version?: 1 | undefined; }, { type: "makeswift::controls::image"; config: { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }; version?: 1 | undefined; }>; data: z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"makeswift-file">; id: z.ZodString; version: z.ZodLiteral<1>; }, "strip", z.ZodTypeAny, { type: "makeswift-file"; id: string; version: 1; }, { type: "makeswift-file"; id: string; version: 1; }>, z.ZodObject<{ type: z.ZodLiteral<"external-file">; width: z.ZodOptional>; height: z.ZodOptional>; url: z.ZodString; version: z.ZodLiteral<1>; }, "strip", z.ZodTypeAny, { type: "external-file"; version: 1; url: string; width?: number | null | undefined; height?: number | null | undefined; }, { type: "external-file"; version: 1; url: string; width?: number | null | undefined; height?: number | null | undefined; }>]>]>; value: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"makeswift-file">; id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "makeswift-file"; id: string; }, { type: "makeswift-file"; id: string; }>, z.ZodObject<{ type: z.ZodLiteral<"external-file">; url: z.ZodString; width: z.ZodOptional>; height: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "external-file"; url: string; width?: number | null | undefined; height?: number | null | undefined; }, { type: "external-file"; url: string; width?: number | null | undefined; height?: number | null | undefined; }>]>; resolvedValue: SchemaType; version: z.ZodOptional>; }; withDimensions: { type: z.ZodLiteral<"makeswift::controls::image">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; format: z.ZodOptional, z.ZodLiteral<"makeswift::controls::image::format::with-dimensions">]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }>; definition: z.ZodObject<{ type: z.ZodLiteral<"makeswift::controls::image">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; format: z.ZodOptional, z.ZodLiteral<"makeswift::controls::image::format::with-dimensions">]>>; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }, { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }>; version: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "makeswift::controls::image"; config: { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }; version?: 1 | undefined; }, { type: "makeswift::controls::image"; config: { label?: string | undefined; description?: string | undefined; format?: "makeswift::controls::image::format::url" | "makeswift::controls::image::format::with-dimensions" | undefined; }; version?: 1 | undefined; }>; data: z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"makeswift-file">; id: z.ZodString; version: z.ZodLiteral<1>; }, "strip", z.ZodTypeAny, { type: "makeswift-file"; id: string; version: 1; }, { type: "makeswift-file"; id: string; version: 1; }>, z.ZodObject<{ type: z.ZodLiteral<"external-file">; width: z.ZodOptional>; height: z.ZodOptional>; url: z.ZodString; version: z.ZodLiteral<1>; }, "strip", z.ZodTypeAny, { type: "external-file"; version: 1; url: string; width?: number | null | undefined; height?: number | null | undefined; }, { type: "external-file"; version: 1; url: string; width?: number | null | undefined; height?: number | null | undefined; }>]>]>; value: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"makeswift-file">; id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "makeswift-file"; id: string; }, { type: "makeswift-file"; id: string; }>, z.ZodObject<{ type: z.ZodLiteral<"external-file">; url: z.ZodString; width: z.ZodOptional>; height: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "external-file"; url: string; width?: number | null | undefined; height?: number | null | undefined; }, { type: "external-file"; url: string; width?: number | null | undefined; height?: number | null | undefined; }>]>; resolvedValue: SchemaType<{ dimensions: { width: number; height: number; }; url: string; } | undefined>; version: z.ZodOptional>; }; }; static deserialize(data: DeserializedRecord): ImageDefinition; constructor(config: C, version: z.infer); get controlType(): "makeswift::controls::image"; get schema(): ReturnedSchemaType; get refinedSchema(): SchemaByFormat; get dataSchema(): z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"makeswift-file">; id: z.ZodString; version: z.ZodLiteral<1>; }, "strip", z.ZodTypeAny, { type: "makeswift-file"; id: string; version: 1; }, { type: "makeswift-file"; id: string; version: 1; }>, z.ZodObject<{ type: z.ZodLiteral<"external-file">; width: z.ZodOptional>; height: z.ZodOptional>; url: z.ZodString; version: z.ZodLiteral<1>; }, "strip", z.ZodTypeAny, { type: "external-file"; version: 1; url: string; width?: number | null | undefined; height?: number | null | undefined; }, { type: "external-file"; version: 1; url: string; width?: number | null | undefined; height?: number | null | undefined; }>]>]>; safeParse(data: unknown | undefined): ParseResult | undefined>; fromData(data: DataType | undefined): ValueType | undefined; toData(value: ValueType): DataType; copyData(data: DataType | undefined, ctx: CopyContext): DataType | undefined; resolveValue(data: DataType | undefined, resolver: ResourceResolver): Resolvable | undefined>; resolveImage({ url, width, height, }: { url: string; width?: number | null; height?: number | null; }): ResolvedValueType; createInstance(args: ControlInstanceArgs): DefaultControlInstance; accept(visitor: ControlDefinitionVisitor, ...args: unknown[]): R; introspect(data: DataType | undefined, target: IntrospectionTarget): R[]; } export { type Config as ImageConfig }; export declare class ImageDefinition extends Definition { } type UserConfig = Config & { format?: F; }; type NormedConfig = undefined extends F ? Config : { label?: string | undefined; description?: string; format: F; }; export declare function Image(config?: UserConfig): ImageDefinition>; export declare namespace Image { var Format: { readonly URL: "makeswift::controls::image::format::url"; readonly WithDimensions: "makeswift::controls::image::format::with-dimensions"; }; } //# sourceMappingURL=image.d.ts.map