@hydro-project/hydroscope
Version:
React-based graph visualization library for Hydro dataflow programs
38 lines • 1.39 kB
TypeScript
/**
* @fileoverview Text utilities for the visualizer
*
* Shared text processing functions like truncation, formatting, etc.
*/
/**
* Configuration for smart label truncation
*/
export interface TruncationOptions {
/** Maximum length of the truncated text */
maxLength: number;
/** Whether to prefer breaking on delimiters */
preferDelimiters?: boolean;
/** Custom delimiters to consider for truncation */
delimiters?: string[];
/** Whether to truncate from the left (keeping the end) */
leftTruncate?: boolean;
}
/**
* Default delimiters commonly found in container/node names
*/
export declare const DEFAULT_DELIMITERS: string[];
/**
* Smart truncation that preserves meaningful parts of labels
* Based on the logic from HierarchyTree.tsx
*/
export declare function truncateLabel(label: string, options: TruncationOptions): string;
/**
* Specialized truncation for container names in collapsed state
* Optimized for Rust-style paths and hierarchical names
*/
export declare function truncateContainerName(name: string, maxLength?: number): string;
/**
* Calculate minimum width needed for a collapsed container based on label
* Assumes ~8px per character + padding
*/
export declare function calculateCollapsedWidth(label: string, minWidth?: number, charWidth?: number, padding?: number): number;
//# sourceMappingURL=textUtils.d.ts.map