/** Coarse visual class, used by the font browser's filter chips. */
export type FontCategory = 'sans' | 'serif' | 'display' | 'handwriting' | 'mono';
export interface FontOption {
/** Stored in `PopupModal.fontFamily`; also the Google family name for Google fonts. */
id: string;
label: string;
/** The CSS `font-family` the renderer applies. */
stack: string;
/** When true, the family is loaded from Google Fonts on first use. */
google?: boolean;
/** Visual class for the browser's category filter. */
category?: FontCategory;
/** True when the family has strong Hebrew coverage. Only these are offered. */
hebrew?: boolean;
/**
* Extra names the font browser's search accepts, beyond `label` and `id`.
*
* Every family here is named in Latin letters, so an author working in Hebrew
* had to guess the English spelling before the list would show them anything.
* The aliases are the names they actually type: the family transliterated, and
* `עברית` on each Hebrew-covering family so asking for Hebrew fonts as a group
* returns the group.
*/
aliases?: string[];
}
export declare const DEFAULT_FONT_ID = "default";
export declare const HOST_FONT_ID = "host";
/** The built-in default, matching the renderer stylesheet. */
export declare const DEFAULT_FONT_STACK = "Arial, Helvetica, sans-serif";
export declare const GOOGLE_FONTS: FontOption[];
/** Look up a curated Google font by id. */
export declare function findGoogleFont(fontId?: string): FontOption | undefined;
/**
* The CSS `font-family` for a stored `fontFamily` id, or `undefined` when the
* default should apply (the renderer then falls back to its stylesheet font).
* `'host'` resolves to `inherit`, so the live popup adopts the host page's font.
*/
export declare function fontCss(fontId?: string): string | undefined;
/**
* Ensure the given Google font is loaded into the document (deduped). Fonts must
* be injected at document level — a `` inside a shadow root wouldn't apply
* to shadow content, but a document-level `@font-face` does. No-op for the
* default/host ids and for non-Google values.
*/
export declare function ensureGoogleFont(fontId?: string, doc?: Document): void;
/**
* Load every curated Google font at once (a single request) so a picker can show
* each option in its own typeface. Deduped; only weight 400 to keep it light.
* Fonts must be injected at document level to reach shadow-root content.
*/
export declare function ensureGoogleFontsPreview(doc?: Document): void;
/**
* Folds a name or a query down to what a search should compare.
*
* Lowercased for the Latin side, and on the Hebrew side stripped of niqqud and
* with the five final letters folded back to their ordinary forms — so a word
* typed with vowel points, or one whose last letter is still mid-word because
* the author is halfway through typing it, lands on the same string as the name
* it is reaching for.
*/
export declare function normalizeFontQuery(value: string): string;
/**
* Whether a font answers to `query`. Matches its display label, its id and any
* alias, so the same search box serves an author typing `rubik` and one typing
* `רוביק`. An empty query matches everything.
*/
export declare function fontMatchesQuery(font: Pick, query: string): boolean;