import { TruncationMode } from '../../../../typography/text-ellipsis/TextEllipsis.js'; /** * Approximate pixel height for a single line of text. * Used by consumers for layout calculations; not involved in truncation logic. * @public */ export declare const TEXT_HEIGHT = 12; /** * Computes the pixel width of a string using a per-character width map. * Unknown characters fall back to the width of '\@'. * * @param text - The string to measure. * @param fontWidthMap - Map of character to pixel width for the active font. * @returns The total width in CSS pixels. * @public */ export declare const calculateWidth: (text: string, fontWidthMap: Record) => number; /** * Controls which side of the string the middle-truncation generator starts * collecting characters from. 'start' keeps head characters first (e.g. * "3…" for "37%"), 'end' keeps tail characters first (e.g. "…%" for "37%"). * Only affects the 'middle' truncation mode. * @public */ export type TruncationPriority = 'start' | 'end'; /** * Truncates a string to fit within the given width by placing an ellipsis at the * start, middle, or end, depending on the truncation mode. If the text fits, it * is returned unchanged. If the width is too small, returns only the ellipsis. * * Key behaviors: * - Uses a generator to determine which characters to keep for each mode. * - Accumulates characters until the capacity (availableWidth minus ellipsis width). * - Applies EPSILON tolerance to treat near-equal widths as fitting. * - Uses MIN_AVAILABLE_WIDTH to return a stable ellipsis when space is minimal. * * @param text - The input string to truncate. * @param availableWidth - Max allowed width in CSS pixels for the final output. * @param fontWidthMap - Per-character width map for the active font. * @param truncationMode - Where to place the ellipsis: 'start' | 'middle' | 'end'. * @param priority - For 'middle' mode only: 'start' keeps head characters first * (e.g. "3…"), 'end' keeps tail characters first (e.g. "…%"). * Defaults to 'end' to match the legacy behavior. * @returns The truncated string with ellipsis applied according to the mode. * @public */ export declare const truncateString: (text: string, availableWidth: number, fontWidthMap: Record, truncationMode?: TruncationMode, priority?: TruncationPriority) => string;