/** * Fonts exposed through `theme.fonts`. * * Each role accepts a curated Google Font slug, a remote-provider family (any * Google/Fontsource/Bunny/Fontshare family by name), or local font files. All * forms resolve to entries for Astro's built-in Fonts API, which self-hosts * and optimizes them; this module only resolves config values into the data * that drives it. */ export type FontCategory = "sans" | "serif" | "mono"; /** The three configurable roles in `theme.fonts`. */ export type FontSlot = "display" | "body" | "mono"; /** Zero-config Astro font providers usable from `theme.fonts`. */ export type RemoteFontProvider = "google" | "fontsource" | "bunny" | "fontshare"; /** A remote-provider family: any family name the provider knows. */ export interface RemoteFontConfig { /** Family name as the provider lists it, e.g. `"Noto Sans JP"`. */ name: string; /** Which provider serves the family. Defaults to `"google"`. */ provider?: RemoteFontProvider; /** Weights (or variable ranges like `"100..900"`) to load. Defaults to `[400, 500, 600, 700]`. */ weights?: (number | string)[]; /** Fallback stack category. Defaults to `"mono"` for the mono role, `"sans"` otherwise. */ fallback?: FontCategory; } /** One `@font-face` declaration for a local font. */ export interface LocalFontVariant { /** Font file path, relative to the project root. */ src: string; /** Face weight; inferred from the file when omitted. */ weight?: number | string; /** Face style; inferred from the file when omitted. */ style?: "normal" | "italic" | "oblique"; } /** A self-hosted family loaded from files in the project. */ export interface LocalFontConfig { /** Family name used in CSS and the OG card. */ name: string; /** The faces to declare (at least one). */ variants: LocalFontVariant[]; /** Fallback stack category. Defaults to `"mono"` for the mono role, `"sans"` otherwise. */ fallback?: FontCategory; } /** A role's font: curated slug, remote family, or local files. */ export type FontValue = string | RemoteFontConfig | LocalFontConfig; /** Resolved theme fonts (a validated value per role, all optional). */ export type FontsConfig = Partial> | undefined; /** A single Astro `fonts:` entry (sans the literal `fontProviders.*()` call). */ export type FontEntry = { kind: "remote"; provider: RemoteFontProvider; cssVariable: string; fallbacks: string[]; name: string; weights: (number | string)[]; } | { kind: "local"; cssVariable: string; fallbacks: string[]; name: string; variants: LocalFontVariant[]; }; /** Slug -> Google family + weights + fallback category. Keep keys alphabetical. */ export declare const GOOGLE_FONTS: { "dm-sans": { category: "sans"; family: string; weights: number[]; }; figtree: { category: "sans"; family: string; weights: number[]; }; "fira-code": { category: "mono"; family: string; weights: number[]; }; geist: { category: "sans"; family: string; weights: number[]; }; "geist-mono": { category: "mono"; family: string; weights: number[]; }; "ibm-plex-mono": { category: "mono"; family: string; weights: number[]; }; "ibm-plex-sans": { category: "sans"; family: string; weights: number[]; }; "ibm-plex-serif": { category: "serif"; family: string; weights: number[]; }; inter: { category: "sans"; family: string; weights: number[]; }; "inter-tight": { category: "sans"; family: string; weights: number[]; }; "jetbrains-mono": { category: "mono"; family: string; weights: number[]; }; lora: { category: "serif"; family: string; weights: number[]; }; manrope: { category: "sans"; family: string; weights: number[]; }; merriweather: { category: "serif"; family: string; weights: number[]; }; "open-sans": { category: "sans"; family: string; weights: number[]; }; "playfair-display": { category: "serif"; family: string; weights: number[]; }; "plus-jakarta-sans": { category: "sans"; family: string; weights: number[]; }; roboto: { category: "sans"; family: string; weights: number[]; }; "roboto-mono": { category: "mono"; family: string; weights: number[]; }; "source-code-pro": { category: "mono"; family: string; weights: number[]; }; "source-sans-3": { category: "sans"; family: string; weights: number[]; }; "source-serif-4": { category: "serif"; family: string; weights: number[]; }; "space-grotesk": { category: "sans"; family: string; weights: number[]; }; "space-mono": { category: "mono"; family: string; weights: number[]; }; "work-sans": { category: "sans"; family: string; weights: number[]; }; }; export type FontSlug = keyof typeof GOOGLE_FONTS; /** All supported slugs, for schema validation and error messages. */ export declare const FONT_SLUGS: string[]; /** Type guard: is `value` a supported font slug? */ export declare const isFontSlug: (value: string) => value is FontSlug; /** Kebab-case a family name into a slug (`"Noto Sans JP"` -> `"noto-sans-jp"`). */ export declare const slugifyFontName: (name: string) => string; /** The unique Astro `fonts:` entries for the configured roles (deduped). */ export declare const buildFontEntries: (fonts: FontsConfig) => FontEntry[]; /** * The config-token CSS that points each role's `--blume-font--src` at the * Astro-populated family variable. Concatenated into the generated entry's * config tokens; empty when no fonts are set so defaults stay the system stacks. */ export declare const buildFontsCss: (fonts: FontsConfig) => string; /** One `` render in the head: its CSS variable + weights to preload. */ export interface FontHead { cssVariable: string; preloadWeights: number[]; } /** * The fonts to feed Astro's `` component in the document head, deduped * by CSS variable with preload weights unioned across the roles that share a * family (so `display` and `body` both set to Inter preload 400/500/600 once). */ export declare const configuredFonts: (fonts: FontsConfig) => FontHead[];