notion-to-jsx 1.2.9 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,14 @@
1
- import React from 'react';
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+
4
+ interface OpenGraphData {
5
+ title: string;
6
+ description: string;
7
+ image: string;
8
+ siteName: string;
9
+ url: string;
10
+ favicon?: string;
11
+ }
2
12
 
3
13
  interface RichTextItem {
4
14
  type: 'text' | 'mention' | string;
@@ -26,40 +36,61 @@ interface RichTextItem {
26
36
  };
27
37
  }
28
38
 
29
- interface NotionBlock {
39
+ interface BaseNotionBlock {
30
40
  object: 'block';
31
41
  id: string;
32
- type: 'paragraph' | 'heading_1' | 'heading_2' | 'heading_3' | 'bulleted_list_item' | 'numbered_list_item' | 'code' | 'image' | 'bookmark' | 'table' | 'table_row' | 'quote' | 'toggle';
33
- paragraph?: {
34
- rich_text: RichTextItem[];
35
- color: string;
42
+ children?: NotionBlock[];
43
+ has_children?: boolean;
44
+ parent?: {
45
+ type: string;
46
+ [key: string]: any;
36
47
  };
37
- heading_1?: {
38
- rich_text: RichTextItem[];
39
- color: string;
48
+ }
49
+ interface LinkPreviewBlock extends BaseNotionBlock {
50
+ type: 'link_preview';
51
+ link_preview: {
52
+ url: string;
40
53
  };
41
- heading_2?: {
54
+ }
55
+ interface ParagraphBlock extends BaseNotionBlock {
56
+ type: 'paragraph';
57
+ paragraph: {
42
58
  rich_text: RichTextItem[];
43
59
  color: string;
44
60
  };
45
- heading_3?: {
61
+ }
62
+ interface Heading1Block extends BaseNotionBlock {
63
+ type: 'heading_1';
64
+ heading_1: {
46
65
  rich_text: RichTextItem[];
47
66
  color: string;
48
67
  };
49
- bulleted_list_item?: {
68
+ }
69
+ interface Heading2Block extends BaseNotionBlock {
70
+ type: 'heading_2';
71
+ heading_2: {
50
72
  rich_text: RichTextItem[];
51
73
  color: string;
52
74
  };
53
- numbered_list_item?: {
75
+ }
76
+ interface Heading3Block extends BaseNotionBlock {
77
+ type: 'heading_3';
78
+ heading_3: {
54
79
  rich_text: RichTextItem[];
55
80
  color: string;
56
81
  };
57
- code?: {
82
+ }
83
+ interface CodeBlock extends BaseNotionBlock {
84
+ type: 'code';
85
+ code: {
58
86
  rich_text: RichTextItem[];
59
87
  language: string;
60
88
  caption: RichTextItem[];
61
89
  };
62
- image?: {
90
+ }
91
+ interface ImageBlock extends BaseNotionBlock {
92
+ type: 'image';
93
+ image: {
63
94
  type: 'file' | 'external';
64
95
  file?: {
65
96
  url: string;
@@ -69,42 +100,89 @@ interface NotionBlock {
69
100
  url: string;
70
101
  };
71
102
  caption: RichTextItem[];
103
+ format: {
104
+ block_width: number;
105
+ block_height: number;
106
+ block_aspect_ratio: number;
107
+ };
72
108
  };
73
- bookmark?: {
109
+ }
110
+ interface BookmarkBlock extends BaseNotionBlock {
111
+ type: 'bookmark';
112
+ bookmark: {
74
113
  url: string;
75
114
  caption: RichTextItem[];
115
+ metadata?: OpenGraphData;
76
116
  };
77
- table?: {
117
+ }
118
+ interface TableBlock extends BaseNotionBlock {
119
+ type: 'table';
120
+ table: {
78
121
  table_width: number;
79
122
  has_column_header: boolean;
80
123
  has_row_header: boolean;
81
124
  };
82
- table_row?: {
125
+ children?: TableRowBlock[];
126
+ }
127
+ interface TableRowBlock extends BaseNotionBlock {
128
+ type: 'table_row';
129
+ table_row: {
83
130
  cells: RichTextItem[][];
84
131
  };
85
- quote?: {
132
+ }
133
+ interface QuoteBlock extends BaseNotionBlock {
134
+ type: 'quote';
135
+ quote: {
86
136
  rich_text: RichTextItem[];
87
137
  color: string;
88
138
  };
89
- toggle?: {
139
+ }
140
+ interface ToggleBlock extends BaseNotionBlock {
141
+ type: 'toggle';
142
+ toggle: {
90
143
  rich_text: RichTextItem[];
91
144
  color: string;
92
145
  };
93
- children?: NotionBlock[];
94
- has_children?: boolean;
95
- parent?: {
96
- type: string;
97
- [key: string]: any;
146
+ }
147
+ interface BulletedListItemBlock extends BaseNotionBlock {
148
+ type: 'bulleted_list_item';
149
+ bulleted_list_item: {
150
+ rich_text: RichTextItem[];
151
+ color: string;
152
+ };
153
+ }
154
+ interface NumberedListItemBlock extends BaseNotionBlock {
155
+ type: 'numbered_list_item';
156
+ numbered_list_item: {
157
+ rich_text: RichTextItem[];
158
+ color: string;
159
+ };
160
+ }
161
+ interface ColumnListBlock extends BaseNotionBlock {
162
+ type: 'column_list';
163
+ children?: ColumnBlock[];
164
+ }
165
+ interface ColumnBlock extends BaseNotionBlock {
166
+ type: 'column';
167
+ }
168
+ interface VideoBlock extends BaseNotionBlock {
169
+ type: 'video';
170
+ video: {
171
+ caption: RichTextItem[];
172
+ type: 'external' | 'file';
173
+ external?: {
174
+ url: string;
175
+ };
98
176
  };
99
177
  }
178
+ type NotionBlock = LinkPreviewBlock | ParagraphBlock | Heading1Block | Heading2Block | Heading3Block | CodeBlock | ImageBlock | BookmarkBlock | TableBlock | TableRowBlock | QuoteBlock | ToggleBlock | BulletedListItemBlock | NumberedListItemBlock | ColumnListBlock | ColumnBlock | VideoBlock;
100
179
 
101
180
  interface Props {
102
181
  blocks: NotionBlock[];
103
182
  title?: string;
104
183
  cover?: string;
105
184
  isDarkMode?: boolean;
106
- onBlockFocus?: (index: number) => void;
107
185
  }
108
- declare const Renderer: React.FC<Props>;
186
+ declare const Renderer: react.MemoExoticComponent<({ blocks, isDarkMode, title, cover }: Props) => react_jsx_runtime.JSX.Element>;
109
187
 
110
- export { type NotionBlock, Renderer };
188
+ export { type BulletedListItemBlock, type ColumnBlock, type ColumnListBlock, type NotionBlock, type NumberedListItemBlock, Renderer, type TableBlock, type TableRowBlock, type ToggleBlock, type VideoBlock };