/** * UI Formatting Utilities * * Common formatting functions for table cells and list display */ /** * Pad and truncate text to exact width for table cells * Uses simple end truncation with ellipsis * * @param text - The text to format * @param width - The exact width to format to * @returns Text padded or truncated to exact width * * @example * formatCell('Hello', 10) // 'Hello ' * formatCell('Hello World!', 8) // 'Hello W…' */ export declare function formatCell(text: string, width: number): string; /** * Format version string with smart middle truncation * Keeps beginning and end visible for version strings like "2.0.38-SNAPSHOT (build 3820)" * * @param version - The version string to format * @param width - The exact width to format to * @returns Version string with middle truncation if needed * * @example * formatVersion('1.0.0', 10) // '1.0.0 ' * formatVersion('2.0.38-SNAPSHOT (build 3820)', 14) // '2.0.38…3820) ' */ export declare function formatVersion(version: string, width: number): string; /** * Format optional value with fallback for table display * * @param text - The text to format (can be null/undefined) * @param width - The exact width to format to * @param fallback - Fallback string when text is null/undefined (default: '-') * @returns Formatted text or fallback * * @example * formatCellOptional('1.0.0', 10) // '1.0.0 ' * formatCellOptional(undefined, 10) // '- ' * formatCellOptional(null, 10, 'N/A') // 'N/A ' */ export declare function formatCellOptional(text: string | null | undefined, width: number, fallback?: string): string; /** * Format optional version with fallback * Uses middle truncation for long versions * * @param version - The version string (can be null/undefined) * @param width - The exact width to format to * @param fallback - Fallback string when version is null/undefined (default: '-') * @returns Formatted version or fallback */ export declare function formatVersionOptional(version: string | null | undefined, width: number, fallback?: string): string; /** * Truncation info for displaying partial lists with "more" indicator */ export interface TruncationInfo { visible: T[]; hiddenCount: number; hasMore: boolean; } /** * Get truncation info for displaying partial lists * * @param items - Full list of items * @param maxVisible - Maximum number of items to show * @returns Truncation info with visible items and hidden count * * @example * const { visible, hiddenCount, hasMore } = getTruncationInfo(plugins, 15); * // Render visible items * {hasMore && ... and {hiddenCount} more} */ export declare function getTruncationInfo(items: T[], maxVisible: number): TruncationInfo; //# sourceMappingURL=formatting.d.ts.map