import type { PdfSpecStyle } from './pdfSpec.cjs'; export type LineHeight = /** Unitless: inherited as a factor of each font size. */ { factor: number; } /** A length or percentage: computed once, inherited as pixels. */ | { px: number; } /** `normal`: each text's from its own font. */ | { normal: true; }; export type WhiteSpace = 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'break-spaces'; /** Whether what is in this state takes its room and paints nothing. */ export declare const paintsNothing: (state: TextState) => boolean; /** White space kept as written (spaces, tabs and line breaks). */ export declare const keepsWhiteSpace: (whiteSpace: WhiteSpace) => whiteSpace is "pre" | "pre-wrap" | "break-spaces"; export interface TextState { fontFamily: string; fontSizePx: number; fontWeight: number; italic: boolean; color: string; lineHeight: LineHeight; letterSpacingPx: number; textAlign: 'left' | 'right' | 'center' | 'justify'; textTransform: 'none' | 'uppercase' | 'lowercase' | 'capitalize'; /** Decorations accumulate from ancestors (CSS draws them all). */ underline: boolean; lineThrough: boolean; decorationColor?: string; backgroundColor?: string; verticalAlign?: 'sub' | 'super'; whiteSpace: WhiteSpace; /** `visibility: hidden`: takes its room and paints nothing. */ hidden?: boolean; /** `opacity: 0`: the same, and nothing inside it can show itself again. */ invisible?: boolean; /** The link around this text, from an inline around a block. */ link?: string; } /** Text in a document's content box: the body's font and color, 15px, `normal`. */ export declare function rootTextState(body: { fontFamily?: string; textColor?: string; }): TextState; /** A CSS length in pixels; `em` and `%` relative to `basePx`. */ export declare function lengthPx(value: unknown, basePx?: number): number | undefined; export declare function parseLineHeight(value: string, fontSizePx: number): LineHeight | undefined; /** Whether CSS accepts a `font-family` list (quoted names or identifiers). */ export declare function isValidFontFamily(value: string): boolean; /** * Parses a `style` attribute into lower-cased property → value pairs, those * CSS applies. Of a shorthand and its longhands, the one that wins comes last, * and a longhand it replaces is left out. */ export declare function parseDeclarations(css: string | undefined): Map; interface DeclaredLines { /** The property that said so, for a report. */ name: string; underline: boolean; lineThrough: boolean; /** The color a `text-decoration` shorthand gives its lines. */ color?: string; /** CSS draws something here that is not drawn, which the caller reports. */ inexact?: boolean; /** Parts of it are not checked: CSS may not read it, so it takes no priority. */ unchecked?: boolean; } /** * The lines an element's own style says it draws, which replace what its tag * draws; undefined when it says nothing CSS keeps. */ export declare function declaredLines(declarations: Map): DeclaredLines | undefined; /** * Applies the inheritable text declarations of an element to the inherited * state. Returns the names it did not understand, for the caller to report. * `inheritedColor` is what `color: inherit` takes, when `parent` already holds * the element's own default (a link's color). */ export declare function applyTextDeclarations(parent: TextState, declarations: Map, inheritedColor?: string): { state: TextState; ignored: string[]; }; /** The line height in points for text in this state. */ export declare function lineHeightPt(state: TextState): number; /** * The PDF spec style of a text node or span. Line heights are absolute: react-pdf * resolves unitless line heights against its own default font size. */ export declare function textStyle(state: TextState): PdfSpecStyle; /** The style properties of `child` that differ from `parent`. */ export declare function styleDifference(child: PdfSpecStyle, parent: PdfSpecStyle): PdfSpecStyle; /** * The lines that do not reach inside an inline-block, as in CSS: `state` * without them. */ export declare const withoutLines: (state: TextState) => TextState; export {};