parseText.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. calculatedLineHeight: number;
  13. contentWidth: number;
  14. contentHeight: number;
  15. width: number;
  16. height: number;
  17. outerWidth: number;
  18. outerHeight: number;
  19. lines: string[];
  20. }
  21. export declare function parsePlainText(text: string, style?: TextStyleProps): PlainTextContentBlock;
  22. declare class RichTextToken {
  23. styleName: string;
  24. text: string;
  25. width: number;
  26. height: number;
  27. innerHeight: number;
  28. contentHeight: number;
  29. contentWidth: number;
  30. lineHeight: number;
  31. font: string;
  32. align: TextAlign;
  33. verticalAlign: TextVerticalAlign;
  34. textPadding: number[];
  35. percentWidth?: string;
  36. isLineHolder: boolean;
  37. }
  38. declare class RichTextLine {
  39. lineHeight: number;
  40. width: number;
  41. tokens: RichTextToken[];
  42. constructor(tokens?: RichTextToken[]);
  43. }
  44. export declare class RichTextContentBlock {
  45. width: number;
  46. height: number;
  47. contentWidth: number;
  48. contentHeight: number;
  49. outerWidth: number;
  50. outerHeight: number;
  51. lines: RichTextLine[];
  52. }
  53. export declare function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock;
  54. export {};