1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21/** 22 * StyledString 23 * 24 * @syscap SystemCapability.ArkUI.ArkUI.Full 25 * @crossplatform 26 * @atomicservice 27 * @since 12 28 */ 29declare class StyledString { 30 /** 31 * constructor. 32 * 33 * @param { string | ImageAttachment | CustomSpan } value - indicates the current object value of the StyledString. 34 * @param { Array<StyleOptions> } [styles] - indicates the SpanStyle objects. 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @crossplatform 37 * @atomicservice 38 * @since 12 39 */ 40 constructor(value: string | ImageAttachment | CustomSpan, styles?: Array<StyleOptions>); 41 42 /** 43 * Get the length of the StyledString's characters. 44 * 45 * @type { number } - the length of the StyledString's characters. 46 * @readonly 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @crossplatform 49 * @atomicservice 50 * @since 12 51 */ 52 readonly length: number; 53 54 /** 55 * Get the literal content of the StyledString. 56 * 57 * @returns { string } - the literal content of the StyledString 58 * @syscap SystemCapability.ArkUI.ArkUI.Full 59 * @crossplatform 60 * @atomicservice 61 * @since 12 62 */ 63 getString(): string; 64 65 /** 66 * Get the attribute objects of the subStyledString. 67 * 68 * @param { number } start - the start position of the subStyledString. 69 * @param { number } length - the length of the subStyledString's characters. 70 * @param { StyledStringKey } [styledKey] - the specified type. 71 * @returns { Array<SpanStyle> } 72 * @throws { BusinessError } 401 - Parameter error. Possible causes: 73 * <br> 1. Mandatory parameters are left unspecified. 74 * <br> 2. Incorrect parameters types. 75 * <br> 3. Parameter verification failed. 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @crossplatform 78 * @atomicservice 79 * @since 12 80 */ 81 getStyles(start: number, length: number, styledKey?: StyledStringKey): Array<SpanStyle>; 82 83 /** 84 * Judge if two attribute strings are equal. 85 * 86 * @param { StyledString } other - another StyledString. 87 * @returns { boolean } 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @crossplatform 90 * @atomicservice 91 * @since 12 92 */ 93 equals(other: StyledString): boolean; 94 95 /** 96 * Get the substring of the StyledString. 97 * 98 * @param { number } start - the start position of the subStyledString. 99 * @param { number } [length] - the length of the subStyledString's characters. 100 * @returns { StyledString } 101 * @throws { BusinessError } 401 - Parameter error. Possible causes: 102 * <br> 1. Mandatory parameters are left unspecified. 103 * <br> 2. Incorrect parameters types. 104 * <br> 3. Parameter verification failed. 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @crossplatform 107 * @atomicservice 108 * @since 12 109 */ 110 subStyledString(start: number, length?: number): StyledString; 111 112 /** 113 * Returns StyledString from the provided HTML string. 114 * 115 * @param { string } html - the html text will be converted to a StyledString. 116 * @returns { Promise<StyledString> } 117 * @throws { BusinessError } 401 - Parameter error. Possible causes: 118 * <br> 1. Mandatory parameters are left unspecified. 119 * <br> 2. Incorrect parameters types. 120 * <br> 3. Parameter verification failed. 121 * @syscap SystemCapability.ArkUI.ArkUI.Full 122 * @atomicservice 123 * @since 12 124 */ 125 static fromHtml(html: string): Promise<StyledString>; 126 127 /** 128 * Returns HTML string from the provided StyledString. 129 * 130 * @param { StyledString } styledString - the StyledString will be converted to a HTML string. 131 * @returns { string } 132 * @throws { BusinessError } 401 - Parameter error. Possible causes: 133 * <br> 1. Mandatory parameters are left unspecified. 134 * <br> 2. Incorrect parameters types. 135 * <br> 3. Parameter verification failed. 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @crossplatform 138 * @atomicservice 139 * @since 14 140 */ 141 static toHtml(styledString: StyledString): string; 142 143 /** 144 * Returns ArrayBuffer from the serialized styled string. 145 * 146 * @param { StyledString } styledString - StyledString parameter. 147 * @returns { ArrayBuffer } 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @systemapi 150 * @since 13 151 */ 152 static marshalling(styledString: StyledString): ArrayBuffer; 153 154 /** 155 * Returns StyledString from the deserialized ArrayBuffer. 156 * 157 * @param { ArrayBuffer } buffer - The buffer will be deserialized to a StyledString. 158 * @returns { Promise<StyledString> } 159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 160 * <br> 1. Mandatory parameters are left unspecified. 161 * <br> 2. Incorrect parameters types. 162 * <br> 3. Parameter verification failed. 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @systemapi 165 * @since 13 166 */ 167 static unmarshalling(buffer: ArrayBuffer): Promise<StyledString>; 168} 169 170/** 171 * StyleOptions 172 * 173 * @interface StyleOptions 174 * @syscap SystemCapability.ArkUI.ArkUI.Full 175 * @crossplatform 176 * @atomicservice 177 * @since 12 178 */ 179declare interface StyleOptions { 180 /** 181 * The start position of the StyleOptions. 182 * 183 * @type { ?number } 184 * @syscap SystemCapability.ArkUI.ArkUI.Full 185 * @crossplatform 186 * @atomicservice 187 * @since 12 188 */ 189 start?: number; 190 191 /** 192 * The length of the modifiedStyledString's characters. 193 * 194 * @type { ?number } 195 * @syscap SystemCapability.ArkUI.ArkUI.Full 196 * @crossplatform 197 * @atomicservice 198 * @since 12 199 */ 200 length?: number; 201 202 /** 203 * The attribute key of the StyleOptions. 204 * 205 * @type { StyledStringKey } 206 * @syscap SystemCapability.ArkUI.ArkUI.Full 207 * @crossplatform 208 * @atomicservice 209 * @since 12 210 */ 211 styledKey: StyledStringKey; 212 213 /** 214 * The attribute value of the StyleOptions. 215 * 216 * @type { StyledStringValue } 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @crossplatform 219 * @atomicservice 220 * @since 12 221 */ 222 styledValue: StyledStringValue; 223} 224 225/** 226 * SpanStyle 227 * 228 * @interface SpanStyle 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @crossplatform 231 * @atomicservice 232 * @since 12 233 */ 234declare interface SpanStyle { 235 /** 236 * The start position of the SpanStyle. 237 * 238 * @type { number } 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @crossplatform 241 * @atomicservice 242 * @since 12 243 */ 244 start: number; 245 246 /** 247 * The length of the modifiedStyledString's characters. 248 * 249 * @type { number } 250 * @syscap SystemCapability.ArkUI.ArkUI.Full 251 * @crossplatform 252 * @atomicservice 253 * @since 12 254 */ 255 length: number; 256 257 /** 258 * The attribute key of the SpanStyle. 259 * 260 * @type { StyledStringKey } 261 * @syscap SystemCapability.ArkUI.ArkUI.Full 262 * @crossplatform 263 * @atomicservice 264 * @since 12 265 */ 266 styledKey: StyledStringKey; 267 268 /** 269 * The attribute value of the SpanStyle. 270 * 271 * @type { StyledStringValue } 272 * @syscap SystemCapability.ArkUI.ArkUI.Full 273 * @crossplatform 274 * @atomicservice 275 * @since 12 276 */ 277 styledValue: StyledStringValue; 278} 279 280/** 281 * Defines TextStyle. 282 * 283 * @syscap SystemCapability.ArkUI.ArkUI.Full 284 * @crossplatform 285 * @atomicservice 286 * @since 12 287 */ 288declare class TextStyle { 289 290 /** 291 * constructor. 292 * 293 * @param { TextStyleInterface } [value] - font property object. 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @crossplatform 296 * @atomicservice 297 * @since 12 298 */ 299 constructor(value?: TextStyleInterface); 300 301 /** 302 * Get the fontColor of the StyledString. 303 * 304 * @type { ?ResourceColor } - the set fontColor of the StyledString or undefined 305 * @readonly 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @crossplatform 308 * @atomicservice 309 * @since 12 310 */ 311 readonly fontColor?: ResourceColor; 312 313 /** 314 * Get the fontFamily of the StyledString. 315 * 316 * @type { ?string } - the fontFamily of the StyledString or undefined 317 * @readonly 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @crossplatform 320 * @atomicservice 321 * @since 12 322 */ 323 readonly fontFamily?: string; 324 325 /** 326 * Get the fontSize of the StyledString. 327 * If not undefined, the unit is vp. 328 * 329 * @type { ?number } - the fontSize of the StyledString or undefined 330 * @readonly 331 * @syscap SystemCapability.ArkUI.ArkUI.Full 332 * @crossplatform 333 * @atomicservice 334 * @since 12 335 */ 336 readonly fontSize?: number; 337 338 /** 339 * Get the fontWeight of the StyledString. 340 * 341 * @type { ?number } - the fontWeight of the StyledString or undefined 342 * @readonly 343 * @syscap SystemCapability.ArkUI.ArkUI.Full 344 * @crossplatform 345 * @atomicservice 346 * @since 12 347 */ 348 readonly fontWeight?: number; 349 350 /** 351 * Get the fontStyle of the StyledString. 352 * 353 * @type { ?FontStyle } - the fontStyle of the StyledString or undefined 354 * @readonly 355 * @syscap SystemCapability.ArkUI.ArkUI.Full 356 * @crossplatform 357 * @atomicservice 358 * @since 12 359 */ 360 readonly fontStyle?: FontStyle; 361} 362 363/** 364 * TextStyleInterface 365 * 366 * @interface TextStyleInterface 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @crossplatform 369 * @atomicservice 370 * @since 12 371 */ 372declare interface TextStyleInterface { 373 /** 374 * The fontColor value of the font property object. 375 * 376 * @type { ?ResourceColor } 377 * @syscap SystemCapability.ArkUI.ArkUI.Full 378 * @crossplatform 379 * @atomicservice 380 * @since 12 381 */ 382 fontColor?: ResourceColor; 383 384 /** 385 * The fontFamily value of the font property object. 386 * 387 * @type { ?ResourceStr } 388 * @syscap SystemCapability.ArkUI.ArkUI.Full 389 * @crossplatform 390 * @atomicservice 391 * @since 12 392 */ 393 fontFamily?: ResourceStr; 394 395 /** 396 * The fontSize value of the font property object. 397 * 398 * @type { ?LengthMetrics } 399 * @syscap SystemCapability.ArkUI.ArkUI.Full 400 * @crossplatform 401 * @atomicservice 402 * @since 12 403 */ 404 fontSize?: LengthMetrics; 405 406 /** 407 * The fontWeight value of the font property object. 408 * 409 * @type { ?(number | FontWeight | string) } 410 * @syscap SystemCapability.ArkUI.ArkUI.Full 411 * @crossplatform 412 * @atomicservice 413 * @since 12 414 */ 415 fontWeight?: number | FontWeight | string; 416 417 /** 418 * The fontStyle value of the font property object. 419 * 420 * @type { ?FontStyle } 421 * @syscap SystemCapability.ArkUI.ArkUI.Full 422 * @crossplatform 423 * @atomicservice 424 * @since 12 425 */ 426 fontStyle?: FontStyle; 427} 428 429/** 430 * Defines DecorationStyle. 431 * 432 * @syscap SystemCapability.ArkUI.ArkUI.Full 433 * @crossplatform 434 * @atomicservice 435 * @since 12 436 */ 437declare class DecorationStyle { 438 439 /** 440 * constructor. 441 * 442 * @param { DecorationStyleInterface } value - text decoration value. 443 * @syscap SystemCapability.ArkUI.ArkUI.Full 444 * @crossplatform 445 * @atomicservice 446 * @since 12 447 */ 448 constructor(value: DecorationStyleInterface); 449 450 /** 451 * Get the text decoration type of the StyledString. 452 * 453 * @type { TextDecorationType } - the decoration type of the StyledString 454 * @readonly 455 * @syscap SystemCapability.ArkUI.ArkUI.Full 456 * @crossplatform 457 * @atomicservice 458 * @since 12 459 */ 460 readonly type: TextDecorationType; 461 462 /** 463 * Get the decorationColor of the StyledString. 464 * 465 * @type { ?ResourceColor } - the decorationColor of the StyledString or undefined 466 * @readonly 467 * @syscap SystemCapability.ArkUI.ArkUI.Full 468 * @crossplatform 469 * @atomicservice 470 * @since 12 471 */ 472 readonly color?: ResourceColor; 473 474 /** 475 * Get the decorationStyle of the StyledString. 476 * 477 * @type { ?TextDecorationStyle } - the decorationStyle of the StyledString or undefined 478 * @readonly 479 * @syscap SystemCapability.ArkUI.ArkUI.Full 480 * @crossplatform 481 * @atomicservice 482 * @since 12 483 */ 484 readonly style?: TextDecorationStyle; 485} 486 487/** 488 * DecorationStyleInterface 489 * 490 * @interface DecorationStyleInterface 491 * @syscap SystemCapability.ArkUI.ArkUI.Full 492 * @crossplatform 493 * @atomicservice 494 * @since 12 495 */ 496declare interface DecorationStyleInterface { 497 /** 498 * The type value of the decoration property object. 499 * 500 * @type { TextDecorationType } 501 * @syscap SystemCapability.ArkUI.ArkUI.Full 502 * @crossplatform 503 * @atomicservice 504 * @since 12 505 */ 506 type: TextDecorationType; 507 508 /** 509 * The color value of the decoration property object. 510 * 511 * @type { ?ResourceColor } 512 * @syscap SystemCapability.ArkUI.ArkUI.Full 513 * @crossplatform 514 * @atomicservice 515 * @since 12 516 */ 517 color?: ResourceColor; 518 519 /** 520 * The style value of the decoration property object. 521 * 522 * @type { ?TextDecorationStyle } 523 * @syscap SystemCapability.ArkUI.ArkUI.Full 524 * @crossplatform 525 * @atomicservice 526 * @since 12 527 */ 528 style?: TextDecorationStyle; 529} 530 531/** 532 * Defines BaselineOffsetStyle. 533 * 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @crossplatform 536 * @atomicservice 537 * @since 12 538 */ 539declare class BaselineOffsetStyle { 540 541 /** 542 * constructor. 543 * 544 * @param { LengthMetrics } value - baseline offset value. 545 * @syscap SystemCapability.ArkUI.ArkUI.Full 546 * @crossplatform 547 * @atomicservice 548 * @since 12 549 */ 550 constructor(value: LengthMetrics); 551 552 /** 553 * Get the baselineOffset value of the StyledString. 554 * The unit is vp. 555 * 556 * @type { number } - the baselineOffset value of the StyledString 557 * @readonly 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @crossplatform 560 * @atomicservice 561 * @since 12 562 */ 563 readonly baselineOffset: number; 564} 565 566/** 567 * Defines LetterSpacingStyle. 568 * 569 * @syscap SystemCapability.ArkUI.ArkUI.Full 570 * @crossplatform 571 * @atomicservice 572 * @since 12 573 */ 574declare class LetterSpacingStyle { 575 576 /** 577 * constructor. 578 * 579 * @param { LengthMetrics } value - letter space value. 580 * @syscap SystemCapability.ArkUI.ArkUI.Full 581 * @crossplatform 582 * @atomicservice 583 * @since 12 584 */ 585 constructor(value: LengthMetrics); 586 587 /** 588 * Get the letterSpacing value of the StyledString. 589 * The unit is vp. 590 * 591 * @type { number } - the letterSpacing value of the StyledString 592 * @readonly 593 * @syscap SystemCapability.ArkUI.ArkUI.Full 594 * @crossplatform 595 * @atomicservice 596 * @since 12 597 */ 598 readonly letterSpacing: number; 599} 600 601/** 602 * Defines TextShadowStyle. 603 * 604 * @syscap SystemCapability.ArkUI.ArkUI.Full 605 * @crossplatform 606 * @atomicservice 607 * @since 12 608 */ 609declare class TextShadowStyle { 610 611 /** 612 * constructor. 613 * 614 * @param { ShadowOptions | Array<ShadowOptions> } value - text shadow value. 615 * @syscap SystemCapability.ArkUI.ArkUI.Full 616 * @crossplatform 617 * @atomicservice 618 * @since 12 619 */ 620 constructor(value: ShadowOptions | Array<ShadowOptions>); 621 622 /** 623 * Get the textShadow value of the StyledString. 624 * 625 * @type { Array<ShadowOptions> } - the textShadow value of the StyledString 626 * @readonly 627 * @syscap SystemCapability.ArkUI.ArkUI.Full 628 * @crossplatform 629 * @atomicservice 630 * @since 12 631 */ 632 readonly textShadow: Array<ShadowOptions>; 633} 634 635/** 636 * Defines Sets the property string background color. 637 * 638 * @syscap SystemCapability.ArkUI.ArkUI.Full 639 * @crossplatform 640 * @atomicservice 641 * @since 14 642 */ 643declare class BackgroundColorStyle { 644 645 /** 646 * constructor. 647 * 648 * @param { TextBackgroundStyle } textBackgroundStyle - textBackgroundStyle value. 649 * @syscap SystemCapability.ArkUI.ArkUI.Full 650 * @crossplatform 651 * @atomicservice 652 * @since 14 653 */ 654 constructor(textBackgroundStyle: TextBackgroundStyle); 655 656 /** 657 * Get the textBackgroundStyle value of the StyledString. 658 * 659 * @type { TextBackgroundStyle } - the textBackgroundStyle value of the StyledString 660 * @readonly 661 * @syscap SystemCapability.ArkUI.ArkUI.Full 662 * @crossplatform 663 * @atomicservice 664 * @since 14 665 */ 666 readonly textBackgroundStyle: TextBackgroundStyle; 667} 668 669/** 670 * Defines GestureStyle. 671 * 672 * @syscap SystemCapability.ArkUI.ArkUI.Full 673 * @crossplatform 674 * @atomicservice 675 * @since 12 676 */ 677declare class GestureStyle { 678 679 /** 680 * constructor. 681 * 682 * @param { GestureStyleInterface } [value] - gesture event object. 683 * @syscap SystemCapability.ArkUI.ArkUI.Full 684 * @crossplatform 685 * @atomicservice 686 * @since 12 687 */ 688 constructor(value?: GestureStyleInterface); 689} 690 691/** 692 * Defines the Gesture Events. 693 * 694 * @interface GestureStyleInterface 695 * @syscap SystemCapability.ArkUI.ArkUI.Full 696 * @crossplatform 697 * @atomicservice 698 * @since 12 699 */ 700declare interface GestureStyleInterface { 701 /** 702 * Trigger a click event when a click is clicked. 703 * 704 * @type { ?Callback<ClickEvent> } 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @crossplatform 707 * @atomicservice 708 * @since 12 709 */ 710 onClick?: Callback<ClickEvent>; 711 712 /** 713 * Trigger a gesture event when long press event is complete. 714 * 715 * @type { ?Callback<GestureEvent> } 716 * @syscap SystemCapability.ArkUI.ArkUI.Full 717 * @crossplatform 718 * @atomicservice 719 * @since 12 720 */ 721 onLongPress?: Callback<GestureEvent>; 722} 723 724/** 725 * Defines ParagraphStyle. 726 * 727 * @syscap SystemCapability.ArkUI.ArkUI.Full 728 * @crossplatform 729 * @atomicservice 730 * @since 12 731 */ 732declare class ParagraphStyle { 733 734 /** 735 * constructor. 736 * 737 * @param { ParagraphStyleInterface } [value] - paragraph property object. 738 * @syscap SystemCapability.ArkUI.ArkUI.Full 739 * @crossplatform 740 * @atomicservice 741 * @since 12 742 */ 743 constructor(value?: ParagraphStyleInterface); 744 745 /** 746 * Get the text alignment of the StyledString. 747 * 748 * @type { ?TextAlign } - the text alignment of the StyledString or undefined 749 * @readonly 750 * @syscap SystemCapability.ArkUI.ArkUI.Full 751 * @crossplatform 752 * @atomicservice 753 * @since 12 754 */ 755 readonly textAlign?: TextAlign; 756 757 /** 758 * Get the first line indentation of the StyledString. 759 * The unit is vp. 760 * 761 * @type { ?number } - the first line indentation of the StyledString or undefined 762 * @readonly 763 * @syscap SystemCapability.ArkUI.ArkUI.Full 764 * @crossplatform 765 * @atomicservice 766 * @since 12 767 */ 768 readonly textIndent?: number; 769 770 /** 771 * Get the maximum number of lines of the StyledString. 772 * 773 * @type { ?number } - the maximum number of the StyledString or undefined 774 * @readonly 775 * @syscap SystemCapability.ArkUI.ArkUI.Full 776 * @crossplatform 777 * @atomicservice 778 * @since 12 779 */ 780 readonly maxLines?: number; 781 782 /** 783 * Get the overflow mode of the StyledString. 784 * 785 * @type { ?TextOverflow } - the overflow mode of the StyledString or undefined 786 * @readonly 787 * @syscap SystemCapability.ArkUI.ArkUI.Full 788 * @crossplatform 789 * @atomicservice 790 * @since 12 791 */ 792 readonly overflow?: TextOverflow; 793 794 /** 795 * Get the wordBreak mode of the StyledString. 796 * 797 * @type { ?WordBreak } - the wordBreak mode of the StyledString or undefined 798 * @readonly 799 * @syscap SystemCapability.ArkUI.ArkUI.Full 800 * @crossplatform 801 * @atomicservice 802 * @since 12 803 */ 804 readonly wordBreak?: WordBreak; 805 806 /** 807 * Get the leading margin of the StyledString. 808 * 809 * @type { ?(number | LeadingMarginPlaceholder) } - the leading margin of the StyledString or undefined 810 * @readonly 811 * @syscap SystemCapability.ArkUI.ArkUI.Full 812 * @crossplatform 813 * @atomicservice 814 * @since 12 815 */ 816 readonly leadingMargin?: number | LeadingMarginPlaceholder; 817} 818 819/** 820 * ParagraphStyleInterface 821 * 822 * @interface ParagraphStyleInterface 823 * @syscap SystemCapability.ArkUI.ArkUI.Full 824 * @crossplatform 825 * @atomicservice 826 * @since 12 827 */ 828declare interface ParagraphStyleInterface { 829 /** 830 * Alignment of text. 831 * 832 * @type { ?TextAlign } 833 * @syscap SystemCapability.ArkUI.ArkUI.Full 834 * @crossplatform 835 * @atomicservice 836 * @since 12 837 */ 838 textAlign?: TextAlign; 839 840 /** 841 * Set the first line indentation. 842 * 843 * @type { ?LengthMetrics } 844 * @syscap SystemCapability.ArkUI.ArkUI.Full 845 * @crossplatform 846 * @atomicservice 847 * @since 12 848 */ 849 textIndent?: LengthMetrics; 850 851 /** 852 * The maximum number of lines of content. 853 * 854 * @type { ?number } 855 * @syscap SystemCapability.ArkUI.ArkUI.Full 856 * @crossplatform 857 * @atomicservice 858 * @since 12 859 */ 860 maxLines?: number; 861 862 /** 863 * The overflow mode of the content. 864 * 865 * @type { ?TextOverflow } 866 * @syscap SystemCapability.ArkUI.ArkUI.Full 867 * @crossplatform 868 * @atomicservice 869 * @since 12 870 */ 871 overflow?: TextOverflow; 872 873 /** 874 * Set word break type. 875 * 876 * @type { ?WordBreak } 877 * @syscap SystemCapability.ArkUI.ArkUI.Full 878 * @crossplatform 879 * @atomicservice 880 * @since 12 881 */ 882 wordBreak?: WordBreak; 883 884 /** 885 * Leading margin. 886 * 887 * @type { ?(LengthMetrics | LeadingMarginPlaceholder) } 888 * @syscap SystemCapability.ArkUI.ArkUI.Full 889 * @crossplatform 890 * @atomicservice 891 * @since 12 892 */ 893 leadingMargin?: LengthMetrics | LeadingMarginPlaceholder; 894} 895 896/** 897 * Defines LineHeightStyle. 898 * 899 * @syscap SystemCapability.ArkUI.ArkUI.Full 900 * @crossplatform 901 * @atomicservice 902 * @since 12 903 */ 904declare class LineHeightStyle { 905 906 /** 907 * constructor. 908 * 909 * @param { LengthMetrics } lineHeight - line height value. 910 * @syscap SystemCapability.ArkUI.ArkUI.Full 911 * @crossplatform 912 * @atomicservice 913 * @since 12 914 */ 915 constructor(lineHeight: LengthMetrics); 916 917 /** 918 * Get the lineHeight value of the StyledString. 919 * The unit is vp. 920 * 921 * @type { number } - the lineHeight value of the StyledString 922 * @readonly 923 * @syscap SystemCapability.ArkUI.ArkUI.Full 924 * @crossplatform 925 * @atomicservice 926 * @since 12 927 */ 928 readonly lineHeight: number; 929} 930 931/** 932 * Defines the URLStyle hyperlink that allows setting a URL string. When clicking on the text to 933 * which the span is attached, the URLStyle will try to open the URL. 934 * 935 * @syscap SystemCapability.ArkUI.ArkUI.Full 936 * @crossplatform 937 * @atomicservice 938 * @since 14 939 */ 940declare class UrlStyle { 941 942 /** 943 * Constructor. 944 * 945 * @param { string } url - URL value. 946 * @syscap SystemCapability.ArkUI.ArkUI.Full 947 * @crossplatform 948 * @atomicservice 949 * @since 14 950 */ 951 constructor(url: string); 952 953 /** 954 * Get the URL value of the StyledString. 955 * 956 * @type { string } - the URL value of the StyledString 957 * @readonly 958 * @syscap SystemCapability.ArkUI.ArkUI.Full 959 * @crossplatform 960 * @atomicservice 961 * @since 14 962 */ 963 readonly url: string; 964} 965 966/** 967 * Defines the Span Type. 968 * 969 * @typedef { TextStyle | DecorationStyle | BaselineOffsetStyle | LetterSpacingStyle | TextShadowStyle | 970 * GestureStyle | ImageAttachment | ParagraphStyle | LineHeightStyle | CustomSpan | 971 * UserDataSpan } StyledStringValue 972 * @syscap SystemCapability.ArkUI.ArkUI.Full 973 * @crossplatform 974 * @atomicservice 975 * @since 12 976 */ 977 978/** 979 * Defines the Span Type. 980 * 981 * @typedef { TextStyle | DecorationStyle | BaselineOffsetStyle | LetterSpacingStyle | TextShadowStyle | 982 * GestureStyle | ImageAttachment | ParagraphStyle | LineHeightStyle | UrlStyle | CustomSpan | 983 * UserDataSpan | BackgroundColorStyle } StyledStringValue 984 * @syscap SystemCapability.ArkUI.ArkUI.Full 985 * @crossplatform 986 * @atomicservice 987 * @since 14 988 */ 989declare type StyledStringValue = TextStyle | DecorationStyle | BaselineOffsetStyle | LetterSpacingStyle | 990TextShadowStyle | GestureStyle | ImageAttachment | ParagraphStyle | LineHeightStyle | UrlStyle | CustomSpan | 991UserDataSpan | BackgroundColorStyle; 992 993/** 994 * MutableStyledString 995 * 996 * @extends StyledString 997 * @syscap SystemCapability.ArkUI.ArkUI.Full 998 * @crossplatform 999 * @atomicservice 1000 * @since 12 1001 */ 1002declare class MutableStyledString extends StyledString { 1003 /** 1004 * Replace the string of the specified range. 1005 * 1006 * @param { number } start - the start position of the replacedString. 1007 * @param { number } length - the length of the replacedString's characters. 1008 * @param { string } other - must be unicode string. 1009 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1010 * <br> 1. Mandatory parameters are left unspecified. 1011 * <br> 2. Incorrect parameters types. 1012 * <br> 3. Parameter verification failed. 1013 * @syscap SystemCapability.ArkUI.ArkUI.Full 1014 * @crossplatform 1015 * @atomicservice 1016 * @since 12 1017 */ 1018 replaceString(start: number, length: number, other: string): void; 1019 1020 /** 1021 * Insert the string at the specified location. 1022 * 1023 * @param { number } start - the start position of the insertedString. 1024 * @param { string } other - must be unicode string. 1025 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1026 * <br> 1. Mandatory parameters are left unspecified. 1027 * <br> 2. Incorrect parameters types. 1028 * <br> 3. Parameter verification failed. 1029 * @syscap SystemCapability.ArkUI.ArkUI.Full 1030 * @crossplatform 1031 * @atomicservice 1032 * @since 12 1033 */ 1034 insertString(start: number, other: string): void; 1035 1036 /** 1037 * Remove the string of the specified range. 1038 * 1039 * @param { number } start - the start position of the removedString. 1040 * @param { number } length - the length of the removedString's characters. 1041 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1042 * <br> 1. Mandatory parameters are left unspecified. 1043 * <br> 2. Incorrect parameters types. 1044 * <br> 3. Parameter verification failed. 1045 * @syscap SystemCapability.ArkUI.ArkUI.Full 1046 * @crossplatform 1047 * @atomicservice 1048 * @since 12 1049 */ 1050 removeString(start: number, length: number): void; 1051 1052 /** 1053 * Replace the specified range string attribute. 1054 * 1055 * @param { SpanStyle } spanStyle - the SpanStyle Object. 1056 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1057 * <br> 1. Mandatory parameters are left unspecified. 1058 * <br> 2. Incorrect parameters types. 1059 * <br> 3. Parameter verification failed. 1060 * @syscap SystemCapability.ArkUI.ArkUI.Full 1061 * @crossplatform 1062 * @atomicservice 1063 * @since 12 1064 */ 1065 replaceStyle(spanStyle: SpanStyle): void; 1066 1067 /** 1068 * Add attributes to the specified range string. 1069 * 1070 * @param { SpanStyle } spanStyle - the SpanStyle Object. 1071 * @throws { BusinessError } 401 - The parameter check failed. 1072 * @syscap SystemCapability.ArkUI.ArkUI.Full 1073 * @crossplatform 1074 * @atomicservice 1075 * @since 12 1076 */ 1077 setStyle(spanStyle: SpanStyle): void; 1078 1079 /** 1080 * Delete the specified type attributes for the specified range string. 1081 * 1082 * @param { number } start - the start position of the removedAttributeStyledString. 1083 * @param { number } length - the length of the removedAttributeStyledString's characters. 1084 * @param { StyledStringKey } styledKey - the specified attribute type's key. 1085 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1086 * <br> 1. Mandatory parameters are left unspecified. 1087 * <br> 2. Incorrect parameters types. 1088 * <br> 3. Parameter verification failed. 1089 * @syscap SystemCapability.ArkUI.ArkUI.Full 1090 * @crossplatform 1091 * @atomicservice 1092 * @since 12 1093 */ 1094 removeStyle(start: number, length: number, styledKey: StyledStringKey): void; 1095 1096 /** 1097 * Delete all attributes for the specified range styledString. 1098 * 1099 * @param { number } start - the start position of the attributeRemovedStyledString's characters. 1100 * @param { number } length - the length of the attributeRemovedStyledString's characters. 1101 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1102 * <br> 1. Mandatory parameters are left unspecified. 1103 * <br> 2. Incorrect parameters types. 1104 * <br> 3. Parameter verification failed. 1105 * @syscap SystemCapability.ArkUI.ArkUI.Full 1106 * @crossplatform 1107 * @atomicservice 1108 * @since 12 1109 */ 1110 removeStyles(start: number, length: number): void; 1111 1112 /** 1113 * Delete all attributes. 1114 * 1115 * @syscap SystemCapability.ArkUI.ArkUI.Full 1116 * @crossplatform 1117 * @atomicservice 1118 * @since 12 1119 */ 1120 clearStyles(): void; 1121 1122 /** 1123 * Replace the StyledString of the specified range. 1124 * 1125 * @param { number } start - the start position of the replacedStyledString. 1126 * @param { number } length - the length of the replacedStyledString's characters. 1127 * @param { StyledString } other - new StyledString. 1128 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1129 * <br> 1. Mandatory parameters are left unspecified. 1130 * <br> 2. Incorrect parameters types. 1131 * <br> 3. Parameter verification failed. 1132 * @syscap SystemCapability.ArkUI.ArkUI.Full 1133 * @crossplatform 1134 * @atomicservice 1135 * @since 12 1136 */ 1137 replaceStyledString(start: number, length: number, other: StyledString): void; 1138 1139 /** 1140 * Insert new StyledString at the specified location. 1141 * 1142 * @param { number } start - the start position of the insertedStyledString. 1143 * @param { StyledString } other - new StyledString. 1144 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1145 * <br> 1. Mandatory parameters are left unspecified. 1146 * <br> 2. Incorrect parameters types. 1147 * <br> 3. Parameter verification failed. 1148 * @syscap SystemCapability.ArkUI.ArkUI.Full 1149 * @crossplatform 1150 * @atomicservice 1151 * @since 12 1152 */ 1153 insertStyledString(start: number, other: StyledString): void; 1154 1155 /** 1156 * Append new StyledString at the end. 1157 * 1158 * @param { StyledString } other - new StyledString. 1159 * @syscap SystemCapability.ArkUI.ArkUI.Full 1160 * @crossplatform 1161 * @atomicservice 1162 * @since 12 1163 */ 1164 appendStyledString(other: StyledString): void; 1165} 1166 1167 1168/** 1169 * the attribute type of the StyledString 1170 * 1171 * @enum { number } 1172 * @syscap SystemCapability.ArkUI.ArkUI.Full 1173 * @crossplatform 1174 * @atomicservice 1175 * @since 12 1176 */ 1177declare enum StyledStringKey { 1178 /** 1179 * The key of TextStyle. 1180 * 1181 * @syscap SystemCapability.ArkUI.ArkUI.Full 1182 * @crossplatform 1183 * @atomicservice 1184 * @since 12 1185 */ 1186 FONT = 0, 1187 1188 /** 1189 * The key of DecorationStyle. 1190 * 1191 * @syscap SystemCapability.ArkUI.ArkUI.Full 1192 * @crossplatform 1193 * @atomicservice 1194 * @since 12 1195 */ 1196 DECORATION = 1, 1197 1198 /** 1199 * The key of BaselineOffsetStyle. 1200 * 1201 * @syscap SystemCapability.ArkUI.ArkUI.Full 1202 * @crossplatform 1203 * @atomicservice 1204 * @since 12 1205 */ 1206 BASELINE_OFFSET = 2, 1207 1208 /** 1209 * The key of LetterSpacingStyle. 1210 * 1211 * @syscap SystemCapability.ArkUI.ArkUI.Full 1212 * @crossplatform 1213 * @atomicservice 1214 * @since 12 1215 */ 1216 LETTER_SPACING = 3, 1217 1218 /** 1219 * The key of TextShadowStyle. 1220 * 1221 * @syscap SystemCapability.ArkUI.ArkUI.Full 1222 * @crossplatform 1223 * @atomicservice 1224 * @since 12 1225 */ 1226 TEXT_SHADOW = 4, 1227 1228 /** 1229 * The key of LineHeightStyle. 1230 * 1231 * @syscap SystemCapability.ArkUI.ArkUI.Full 1232 * @crossplatform 1233 * @atomicservice 1234 * @since 12 1235 */ 1236 LINE_HEIGHT = 5, 1237 1238 /** 1239 * The key of BackgroundColorStyle. 1240 * 1241 * @syscap SystemCapability.ArkUI.ArkUI.Full 1242 * @crossplatform 1243 * @atomicservice 1244 * @since 14 1245 */ 1246 BACKGROUND_COLOR = 6, 1247 1248 /** 1249 * The key of UrlStyle. 1250 * 1251 * @syscap SystemCapability.ArkUI.ArkUI.Full 1252 * @crossplatform 1253 * @atomicservice 1254 * @since 14 1255 */ 1256 URL = 7, 1257 1258 /** 1259 * The key of GestureStyle. 1260 * 1261 * @syscap SystemCapability.ArkUI.ArkUI.Full 1262 * @crossplatform 1263 * @atomicservice 1264 * @since 12 1265 */ 1266 GESTURE = 100, 1267 1268 /** 1269 * The key of ParagraphStyle. 1270 * 1271 * @syscap SystemCapability.ArkUI.ArkUI.Full 1272 * @crossplatform 1273 * @atomicservice 1274 * @since 12 1275 */ 1276 PARAGRAPH_STYLE = 200, 1277 1278 /** 1279 * The key of ImageAttachment. 1280 * 1281 * @syscap SystemCapability.ArkUI.ArkUI.Full 1282 * @crossplatform 1283 * @atomicservice 1284 * @since 12 1285 */ 1286 IMAGE = 300, 1287 1288 /** 1289 * The key of CustomSpan. 1290 * 1291 * @syscap SystemCapability.ArkUI.ArkUI.Full 1292 * @crossplatform 1293 * @atomicservice 1294 * @since 12 1295 */ 1296 CUSTOM_SPAN = 400, 1297 1298 /** 1299 * The key of UserDataSpan. 1300 * 1301 * @syscap SystemCapability.ArkUI.ArkUI.Full 1302 * @crossplatform 1303 * @atomicservice 1304 * @since 12 1305 */ 1306 USER_DATA = 500, 1307} 1308 1309/** 1310 * Defines ImageAttachment. 1311 * 1312 * @syscap SystemCapability.ArkUI.ArkUI.Full 1313 * @crossplatform 1314 * @atomicservice 1315 * @since 12 1316 */ 1317declare class ImageAttachment { 1318 1319 /** 1320 * constructor. 1321 * 1322 * @param { ImageAttachmentInterface } value - image attachment object. 1323 * @syscap SystemCapability.ArkUI.ArkUI.Full 1324 * @crossplatform 1325 * @atomicservice 1326 * @since 12 1327 */ 1328 constructor(value: ImageAttachmentInterface); 1329 1330 /** 1331 * constructor supported by AttachmentType. 1332 * 1333 * @param { Optional<AttachmentType> } attachment - image attachment object. 1334 * @syscap SystemCapability.ArkUI.ArkUI.Full 1335 * @crossplatform 1336 * @atomicservice 1337 * @since 15 1338 */ 1339 constructor(attachment: Optional<AttachmentType>); 1340 1341 /** 1342 * Get the image content of the StyledString. 1343 * 1344 * @type { PixelMap } - the image content of the StyledString or undefined 1345 * @readonly 1346 * @syscap SystemCapability.ArkUI.ArkUI.Full 1347 * @crossplatform 1348 * @atomicservice 1349 * @since 12 1350 */ 1351 readonly value: PixelMap; 1352 1353 /** 1354 * Get the imageSize of the StyledString. 1355 * 1356 * @type { ?SizeOptions } - the imageSize of the StyledString or undefined 1357 * @readonly 1358 * @syscap SystemCapability.ArkUI.ArkUI.Full 1359 * @crossplatform 1360 * @atomicservice 1361 * @since 12 1362 */ 1363 readonly size?: SizeOptions; 1364 1365 /** 1366 * Get the ImageSpanAlignment of the StyledString. 1367 * 1368 * @type { ?ImageSpanAlignment } - the ImageSpanAlignment of the StyledString or undefined 1369 * @readonly 1370 * @syscap SystemCapability.ArkUI.ArkUI.Full 1371 * @crossplatform 1372 * @atomicservice 1373 * @since 12 1374 */ 1375 readonly verticalAlign?: ImageSpanAlignment; 1376 1377 /** 1378 * Get the imageFit of the StyledString. 1379 * 1380 * @type { ?ImageFit } - the imageFit of the StyledString or undefined 1381 * @readonly 1382 * @syscap SystemCapability.ArkUI.ArkUI.Full 1383 * @crossplatform 1384 * @atomicservice 1385 * @since 12 1386 */ 1387 readonly objectFit?: ImageFit; 1388 1389 /** 1390 * Get the imageAttachmentLayoutStyle of the StyledString. 1391 * 1392 * @type { ?ImageAttachmentLayoutStyle } - the imageAttachmentLayoutStyle of the StyledString or undefined 1393 * @readonly 1394 * @syscap SystemCapability.ArkUI.ArkUI.Full 1395 * @crossplatform 1396 * @atomicservice 1397 * @since 12 1398 */ 1399 readonly layoutStyle?: ImageAttachmentLayoutStyle; 1400 1401 /** 1402 * Get the imageAttachment colorFilter of the StyledString. 1403 * 1404 * @type { ?ColorFilterType } - the imageAttachment colorFilter of the StyledString or undefined 1405 * @readonly 1406 * @syscap SystemCapability.ArkUI.ArkUI.Full 1407 * @crossplatform 1408 * @atomicservice 1409 * @since 15 1410 */ 1411 readonly colorFilter?: ColorFilterType; 1412} 1413 1414/** 1415 * Defines the ResourceImageAttachmentOptions. 1416 * 1417 * @interface ResourceImageAttachmentOptions 1418 * @syscap SystemCapability.ArkUI.ArkUI.Full 1419 * @crossplatform 1420 * @atomicservice 1421 * @since 15 1422 */ 1423declare interface ResourceImageAttachmentOptions { 1424 /** 1425 * The content of the ResourceImageAttachment. 1426 * 1427 * @type { Optional<ResourceStr> } 1428 * @syscap SystemCapability.ArkUI.ArkUI.Full 1429 * @crossplatform 1430 * @atomicservice 1431 * @since 15 1432 */ 1433 resourceValue: Optional<ResourceStr>; 1434 1435 /** 1436 * size of the ResourceImage. 1437 * 1438 * @type { ?SizeOptions } 1439 * @syscap SystemCapability.ArkUI.ArkUI.Full 1440 * @crossplatform 1441 * @atomicservice 1442 * @since 15 1443 */ 1444 size?: SizeOptions; 1445 1446 /** 1447 * Image vertical align. 1448 * 1449 * @type { ?ImageSpanAlignment } 1450 * @syscap SystemCapability.ArkUI.ArkUI.Full 1451 * @crossplatform 1452 * @atomicservice 1453 * @since 15 1454 */ 1455 verticalAlign?: ImageSpanAlignment; 1456 1457 /** 1458 * Sets the zoom type of the ImageAttachment. 1459 * 1460 * @type { ?ImageFit } 1461 * @syscap SystemCapability.ArkUI.ArkUI.Full 1462 * @crossplatform 1463 * @atomicservice 1464 * @since 15 1465 */ 1466 objectFit?: ImageFit; 1467 1468 /** 1469 * The Image Layout Style of the Resource Image. 1470 * 1471 * @type { ?ImageAttachmentLayoutStyle } 1472 * @syscap SystemCapability.ArkUI.ArkUI.Full 1473 * @crossplatform 1474 * @atomicservice 1475 * @since 15 1476 */ 1477 layoutStyle?: ImageAttachmentLayoutStyle; 1478 1479 /** 1480 * Sets the color filter effect on the image attachment. 1481 * 1482 * @type { ?ColorFilterType } filter ColorFilter object. 1483 * @syscap SystemCapability.ArkUI.ArkUI.Full 1484 * @crossplatform 1485 * @atomicservice 1486 * @since 15 1487 */ 1488 colorFilter?: ColorFilterType; 1489 1490 /** 1491 * Sets the synchronous or asynchronous mode for image loading. 1492 * The default parameter type is bool, and the default value is false. 1493 * 1494 * @type { ?boolean } 1495 * @syscap SystemCapability.ArkUI.ArkUI.Full 1496 * @crossplatform 1497 * @atomicservice 1498 * @since 15 1499 */ 1500 syncLoad?: boolean; 1501} 1502 1503/** 1504 * Defines the ImageAttachmentInterface. 1505 * 1506 * @interface ImageAttachmentInterface 1507 * @syscap SystemCapability.ArkUI.ArkUI.Full 1508 * @crossplatform 1509 * @atomicservice 1510 * @since 12 1511 */ 1512declare interface ImageAttachmentInterface { 1513 /** 1514 * The content of the ImageAttachment. 1515 * 1516 * @type { PixelMap } 1517 * @syscap SystemCapability.ArkUI.ArkUI.Full 1518 * @crossplatform 1519 * @atomicservice 1520 * @since 12 1521 */ 1522 value: PixelMap; 1523 1524 /** 1525 * Image size. 1526 * 1527 * @type { ?SizeOptions } 1528 * @syscap SystemCapability.ArkUI.ArkUI.Full 1529 * @crossplatform 1530 * @atomicservice 1531 * @since 12 1532 */ 1533 size?: SizeOptions; 1534 1535 /** 1536 * Image vertical align. 1537 * 1538 * @type { ?ImageSpanAlignment } 1539 * @syscap SystemCapability.ArkUI.ArkUI.Full 1540 * @crossplatform 1541 * @atomicservice 1542 * @since 12 1543 */ 1544 verticalAlign?: ImageSpanAlignment; 1545 1546 /** 1547 * Image fit. 1548 * 1549 * @type { ?ImageFit } 1550 * @syscap SystemCapability.ArkUI.ArkUI.Full 1551 * @crossplatform 1552 * @atomicservice 1553 * @since 12 1554 */ 1555 objectFit?: ImageFit; 1556 1557 /** 1558 * The Image Layout Style. 1559 * 1560 * @type { ?ImageAttachmentLayoutStyle } 1561 * @syscap SystemCapability.ArkUI.ArkUI.Full 1562 * @crossplatform 1563 * @atomicservice 1564 * @since 12 1565 */ 1566 layoutStyle?: ImageAttachmentLayoutStyle; 1567 1568 /** 1569 * Sets the color filter effect on the image attachment. 1570 * 1571 * @type { ?ColorFilterType } filter ColorFilter object. 1572 * @syscap SystemCapability.ArkUI.ArkUI.Full 1573 * @crossplatform 1574 * @atomicservice 1575 * @since 15 1576 */ 1577 colorFilter?: ColorFilterType; 1578} 1579 1580/** 1581 * Defines the Attachment Type. 1582 * 1583 * @typedef { ImageAttachmentInterface | ResourceImageAttachmentOptions } AttachmentType 1584 * @syscap SystemCapability.ArkUI.ArkUI.Full 1585 * @crossplatform 1586 * @atomicservice 1587 * @since 15 1588 */ 1589declare type AttachmentType = ImageAttachmentInterface | ResourceImageAttachmentOptions; 1590 1591/** 1592 * Defines the ColorFilter Type. 1593 * 1594 * @typedef { ColorFilter | DrawingColorFilter } ColorFilterType 1595 * @syscap SystemCapability.ArkUI.ArkUI.Full 1596 * @crossplatform 1597 * @atomicservice 1598 * @since 15 1599 */ 1600declare type ColorFilterType = ColorFilter | DrawingColorFilter; 1601 1602/** 1603 * Defines the ImageAttachment Layout Style. 1604 * 1605 * @interface ImageAttachmentLayoutStyle 1606 * @syscap SystemCapability.ArkUI.ArkUI.Full 1607 * @crossplatform 1608 * @atomicservice 1609 * @since 12 1610 */ 1611declare interface ImageAttachmentLayoutStyle { 1612 /** 1613 * Outer Margin. 1614 * 1615 * @type { ?(LengthMetrics | Margin) } 1616 * @syscap SystemCapability.ArkUI.ArkUI.Full 1617 * @crossplatform 1618 * @atomicservice 1619 * @since 12 1620 */ 1621 margin?: LengthMetrics | Margin; 1622 1623 /** 1624 * Inner margin. 1625 * 1626 * @type { ?(LengthMetrics | Padding) } 1627 * @syscap SystemCapability.ArkUI.ArkUI.Full 1628 * @crossplatform 1629 * @atomicservice 1630 * @since 12 1631 */ 1632 padding?: LengthMetrics | Padding; 1633 1634 /** 1635 * Border radius. 1636 * 1637 * @type { ?(LengthMetrics | BorderRadiuses) } 1638 * @syscap SystemCapability.ArkUI.ArkUI.Full 1639 * @crossplatform 1640 * @atomicservice 1641 * @since 12 1642 */ 1643 borderRadius?: LengthMetrics | BorderRadiuses; 1644} 1645 1646/** 1647 * Defines the CustomSpanMetrics interface. 1648 * 1649 * @interface CustomSpanMetrics 1650 * @syscap SystemCapability.ArkUI.ArkUI.Full 1651 * @crossplatform 1652 * @atomicservice 1653 * @since 12 1654 */ 1655declare interface CustomSpanMetrics { 1656 /** 1657 * CustomSpan Width. 1658 * The unit is vp. 1659 * 1660 * @type { number } 1661 * @default 0 1662 * @syscap SystemCapability.ArkUI.ArkUI.Full 1663 * @crossplatform 1664 * @atomicservice 1665 * @since 12 1666 */ 1667 width: number; 1668 1669 /** 1670 * CustomSpan Height. 1671 * The unit is vp. 1672 * 1673 * @type { ?number } 1674 * @syscap SystemCapability.ArkUI.ArkUI.Full 1675 * @crossplatform 1676 * @atomicservice 1677 * @since 12 1678 */ 1679 height?: number; 1680} 1681 1682/** 1683 * Defines the CustomSpanDrawInfo interface. 1684 * 1685 * @interface CustomSpanDrawInfo 1686 * @syscap SystemCapability.ArkUI.ArkUI.Full 1687 * @crossplatform 1688 * @atomicservice 1689 * @since 12 1690 */ 1691declare interface CustomSpanDrawInfo { 1692 /** 1693 * CustomSpan's offset relative to the parent component. 1694 * The unit is px. 1695 * 1696 * @type { number } 1697 * @syscap SystemCapability.ArkUI.ArkUI.Full 1698 * @crossplatform 1699 * @atomicservice 1700 * @since 12 1701 */ 1702 x: number; 1703 1704 /** 1705 * The top position of the line where customSpan is located. 1706 * The unit is px. 1707 * 1708 * @type { number } 1709 * @syscap SystemCapability.ArkUI.ArkUI.Full 1710 * @crossplatform 1711 * @atomicservice 1712 * @since 12 1713 */ 1714 lineTop: number; 1715 1716 /** 1717 * The bottom position of the line where customSpan is located. 1718 * The unit is px. 1719 * 1720 * @type { number } 1721 * @syscap SystemCapability.ArkUI.ArkUI.Full 1722 * @crossplatform 1723 * @atomicservice 1724 * @since 12 1725 */ 1726 lineBottom: number; 1727 1728 /** 1729 * The baseline offset of the line where customSpan is located. 1730 * The unit is px. 1731 * 1732 * @type { number } 1733 * @syscap SystemCapability.ArkUI.ArkUI.Full 1734 * @crossplatform 1735 * @atomicservice 1736 * @since 12 1737 */ 1738 baseline: number; 1739} 1740 1741/** 1742 * Defines the CustomSpanMeasureInfo interface. 1743 * 1744 * @interface CustomSpanMeasureInfo 1745 * @syscap SystemCapability.ArkUI.ArkUI.Full 1746 * @crossplatform 1747 * @atomicservice 1748 * @since 12 1749 */ 1750declare interface CustomSpanMeasureInfo { 1751 /** 1752 * Current component's fontSize value. 1753 * The unit is fp. 1754 * 1755 * @type { number } 1756 * @syscap SystemCapability.ArkUI.ArkUI.Full 1757 * @crossplatform 1758 * @atomicservice 1759 * @since 12 1760 */ 1761 fontSize: number; 1762} 1763 1764/** 1765 * Defines CustomSpan. 1766 * 1767 * @syscap SystemCapability.ArkUI.ArkUI.Full 1768 * @crossplatform 1769 * @atomicservice 1770 * @since 12 1771 */ 1772declare abstract class CustomSpan { 1773 /** 1774 * Measure the size of custom span. 1775 * 1776 * @param { CustomSpanMeasureInfo } measureInfo 1777 * @returns { CustomSpanMetrics } - CustomSpan Size 1778 * @syscap SystemCapability.ArkUI.ArkUI.Full 1779 * @crossplatform 1780 * @atomicservice 1781 * @since 12 1782 */ 1783 abstract onMeasure(measureInfo: CustomSpanMeasureInfo) : CustomSpanMetrics; 1784 1785 /** 1786 * Draw the custom span. 1787 * 1788 * @param { DrawContext } context 1789 * @param { CustomSpanDrawInfo } drawInfo 1790 * @syscap SystemCapability.ArkUI.ArkUI.Full 1791 * @crossplatform 1792 * @atomicservice 1793 * @since 12 1794 */ 1795 abstract onDraw(context: DrawContext, drawInfo: CustomSpanDrawInfo): void; 1796 1797 /** 1798 * Invalidate all components that use the object, which will cause a re-render of all components. 1799 * 1800 * @syscap SystemCapability.ArkUI.ArkUI.Full 1801 * @crossplatform 1802 * @atomicservice 1803 * @since 13 1804 */ 1805 invalidate(): void; 1806} 1807 1808/** 1809 * Defines UserDataSpan. Used to store and obtain user data. 1810 * 1811 * @syscap SystemCapability.ArkUI.ArkUI.Full 1812 * @crossplatform 1813 * @atomicservice 1814 * @since 12 1815 */ 1816declare abstract class UserDataSpan {}