UNPKG

@prismicio/types-internal

Version:
1,190 lines (1,189 loc) 472 kB
import * as t from "io-ts"; import { ContentPath, TraverseSliceContentFn, TraverseWidgetContentFn } from "../../../_internal/utils"; import { type StaticSlices } from "../../../customtypes"; import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx"; export declare const SlicesContentType = "SliceContentType"; export declare const isSlicesContent: (u: unknown) => u is { __TYPE__: "SliceContentType"; value: { key: string; name: string; maybeLabel: string | undefined; widget: { type: string; __TYPE__: "EmptyContent"; } | { __TYPE__: "BooleanContent"; value: boolean; } | ({ embed_url: string; type: string; } & { version?: string | number | null; title?: string | null | undefined; author_name?: string | null | undefined; author_url?: string | null | undefined; provider_name?: string | null | undefined; provider_url?: string | null | undefined; cache_age?: string | number | null; thumbnail_url?: string | null | undefined; thumbnail_width?: number | null | undefined; thumbnail_height?: number | null | undefined; html?: string | null | undefined; } & { __TYPE__: "EmbedContent"; all: unknown; }) | { type: "Color"; value: string; __TYPE__: "FieldContent"; } | { type: "Date"; value: string; __TYPE__: "FieldContent"; } | { type: "Number"; value: string; __TYPE__: "FieldContent"; } | { type: "Range"; value: string; __TYPE__: "FieldContent"; } | { type: "Select"; value: string; __TYPE__: "FieldContent"; } | { type: "Text"; value: string; __TYPE__: "FieldContent"; } | { type: "Timestamp"; value: string; __TYPE__: "FieldContent"; } | ({ position: { lat: number; lng: number; }; } & { __TYPE__: "GeoPointContent"; }) | ({ origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; } & { thumbnails?: { [x: string]: { origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; }; }; } & { __TYPE__: "ImageContent"; }) | { __TYPE__: "IntegrationFieldsContent"; value: string; } | ({ key: string; } & { __TYPE__: "LinkContent"; value: ({ __TYPE__: "ImageLink"; } & ((({ kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | { kind: "image"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "FileLink"; } & ((({ kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | { kind: "file"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "MediaLink"; } & { kind: "media"; } & { text?: string; variant?: string; }) | ({ __TYPE__: "DocumentLink"; } & (({ id: string; } | { kind: "document"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "ExternalLink"; } & ((({ url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | { kind: "web"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "AnyLink"; } & { kind: "any"; } & { text?: string; variant?: string; }); }) | { __TYPE__: "RepeatableContent"; type: "Link"; value: ({ key: string; } & { __TYPE__: "LinkContent"; value: ({ __TYPE__: "ImageLink"; } & ((({ kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | { kind: "image"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "FileLink"; } & ((({ kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | { kind: "file"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "MediaLink"; } & { kind: "media"; } & { text?: string; variant?: string; }) | ({ __TYPE__: "DocumentLink"; } & (({ id: string; } | { kind: "document"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "ExternalLink"; } & ((({ url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | { kind: "web"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "AnyLink"; } & { kind: "any"; } & { text?: string; variant?: string; }); })[]; } | import("..").GroupContent | { __TYPE__: "StructuredTextContent"; value: (({ type: "image"; data: { origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; } & { linkTo?: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | null | undefined; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "embed"; data: { embed_url: string; type: string; } & { version?: string | number | null; title?: string | null | undefined; author_name?: string | null | undefined; author_url?: string | null | undefined; provider_name?: string | null | undefined; provider_url?: string | null | undefined; cache_age?: string | number | null; thumbnail_url?: string | null | undefined; thumbnail_width?: number | null | undefined; thumbnail_height?: number | null | undefined; html?: string | null | undefined; } & { __TYPE__: "EmbedContent"; all: unknown; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"; content: { text: string; } & { spans?: ({ data: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }); start: number; end: number; type: "hyperlink"; } | { data: string; start: number; end: number; type: "label"; } | { start: number; end: number; type: "strong" | "em" | "list-item"; })[]; }; } & { label?: string; direction?: string; }))[]; } | { __TYPE__: "SeparatorContent"; } | { __TYPE__: "TableContent"; content: ({ key: string; } & { type: "tableRow"; content: ({ key: string; } & { type: "tableHeader" | "tableCell"; content: { __TYPE__: "StructuredTextContent"; value: (({ type: "image"; data: { origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; } & { linkTo?: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | null | undefined; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "embed"; data: { embed_url: string; type: string; } & { version?: string | number | null; title?: string | null | undefined; author_name?: string | null | undefined; author_url?: string | null | undefined; provider_name?: string | null | undefined; provider_url?: string | null | undefined; cache_age?: string | number | null; thumbnail_url?: string | null | undefined; thumbnail_width?: number | null | undefined; thumbnail_height?: number | null | undefined; html?: string | null | undefined; } & { __TYPE__: "EmbedContent"; all: unknown; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"; content: { text: string; } & { spans?: ({ data: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }); start: number; end: number; type: "hyperlink"; } | { data: string; start: number; end: number; type: "label"; } | { start: number; end: number; type: "strong" | "em" | "list-item"; })[]; }; } & { label?: string; direction?: string; }))[]; }; } & { columnWidth?: number; })[]; })[]; } | { __TYPE__: "CompositeSliceContent"; nonRepeat: { [x: string]: { type: string; __TYPE__: "EmptyContent"; } | { __TYPE__: "BooleanContent"; value: boolean; } | ({ embed_url: string; type: string; } & { version?: string | number | null; title?: string | null | undefined; author_name?: string | null | undefined; author_url?: string | null | undefined; provider_name?: string | null | undefined; provider_url?: string | null | undefined; cache_age?: string | number | null; thumbnail_url?: string | null | undefined; thumbnail_width?: number | null | undefined; thumbnail_height?: number | null | undefined; html?: string | null | undefined; } & { __TYPE__: "EmbedContent"; all: unknown; }) | { type: "Color"; value: string; __TYPE__: "FieldContent"; } | { type: "Date"; value: string; __TYPE__: "FieldContent"; } | { type: "Number"; value: string; __TYPE__: "FieldContent"; } | { type: "Range"; value: string; __TYPE__: "FieldContent"; } | { type: "Select"; value: string; __TYPE__: "FieldContent"; } | { type: "Text"; value: string; __TYPE__: "FieldContent"; } | { type: "Timestamp"; value: string; __TYPE__: "FieldContent"; } | ({ position: { lat: number; lng: number; }; } & { __TYPE__: "GeoPointContent"; }) | ({ origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; } & { thumbnails?: { [x: string]: { origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; }; }; } & { __TYPE__: "ImageContent"; }) | { __TYPE__: "IntegrationFieldsContent"; value: string; } | ({ key: string; } & { __TYPE__: "LinkContent"; value: ({ __TYPE__: "ImageLink"; } & ((({ kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | { kind: "image"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "FileLink"; } & ((({ kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | { kind: "file"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "MediaLink"; } & { kind: "media"; } & { text?: string; variant?: string; }) | ({ __TYPE__: "DocumentLink"; } & (({ id: string; } | { kind: "document"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "ExternalLink"; } & ((({ url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | { kind: "web"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "AnyLink"; } & { kind: "any"; } & { text?: string; variant?: string; }); }) | { __TYPE__: "RepeatableContent"; type: "Link"; value: ({ key: string; } & { __TYPE__: "LinkContent"; value: ({ __TYPE__: "ImageLink"; } & ((({ kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | { kind: "image"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "FileLink"; } & ((({ kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | { kind: "file"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "MediaLink"; } & { kind: "media"; } & { text?: string; variant?: string; }) | ({ __TYPE__: "DocumentLink"; } & (({ id: string; } | { kind: "document"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "ExternalLink"; } & ((({ url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | { kind: "web"; }) & { text?: string; variant?: string; })) | ({ __TYPE__: "AnyLink"; } & { kind: "any"; } & { text?: string; variant?: string; }); })[]; } | { __TYPE__: "StructuredTextContent"; value: (({ type: "image"; data: { origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; } & { linkTo?: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | null | undefined; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "embed"; data: { embed_url: string; type: string; } & { version?: string | number | null; title?: string | null | undefined; author_name?: string | null | undefined; author_url?: string | null | undefined; provider_name?: string | null | undefined; provider_url?: string | null | undefined; cache_age?: string | number | null; thumbnail_url?: string | null | undefined; thumbnail_width?: number | null | undefined; thumbnail_height?: number | null | undefined; html?: string | null | undefined; } & { __TYPE__: "EmbedContent"; all: unknown; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"; content: { text: string; } & { spans?: ({ data: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }); start: number; end: number; type: "hyperlink"; } | { data: string; start: number; end: number; type: "label"; } | { start: number; end: number; type: "strong" | "em" | "list-item"; })[]; }; } & { label?: string; direction?: string; }))[]; } | { __TYPE__: "SeparatorContent"; } | { __TYPE__: "TableContent"; content: ({ key: string; } & { type: "tableRow"; content: ({ key: string; } & { type: "tableHeader" | "tableCell"; content: { __TYPE__: "StructuredTextContent"; value: (({ type: "image"; data: { origin: { id: string; url: string; width: number; height: number; }; width: number; height: number; edit: { zoom: number; crop: { x: number; y: number; }; background: string; }; } & { url?: string; credits?: string | null; alt?: string | null; provider?: string | null | undefined; } & { linkTo?: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }) | null | undefined; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "embed"; data: { embed_url: string; type: string; } & { version?: string | number | null; title?: string | null | undefined; author_name?: string | null | undefined; author_url?: string | null | undefined; provider_name?: string | null | undefined; provider_url?: string | null | undefined; cache_age?: string | number | null; thumbnail_url?: string | null | undefined; thumbnail_width?: number | null | undefined; thumbnail_height?: number | null | undefined; html?: string | null | undefined; } & { __TYPE__: "EmbedContent"; all: unknown; }; } & { label?: string | null | undefined; direction?: string | null | undefined; }) | ({ type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"; content: { text: string; } & { spans?: ({ data: ({ __TYPE__: "ImageLink"; } & { kind: "image"; id: string; url: string; height: string; width: string; size: string; name: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "FileLink"; } & { kind: "file"; id: string; url: string; name: string; size: string; } & { date?: string | null | undefined; }) | ({ __TYPE__: "DocumentLink"; } & { id: string; }) | ({ __TYPE__: "ExternalLink"; } & { url: string; } & { kind?: "web"; target?: string | null | undefined; preview?: { title?: string; } | null | undefined; }); start: number; end: number; type: "hyperlink"; } | { data: string; start: number; end: number; type: "label"; } | { start: number; end: number; type: "strong" | "em" | "list-item"; })[]; }; } & { label?: string; direction?: string; }))[]; }; } & {