import type { PostextContent, PostextConfig } from '../types.js'; import type { VDTDocument } from '../vdt.js'; import type { BuildProgress } from '../pipeline/build.js'; export type { BuildProgress } from '../pipeline/build.js'; import type { BuildStats, FontPayload } from './protocol.js'; import { type FontReport, type PrepareFontsOptions } from '../fonts/prepare.js'; export type { BuildStats, FontPayload } from './protocol.js'; export type { BuildPassInfo } from '../pipeline/build.js'; /** A face for `registerFonts`: a `FontPayload` whose CSS weight may also be * a number (`700` as well as `'700'` or `'bold'`). */ export type FontPayloadInput = Omit & { weight: string | number; }; export interface BuildOptions { signal?: AbortSignal; /** Called as the worker's placement advances (throttled by the worker). */ onProgress?: (progress: BuildProgress) => void; /** Called with the finished build's pass timings, right before it resolves. */ onStats?: (stats: BuildStats) => void; /** Fingerprint of `content.resources`. Consecutive builds with the same * key ship the list once; the worker keeps it (see the protocol). */ resourcesKey?: string; /** Fingerprint of the whole build; the worker answers a repeat from its * document cache (see the protocol). */ cacheKey?: string; /** @internal False: keep the document in the worker only (see `warm`). */ wantDoc?: boolean; } export interface LayoutWorkerHandle { registerFonts(faces: FontPayloadInput[]): Promise; /** Drop every face whose family matches one of `families` from the worker's * face set so the next `registerFonts` for that family takes effect * instead of being deduped against a stale face. */ unregisterFonts(families: string[]): Promise; build(content: PostextContent, config?: PostextConfig, opts?: BuildOptions): Promise; /** Build into the worker's document cache without sending the document * back (`cacheKey` required): the next `build` with that key is a hit. */ warm(content: PostextContent, config: PostextConfig | undefined, opts: BuildOptions & { cacheKey: string; }): Promise; /** * `prepareFonts` on the page (#629), then the files of every face it * found that the font registry holds — the resolver's, a bundle's, the * page's readable `@font-face` rules — sent with `registerFonts`: the * worker has a font set of its own. Resolves with the page's report. */ prepareFonts?(content: PostextContent, config?: PostextConfig, options?: PrepareFontsOptions): Promise; dispose(): void; } export interface CreateLayoutWorkerOptions { /** * Allows consumers to provide their own Worker instance. Useful for build * tooling that needs to control the worker URL resolution. */ worker?: Worker; /** * URL of the worker entry module (`postext/worker/entry`) to start, when * it is not the file next to this module — a copy on your server, or a * CDN build such as `https://esm.sh/postext@1.4.2/worker/entry`. A URL on * another origin is started through a same-origin blob module that * imports it (a worker script must be same-origin; the CDN must allow * CORS). Ignored when `worker` is given. */ url?: string | URL; } export declare function createLayoutWorker(options?: CreateLayoutWorkerOptions): LayoutWorkerHandle; //# sourceMappingURL=client.d.ts.map