A React component library for rendering common AT Protocol records for applications such as Bluesky and Leaflet.
at main 5.4 kB view raw
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 = 91 | LeafletTextBlock 92 | LeafletHeaderBlock 93 | LeafletImageBlock; 94 95export interface LeafletWebsiteBlock { 96 $type?: "pub.leaflet.blocks.website"; 97 src: string; 98 title?: string; 99 description?: string; 100 previewImage?: LeafletBlobRef; 101} 102 103export interface LeafletIFrameBlock { 104 $type?: "pub.leaflet.blocks.iframe"; 105 url: string; 106 height?: number; 107} 108 109export interface LeafletMathBlock { 110 $type?: "pub.leaflet.blocks.math"; 111 tex: string; 112} 113 114export interface LeafletCodeBlock { 115 $type?: "pub.leaflet.blocks.code"; 116 plaintext: string; 117 language?: string; 118 syntaxHighlightingTheme?: string; 119} 120 121export interface LeafletHorizontalRuleBlock { 122 $type?: "pub.leaflet.blocks.horizontalRule"; 123} 124 125export interface LeafletBskyPostBlock { 126 $type?: "pub.leaflet.blocks.bskyPost"; 127 postRef: StrongRef; 128} 129 130export interface LeafletRichTextFacet { 131 index: LeafletByteSlice; 132 features: LeafletRichTextFeature[]; 133} 134 135export interface LeafletByteSlice { 136 byteStart: number; 137 byteEnd: number; 138} 139 140export type LeafletRichTextFeature = 141 | LeafletRichTextLinkFeature 142 | LeafletRichTextCodeFeature 143 | LeafletRichTextHighlightFeature 144 | LeafletRichTextUnderlineFeature 145 | LeafletRichTextStrikethroughFeature 146 | LeafletRichTextIdFeature 147 | LeafletRichTextBoldFeature 148 | LeafletRichTextItalicFeature; 149 150export interface LeafletRichTextLinkFeature { 151 $type: "pub.leaflet.richtext.facet#link"; 152 uri: string; 153} 154 155export interface LeafletRichTextCodeFeature { 156 $type: "pub.leaflet.richtext.facet#code"; 157} 158 159export interface LeafletRichTextHighlightFeature { 160 $type: "pub.leaflet.richtext.facet#highlight"; 161} 162 163export interface LeafletRichTextUnderlineFeature { 164 $type: "pub.leaflet.richtext.facet#underline"; 165} 166 167export interface LeafletRichTextStrikethroughFeature { 168 $type: "pub.leaflet.richtext.facet#strikethrough"; 169} 170 171export interface LeafletRichTextIdFeature { 172 $type: "pub.leaflet.richtext.facet#id"; 173 id?: string; 174} 175 176export interface LeafletRichTextBoldFeature { 177 $type: "pub.leaflet.richtext.facet#bold"; 178} 179 180export interface LeafletRichTextItalicFeature { 181 $type: "pub.leaflet.richtext.facet#italic"; 182} 183 184export interface LeafletBlobRef { 185 $type?: string; 186 ref?: { 187 $link?: string; 188 }; 189 cid?: string; 190 mimeType?: string; 191 size?: number; 192} 193 194export interface LeafletPublicationRecord { 195 $type?: "pub.leaflet.publication"; 196 name: string; 197 base_path?: string; 198 description?: string; 199 icon?: LeafletBlobRef; 200 theme?: LeafletTheme; 201 preferences?: LeafletPublicationPreferences; 202} 203 204export interface LeafletPublicationPreferences { 205 showInDiscover?: boolean; 206 showComments?: boolean; 207} 208 209export interface LeafletTheme { 210 backgroundColor?: LeafletThemeColor; 211 backgroundImage?: LeafletThemeBackgroundImage; 212 primary?: LeafletThemeColor; 213 pageBackground?: LeafletThemeColor; 214 showPageBackground?: boolean; 215 accentBackground?: LeafletThemeColor; 216 accentText?: LeafletThemeColor; 217} 218 219export type LeafletThemeColor = LeafletThemeColorRgb | LeafletThemeColorRgba; 220 221export interface LeafletThemeColorRgb { 222 $type?: "pub.leaflet.theme.color#rgb"; 223 r: number; 224 g: number; 225 b: number; 226} 227 228export interface LeafletThemeColorRgba { 229 $type?: "pub.leaflet.theme.color#rgba"; 230 r: number; 231 g: number; 232 b: number; 233 a: number; 234} 235 236export interface LeafletThemeBackgroundImage { 237 $type?: "pub.leaflet.theme.backgroundImage"; 238 image: LeafletBlobRef; 239 width?: number; 240 repeat?: boolean; 241} 242 243export type LeafletInlineRenderable = 244 | LeafletTextBlock 245 | LeafletHeaderBlock 246 | LeafletBlockquoteBlock;