import { RTAnyNode, RTEmNode, RTEmbedNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTImageNode, RTLabelNode, RTLinkNode, RTListItemNode, RTListNode, RTOListItemNode, RTOListNode, RTParagraphNode, RTPreformattedNode, RTSpanNode, RTStrongNode, RichTextNodeTypes } from "../types/value/richText.js"; //#region src/richtext/types.d.ts /** * Serializes a node from a rich text or title field with a function * * @typeParam ReturnType - Return type of the function serializer. * @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text} */ type RichTextFunctionSerializer = (type: RichTextNodeTypes, node: RTAnyNode, text: string | undefined, children: ReturnType[], key: string) => ReturnType | null | undefined; /** * Map serializer's tag function serializer, can be helpful for typing those handlers * * @typeParam ReturnType - Return type of the tag serializer */ type RichTextMapSerializerFunction = (payload: { type: Node["type"]; node: Node; text: TextType; children: ReturnType[]; key: string; }) => ReturnType | null | undefined; /** * Serializes a node from a rich text field with a map. * * @remarks * This type of serializer needs to be processed through {@link wrapMapSerializer} before being * used with {@link serialize}. * @typeParam ReturnType - Return type of the map serializer. * @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text} */ type RichTextMapSerializer = { heading1?: RichTextMapSerializerFunction; heading2?: RichTextMapSerializerFunction; heading3?: RichTextMapSerializerFunction; heading4?: RichTextMapSerializerFunction; heading5?: RichTextMapSerializerFunction; heading6?: RichTextMapSerializerFunction; paragraph?: RichTextMapSerializerFunction; preformatted?: RichTextMapSerializerFunction; strong?: RichTextMapSerializerFunction; em?: RichTextMapSerializerFunction; listItem?: RichTextMapSerializerFunction; oListItem?: RichTextMapSerializerFunction; list?: RichTextMapSerializerFunction; oList?: RichTextMapSerializerFunction; image?: RichTextMapSerializerFunction; embed?: RichTextMapSerializerFunction; hyperlink?: RichTextMapSerializerFunction; label?: RichTextMapSerializerFunction; span?: RichTextMapSerializerFunction; }; interface Tree { key: string; children: TreeNode[]; } interface TreeNode { key: string; type: RichTextNodeTypes; text?: string; node: RTAnyNode; children: TreeNode[]; } //#endregion export { RichTextFunctionSerializer, RichTextMapSerializer, RichTextMapSerializerFunction, Tree }; //# sourceMappingURL=types.d.ts.map