parseText.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { TextAlign, TextVerticalAlign } from '../../core/types';
  2. import { TextStyleProps } from '../Text';
  3. interface InnerTruncateOption {
  4. maxIteration?: number;
  5. minChar?: number;
  6. placeholder?: string;
  7. maxIterations?: number;
  8. }
  9. export declare function truncateText(text: string, containerWidth: number, font: string, ellipsis: string, options: InnerTruncateOption): string;
  10. export interface PlainTextContentBlock {
  11. lineHeight: number;
  12. contentHeight: number;
  13. calculatedLineHeight: number;
  14. height: number;
  15. outerHeight: number;
  16. width: number;
  17. lines: string[];
  18. }
  19. export declare function parsePlainText(text: string, style?: TextStyleProps): PlainTextContentBlock;
  20. declare class RichTextToken {
  21. styleName: string;
  22. text: string;
  23. width: number;
  24. height: number;
  25. innerHeight: number;
  26. contentHeight: number;
  27. contentWidth: number;
  28. lineHeight: number;
  29. font: string;
  30. align: TextAlign;
  31. verticalAlign: TextVerticalAlign;
  32. textPadding: number[];
  33. percentWidth?: string;
  34. isLineHolder: boolean;
  35. }
  36. declare class RichTextLine {
  37. lineHeight: number;
  38. width: number;
  39. tokens: RichTextToken[];
  40. constructor(tokens?: RichTextToken[]);
  41. }
  42. export declare class RichTextContentBlock {
  43. width: number;
  44. height: number;
  45. contentWidth: number;
  46. contentHeight: number;
  47. outerWidth: number;
  48. outerHeight: number;
  49. lines: RichTextLine[];
  50. }
  51. export declare function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock;
  52. export {};