UNPKG

astro-font

Version:

An Astro integration to optimize Local & Google fonts inspired by @next/font

35 lines (33 loc) 1.5 kB
type GlobalValues = 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset'; interface Source { path: string; preload?: boolean; css?: Record<string, string>; style: 'normal' | 'italic' | 'oblique' | `oblique ${number}deg` | GlobalValues | (string & {}); weight?: 'normal' | 'bold' | 'lighter' | 'bolder' | GlobalValues | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | (string & {}) | (number & {}); } interface Config { name: string; src: Source[]; fetch?: boolean; verbose?: boolean; selector?: string; preload?: boolean; cacheDir?: string; basePath?: string; fallbackName?: string; googleFontsURL?: string; cssVariable?: string | boolean; fallback: 'serif' | 'sans-serif' | 'monospace'; display: 'auto' | 'block' | 'swap' | 'fallback' | 'optional' | (string & {}); } interface Props { config: Config[]; } declare function getRelativePath(from: string, to: string): string; declare function getPreloadType(src: string): string; declare function generateFonts(fontCollection: Config[]): Promise<Config[]>; declare function createPreloads(fontCollection: Config): string[]; declare function createBaseCSS(fontCollection: Config): Promise<string[]>; declare function createFontCSS(fontCollection: Config): Promise<string>; export { type Props, createBaseCSS, createFontCSS, createPreloads, generateFonts, getPreloadType, getRelativePath };