···5050 * Checks if the record is a pub.leaflet.document
5151 */
5252export function isLeafletDocument(
5353- record: unknown,
5353+ record: unknown
5454): record is PubLeafletDocument.Record {
5555 if (!record || typeof record !== "object") return false;
5656 const r = record as Record<string, unknown>;
···6565 * Checks if the record is a site.standard.document
6666 */
6767export function isStandardDocument(
6868- record: unknown,
6868+ record: unknown
6969): record is SiteStandardDocument.Record {
7070 if (!record || typeof record !== "object") return false;
7171 const r = record as Record<string, unknown>;
···7676 * Checks if the record is a pub.leaflet.publication
7777 */
7878export function isLeafletPublication(
7979- record: unknown,
7979+ record: unknown
8080): record is PubLeafletPublication.Record {
8181 if (!record || typeof record !== "object") return false;
8282 const r = record as Record<string, unknown>;
···9191 * Checks if the record is a site.standard.publication
9292 */
9393export function isStandardPublication(
9494- record: unknown,
9494+ record: unknown
9595): record is SiteStandardPublication.Record {
9696 if (!record || typeof record !== "object") return false;
9797 const r = record as Record<string, unknown>;
···106106 | $Typed<PubLeafletThemeColor.Rgba>
107107 | $Typed<PubLeafletThemeColor.Rgb>
108108 | { $type: string }
109109- | undefined,
109109+ | undefined
110110): { r: number; g: number; b: number } | undefined {
111111 if (!color || typeof color !== "object") return undefined;
112112 const c = color as Record<string, unknown>;
···124124 * Converts a pub.leaflet theme to a site.standard.theme.basic format
125125 */
126126export function leafletThemeToBasicTheme(
127127- theme: PubLeafletPublication.Theme | undefined,
127127+ theme: PubLeafletPublication.Theme | undefined
128128): SiteStandardThemeBasic.Main | undefined {
129129 if (!theme) return undefined;
130130131131 const background = extractRgb(theme.backgroundColor);
132132- const accent =
133133- extractRgb(theme.accentBackground) || extractRgb(theme.primary);
132132+ const accent = extractRgb(theme.accentBackground) || extractRgb(theme.primary);
134133 const accentForeground = extractRgb(theme.accentText);
135134136135 // If we don't have the required colors, return undefined
···161160 * @param uri - Optional document URI, used to extract the rkey for the path field when normalizing pub.leaflet records
162161 * @returns A normalized document in site.standard format, or null if invalid/unrecognized
163162 */
164164-export function normalizeDocument(
165165- record: unknown,
166166- uri?: string,
167167-): NormalizedDocument | null {
163163+export function normalizeDocument(record: unknown, uri?: string): NormalizedDocument | null {
168164 if (!record || typeof record !== "object") return null;
169165170166 // Pass through site.standard records directly (theme is already in correct format if present)
···223219 * @returns A normalized publication in site.standard format, or null if invalid/unrecognized
224220 */
225221export function normalizePublication(
226226- record: unknown,
222222+ record: unknown
227223): NormalizedPublication | null {
228224 if (!record || typeof record !== "object") return null;
229225···272268 showComments: record.preferences.showComments,
273269 showMentions: record.preferences.showMentions,
274270 showPrevNext: record.preferences.showPrevNext,
275275- showRecommends: record.preferences.showRecommends,
276271 }
277272 : undefined;
278273···295290 * Type guard to check if a normalized document has leaflet content
296291 */
297292export function hasLeafletContent(
298298- doc: NormalizedDocument,
293293+ doc: NormalizedDocument
299294): doc is NormalizedDocument & {
300295 content: $Typed<PubLeafletContent.Main>;
301296} {
···309304 * Gets the pages array from a normalized document, handling both formats
310305 */
311306export function getDocumentPages(
312312- doc: NormalizedDocument,
307307+ doc: NormalizedDocument
313308): PubLeafletContent.Main["pages"] | undefined {
314309 if (!doc.content) return undefined;
315310