Something went wrong. Try again.
leaflet fork for copy edit / bug fixes forked from leaflet.pub/leaflet
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031import type { PubLeafletPublication } from "lexicons/api";import { blobRefToSrc } from "./blobRefToSrc";
export type WordmarkData = { src: string; width?: number; aspectRatio?: { width: number; height: number };};
// Resolves a published publication theme's wordmark into a renderable image// src + width. Returns null when no wordmark is set (callers fall back to the// logo + name). For draft editing, the wordmark src comes from the// theme/wordmark-image fact instead — see the editor.export function wordmarkFromTheme( theme: PubLeafletPublication.Theme | undefined | null, did: string,): WordmarkData | null { const wordmark = theme?.wordmark; if (!wordmark?.image?.ref) return null; return { src: blobRefToSrc(wordmark.image.ref, did), width: wordmark.width ?? undefined, aspectRatio: wordmark.aspectRatio ? { width: wordmark.aspectRatio.width, height: wordmark.aspectRatio.height, } : undefined, };}