import { Awaitable, Arrayable } from '@unocss/core'; type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'fontsource' | 'none' | Provider; interface WebFontMeta { name: string; weights?: (string | number)[]; italic?: boolean; variable?: Record>; /** * Override the provider * @default */ provider?: WebFontsProviders; } interface WebFontProcessor { getCSS?: (fonts: ResolvedWebFontMeta[], providers: Provider[], getCSSDefault: (fonts: ResolvedWebFontMeta[], providers: Provider[]) => Awaitable) => Awaitable; transformCSS?: (css: string) => Promise; } interface ResolvedWebFontMeta extends Omit { provider: Provider; } interface WebFontsOptions { /** * Provider service of the web fonts * @default 'google' */ provider?: WebFontsProviders; /** * The fonts */ fonts?: Record; /** * Extend fonts to the theme object * @default true */ extendTheme?: boolean; /** * Key for the theme object * * @default 'fontFamily' */ themeKey?: string; /** * Inline CSS @import() * * @default true */ inlineImports?: boolean; /** * Custom fetch function * * @default undefined */ customFetch?: (url: string) => Promise; /** * Custom processor for the font CSS */ processors?: Arrayable; /** * Timeouts for fetching web fonts */ timeouts?: false | { /** * Timeout for printing warning message * * @default 500 */ warning?: number; /** * Timeout for failing the fetch * * @default 2000 */ failure?: number; }; } interface Provider { name: WebFontsProviders; getPreflight?: (fonts: WebFontMeta[]) => Awaitable; getImportUrl?: (fonts: WebFontMeta[]) => string | undefined; getFontName?: (font: WebFontMeta) => string; } interface Axes { default: string; min: string; max: string; step: string; } export type { Axes as A, Provider as P, ResolvedWebFontMeta as R, WebFontMeta as W, WebFontsProviders as a, WebFontsOptions as b, WebFontProcessor as c };