UNPKG

@prismicio/types-internal

Version:
1,085 lines (1,084 loc) 189 kB
import { Either } from "fp-ts/lib/Either"; import * as t from "io-ts"; import type { OnFieldFn } from "../_internal/utils"; import type { Group, NestableWidget, NestedGroup, UID } from "./widgets"; import type { SharedSlice } from "./widgets/slices/SharedSlice"; import type { DynamicWidget } from "./widgets/Widget"; import type { StaticWidget } from "./widgets/Widget"; export declare const CustomTypeFormat: { page: string; custom: string; }; declare class CustomTypeSlicesError extends Error { slices: Array<string>; message: string; constructor(slices: Array<string>); _formatError(slicesRefs: Array<string>): string; } export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{ id: t.StringC; label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; repeatable: t.BooleanC; json: t.RecordC<t.StringC, t.Type<{ [x: string]: ({ type: "Boolean"; } & { config?: { label?: string | null | undefined; default_value?: boolean; placeholder_true?: string; placeholder_false?: string; }; }) | ({ type: "Color"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; }; }) | ({ type: "Date"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Embed"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; }; }) | ({ type: "GeoPoint"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; }; }) | ({ type: "Image"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; constraint?: { width?: number | null; height?: number | null; }; thumbnails?: readonly ({ name: string; } & { width?: number | null; height?: number | null; })[]; }; }) | ({ type: "IntegrationFields"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; catalog?: string; }; }) | ({ type: "Link"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; select?: "media" | "document" | "web" | null; customtypes?: readonly (string | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; } | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; })[]; })[]; })[]; masks?: readonly string[]; tags?: readonly string[]; allowTargetBlank?: boolean; allowText?: boolean; repeat?: boolean; variants?: string[]; }; }) | ({ type: "Number"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "Range"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "StructuredText"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; single?: string; multi?: string; imageConstraint?: { width?: number | null; height?: number | null; }; labels?: readonly string[]; allowTargetBlank?: boolean; }; }) | ({ type: "Select"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default_value?: string; options?: readonly string[]; }; }) | ({ type: "Separator"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Table"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Text"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; }; }) | ({ type: "Timestamp"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Group"; } & { fieldset?: string | null | undefined; icon?: string; description?: string; config?: { label?: string | null | undefined; repeat?: boolean; fields?: { [x: string]: ({ type: "Boolean"; } & { config?: { label?: string | null | undefined; default_value?: boolean; placeholder_true?: string; placeholder_false?: string; }; }) | ({ type: "Color"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; }; }) | ({ type: "Date"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Embed"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; }; }) | ({ type: "GeoPoint"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; }; }) | ({ type: "Image"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; constraint?: { width?: number | null; height?: number | null; }; thumbnails?: readonly ({ name: string; } & { width?: number | null; height?: number | null; })[]; }; }) | ({ type: "IntegrationFields"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; catalog?: string; }; }) | ({ type: "Link"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; select?: "media" | "document" | "web" | null; customtypes?: readonly (string | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; } | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; })[]; })[]; })[]; masks?: readonly string[]; tags?: readonly string[]; allowTargetBlank?: boolean; allowText?: boolean; repeat?: boolean; variants?: string[]; }; }) | ({ type: "Number"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "Range"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "StructuredText"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; single?: string; multi?: string; imageConstraint?: { width?: number | null; height?: number | null; }; labels?: readonly string[]; allowTargetBlank?: boolean; }; }) | ({ type: "Select"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default_value?: string; options?: readonly string[]; }; }) | ({ type: "Separator"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Table"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Text"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; }; }) | ({ type: "Timestamp"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Group"; } & { fieldset?: string | null | undefined; icon?: string; description?: string; config?: { label?: string | null | undefined; repeat?: boolean; fields?: { [x: string]: ({ type: "Boolean"; } & { config?: { label?: string | null | undefined; default_value?: boolean; placeholder_true?: string; placeholder_false?: string; }; }) | ({ type: "Color"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; }; }) | ({ type: "Date"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Embed"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; }; }) | ({ type: "GeoPoint"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; }; }) | ({ type: "Image"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; constraint?: { width?: number | null; height?: number | null; }; thumbnails?: readonly ({ name: string; } & { width?: number | null; height?: number | null; })[]; }; }) | ({ type: "IntegrationFields"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; catalog?: string; }; }) | ({ type: "Link"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; select?: "media" | "document" | "web" | null; customtypes?: readonly (string | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; } | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; })[]; })[]; })[]; masks?: readonly string[]; tags?: readonly string[]; allowTargetBlank?: boolean; allowText?: boolean; repeat?: boolean; variants?: string[]; }; }) | ({ type: "Number"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "Range"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "StructuredText"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; single?: string; multi?: string; imageConstraint?: { width?: number | null; height?: number | null; }; labels?: readonly string[]; allowTargetBlank?: boolean; }; }) | ({ type: "Select"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default_value?: string; options?: readonly string[]; }; }) | ({ type: "Separator"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Table"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Text"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; }; }) | ({ type: "Timestamp"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }); }; }; }); }; }; }) | ({ type: "UID"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; }; }) | ({ type: "Choice" | "Slices"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; labels?: { [x: string]: readonly ({ name: string; } & { display?: string; })[]; } | null; choices?: { [x: string]: ({ type: "Boolean"; } & { config?: { label?: string | null | undefined; default_value?: boolean; placeholder_true?: string; placeholder_false?: string; }; }) | ({ type: "Color"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; }; }) | ({ type: "Date"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Embed"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; }; }) | ({ type: "GeoPoint"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; }; }) | ({ type: "Image"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; constraint?: { width?: number | null; height?: number | null; }; thumbnails?: readonly ({ name: string; } & { width?: number | null; height?: number | null; })[]; }; }) | ({ type: "IntegrationFields"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; catalog?: string; }; }) | ({ type: "Link"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; select?: "media" | "document" | "web" | null; customtypes?: readonly (string | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; } | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; })[]; })[]; })[]; masks?: readonly string[]; tags?: readonly string[]; allowTargetBlank?: boolean; allowText?: boolean; repeat?: boolean; variants?: string[]; }; }) | ({ type: "Number"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "Range"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "StructuredText"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; single?: string; multi?: string; imageConstraint?: { width?: number | null; height?: number | null; }; labels?: readonly string[]; allowTargetBlank?: boolean; }; }) | ({ type: "Select"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default_value?: string; options?: readonly string[]; }; }) | ({ type: "Separator"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Table"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Text"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; }; }) | ({ type: "Timestamp"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Group"; } & { fieldset?: string | null | undefined; icon?: string; description?: string; config?: { label?: string | null | undefined; repeat?: boolean; fields?: { [x: string]: ({ type: "Boolean"; } & { config?: { label?: string | null | undefined; default_value?: boolean; placeholder_true?: string; placeholder_false?: string; }; }) | ({ type: "Color"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; }; }) | ({ type: "Date"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Embed"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; }; }) | ({ type: "GeoPoint"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; }; }) | ({ type: "Image"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; constraint?: { width?: number | null; height?: number | null; }; thumbnails?: readonly ({ name: string; } & { width?: number | null; height?: number | null; })[]; }; }) | ({ type: "IntegrationFields"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; catalog?: string; }; }) | ({ type: "Link"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; select?: "media" | "document" | "web" | null; customtypes?: readonly (string | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; } | { id: string; fields: readonly (string | { id: string; customtypes: readonly (string | { id: string; fields: readonly (string | { id: string; fields: readonly string[]; })[]; })[]; })[]; })[]; })[]; masks?: readonly string[]; tags?: readonly string[]; allowTargetBlank?: boolean; allowText?: boolean; repeat?: boolean; variants?: string[]; }; }) | ({ type: "Number"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "Range"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; min?: number; max?: number; step?: number; }; }) | ({ type: "StructuredText"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; single?: string; multi?: string; imageConstraint?: { width?: number | null; height?: number | null; }; labels?: readonly string[]; allowTargetBlank?: boolean; }; }) | ({ type: "Select"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default_value?: string; options?: readonly string[]; }; }) | ({ type: "Separator"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Table"; } & { config?: { label?: string | null | undefined; }; }) | ({ type: "Text"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; useAsTitle?: boolean; placeholder?: string; }; }) | ({ type: "Timestamp"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }); }; }; }) | ({ type: "Slice"; } & { fieldset?: string | null | undefined; description?: string; icon?: string; display?: string; "non-repeat"?: { [x: string]: ({ type: "Boolean"; } & { config?: { label?: string | null | undefined; default_value?: boolean; placeholder_true?: string; placeholder_false?: string; }; }) | ({ type: "Color"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; }; }) | ({ type: "Date"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; default?: string; }; }) | ({ type: "Embed"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; placeholder?: string; useAsTitle?: boolean; }; }) | ({ type: "GeoPoint"; } & { fieldset?: string | null | undefined; config?: { label?: string | null | undefined; }; }) | ({ type: "Image"; } & { fieldset?: string | null | undefined; config?: {