A React component library for rendering common AT Protocol records for applications such as Bluesky and Leaflet.
1export interface StrongRef {
2 uri: string;
3 cid: string;
4}
5
6export interface LeafletDocumentRecord {
7 $type?: "pub.leaflet.document";
8 title: string;
9 postRef?: StrongRef;
10 description?: string;
11 publishedAt?: string;
12 publication: string;
13 author: string;
14 pages: LeafletDocumentPage[];
15}
16
17export type LeafletDocumentPage = LeafletLinearDocumentPage;
18
19export interface LeafletLinearDocumentPage {
20 $type?: "pub.leaflet.pages.linearDocument";
21 blocks?: LeafletLinearDocumentBlock[];
22}
23
24export type LeafletAlignmentValue =
25 | "#textAlignLeft"
26 | "#textAlignCenter"
27 | "#textAlignRight"
28 | "#textAlignJustify"
29 | "textAlignLeft"
30 | "textAlignCenter"
31 | "textAlignRight"
32 | "textAlignJustify";
33
34export interface LeafletLinearDocumentBlock {
35 block: LeafletBlock;
36 alignment?: LeafletAlignmentValue;
37}
38
39export type LeafletBlock =
40 | LeafletTextBlock
41 | LeafletHeaderBlock
42 | LeafletBlockquoteBlock
43 | LeafletImageBlock
44 | LeafletUnorderedListBlock
45 | LeafletWebsiteBlock
46 | LeafletIFrameBlock
47 | LeafletMathBlock
48 | LeafletCodeBlock
49 | LeafletHorizontalRuleBlock
50 | LeafletBskyPostBlock;
51
52export interface LeafletBaseTextBlock {
53 plaintext: string;
54 facets?: LeafletRichTextFacet[];
55}
56
57export interface LeafletTextBlock extends LeafletBaseTextBlock {
58 $type?: "pub.leaflet.blocks.text";
59}
60
61export interface LeafletHeaderBlock extends LeafletBaseTextBlock {
62 $type?: "pub.leaflet.blocks.header";
63 level?: number;
64}
65
66export interface LeafletBlockquoteBlock extends LeafletBaseTextBlock {
67 $type?: "pub.leaflet.blocks.blockquote";
68}
69
70export interface LeafletImageBlock {
71 $type?: "pub.leaflet.blocks.image";
72 image: LeafletBlobRef;
73 alt?: string;
74 aspectRatio: {
75 width: number;
76 height: number;
77 };
78}
79
80export interface LeafletUnorderedListBlock {
81 $type?: "pub.leaflet.blocks.unorderedList";
82 children: LeafletListItem[];
83}
84
85export interface LeafletListItem {
86 content: LeafletListContent;
87 children?: LeafletListItem[];
88}
89
90export type LeafletListContent = LeafletTextBlock | LeafletHeaderBlock | LeafletImageBlock;
91
92export interface LeafletWebsiteBlock {
93 $type?: "pub.leaflet.blocks.website";
94 src: string;
95 title?: string;
96 description?: string;
97 previewImage?: LeafletBlobRef;
98}
99
100export interface LeafletIFrameBlock {
101 $type?: "pub.leaflet.blocks.iframe";
102 url: string;
103 height?: number;
104}
105
106export interface LeafletMathBlock {
107 $type?: "pub.leaflet.blocks.math";
108 tex: string;
109}
110
111export interface LeafletCodeBlock {
112 $type?: "pub.leaflet.blocks.code";
113 plaintext: string;
114 language?: string;
115 syntaxHighlightingTheme?: string;
116}
117
118export interface LeafletHorizontalRuleBlock {
119 $type?: "pub.leaflet.blocks.horizontalRule";
120}
121
122export interface LeafletBskyPostBlock {
123 $type?: "pub.leaflet.blocks.bskyPost";
124 postRef: StrongRef;
125}
126
127export interface LeafletRichTextFacet {
128 index: LeafletByteSlice;
129 features: LeafletRichTextFeature[];
130}
131
132export interface LeafletByteSlice {
133 byteStart: number;
134 byteEnd: number;
135}
136
137export type LeafletRichTextFeature =
138 | LeafletRichTextLinkFeature
139 | LeafletRichTextCodeFeature
140 | LeafletRichTextHighlightFeature
141 | LeafletRichTextUnderlineFeature
142 | LeafletRichTextStrikethroughFeature
143 | LeafletRichTextIdFeature
144 | LeafletRichTextBoldFeature
145 | LeafletRichTextItalicFeature;
146
147export interface LeafletRichTextLinkFeature {
148 $type: "pub.leaflet.richtext.facet#link";
149 uri: string;
150}
151
152export interface LeafletRichTextCodeFeature {
153 $type: "pub.leaflet.richtext.facet#code";
154}
155
156export interface LeafletRichTextHighlightFeature {
157 $type: "pub.leaflet.richtext.facet#highlight";
158}
159
160export interface LeafletRichTextUnderlineFeature {
161 $type: "pub.leaflet.richtext.facet#underline";
162}
163
164export interface LeafletRichTextStrikethroughFeature {
165 $type: "pub.leaflet.richtext.facet#strikethrough";
166}
167
168export interface LeafletRichTextIdFeature {
169 $type: "pub.leaflet.richtext.facet#id";
170 id?: string;
171}
172
173export interface LeafletRichTextBoldFeature {
174 $type: "pub.leaflet.richtext.facet#bold";
175}
176
177export interface LeafletRichTextItalicFeature {
178 $type: "pub.leaflet.richtext.facet#italic";
179}
180
181export interface LeafletBlobRef {
182 $type?: string;
183 ref?: {
184 $link?: string;
185 };
186 cid?: string;
187 mimeType?: string;
188 size?: number;
189}
190
191export interface LeafletPublicationRecord {
192 $type?: "pub.leaflet.publication";
193 name: string;
194 base_path?: string;
195 description?: string;
196 icon?: LeafletBlobRef;
197 theme?: LeafletTheme;
198 preferences?: LeafletPublicationPreferences;
199}
200
201export interface LeafletPublicationPreferences {
202 showInDiscover?: boolean;
203 showComments?: boolean;
204}
205
206export interface LeafletTheme {
207 backgroundColor?: LeafletThemeColor;
208 backgroundImage?: LeafletThemeBackgroundImage;
209 primary?: LeafletThemeColor;
210 pageBackground?: LeafletThemeColor;
211 showPageBackground?: boolean;
212 accentBackground?: LeafletThemeColor;
213 accentText?: LeafletThemeColor;
214}
215
216export type LeafletThemeColor = LeafletThemeColorRgb | LeafletThemeColorRgba;
217
218export interface LeafletThemeColorRgb {
219 $type?: "pub.leaflet.theme.color#rgb";
220 r: number;
221 g: number;
222 b: number;
223}
224
225export interface LeafletThemeColorRgba {
226 $type?: "pub.leaflet.theme.color#rgba";
227 r: number;
228 g: number;
229 b: number;
230 a: number;
231}
232
233export interface LeafletThemeBackgroundImage {
234 $type?: "pub.leaflet.theme.backgroundImage";
235 image: LeafletBlobRef;
236 width?: number;
237 repeat?: boolean;
238}
239
240export type LeafletInlineRenderable = LeafletTextBlock | LeafletHeaderBlock | LeafletBlockquoteBlock;