/** * Turn components that need an external service into plain `image` components, * before anything else looks at the document. * * A `visual` is a nested presentation rendered by LibreOffice; a `highcharts` * is a chart rendered by an export server. Both end up as a PNG in the package, * and neither has an OOXML form of its own — so rather than teaching the * compiler about services, they are desugared here and the compiler only ever * sees an image. * * That keeps compilation a pure function of the document. Everything that can * fail, block on a network call or depend on a machine's LibreOffice happens in * this pass; what comes out is a document that builds anywhere. */ import { type RasterizeFontFace, type ServicesConfig, type GenerationWarning } from '@json-to-office/shared'; import type { ThemeConfig } from '../styles'; export interface DesugarExternalsOptions { theme: ThemeConfig; services?: ServicesConfig; /** Directory relative asset paths inside a visual resolve against. */ baseDir?: string; /** Font faces staged for each visual's LibreOffice render. */ visualFonts?: readonly RasterizeFontFace[]; /** Font faces a chart's export server is handed as inline `@font-face`. */ chartFonts?: readonly RasterizeFontFace[]; /** Where a chart posted to a remote export server is reported. */ warnings?: GenerationWarning[]; } /** * Replace every `visual` and `highcharts` in `document` with its image. * * Visuals are rasterized in one batch first: without it each visual would cost * its own service round trip and its own LibreOffice launch — about * twenty-five of each for the bundled templates. The batch is only an * accelerator, though: anything it misses, or a batch that fails outright, * falls back to rasterizing that visual on its own. * * The walk resolves sibling components together rather than one at a time, so * charts are not paced by the document's shape and have to be paced * deliberately: each one waits for a slot in its export server's gate, and a * chart identical to one already rendered here reuses that render. */ export declare function desugarExternals(document: T, options: DesugarExternalsOptions): Promise; //# sourceMappingURL=desugarExternals.d.ts.map