notion-block-renderer
Version:
Notion Block to React Components.
136 lines (135 loc) • 3.37 kB
TypeScript
export declare enum AnnotationEnum {
bold = "bold",
code = "code",
italic = "italic",
underline = "underline",
color = "color"
}
export declare type AnnotationType = {
bold: boolean;
code: boolean;
italic: boolean;
strikethrough: boolean;
underline: boolean;
color: string;
};
export declare type RichTextType = {
plain_text: string;
href: string | null;
annotations: AnnotationType;
type: string;
text: {
content: string;
link: {
url: string;
} | null;
};
};
export declare enum BlockEnum {
paragraph = "paragraph",
heading_1 = "heading_1",
heading_2 = "heading_2",
heading_3 = "heading_3",
callout = "callout",
quote = "quote",
bulleted_list_item = "bulleted_list_item",
numbered_list_item = "numbered_list_item",
code = "code",
image = "image",
video = "video"
}
export declare enum BlockListEnum {
bulleted_list_item = "bulleted_list_item",
numbered_list_item = "numbered_list_item"
}
declare type TextBlockType = {
color: string;
rich_text: RichTextType[];
};
declare type CodeBlockType = {
rich_text: RichTextType[];
caption: RichTextType[];
language: string;
};
export declare type FileBlockType = {
caption: RichTextType[];
external: {
url: string;
};
file: {
expiry_time?: string;
url: string;
};
type: string;
};
declare type CalloutBlockType = {
color: string;
icon: {
emoji: string;
};
rich_text: RichTextType[];
};
export declare type BlockTypeName = "paragraph" | "heading_1" | "heading_2" | "heading_3" | "code" | "image" | "video" | "callout" | "quote" | "bulleted_list_item" | "numbered_list_item";
declare type BaseBlock = {
id: string;
object: string;
parent: any;
created_time: any;
last_edited_time: any;
created_by: any;
last_edited_by: any;
has_children: boolean;
archived: boolean;
};
declare type Paragraph = BaseBlock & {
type: "paragraph";
paragraph: TextBlockType;
};
export declare type Heading1 = BaseBlock & {
type: "heading_1";
heading_1: TextBlockType;
};
export declare type Heading2 = BaseBlock & {
type: "heading_2";
heading_2: TextBlockType;
};
export declare type Heading3 = BaseBlock & {
type: "heading_3";
heading_3: TextBlockType;
};
declare type TableOfContents = BaseBlock & {
type: "table_of_contents";
table_of_contents: {
color: string;
};
};
declare type Code = BaseBlock & {
type: "code";
code: CodeBlockType;
};
declare type Image = BaseBlock & {
type: "image";
image: FileBlockType;
};
declare type Video = BaseBlock & {
type: "video";
video: FileBlockType;
};
declare type Callout = BaseBlock & {
type: "callout";
callout: CalloutBlockType;
};
declare type Quote = BaseBlock & {
type: "quote";
quote: TextBlockType;
};
declare type BulletedListItem = BaseBlock & {
type: "bulleted_list_item";
bulleted_list_item: TextBlockType;
};
declare type NumberedListItem = BaseBlock & {
type: "numbered_list_item";
numbered_list_item: TextBlockType;
};
export declare type BlockType = Paragraph | Heading1 | Heading2 | Heading3 | TableOfContents | Code | Image | Video | Callout | Quote | BulletedListItem | NumberedListItem;
export {};