import { ParagraphIndent } from './paragraph.js';
/**
 * OOXML-aligned tab stop definition.
 * Positions are in twips (1/1440 inch) to preserve exact OOXML values.
 * Common conversions: 720 twips = 0.5", 1440 twips = 1"
 */
export interface TabStop {
    val: 'start' | 'end' | 'center' | 'decimal' | 'bar' | 'clear';
    pos: number;
    leader?: 'none' | 'dot' | 'hyphen' | 'heavy' | 'underscore' | 'middleDot';
    source?: 'explicit' | 'default';
}
/**
 * Context for tab stop computation.
 * All measurements in twips to match OOXML precision.
 */
export interface TabContext {
    explicitStops: TabStop[];
    defaultTabInterval: number;
    paragraphIndent: ParagraphIndent;
}
/**
 * A run with its computed horizontal position.
 * Generic over run type so both PM and layout can use it.
 */
export interface RunPosition<T = unknown> {
    run: T;
    x: number;
    width: number;
    tabStop?: TabStop;
}
export interface TabbedRun<T = unknown> {
    run: T;
    width: number;
    isTab?: boolean;
    text?: string;
}
export interface LayoutWithTabsOptions<T = unknown> {
    measureTextWidth?: (run: T, text: string) => number;
    decimalSeparator?: string;
}
export interface CalculateTabWidthParams {
    /**
     * Current horizontal position before the tab, in the same units as tabStops (usually px)
     */
    currentX: number;
    /**
     * Sorted tab stops in the same units as currentX. Use computeTabStops + unit conversion first.
     */
    tabStops: TabStop[];
    /**
     * Available paragraph width in the same units.
     */
    paragraphWidth: number;
    /**
     * Default tab distance (fallback) in the same units.
     */
    defaultTabDistance: number;
    /**
     * Default line length (used to repeat the default grid) in the same units.
     */
    defaultLineLength: number;
    /**
     * Text immediately following the tab (used for center/end/decimal).
     */
    followingText?: string;
    /**
     * Optional measurement function for followingText; if omitted, length-based approximation is used.
     */
    measureText?: (text: string) => number;
    /**
     * Decimal separator character for decimal/num tabs.
     */
    decimalSeparator?: string;
}
export interface CalculateTabWidthResult {
    width: number;
    leader?: TabStop['leader'];
    alignment: TabStop['val'] | 'default';
    tabStopPosUsed: number | 'default';
}
/**
 * Compute the full set of tab stops for a paragraph.
 *
 * Merges explicit stops from the style with default stops at regular intervals.
 * Filters out stops that fall before the paragraph's left indent.
 *
 * @param context - Tab context (explicit stops, defaults, indents in twips)
 * @returns Sorted array of tab stops in twips
 */
export declare function computeTabStops(context: TabContext): TabStop[];
/**
 * Layout runs with tab awareness, computing horizontal positions.
 *
 * Handles all OOXML tab alignment types:
 * - start: Text begins at tab stop (left-aligned)
 * - end: Text ends at tab stop (right-aligned)
 * - center: Text is centered at tab stop
 * - decimal: Decimal separator aligns at tab stop
 * - bar: Vertical line at tab stop (handled by painters, not layout)
 *
 * Note: This function operates in the measurer's coordinate space (typically pixels).
 * Tab stop positions should be converted from twips before calling this function.
 *
 * @param runs - Array of runs with pre-computed widths (in measurer units)
 * @param stops - Sorted tab stops (positions converted to measurer units)
 * @param lineWidth - Maximum line width (in measurer units)
 * @param options - Optional config (measureTextWidth for accuracy, decimalSeparator for locale)
 * @returns Runs with computed x positions
 */
export declare function layoutWithTabs<T>(runs: TabbedRun<T>[], stops: TabStop[], lineWidth: number, options?: LayoutWithTabsOptions<T>): RunPosition<T>[];
/**
 * Compute the visual width a tab should occupy based on tab stops and following text.
 * This is a pure helper for consumers that only need a single tab width (e.g., adapters).
 */
export declare function calculateTabWidth(params: CalculateTabWidthParams): CalculateTabWidthResult;
//# sourceMappingURL=tabs.d.ts.map