/** * The `visual` component: a free-canvas graphic authored as a single pptx * slide. * * Nothing here renders a document. A visual has no OOXML form of its own — an * injected rasterization service (`services.pptx`) draws the slide into a PNG * and it becomes a plain `image`, exactly as a `highcharts` becomes one. What * lives here is the presentation that gets sent, the identity that keys the * batch, and the image props the result desugars to. */ import type { VisualRasterProps } from '@json-to-office/shared-docx'; import type { PptxServiceConfig, PptxRasterizeResult, RasterizeFontFace } from '@json-to-office/shared'; export declare const DEFAULT_RASTERIZE_SERVER_URL = "http://localhost:7802"; /** * Build a single-slide pptx presentation component definition from visual props. * The shape mirrors a normal `.pptx.json` document so the pptx engine renders * it unchanged. Exported for reuse by the `flattenVisuals` transform. */ export declare function buildVisualPresentation(props: VisualRasterProps): Record; /** * Where an image sits on the page, and how big it is. * * The authoring surface of the `image` component a visual desugars into, so * this is the shape a visual's placement props have to land in. */ export interface ImageOptions { caption?: string; width?: number | string; height?: number | string; widthRelativeTo?: 'content' | 'page'; heightRelativeTo?: 'content' | 'page'; alignment?: 'left' | 'center' | 'right'; spacing?: { before?: number; after?: number; }; floating?: { horizontalPosition?: { relative?: 'character' | 'column' | 'margin' | 'page' | 'text'; align?: 'left' | 'center' | 'right' | 'inside' | 'outside'; offset?: number | string; }; verticalPosition?: { relative?: 'margin' | 'page' | 'paragraph' | 'line' | 'text'; align?: 'top' | 'center' | 'bottom' | 'inside' | 'outside'; offset?: number | string; }; wrap?: { type: 'none' | 'square' | 'topAndBottom' | 'around' | 'tight' | 'through'; side?: 'bothSides' | 'left' | 'right' | 'largest'; margins?: { top?: number | string; bottom?: number | string; left?: number | string; right?: number | string; }; }; allowOverlap?: boolean; behindDocument?: boolean; lockAnchor?: boolean; layoutInCell?: boolean; zIndex?: number; rotation?: number; visibility?: 'hidden' | 'inherit'; }; keepNext?: boolean; keepLines?: boolean; } /** * Default rendered width (px) for a visual: its physical canvas inches, so a * 6×4 canvas prints 6×4 unless `width` overrides. */ export declare function defaultVisualWidthPx(props: VisualRasterProps): number; /** * Shared image-placement options derived from a visual's props. Used by BOTH * desugaring paths — the generation pre-pass and the offline flatten transform * — so the two cannot drift: width default, alignment default, caption, * spacing, floating and the keep flags all live here once. */ export declare function visualToImageOptions(props: VisualRasterProps): ImageOptions; /** * Map visual props to the `image` props they desugar to (used by the * `flattenVisuals` transform to produce a portable, service-free document). */ export declare function visualToImageProps(props: VisualRasterProps, base64DataUri: string): Record; /** * Identity of one visual rasterization: content + resolution + (for HTTP * services) the target server. Keys the per-document pre-rasterization map * (#153); the pre-pass and the render-time lookup MUST use this one function * so the two sides cannot drift. * * FONTS ARE DELIBERATELY NOT PART OF THIS KEY. The map is built and consumed * inside a single `renderDocument` call, which has exactly one font set, so * the pre-pass and the render-time lookup can never disagree about fonts. * The load-bearing font key is the RASTERIZER's on-disk cache key, which is * process-wide and shared across documents and users — see `fontsDigest` in * jto-cli's pptx-rasterizer.ts. */ export declare function visualRasterKey(presentation: unknown, dpi: number, serverUrl?: string): string; /** * The serverUrl that actually differentiates a visual's rasterization. An * in-process `render` callback takes precedence over any serverUrl — * per-visual or config — so overrides only matter when rasterization would * go over HTTP. Deliberately keyed on `render` alone (NOT `renderBatch`): * per-visual fallbacks always go through `rasterizeVisualSlide`, which only * consults `render`, and pre-pass inclusion must match what a fallback would * actually do or the same visual could rasterize against two different * services depending on cache luck. */ export declare function effectiveVisualServerUrl(props: VisualRasterProps, serviceConfig: PptxServiceConfig | undefined): string | undefined; /** * Rasterize a single-slide presentation to a PNG via the configured service. * An in-process `render` callback takes precedence over an HTTP `serverUrl`. * Exported for the pre-rasterization pass, whose per-visual fallback must * behave exactly like render-time rasterization. */ export declare function rasterizeVisualSlide(presentation: Record, dpi: number, propsServerUrl: string | undefined, serviceConfig: PptxServiceConfig | undefined, baseDir: string | undefined, /** * Document fonts staged for the rasterizer's LibreOffice launch. Added * conditionally below so a fontless document's request body stays exactly * what it was before fonts existed. */ fonts?: readonly RasterizeFontFace[]): Promise; //# sourceMappingURL=visual.d.ts.map