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/*** if arkts 1.2 */ 22import { Callback, ShadowOptions, ClickEvent, Optional, PixelMap } from './common'; 23import { TextAlign, FontStyle, FontWeight, TextDecorationType, TextDecorationStyle, WordBreak, TextOverflow, ImageFit, ImageSpanAlignment } from './enums'; 24import { ResourceStr, ResourceColor, LengthMetrics, SizeOptions, Margin, Padding, BorderRadiuses, ColorFilter } from './units'; 25import { TextBackgroundStyle } from './span'; 26import { GestureEvent } from "./gesture"; 27import { DrawingColorFilter } from './image'; 28import { LeadingMarginPlaceholder } from './richEditor'; 29import image from '../../@ohos.multimedia.image'; 30import { DrawContext } from '../../arkui/Graphics'; 31/*** endif */ 32 33/** 34 * Defines the StyledStringMarshallingValue Type. 35 * 36 * @typedef { UserDataSpan } StyledStringMarshallingValue 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @systemapi 39 * @since arkts {'1.1':'19','1.2':'20'} 40 * @arkts 1.1&1.2 41 */ 42declare type StyledStringMarshallingValue = UserDataSpan; 43 44 45/** 46 * Defines the callback type used in marshalling. 47 * 48 * @typedef { function } StyledStringMarshallCallback 49 * @param { StyledStringMarshallingValue } marshallableVal - value that will be serialized to array buffer 50 * @returns { ArrayBuffer } Array buffer from the serialized marshalling value 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @systemapi 53 * @since arkts {'1.1':'19','1.2':'20'} 54 * @arkts 1.1&1.2 55 */ 56declare type StyledStringMarshallCallback = (marshallableVal: StyledStringMarshallingValue) => ArrayBuffer; 57 58/** 59 * Defines the callback type used in unmarshalling. 60 * 61 * @typedef { function } StyledStringUnmarshallCallback 62 * @param { ArrayBuffer } buf - The buffer that will be deserialized to a StyledStringMarshallingValue. 63 * @returns { StyledStringMarshallingValue } Marshalling value from the deserialized ArrayBuffer. 64 * @syscap SystemCapability.ArkUI.ArkUI.Full 65 * @systemapi 66 * @since arkts {'1.1':'19','1.2':'20'} 67 * @arkts 1.1&1.2 68 */ 69declare type StyledStringUnmarshallCallback = (buf: ArrayBuffer) => StyledStringMarshallingValue; 70 71/** 72 * StyledString 73 * 74 * @syscap SystemCapability.ArkUI.ArkUI.Full 75 * @crossplatform 76 * @atomicservice 77 * @since arkts {'1.1':'12','1.2':'20'} 78 * @arkts 1.1&1.2 79 */ 80declare class StyledString { 81 /** 82 * constructor. 83 * 84 * @param { string | ImageAttachment | CustomSpan } value - indicates the current object value of the StyledString. 85 * @param { Array<StyleOptions> } [styles] - indicates the SpanStyle objects. 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @crossplatform 88 * @atomicservice 89 * @since arkts {'1.1':'12','1.2':'20'} 90 * @arkts 1.1&1.2 91 */ 92 constructor(value: string | ImageAttachment | CustomSpan, styles?: Array<StyleOptions>); 93 94 /** 95 * Get the length of the StyledString's characters. 96 * 97 * @type { number } - the length of the StyledString's characters. 98 * @readonly 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @crossplatform 101 * @atomicservice 102 * @since arkts {'1.1':'12','1.2':'20'} 103 * @arkts 1.1&1.2 104 */ 105 readonly length: number; 106 107 /** 108 * Get the literal content of the StyledString. 109 * 110 * @returns { string } - the literal content of the StyledString 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @crossplatform 113 * @atomicservice 114 * @since arkts {'1.1':'12','1.2':'20'} 115 * @arkts 1.1&1.2 116 */ 117 getString(): string; 118 119 /** 120 * Get the attribute objects of the subStyledString. 121 * 122 * @param { number } start - the start position of the subStyledString. 123 * @param { number } length - the length of the subStyledString's characters. 124 * @param { StyledStringKey } [styledKey] - the specified type. 125 * @returns { Array<SpanStyle> } 126 * @throws { BusinessError } 401 - Parameter error. Possible causes: 127 * <br> 1. Mandatory parameters are left unspecified. 128 * <br> 2. Incorrect parameters types. 129 * <br> 3. Parameter verification failed. 130 * @syscap SystemCapability.ArkUI.ArkUI.Full 131 * @crossplatform 132 * @atomicservice 133 * @since arkts {'1.1':'12','1.2':'20'} 134 * @arkts 1.1&1.2 135 */ 136 getStyles(start: number, length: number, styledKey?: StyledStringKey): Array<SpanStyle>; 137 138 /** 139 * Judge if two attribute strings are equal. 140 * 141 * @param { StyledString } other - another StyledString. 142 * @returns { boolean } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @crossplatform 145 * @atomicservice 146 * @since arkts {'1.1':'12','1.2':'20'} 147 * @arkts 1.1&1.2 148 */ 149 equals(other: StyledString): boolean; 150 151 /** 152 * Get the substring of the StyledString. 153 * 154 * @param { number } start - the start position of the subStyledString. 155 * @param { number } [length] - the length of the subStyledString's characters. 156 * @returns { StyledString } 157 * @throws { BusinessError } 401 - Parameter error. Possible causes: 158 * <br> 1. Mandatory parameters are left unspecified. 159 * <br> 2. Incorrect parameters types. 160 * <br> 3. Parameter verification failed. 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @crossplatform 163 * @atomicservice 164 * @since arkts {'1.1':'12','1.2':'20'} 165 * @arkts 1.1&1.2 166 */ 167 subStyledString(start: number, length?: number): StyledString; 168 169 /** 170 * Returns StyledString from the provided HTML string. 171 * 172 * @param { string } html - the html text will be converted to a StyledString. 173 * @returns { Promise<StyledString> } 174 * @throws { BusinessError } 401 - Parameter error. Possible causes: 175 * <br> 1. Mandatory parameters are left unspecified. 176 * <br> 2. Incorrect parameters types. 177 * <br> 3. Parameter verification failed. 178 * @throws { BusinessError } 170001 - Convert Error. 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @atomicservice 181 * @since arkts {'1.1':'12','1.2':'20'} 182 * @arkts 1.1&1.2 183 */ 184 static fromHtml(html: string): Promise<StyledString>; 185 186 /** 187 * Returns HTML string from the provided StyledString. 188 * 189 * @param { StyledString } styledString - the StyledString will be converted to a HTML string. 190 * @returns { string } Returns the HTML string converted from the provided StyledString. 191 * @throws { BusinessError } 401 - Parameter error. Possible causes: 192 * <br> 1. Mandatory parameters are left unspecified. 193 * <br> 2. Incorrect parameters types. 194 * <br> 3. Parameter verification failed. 195 * @syscap SystemCapability.ArkUI.ArkUI.Full 196 * @crossplatform 197 * @atomicservice 198 * @since arkts {'1.1':'14','1.2':'20'} 199 * @arkts 1.1&1.2 200 */ 201 static toHtml(styledString: StyledString): string; 202 203 /** 204 * Returns ArrayBuffer from the serialized styled string. 205 * 206 * @param { StyledString } styledString - StyledString parameter. 207 * @param { function } callback - When marshalling StyledStringMarshingValue, will trigger this callback to get ArrayBuffer 208 * @returns { ArrayBuffer } 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @systemapi 211 * @since arkts {'1.1':'19','1.2':'20'} 212 * @arkts 1.1&1.2 213 */ 214 static marshalling(styledString: StyledString, callback: StyledStringMarshallCallback): ArrayBuffer; 215 216 /** 217 * Returns StyledString from the deserialized ArrayBuffer. 218 * 219 * @param { ArrayBuffer } buffer - The buffer will be deserialized to a StyledString. 220 * @param { function } callback - When unmarshalling ArrayBuffer, will trigger this callback to get StyledStringMarshingValue 221 * @returns { Promise<StyledString> } 222 * @throws { BusinessError } 401 - Parameter error. Possible causes: 223 * <br> 1. Mandatory parameters are left unspecified. 224 * <br> 2. Incorrect parameters types. 225 * <br> 3. Parameter verification failed. 226 * @throws { BusinessError } 170002 - Styled string decode error. 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @systemapi 229 * @since arkts {'1.1':'19','1.2':'20'} 230 * @arkts 1.1&1.2 231 */ 232 static unmarshalling(buffer: ArrayBuffer, callback: StyledStringUnmarshallCallback): Promise<StyledString>; 233 234 /** 235 * Returns ArrayBuffer from the serialized styled string. 236 * 237 * @param { StyledString } styledString - StyledString parameter. 238 * @returns { ArrayBuffer } 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @systemapi 241 * @since arkts {'1.1':'13','1.2':'20'} 242 * @arkts 1.1&1.2 243 */ 244 static marshalling(styledString: StyledString): ArrayBuffer; 245 246 /** 247 * Returns StyledString from the deserialized ArrayBuffer. 248 * 249 * @param { ArrayBuffer } buffer - The buffer will be deserialized to a StyledString. 250 * @returns { Promise<StyledString> } 251 * @throws { BusinessError } 401 - Parameter error. Possible causes: 252 * <br> 1. Mandatory parameters are left unspecified. 253 * <br> 2. Incorrect parameters types. 254 * <br> 3. Parameter verification failed. 255 * @throws { BusinessError } 170002 - Styled string decode error. 256 * @syscap SystemCapability.ArkUI.ArkUI.Full 257 * @systemapi 258 * @since arkts {'1.1':'13','1.2':'20'} 259 * @arkts 1.1&1.2 260 */ 261 static unmarshalling(buffer: ArrayBuffer): Promise<StyledString>; 262} 263 264/** 265 * StyleOptions 266 * 267 * @interface StyleOptions 268 * @syscap SystemCapability.ArkUI.ArkUI.Full 269 * @crossplatform 270 * @atomicservice 271 * @since arkts {'1.1':'12','1.2':'20'} 272 * @arkts 1.1&1.2 273 */ 274declare interface StyleOptions { 275 /** 276 * The start position of the StyleOptions. 277 * 278 * @type { ?number } 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @crossplatform 281 * @atomicservice 282 * @since arkts {'1.1':'12','1.2':'20'} 283 * @arkts 1.1&1.2 284 */ 285 start?: number; 286 287 /** 288 * The length of the modifiedStyledString's characters. 289 * 290 * @type { ?number } 291 * @syscap SystemCapability.ArkUI.ArkUI.Full 292 * @crossplatform 293 * @atomicservice 294 * @since arkts {'1.1':'12','1.2':'20'} 295 * @arkts 1.1&1.2 296 */ 297 length?: number; 298 299 /** 300 * The attribute key of the StyleOptions. 301 * 302 * @type { StyledStringKey } 303 * @syscap SystemCapability.ArkUI.ArkUI.Full 304 * @crossplatform 305 * @atomicservice 306 * @since arkts {'1.1':'12','1.2':'20'} 307 * @arkts 1.1&1.2 308 */ 309 styledKey: StyledStringKey; 310 311 /** 312 * The attribute value of the StyleOptions. 313 * 314 * @type { StyledStringValue } 315 * @syscap SystemCapability.ArkUI.ArkUI.Full 316 * @crossplatform 317 * @atomicservice 318 * @since arkts {'1.1':'12','1.2':'20'} 319 * @arkts 1.1&1.2 320 */ 321 styledValue: StyledStringValue; 322} 323 324/** 325 * SpanStyle 326 * 327 * @interface SpanStyle 328 * @syscap SystemCapability.ArkUI.ArkUI.Full 329 * @crossplatform 330 * @atomicservice 331 * @since arkts {'1.1':'12','1.2':'20'} 332 * @arkts 1.1&1.2 333 */ 334declare interface SpanStyle { 335 /** 336 * The start position of the SpanStyle. 337 * 338 * @type { number } 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @crossplatform 341 * @atomicservice 342 * @since arkts {'1.1':'12','1.2':'20'} 343 * @arkts 1.1&1.2 344 */ 345 start: number; 346 347 /** 348 * The length of the modifiedStyledString's characters. 349 * 350 * @type { number } 351 * @syscap SystemCapability.ArkUI.ArkUI.Full 352 * @crossplatform 353 * @atomicservice 354 * @since arkts {'1.1':'12','1.2':'20'} 355 * @arkts 1.1&1.2 356 */ 357 length: number; 358 359 /** 360 * The attribute key of the SpanStyle. 361 * 362 * @type { StyledStringKey } 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @crossplatform 365 * @atomicservice 366 * @since arkts {'1.1':'12','1.2':'20'} 367 * @arkts 1.1&1.2 368 */ 369 styledKey: StyledStringKey; 370 371 /** 372 * The attribute value of the SpanStyle. 373 * 374 * @type { StyledStringValue } 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @crossplatform 377 * @atomicservice 378 * @since arkts {'1.1':'12','1.2':'20'} 379 * @arkts 1.1&1.2 380 */ 381 styledValue: StyledStringValue; 382} 383 384/** 385 * Defines TextStyle. 386 * 387 * @syscap SystemCapability.ArkUI.ArkUI.Full 388 * @crossplatform 389 * @atomicservice 390 * @since arkts {'1.1':'12','1.2':'20'} 391 * @arkts 1.1&1.2 392 */ 393declare class TextStyle { 394 395 /** 396 * constructor. 397 * 398 * @param { TextStyleInterface } [value] - font property object. 399 * @syscap SystemCapability.ArkUI.ArkUI.Full 400 * @crossplatform 401 * @atomicservice 402 * @since arkts {'1.1':'12','1.2':'20'} 403 * @arkts 1.1&1.2 404 */ 405 constructor(value?: TextStyleInterface); 406 407 /** 408 * Get the fontColor of the StyledString. 409 * 410 * @type { ?ResourceColor } - the set fontColor of the StyledString or undefined 411 * @readonly 412 * @syscap SystemCapability.ArkUI.ArkUI.Full 413 * @crossplatform 414 * @atomicservice 415 * @since arkts {'1.1':'12','1.2':'20'} 416 * @arkts 1.1&1.2 417 */ 418 readonly fontColor?: ResourceColor; 419 420 /** 421 * Get the fontFamily of the StyledString. 422 * 423 * @type { ?string } - the fontFamily of the StyledString or undefined 424 * @readonly 425 * @syscap SystemCapability.ArkUI.ArkUI.Full 426 * @crossplatform 427 * @atomicservice 428 * @since arkts {'1.1':'12','1.2':'20'} 429 * @arkts 1.1&1.2 430 */ 431 readonly fontFamily?: string; 432 433 /** 434 * Get the fontSize of the StyledString. 435 * If not undefined, the unit is vp. 436 * 437 * @type { ?number } - the fontSize of the StyledString or undefined 438 * @readonly 439 * @syscap SystemCapability.ArkUI.ArkUI.Full 440 * @crossplatform 441 * @atomicservice 442 * @since arkts {'1.1':'12','1.2':'20'} 443 * @arkts 1.1&1.2 444 */ 445 readonly fontSize?: number; 446 447 /** 448 * Get the fontWeight of the StyledString. 449 * 450 * @type { ?number } - the fontWeight of the StyledString or undefined 451 * @readonly 452 * @syscap SystemCapability.ArkUI.ArkUI.Full 453 * @crossplatform 454 * @atomicservice 455 * @since arkts {'1.1':'12','1.2':'20'} 456 * @arkts 1.1&1.2 457 */ 458 readonly fontWeight?: number; 459 460 /** 461 * Get the fontStyle of the StyledString. 462 * 463 * @type { ?FontStyle } - the fontStyle of the StyledString or undefined 464 * @readonly 465 * @syscap SystemCapability.ArkUI.ArkUI.Full 466 * @crossplatform 467 * @atomicservice 468 * @since arkts {'1.1':'12','1.2':'20'} 469 * @arkts 1.1&1.2 470 */ 471 readonly fontStyle?: FontStyle; 472 473 /** 474 * Get the stroke width of the StyledString with the unit 'vp'. 475 * 476 * @type { ?number } - the stroke width of the StyledString or undefined 477 * @readonly 478 * @syscap SystemCapability.ArkUI.ArkUI.Full 479 * @crossplatform 480 * @atomicservice 481 * @since 20 482 */ 483 readonly strokeWidth?: number; 484 485 /** 486 * Get the stroke color of the StyledString. 487 * 488 * @type { ?ResourceColor } - the stroke color of the StyledString or undefined 489 * @readonly 490 * @syscap SystemCapability.ArkUI.ArkUI.Full 491 * @crossplatform 492 * @atomicservice 493 * @since 20 494 */ 495 readonly strokeColor?: ResourceColor; 496 497 /** 498 * Get the superscript style of the StyledString. 499 * 500 * @type { ?SuperscriptStyle } - the set superscriptStyle of the StyledString 501 * @readonly 502 * @syscap SystemCapability.ArkUI.ArkUI.Full 503 * @crossplatform 504 * @atomicservice 505 * @since 20 506 */ 507 readonly superscript?: SuperscriptStyle; 508} 509 510/** 511 * TextStyleInterface 512 * 513 * @interface TextStyleInterface 514 * @syscap SystemCapability.ArkUI.ArkUI.Full 515 * @crossplatform 516 * @atomicservice 517 * @since arkts {'1.1':'12','1.2':'20'} 518 * @arkts 1.1&1.2 519 */ 520declare interface TextStyleInterface { 521 /** 522 * The fontColor value of the font property object. 523 * 524 * @type { ?ResourceColor } 525 * @syscap SystemCapability.ArkUI.ArkUI.Full 526 * @crossplatform 527 * @atomicservice 528 * @since arkts {'1.1':'12','1.2':'20'} 529 * @arkts 1.1&1.2 530 */ 531 fontColor?: ResourceColor; 532 533 /** 534 * The fontFamily value of the font property object. 535 * 536 * @type { ?ResourceStr } 537 * @syscap SystemCapability.ArkUI.ArkUI.Full 538 * @crossplatform 539 * @atomicservice 540 * @since arkts {'1.1':'12','1.2':'20'} 541 * @arkts 1.1&1.2 542 */ 543 fontFamily?: ResourceStr; 544 545 /** 546 * The fontSize value of the font property object. 547 * 548 * @type { ?LengthMetrics } 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @crossplatform 551 * @atomicservice 552 * @since arkts {'1.1':'12','1.2':'20'} 553 * @arkts 1.1&1.2 554 */ 555 fontSize?: LengthMetrics; 556 557 /** 558 * The fontWeight value of the font property object. 559 * 560 * @type { ?(number | FontWeight | string) } 561 * @syscap SystemCapability.ArkUI.ArkUI.Full 562 * @crossplatform 563 * @atomicservice 564 * @since arkts {'1.1':'12','1.2':'20'} 565 * @arkts 1.1&1.2 566 */ 567 fontWeight?: number | FontWeight | string; 568 569 /** 570 * The fontStyle value of the font property object. 571 * 572 * @type { ?FontStyle } 573 * @syscap SystemCapability.ArkUI.ArkUI.Full 574 * @crossplatform 575 * @atomicservice 576 * @since arkts {'1.1':'12','1.2':'20'} 577 * @arkts 1.1&1.2 578 */ 579 fontStyle?: FontStyle; 580 581 /** 582 * The stroke width of the text. 583 * 584 * @type { ?LengthMetrics } 585 * @syscap SystemCapability.ArkUI.ArkUI.Full 586 * @crossplatform 587 * @atomicservice 588 * @since 20 589 */ 590 strokeWidth?: LengthMetrics; 591 592 /** 593 * The stroke color of the text. 594 * 595 * @type { ?ResourceColor } 596 * @syscap SystemCapability.ArkUI.ArkUI.Full 597 * @crossplatform 598 * @atomicservice 599 * @since 20 600 */ 601 strokeColor?: ResourceColor; 602 603 /** 604 * The superscript value of the font property object. 605 * 606 * @type { ?SuperscriptStyle } 607 * @syscap SystemCapability.ArkUI.ArkUI.Full 608 * @crossplatform 609 * @atomicservice 610 * @since 20 611 */ 612 superscript?: SuperscriptStyle; 613} 614 615/** 616 * Defines DecorationOptions for Decoration. 617 * 618 * @interface DecorationOptions 619 * @syscap SystemCapability.ArkUI.ArkUI.Full 620 * @crossplatform 621 * @atomicservice 622 * @since 20 623 */ 624declare interface DecorationOptions { 625 /** 626 * Enable to show multi TextDecorationType at a time. 627 * 628 * @type { ?boolean } 629 * @syscap SystemCapability.ArkUI.ArkUI.Full 630 * @crossplatform 631 * @atomicservice 632 * @since 20 633 */ 634 enableMultiType?: boolean; 635} 636 637/** 638 * Defines DecorationStyle. 639 * 640 * @syscap SystemCapability.ArkUI.ArkUI.Full 641 * @crossplatform 642 * @atomicservice 643 * @since arkts {'1.1':'12','1.2':'20'} 644 * @arkts 1.1&1.2 645 */ 646declare class DecorationStyle { 647 648 /** 649 * constructor. 650 * 651 * @param { DecorationStyleInterface } value - text decoration value. 652 * @syscap SystemCapability.ArkUI.ArkUI.Full 653 * @crossplatform 654 * @atomicservice 655 * @since arkts {'1.1':'12','1.2':'20'} 656 * @arkts 1.1&1.2 657 */ 658 constructor(value: DecorationStyleInterface); 659 660 /** 661 * constructor. 662 * 663 * @param { DecorationStyleInterface } value - text decoration value. 664 * @param { DecorationOptions } [options] - decoration options. 665 * @syscap SystemCapability.ArkUI.ArkUI.Full 666 * @crossplatform 667 * @atomicservice 668 * @since 20 669 */ 670 constructor(value: DecorationStyleInterface, options?: DecorationOptions); 671 672 /** 673 * Get the text decoration type of the StyledString. 674 * 675 * @type { TextDecorationType } - the decoration type of the StyledString 676 * @readonly 677 * @syscap SystemCapability.ArkUI.ArkUI.Full 678 * @crossplatform 679 * @atomicservice 680 * @since arkts {'1.1':'12','1.2':'20'} 681 * @arkts 1.1&1.2 682 */ 683 readonly type: TextDecorationType; 684 685 /** 686 * Get the decorationColor of the StyledString. 687 * 688 * @type { ?ResourceColor } - the decorationColor of the StyledString or undefined 689 * @readonly 690 * @syscap SystemCapability.ArkUI.ArkUI.Full 691 * @crossplatform 692 * @atomicservice 693 * @since arkts {'1.1':'12','1.2':'20'} 694 * @arkts 1.1&1.2 695 */ 696 readonly color?: ResourceColor; 697 698 /** 699 * Get the decorationStyle of the StyledString. 700 * 701 * @type { ?TextDecorationStyle } - the decorationStyle of the StyledString or undefined 702 * @readonly 703 * @syscap SystemCapability.ArkUI.ArkUI.Full 704 * @crossplatform 705 * @atomicservice 706 * @since arkts {'1.1':'12','1.2':'20'} 707 * @arkts 1.1&1.2 708 */ 709 readonly style?: TextDecorationStyle; 710 711 /** 712 * Get the thickness scale of the StyledString. 713 * 714 * @type { ?number } - the thickness scale of the StyledString or undefined 715 * @readonly 716 * @syscap SystemCapability.ArkUI.ArkUI.Full 717 * @crossplatform 718 * @atomicservice 719 * @since 20 720 */ 721 readonly thicknessScale?: number; 722 723 /** 724 * Get the DecorationOptions of the StyledString. 725 * 726 * @type { ?DecorationOptions } - the decorationOptions of the StyledString or undefined 727 * @readonly 728 * @syscap SystemCapability.ArkUI.ArkUI.Full 729 * @crossplatform 730 * @atomicservice 731 * @since 20 732 */ 733 readonly options?: DecorationOptions; 734} 735 736/** 737 * DecorationStyleInterface 738 * 739 * @interface DecorationStyleInterface 740 * @syscap SystemCapability.ArkUI.ArkUI.Full 741 * @crossplatform 742 * @atomicservice 743 * @since arkts {'1.1':'12','1.2':'20'} 744 * @arkts 1.1&1.2 745 */ 746declare interface DecorationStyleInterface { 747 /** 748 * The type value of the decoration property object. 749 * 750 * @type { TextDecorationType } 751 * @syscap SystemCapability.ArkUI.ArkUI.Full 752 * @crossplatform 753 * @atomicservice 754 * @since arkts {'1.1':'12','1.2':'20'} 755 * @arkts 1.1&1.2 756 */ 757 type: TextDecorationType; 758 759 /** 760 * The color value of the decoration property object. 761 * 762 * @type { ?ResourceColor } 763 * @syscap SystemCapability.ArkUI.ArkUI.Full 764 * @crossplatform 765 * @atomicservice 766 * @since arkts {'1.1':'12','1.2':'20'} 767 * @arkts 1.1&1.2 768 */ 769 color?: ResourceColor; 770 771 /** 772 * The style value of the decoration property object. 773 * 774 * @type { ?TextDecorationStyle } 775 * @syscap SystemCapability.ArkUI.ArkUI.Full 776 * @crossplatform 777 * @atomicservice 778 * @since arkts {'1.1':'12','1.2':'20'} 779 * @arkts 1.1&1.2 780 */ 781 style?: TextDecorationStyle; 782 783 /** 784 * The thickness scale of the decoration 785 * 786 * @type { ?number } 787 * @syscap SystemCapability.ArkUI.ArkUI.Full 788 * @crossplatform 789 * @atomicservice 790 * @since 20 791 */ 792 thicknessScale?: number; 793} 794 795/** 796 * Defines BaselineOffsetStyle. 797 * 798 * @syscap SystemCapability.ArkUI.ArkUI.Full 799 * @crossplatform 800 * @atomicservice 801 * @since arkts {'1.1':'12','1.2':'20'} 802 * @arkts 1.1&1.2 803 */ 804declare class BaselineOffsetStyle { 805 806 /** 807 * constructor. 808 * 809 * @param { LengthMetrics } value - baseline offset value. 810 * @syscap SystemCapability.ArkUI.ArkUI.Full 811 * @crossplatform 812 * @atomicservice 813 * @since arkts {'1.1':'12','1.2':'20'} 814 * @arkts 1.1&1.2 815 */ 816 constructor(value: LengthMetrics); 817 818 /** 819 * Get the baselineOffset value of the StyledString. 820 * The unit is vp. 821 * 822 * @type { number } - the baselineOffset value of the StyledString 823 * @readonly 824 * @syscap SystemCapability.ArkUI.ArkUI.Full 825 * @crossplatform 826 * @atomicservice 827 * @since arkts {'1.1':'12','1.2':'20'} 828 * @arkts 1.1&1.2 829 */ 830 readonly baselineOffset: number; 831} 832 833/** 834 * Defines LetterSpacingStyle. 835 * 836 * @syscap SystemCapability.ArkUI.ArkUI.Full 837 * @crossplatform 838 * @atomicservice 839 * @since arkts {'1.1':'12','1.2':'20'} 840 * @arkts 1.1&1.2 841 */ 842declare class LetterSpacingStyle { 843 844 /** 845 * constructor. 846 * 847 * @param { LengthMetrics } value - letter space value. 848 * @syscap SystemCapability.ArkUI.ArkUI.Full 849 * @crossplatform 850 * @atomicservice 851 * @since arkts {'1.1':'12','1.2':'20'} 852 * @arkts 1.1&1.2 853 */ 854 constructor(value: LengthMetrics); 855 856 /** 857 * Get the letterSpacing value of the StyledString. 858 * The unit is vp. 859 * 860 * @type { number } - the letterSpacing value of the StyledString 861 * @readonly 862 * @syscap SystemCapability.ArkUI.ArkUI.Full 863 * @crossplatform 864 * @atomicservice 865 * @since arkts {'1.1':'12','1.2':'20'} 866 * @arkts 1.1&1.2 867 */ 868 readonly letterSpacing: number; 869} 870 871/** 872 * Defines TextShadowStyle. 873 * 874 * @syscap SystemCapability.ArkUI.ArkUI.Full 875 * @crossplatform 876 * @atomicservice 877 * @since arkts {'1.1':'12','1.2':'20'} 878 * @arkts 1.1&1.2 879 */ 880declare class TextShadowStyle { 881 882 /** 883 * constructor. 884 * 885 * @param { ShadowOptions | Array<ShadowOptions> } value - text shadow value. 886 * @syscap SystemCapability.ArkUI.ArkUI.Full 887 * @crossplatform 888 * @atomicservice 889 * @since arkts {'1.1':'12','1.2':'20'} 890 * @arkts 1.1&1.2 891 */ 892 constructor(value: ShadowOptions | Array<ShadowOptions>); 893 894 /** 895 * Get the textShadow value of the StyledString. 896 * 897 * @type { Array<ShadowOptions> } - the textShadow value of the StyledString 898 * @readonly 899 * @syscap SystemCapability.ArkUI.ArkUI.Full 900 * @crossplatform 901 * @atomicservice 902 * @since arkts {'1.1':'12','1.2':'20'} 903 * @arkts 1.1&1.2 904 */ 905 readonly textShadow: Array<ShadowOptions>; 906} 907 908/** 909 * Defines Sets the property string background color. 910 * 911 * @syscap SystemCapability.ArkUI.ArkUI.Full 912 * @crossplatform 913 * @atomicservice 914 * @since arkts {'1.1':'14','1.2':'20'} 915 * @arkts 1.1&1.2 916 */ 917declare class BackgroundColorStyle { 918 919 /** 920 * constructor. 921 * 922 * @param { TextBackgroundStyle } textBackgroundStyle - textBackgroundStyle value. 923 * @syscap SystemCapability.ArkUI.ArkUI.Full 924 * @crossplatform 925 * @atomicservice 926 * @since arkts {'1.1':'14','1.2':'20'} 927 * @arkts 1.1&1.2 928 */ 929 constructor(textBackgroundStyle: TextBackgroundStyle); 930 931 /** 932 * Get the textBackgroundStyle value of the StyledString. 933 * 934 * @type { TextBackgroundStyle } - the textBackgroundStyle value of the StyledString 935 * @readonly 936 * @syscap SystemCapability.ArkUI.ArkUI.Full 937 * @crossplatform 938 * @atomicservice 939 * @since arkts {'1.1':'14','1.2':'20'} 940 * @arkts 1.1&1.2 941 */ 942 readonly textBackgroundStyle: TextBackgroundStyle; 943} 944 945/** 946 * Defines GestureStyle. 947 * 948 * @syscap SystemCapability.ArkUI.ArkUI.Full 949 * @crossplatform 950 * @atomicservice 951 * @since arkts {'1.1':'12','1.2':'20'} 952 * @arkts 1.1&1.2 953 */ 954declare class GestureStyle { 955 956 /** 957 * constructor. 958 * 959 * @param { GestureStyleInterface } [value] - gesture event object. 960 * @syscap SystemCapability.ArkUI.ArkUI.Full 961 * @crossplatform 962 * @atomicservice 963 * @since arkts {'1.1':'12','1.2':'20'} 964 * @arkts 1.1&1.2 965 */ 966 constructor(value?: GestureStyleInterface); 967} 968 969/** 970 * Defines the Gesture Events. 971 * 972 * @interface GestureStyleInterface 973 * @syscap SystemCapability.ArkUI.ArkUI.Full 974 * @crossplatform 975 * @atomicservice 976 * @since arkts {'1.1':'12','1.2':'20'} 977 * @arkts 1.1&1.2 978 */ 979declare interface GestureStyleInterface { 980 /** 981 * Trigger a click event when a click is clicked. 982 * 983 * @type { ?Callback<ClickEvent> } 984 * @syscap SystemCapability.ArkUI.ArkUI.Full 985 * @crossplatform 986 * @atomicservice 987 * @since arkts {'1.1':'12','1.2':'20'} 988 * @arkts 1.1&1.2 989 */ 990 onClick?: Callback<ClickEvent>; 991 992 /** 993 * Trigger a gesture event when long press event is complete. 994 * 995 * @type { ?Callback<GestureEvent> } 996 * @syscap SystemCapability.ArkUI.ArkUI.Full 997 * @crossplatform 998 * @atomicservice 999 * @since arkts {'1.1':'12','1.2':'20'} 1000 * @arkts 1.1&1.2 1001 */ 1002 onLongPress?: Callback<GestureEvent>; 1003 1004 /** 1005 * Trigger a touch event when touched. 1006 * 1007 * @type { ?Callback<TouchEvent> } 1008 * @syscap SystemCapability.ArkUI.ArkUI.Full 1009 * @crossplatform 1010 * @atomicservice 1011 * @since 20 1012 */ 1013 onTouch?: Callback<TouchEvent>; 1014} 1015 1016/** 1017 * Defines ParagraphStyle. 1018 * 1019 * @syscap SystemCapability.ArkUI.ArkUI.Full 1020 * @crossplatform 1021 * @atomicservice 1022 * @since arkts {'1.1':'12','1.2':'20'} 1023 * @arkts 1.1&1.2 1024 */ 1025declare class ParagraphStyle { 1026 1027 /** 1028 * constructor. 1029 * 1030 * @param { ParagraphStyleInterface } [value] - paragraph property object. 1031 * @syscap SystemCapability.ArkUI.ArkUI.Full 1032 * @crossplatform 1033 * @atomicservice 1034 * @since arkts {'1.1':'12','1.2':'20'} 1035 * @arkts 1.1&1.2 1036 */ 1037 constructor(value?: ParagraphStyleInterface); 1038 1039 /** 1040 * Get the text alignment of the StyledString. 1041 * 1042 * @type { ?TextAlign } - the text alignment of the StyledString or undefined 1043 * @readonly 1044 * @syscap SystemCapability.ArkUI.ArkUI.Full 1045 * @crossplatform 1046 * @atomicservice 1047 * @since arkts {'1.1':'12','1.2':'20'} 1048 * @arkts 1.1&1.2 1049 */ 1050 readonly textAlign?: TextAlign; 1051 1052 /** 1053 * Get the text vertical alignment of the StyledString. 1054 * 1055 * @type { ?TextVerticalAlign } - the text vertical alignment of the StyledString or undefined 1056 * @readonly 1057 * @syscap SystemCapability.ArkUI.ArkUI.Full 1058 * @crossplatform 1059 * @atomicservice 1060 * @since 20 1061 */ 1062 readonly textVerticalAlign?: TextVerticalAlign; 1063 1064 /** 1065 * Get the first line indentation of the StyledString. 1066 * The unit is vp. 1067 * 1068 * @type { ?number } - the first line indentation of the StyledString or undefined 1069 * @readonly 1070 * @syscap SystemCapability.ArkUI.ArkUI.Full 1071 * @crossplatform 1072 * @atomicservice 1073 * @since arkts {'1.1':'12','1.2':'20'} 1074 * @arkts 1.1&1.2 1075 */ 1076 readonly textIndent?: number; 1077 1078 /** 1079 * Get the maximum number of lines of the StyledString. 1080 * 1081 * @type { ?number } - the maximum number of the StyledString or undefined 1082 * @readonly 1083 * @syscap SystemCapability.ArkUI.ArkUI.Full 1084 * @crossplatform 1085 * @atomicservice 1086 * @since arkts {'1.1':'12','1.2':'20'} 1087 * @arkts 1.1&1.2 1088 */ 1089 readonly maxLines?: number; 1090 1091 /** 1092 * Get the overflow mode of the StyledString. 1093 * 1094 * @type { ?TextOverflow } - the overflow mode of the StyledString or undefined 1095 * @readonly 1096 * @syscap SystemCapability.ArkUI.ArkUI.Full 1097 * @crossplatform 1098 * @atomicservice 1099 * @since arkts {'1.1':'12','1.2':'20'} 1100 * @arkts 1.1&1.2 1101 */ 1102 readonly overflow?: TextOverflow; 1103 1104 /** 1105 * Get the wordBreak mode of the StyledString. 1106 * 1107 * @type { ?WordBreak } - the wordBreak mode of the StyledString or undefined 1108 * @readonly 1109 * @syscap SystemCapability.ArkUI.ArkUI.Full 1110 * @crossplatform 1111 * @atomicservice 1112 * @since arkts {'1.1':'12','1.2':'20'} 1113 * @arkts 1.1&1.2 1114 */ 1115 readonly wordBreak?: WordBreak; 1116 1117 /** 1118 * Get the leading margin of the StyledString. 1119 * 1120 * @type { ?(number | LeadingMarginPlaceholder) } - the leading margin of the StyledString or undefined 1121 * @readonly 1122 * @syscap SystemCapability.ArkUI.ArkUI.Full 1123 * @crossplatform 1124 * @atomicservice 1125 * @since arkts {'1.1':'12','1.2':'20'} 1126 * @arkts 1.1&1.2 1127 */ 1128 readonly leadingMargin?: number | LeadingMarginPlaceholder; 1129 1130 /** 1131 * Get the paragraph spacing of the StyledString. 1132 * The unit is vp. 1133 * 1134 * @type { ?number } 1135 * @readonly 1136 * @syscap SystemCapability.ArkUI.ArkUI.Full 1137 * @crossplatform 1138 * @atomicservice 1139 * @since arkts {'1.1':'19','1.2':'20'} 1140 * @arkts 1.1&1.2 1141 */ 1142 readonly paragraphSpacing?: number; 1143} 1144 1145/** 1146 * ParagraphStyleInterface 1147 * 1148 * @interface ParagraphStyleInterface 1149 * @syscap SystemCapability.ArkUI.ArkUI.Full 1150 * @crossplatform 1151 * @atomicservice 1152 * @since arkts {'1.1':'12','1.2':'20'} 1153 * @arkts 1.1&1.2 1154 */ 1155declare interface ParagraphStyleInterface { 1156 /** 1157 * Alignment of text. 1158 * 1159 * @type { ?TextAlign } 1160 * @syscap SystemCapability.ArkUI.ArkUI.Full 1161 * @crossplatform 1162 * @atomicservice 1163 * @since arkts {'1.1':'12','1.2':'20'} 1164 * @arkts 1.1&1.2 1165 */ 1166 textAlign?: TextAlign; 1167 1168 /** 1169 * Vertical alignment of text. 1170 * 1171 * @type { ?TextVerticalAlign } 1172 * @syscap SystemCapability.ArkUI.ArkUI.Full 1173 * @crossplatform 1174 * @atomicservice 1175 * @since 20 1176 */ 1177 textVerticalAlign?: TextVerticalAlign; 1178 1179 /** 1180 * Set the first line indentation. 1181 * 1182 * @type { ?LengthMetrics } 1183 * @syscap SystemCapability.ArkUI.ArkUI.Full 1184 * @crossplatform 1185 * @atomicservice 1186 * @since arkts {'1.1':'12','1.2':'20'} 1187 * @arkts 1.1&1.2 1188 */ 1189 textIndent?: LengthMetrics; 1190 1191 /** 1192 * The maximum number of lines of content. 1193 * 1194 * @type { ?number } 1195 * @syscap SystemCapability.ArkUI.ArkUI.Full 1196 * @crossplatform 1197 * @atomicservice 1198 * @since arkts {'1.1':'12','1.2':'20'} 1199 * @arkts 1.1&1.2 1200 */ 1201 maxLines?: number; 1202 1203 /** 1204 * The overflow mode of the content. 1205 * 1206 * @type { ?TextOverflow } 1207 * @syscap SystemCapability.ArkUI.ArkUI.Full 1208 * @crossplatform 1209 * @atomicservice 1210 * @since arkts {'1.1':'12','1.2':'20'} 1211 * @arkts 1.1&1.2 1212 */ 1213 overflow?: TextOverflow; 1214 1215 /** 1216 * Set word break type. 1217 * 1218 * @type { ?WordBreak } 1219 * @syscap SystemCapability.ArkUI.ArkUI.Full 1220 * @crossplatform 1221 * @atomicservice 1222 * @since arkts {'1.1':'12','1.2':'20'} 1223 * @arkts 1.1&1.2 1224 */ 1225 wordBreak?: WordBreak; 1226 1227 /** 1228 * Leading margin. 1229 * 1230 * @type { ?(LengthMetrics | LeadingMarginPlaceholder) } 1231 * @syscap SystemCapability.ArkUI.ArkUI.Full 1232 * @crossplatform 1233 * @atomicservice 1234 * @since arkts {'1.1':'12','1.2':'20'} 1235 * @arkts 1.1&1.2 1236 */ 1237 leadingMargin?: LengthMetrics | LeadingMarginPlaceholder; 1238 1239 /** 1240 * Set the paragraph spacing of the StyledString. 1241 * 1242 * @type { ?LengthMetrics } 1243 * @syscap SystemCapability.ArkUI.ArkUI.Full 1244 * @crossplatform 1245 * @atomicservice 1246 * @since arkts {'1.1':'19','1.2':'20'} 1247 * @arkts 1.1&1.2 1248 */ 1249 paragraphSpacing?: LengthMetrics; 1250} 1251 1252/** 1253 * Defines LineHeightStyle. 1254 * 1255 * @syscap SystemCapability.ArkUI.ArkUI.Full 1256 * @crossplatform 1257 * @atomicservice 1258 * @since arkts {'1.1':'12','1.2':'20'} 1259 * @arkts 1.1&1.2 1260 */ 1261declare class LineHeightStyle { 1262 1263 /** 1264 * constructor. 1265 * 1266 * @param { LengthMetrics } lineHeight - line height value. 1267 * @syscap SystemCapability.ArkUI.ArkUI.Full 1268 * @crossplatform 1269 * @atomicservice 1270 * @since arkts {'1.1':'12','1.2':'20'} 1271 * @arkts 1.1&1.2 1272 */ 1273 constructor(lineHeight: LengthMetrics); 1274 1275 /** 1276 * Get the lineHeight value of the StyledString. 1277 * The unit is vp. 1278 * 1279 * @type { number } - the lineHeight value of the StyledString 1280 * @readonly 1281 * @syscap SystemCapability.ArkUI.ArkUI.Full 1282 * @crossplatform 1283 * @atomicservice 1284 * @since arkts {'1.1':'12','1.2':'20'} 1285 * @arkts 1.1&1.2 1286 */ 1287 readonly lineHeight: number; 1288} 1289 1290/** 1291 * Defines the URLStyle hyperlink that allows setting a URL string. When clicking on the text to 1292 * which the span is attached, the URLStyle will try to open the URL. 1293 * 1294 * @syscap SystemCapability.ArkUI.ArkUI.Full 1295 * @crossplatform 1296 * @atomicservice 1297 * @since arkts {'1.1':'14','1.2':'20'} 1298 * @arkts 1.1&1.2 1299 */ 1300declare class UrlStyle { 1301 1302 /** 1303 * Constructor. 1304 * 1305 * @param { string } url - URL value. 1306 * @syscap SystemCapability.ArkUI.ArkUI.Full 1307 * @crossplatform 1308 * @atomicservice 1309 * @since arkts {'1.1':'14','1.2':'20'} 1310 * @arkts 1.1&1.2 1311 */ 1312 constructor(url: string); 1313 1314 /** 1315 * Get the URL value of the StyledString. 1316 * 1317 * @type { string } - the URL value of the StyledString 1318 * @readonly 1319 * @syscap SystemCapability.ArkUI.ArkUI.Full 1320 * @crossplatform 1321 * @atomicservice 1322 * @since arkts {'1.1':'14','1.2':'20'} 1323 * @arkts 1.1&1.2 1324 */ 1325 readonly url: string; 1326} 1327 1328/** 1329 * Defines the Span Type. 1330 * 1331 * @typedef { TextStyle | DecorationStyle | BaselineOffsetStyle | LetterSpacingStyle | TextShadowStyle | 1332 * GestureStyle | ImageAttachment | ParagraphStyle | LineHeightStyle | CustomSpan | 1333 * UserDataSpan } StyledStringValue 1334 * @syscap SystemCapability.ArkUI.ArkUI.Full 1335 * @crossplatform 1336 * @atomicservice 1337 * @since 12 1338 */ 1339 1340/** 1341 * Defines the Span Type. 1342 * 1343 * @typedef { TextStyle | DecorationStyle | BaselineOffsetStyle | LetterSpacingStyle | TextShadowStyle | 1344 * GestureStyle | ImageAttachment | ParagraphStyle | LineHeightStyle | UrlStyle | CustomSpan | 1345 * UserDataSpan | BackgroundColorStyle } StyledStringValue 1346 * @syscap SystemCapability.ArkUI.ArkUI.Full 1347 * @crossplatform 1348 * @atomicservice 1349 * @since arkts {'1.1':'14','1.2':'20'} 1350 * @arkts 1.1&1.2 1351 */ 1352declare type StyledStringValue = TextStyle | DecorationStyle | BaselineOffsetStyle | LetterSpacingStyle | 1353TextShadowStyle | GestureStyle | ImageAttachment | ParagraphStyle | LineHeightStyle | UrlStyle | CustomSpan | 1354UserDataSpan | BackgroundColorStyle; 1355 1356/** 1357 * MutableStyledString 1358 * 1359 * @extends StyledString 1360 * @syscap SystemCapability.ArkUI.ArkUI.Full 1361 * @crossplatform 1362 * @atomicservice 1363 * @since arkts {'1.1':'12','1.2':'20'} 1364 * @arkts 1.1&1.2 1365 */ 1366declare class MutableStyledString extends StyledString { 1367 /** 1368 * constructor. 1369 * 1370 * @param { string | ImageAttachment | CustomSpan } value - indicates the current object value of the MutableStyledString. 1371 * @param { Array<StyleOptions> } [styles] - indicates the SpanStyle objects. 1372 * @syscap SystemCapability.ArkUI.ArkUI.Full 1373 * @crossplatform 1374 * @atomicservice 1375 * @since 20 1376 * @arkts 1.2 1377 */ 1378 constructor(value: string | ImageAttachment | CustomSpan, styles?: Array<StyleOptions>); 1379 1380 /** 1381 * Replace the string of the specified range. 1382 * 1383 * @param { number } start - the start position of the replacedString. 1384 * @param { number } length - the length of the replacedString's characters. 1385 * @param { string } other - must be unicode string. 1386 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1387 * <br> 1. Mandatory parameters are left unspecified. 1388 * <br> 2. Incorrect parameters types. 1389 * <br> 3. Parameter verification failed. 1390 * @syscap SystemCapability.ArkUI.ArkUI.Full 1391 * @crossplatform 1392 * @atomicservice 1393 * @since arkts {'1.1':'12','1.2':'20'} 1394 * @arkts 1.1&1.2 1395 */ 1396 replaceString(start: number, length: number, other: string): void; 1397 1398 /** 1399 * Insert the string at the specified location. 1400 * 1401 * @param { number } start - the start position of the insertedString. 1402 * @param { string } other - must be unicode string. 1403 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1404 * <br> 1. Mandatory parameters are left unspecified. 1405 * <br> 2. Incorrect parameters types. 1406 * <br> 3. Parameter verification failed. 1407 * @syscap SystemCapability.ArkUI.ArkUI.Full 1408 * @crossplatform 1409 * @atomicservice 1410 * @since arkts {'1.1':'12','1.2':'20'} 1411 * @arkts 1.1&1.2 1412 */ 1413 insertString(start: number, other: string): void; 1414 1415 /** 1416 * Remove the string of the specified range. 1417 * 1418 * @param { number } start - the start position of the removedString. 1419 * @param { number } length - the length of the removedString's characters. 1420 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1421 * <br> 1. Mandatory parameters are left unspecified. 1422 * <br> 2. Incorrect parameters types. 1423 * <br> 3. Parameter verification failed. 1424 * @syscap SystemCapability.ArkUI.ArkUI.Full 1425 * @crossplatform 1426 * @atomicservice 1427 * @since arkts {'1.1':'12','1.2':'20'} 1428 * @arkts 1.1&1.2 1429 */ 1430 removeString(start: number, length: number): void; 1431 1432 /** 1433 * Replace the specified range string attribute. 1434 * 1435 * @param { SpanStyle } spanStyle - the SpanStyle Object. 1436 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1437 * <br> 1. Mandatory parameters are left unspecified. 1438 * <br> 2. Incorrect parameters types. 1439 * <br> 3. Parameter verification failed. 1440 * @syscap SystemCapability.ArkUI.ArkUI.Full 1441 * @crossplatform 1442 * @atomicservice 1443 * @since arkts {'1.1':'12','1.2':'20'} 1444 * @arkts 1.1&1.2 1445 */ 1446 replaceStyle(spanStyle: SpanStyle): void; 1447 1448 /** 1449 * Add attributes to the specified range string. 1450 * 1451 * @param { SpanStyle } spanStyle - the SpanStyle Object. 1452 * @throws { BusinessError } 401 - The parameter check failed. 1453 * @syscap SystemCapability.ArkUI.ArkUI.Full 1454 * @crossplatform 1455 * @atomicservice 1456 * @since arkts {'1.1':'12','1.2':'20'} 1457 * @arkts 1.1&1.2 1458 */ 1459 setStyle(spanStyle: SpanStyle): void; 1460 1461 /** 1462 * Delete the specified type attributes for the specified range string. 1463 * 1464 * @param { number } start - the start position of the removedAttributeStyledString. 1465 * @param { number } length - the length of the removedAttributeStyledString's characters. 1466 * @param { StyledStringKey } styledKey - the specified attribute type's key. 1467 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1468 * <br> 1. Mandatory parameters are left unspecified. 1469 * <br> 2. Incorrect parameters types. 1470 * <br> 3. Parameter verification failed. 1471 * @syscap SystemCapability.ArkUI.ArkUI.Full 1472 * @crossplatform 1473 * @atomicservice 1474 * @since arkts {'1.1':'12','1.2':'20'} 1475 * @arkts 1.1&1.2 1476 */ 1477 removeStyle(start: number, length: number, styledKey: StyledStringKey): void; 1478 1479 /** 1480 * Delete all attributes for the specified range styledString. 1481 * 1482 * @param { number } start - the start position of the attributeRemovedStyledString's characters. 1483 * @param { number } length - the length of the attributeRemovedStyledString's characters. 1484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1485 * <br> 1. Mandatory parameters are left unspecified. 1486 * <br> 2. Incorrect parameters types. 1487 * <br> 3. Parameter verification failed. 1488 * @syscap SystemCapability.ArkUI.ArkUI.Full 1489 * @crossplatform 1490 * @atomicservice 1491 * @since arkts {'1.1':'12','1.2':'20'} 1492 * @arkts 1.1&1.2 1493 */ 1494 removeStyles(start: number, length: number): void; 1495 1496 /** 1497 * Delete all attributes. 1498 * 1499 * @syscap SystemCapability.ArkUI.ArkUI.Full 1500 * @crossplatform 1501 * @atomicservice 1502 * @since arkts {'1.1':'12','1.2':'20'} 1503 * @arkts 1.1&1.2 1504 */ 1505 clearStyles(): void; 1506 1507 /** 1508 * Replace the StyledString of the specified range. 1509 * 1510 * @param { number } start - the start position of the replacedStyledString. 1511 * @param { number } length - the length of the replacedStyledString's characters. 1512 * @param { StyledString } other - new StyledString. 1513 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1514 * <br> 1. Mandatory parameters are left unspecified. 1515 * <br> 2. Incorrect parameters types. 1516 * <br> 3. Parameter verification failed. 1517 * @syscap SystemCapability.ArkUI.ArkUI.Full 1518 * @crossplatform 1519 * @atomicservice 1520 * @since arkts {'1.1':'12','1.2':'20'} 1521 * @arkts 1.1&1.2 1522 */ 1523 replaceStyledString(start: number, length: number, other: StyledString): void; 1524 1525 /** 1526 * Insert new StyledString at the specified location. 1527 * 1528 * @param { number } start - the start position of the insertedStyledString. 1529 * @param { StyledString } other - new StyledString. 1530 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1531 * <br> 1. Mandatory parameters are left unspecified. 1532 * <br> 2. Incorrect parameters types. 1533 * <br> 3. Parameter verification failed. 1534 * @syscap SystemCapability.ArkUI.ArkUI.Full 1535 * @crossplatform 1536 * @atomicservice 1537 * @since arkts {'1.1':'12','1.2':'20'} 1538 * @arkts 1.1&1.2 1539 */ 1540 insertStyledString(start: number, other: StyledString): void; 1541 1542 /** 1543 * Append new StyledString at the end. 1544 * 1545 * @param { StyledString } other - new StyledString. 1546 * @syscap SystemCapability.ArkUI.ArkUI.Full 1547 * @crossplatform 1548 * @atomicservice 1549 * @since arkts {'1.1':'12','1.2':'20'} 1550 * @arkts 1.1&1.2 1551 */ 1552 appendStyledString(other: StyledString): void; 1553} 1554 1555 1556/** 1557 * the attribute type of the StyledString 1558 * 1559 * @enum { number } 1560 * @syscap SystemCapability.ArkUI.ArkUI.Full 1561 * @crossplatform 1562 * @atomicservice 1563 * @since arkts {'1.1':'12','1.2':'20'} 1564 * @arkts 1.1&1.2 1565 */ 1566declare enum StyledStringKey { 1567 /** 1568 * The key of TextStyle. 1569 * 1570 * @syscap SystemCapability.ArkUI.ArkUI.Full 1571 * @crossplatform 1572 * @atomicservice 1573 * @since arkts {'1.1':'12','1.2':'20'} 1574 * @arkts 1.1&1.2 1575 */ 1576 FONT = 0, 1577 1578 /** 1579 * The key of DecorationStyle. 1580 * 1581 * @syscap SystemCapability.ArkUI.ArkUI.Full 1582 * @crossplatform 1583 * @atomicservice 1584 * @since arkts {'1.1':'12','1.2':'20'} 1585 * @arkts 1.1&1.2 1586 */ 1587 DECORATION = 1, 1588 1589 /** 1590 * The key of BaselineOffsetStyle. 1591 * 1592 * @syscap SystemCapability.ArkUI.ArkUI.Full 1593 * @crossplatform 1594 * @atomicservice 1595 * @since arkts {'1.1':'12','1.2':'20'} 1596 * @arkts 1.1&1.2 1597 */ 1598 BASELINE_OFFSET = 2, 1599 1600 /** 1601 * The key of LetterSpacingStyle. 1602 * 1603 * @syscap SystemCapability.ArkUI.ArkUI.Full 1604 * @crossplatform 1605 * @atomicservice 1606 * @since arkts {'1.1':'12','1.2':'20'} 1607 * @arkts 1.1&1.2 1608 */ 1609 LETTER_SPACING = 3, 1610 1611 /** 1612 * The key of TextShadowStyle. 1613 * 1614 * @syscap SystemCapability.ArkUI.ArkUI.Full 1615 * @crossplatform 1616 * @atomicservice 1617 * @since arkts {'1.1':'12','1.2':'20'} 1618 * @arkts 1.1&1.2 1619 */ 1620 TEXT_SHADOW = 4, 1621 1622 /** 1623 * The key of LineHeightStyle. 1624 * 1625 * @syscap SystemCapability.ArkUI.ArkUI.Full 1626 * @crossplatform 1627 * @atomicservice 1628 * @since arkts {'1.1':'12','1.2':'20'} 1629 * @arkts 1.1&1.2 1630 */ 1631 LINE_HEIGHT = 5, 1632 1633 /** 1634 * The key of BackgroundColorStyle. 1635 * 1636 * @syscap SystemCapability.ArkUI.ArkUI.Full 1637 * @crossplatform 1638 * @atomicservice 1639 * @since arkts {'1.1':'14','1.2':'20'} 1640 * @arkts 1.1&1.2 1641 */ 1642 BACKGROUND_COLOR = 6, 1643 1644 /** 1645 * The key of UrlStyle. 1646 * 1647 * @syscap SystemCapability.ArkUI.ArkUI.Full 1648 * @crossplatform 1649 * @atomicservice 1650 * @since arkts {'1.1':'14','1.2':'20'} 1651 * @arkts 1.1&1.2 1652 */ 1653 URL = 7, 1654 1655 /** 1656 * The key of GestureStyle. 1657 * 1658 * @syscap SystemCapability.ArkUI.ArkUI.Full 1659 * @crossplatform 1660 * @atomicservice 1661 * @since arkts {'1.1':'12','1.2':'20'} 1662 * @arkts 1.1&1.2 1663 */ 1664 GESTURE = 100, 1665 1666 /** 1667 * The key of ParagraphStyle. 1668 * 1669 * @syscap SystemCapability.ArkUI.ArkUI.Full 1670 * @crossplatform 1671 * @atomicservice 1672 * @since arkts {'1.1':'12','1.2':'20'} 1673 * @arkts 1.1&1.2 1674 */ 1675 PARAGRAPH_STYLE = 200, 1676 1677 /** 1678 * The key of ImageAttachment. 1679 * 1680 * @syscap SystemCapability.ArkUI.ArkUI.Full 1681 * @crossplatform 1682 * @atomicservice 1683 * @since arkts {'1.1':'12','1.2':'20'} 1684 * @arkts 1.1&1.2 1685 */ 1686 IMAGE = 300, 1687 1688 /** 1689 * The key of CustomSpan. 1690 * 1691 * @syscap SystemCapability.ArkUI.ArkUI.Full 1692 * @crossplatform 1693 * @atomicservice 1694 * @since arkts {'1.1':'12','1.2':'20'} 1695 * @arkts 1.1&1.2 1696 */ 1697 CUSTOM_SPAN = 400, 1698 1699 /** 1700 * The key of UserDataSpan. 1701 * 1702 * @syscap SystemCapability.ArkUI.ArkUI.Full 1703 * @crossplatform 1704 * @atomicservice 1705 * @since arkts {'1.1':'12','1.2':'20'} 1706 * @arkts 1.1&1.2 1707 */ 1708 USER_DATA = 500, 1709} 1710 1711/** 1712 * Defines ImageAttachment. 1713 * 1714 * @syscap SystemCapability.ArkUI.ArkUI.Full 1715 * @crossplatform 1716 * @atomicservice 1717 * @since arkts {'1.1':'12','1.2':'20'} 1718 * @arkts 1.1&1.2 1719 */ 1720declare class ImageAttachment { 1721 1722 /** 1723 * constructor. 1724 * 1725 * @param { ImageAttachmentInterface } value - image attachment object. 1726 * @syscap SystemCapability.ArkUI.ArkUI.Full 1727 * @crossplatform 1728 * @atomicservice 1729 * @since 12 1730 */ 1731 constructor(value: ImageAttachmentInterface); 1732 1733 /** 1734 * constructor supported by AttachmentType. 1735 * 1736 * @param { Optional<AttachmentType> } attachment - image attachment object. 1737 * @syscap SystemCapability.ArkUI.ArkUI.Full 1738 * @crossplatform 1739 * @atomicservice 1740 * @since 15 1741 */ 1742 constructor(attachment: Optional<AttachmentType>); 1743 1744 /** 1745 * constructor supported by AttachmentType. 1746 * 1747 * @param { ImageAttachmentInterface | Optional<AttachmentType> } attachment - image attachment object. 1748 * @syscap SystemCapability.ArkUI.ArkUI.Full 1749 * @crossplatform 1750 * @atomicservice 1751 * @since 20 1752 * @arkts 1.2 1753 */ 1754 constructor(value: ImageAttachmentInterface | Optional<AttachmentType>); 1755 1756 /** 1757 * Get the image content of the StyledString. 1758 * 1759 * @type { PixelMap } - the image content of the StyledString or undefined 1760 * @readonly 1761 * @syscap SystemCapability.ArkUI.ArkUI.Full 1762 * @crossplatform 1763 * @atomicservice 1764 * @since arkts {'1.1':'12','1.2':'20'} 1765 * @arkts 1.1&1.2 1766 */ 1767 readonly value: PixelMap; 1768 1769 /** 1770 * Get the imageSize of the StyledString. 1771 * 1772 * @type { ?SizeOptions } - the imageSize of the StyledString or undefined 1773 * @readonly 1774 * @syscap SystemCapability.ArkUI.ArkUI.Full 1775 * @crossplatform 1776 * @atomicservice 1777 * @since arkts {'1.1':'12','1.2':'20'} 1778 * @arkts 1.1&1.2 1779 */ 1780 readonly size?: SizeOptions; 1781 1782 /** 1783 * Get the ImageSpanAlignment of the StyledString. 1784 * 1785 * @type { ?ImageSpanAlignment } - the ImageSpanAlignment of the StyledString or undefined 1786 * @readonly 1787 * @syscap SystemCapability.ArkUI.ArkUI.Full 1788 * @crossplatform 1789 * @atomicservice 1790 * @since arkts {'1.1':'12','1.2':'20'} 1791 * @arkts 1.1&1.2 1792 */ 1793 readonly verticalAlign?: ImageSpanAlignment; 1794 1795 /** 1796 * Get the imageFit of the StyledString. 1797 * 1798 * @type { ?ImageFit } - the imageFit of the StyledString or undefined 1799 * @readonly 1800 * @syscap SystemCapability.ArkUI.ArkUI.Full 1801 * @crossplatform 1802 * @atomicservice 1803 * @since arkts {'1.1':'12','1.2':'20'} 1804 * @arkts 1.1&1.2 1805 */ 1806 readonly objectFit?: ImageFit; 1807 1808 /** 1809 * Get the imageAttachmentLayoutStyle of the StyledString. 1810 * 1811 * @type { ?ImageAttachmentLayoutStyle } - the imageAttachmentLayoutStyle of the StyledString or undefined 1812 * @readonly 1813 * @syscap SystemCapability.ArkUI.ArkUI.Full 1814 * @crossplatform 1815 * @atomicservice 1816 * @since arkts {'1.1':'12','1.2':'20'} 1817 * @arkts 1.1&1.2 1818 */ 1819 readonly layoutStyle?: ImageAttachmentLayoutStyle; 1820 1821 /** 1822 * Get the imageAttachment colorFilter of the StyledString. 1823 * 1824 * @type { ?ColorFilterType } - the imageAttachment colorFilter of the StyledString or undefined 1825 * @readonly 1826 * @syscap SystemCapability.ArkUI.ArkUI.Full 1827 * @crossplatform 1828 * @atomicservice 1829 * @since arkts {'1.1':'15','1.2':'20'} 1830 * @arkts 1.1&1.2 1831 */ 1832 readonly colorFilter?: ColorFilterType; 1833} 1834 1835/** 1836 * Defines the ResourceImageAttachmentOptions. 1837 * 1838 * @interface ResourceImageAttachmentOptions 1839 * @syscap SystemCapability.ArkUI.ArkUI.Full 1840 * @crossplatform 1841 * @atomicservice 1842 * @since arkts {'1.1':'15','1.2':'20'} 1843 * @arkts 1.1&1.2 1844 */ 1845declare interface ResourceImageAttachmentOptions { 1846 /** 1847 * The content of the ResourceImageAttachment. 1848 * 1849 * @type { Optional<ResourceStr> } 1850 * @syscap SystemCapability.ArkUI.ArkUI.Full 1851 * @crossplatform 1852 * @atomicservice 1853 * @since arkts {'1.1':'15','1.2':'20'} 1854 * @arkts 1.1&1.2 1855 */ 1856 resourceValue: Optional<ResourceStr>; 1857 1858 /** 1859 * size of the ResourceImage. 1860 * 1861 * @type { ?SizeOptions } 1862 * @syscap SystemCapability.ArkUI.ArkUI.Full 1863 * @crossplatform 1864 * @atomicservice 1865 * @since arkts {'1.1':'15','1.2':'20'} 1866 * @arkts 1.1&1.2 1867 */ 1868 size?: SizeOptions; 1869 1870 /** 1871 * Image vertical align. 1872 * 1873 * @type { ?ImageSpanAlignment } 1874 * @syscap SystemCapability.ArkUI.ArkUI.Full 1875 * @crossplatform 1876 * @atomicservice 1877 * @since arkts {'1.1':'15','1.2':'20'} 1878 * @arkts 1.1&1.2 1879 */ 1880 verticalAlign?: ImageSpanAlignment; 1881 1882 /** 1883 * Sets the zoom type of the ImageAttachment. 1884 * 1885 * @type { ?ImageFit } 1886 * @syscap SystemCapability.ArkUI.ArkUI.Full 1887 * @crossplatform 1888 * @atomicservice 1889 * @since arkts {'1.1':'15','1.2':'20'} 1890 * @arkts 1.1&1.2 1891 */ 1892 objectFit?: ImageFit; 1893 1894 /** 1895 * The Image Layout Style of the Resource Image. 1896 * 1897 * @type { ?ImageAttachmentLayoutStyle } 1898 * @syscap SystemCapability.ArkUI.ArkUI.Full 1899 * @crossplatform 1900 * @atomicservice 1901 * @since arkts {'1.1':'15','1.2':'20'} 1902 * @arkts 1.1&1.2 1903 */ 1904 layoutStyle?: ImageAttachmentLayoutStyle; 1905 1906 /** 1907 * Sets the color filter effect on the image attachment. 1908 * 1909 * @type { ?ColorFilterType } filter ColorFilter object. 1910 * @syscap SystemCapability.ArkUI.ArkUI.Full 1911 * @crossplatform 1912 * @atomicservice 1913 * @since arkts {'1.1':'15','1.2':'20'} 1914 * @arkts 1.1&1.2 1915 */ 1916 colorFilter?: ColorFilterType; 1917 1918 /** 1919 * Sets the synchronous or asynchronous mode for image loading. 1920 * The default parameter type is bool, and the default value is false. 1921 * 1922 * @type { ?boolean } 1923 * @syscap SystemCapability.ArkUI.ArkUI.Full 1924 * @crossplatform 1925 * @atomicservice 1926 * @since arkts {'1.1':'15','1.2':'20'} 1927 * @arkts 1.1&1.2 1928 */ 1929 syncLoad?: boolean; 1930} 1931 1932/** 1933 * Defines the ImageAttachmentInterface. 1934 * 1935 * @interface ImageAttachmentInterface 1936 * @syscap SystemCapability.ArkUI.ArkUI.Full 1937 * @crossplatform 1938 * @atomicservice 1939 * @since arkts {'1.1':'12','1.2':'20'} 1940 * @arkts 1.1&1.2 1941 */ 1942declare interface ImageAttachmentInterface { 1943 /** 1944 * The content of the ImageAttachment. 1945 * 1946 * @type { PixelMap } 1947 * @syscap SystemCapability.ArkUI.ArkUI.Full 1948 * @crossplatform 1949 * @atomicservice 1950 * @since arkts {'1.1':'12','1.2':'20'} 1951 * @arkts 1.1&1.2 1952 */ 1953 value: PixelMap; 1954 1955 /** 1956 * Image size. 1957 * 1958 * @type { ?SizeOptions } 1959 * @syscap SystemCapability.ArkUI.ArkUI.Full 1960 * @crossplatform 1961 * @atomicservice 1962 * @since arkts {'1.1':'12','1.2':'20'} 1963 * @arkts 1.1&1.2 1964 */ 1965 size?: SizeOptions; 1966 1967 /** 1968 * Image vertical align. 1969 * 1970 * @type { ?ImageSpanAlignment } 1971 * @syscap SystemCapability.ArkUI.ArkUI.Full 1972 * @crossplatform 1973 * @atomicservice 1974 * @since arkts {'1.1':'12','1.2':'20'} 1975 * @arkts 1.1&1.2 1976 */ 1977 verticalAlign?: ImageSpanAlignment; 1978 1979 /** 1980 * Image fit. 1981 * 1982 * @type { ?ImageFit } 1983 * @syscap SystemCapability.ArkUI.ArkUI.Full 1984 * @crossplatform 1985 * @atomicservice 1986 * @since arkts {'1.1':'12','1.2':'20'} 1987 * @arkts 1.1&1.2 1988 */ 1989 objectFit?: ImageFit; 1990 1991 /** 1992 * The Image Layout Style. 1993 * 1994 * @type { ?ImageAttachmentLayoutStyle } 1995 * @syscap SystemCapability.ArkUI.ArkUI.Full 1996 * @crossplatform 1997 * @atomicservice 1998 * @since arkts {'1.1':'12','1.2':'20'} 1999 * @arkts 1.1&1.2 2000 */ 2001 layoutStyle?: ImageAttachmentLayoutStyle; 2002 2003 /** 2004 * Sets the color filter effect on the image attachment. 2005 * 2006 * @type { ?ColorFilterType } filter ColorFilter object. 2007 * @syscap SystemCapability.ArkUI.ArkUI.Full 2008 * @crossplatform 2009 * @atomicservice 2010 * @since arkts {'1.1':'15','1.2':'20'} 2011 * @arkts 1.1&1.2 2012 */ 2013 colorFilter?: ColorFilterType; 2014} 2015 2016/** 2017 * Defines the Attachment Type. 2018 * 2019 * @typedef { ImageAttachmentInterface | ResourceImageAttachmentOptions } AttachmentType 2020 * @syscap SystemCapability.ArkUI.ArkUI.Full 2021 * @crossplatform 2022 * @atomicservice 2023 * @since arkts {'1.1':'15','1.2':'20'} 2024 * @arkts 1.1&1.2 2025 */ 2026declare type AttachmentType = ImageAttachmentInterface | ResourceImageAttachmentOptions; 2027 2028/** 2029 * Defines the ColorFilter Type. 2030 * 2031 * @typedef { ColorFilter | DrawingColorFilter } ColorFilterType 2032 * @syscap SystemCapability.ArkUI.ArkUI.Full 2033 * @crossplatform 2034 * @atomicservice 2035 * @since arkts {'1.1':'15','1.2':'20'} 2036 * @arkts 1.1&1.2 2037 */ 2038declare type ColorFilterType = ColorFilter | DrawingColorFilter; 2039 2040/** 2041 * Defines the ImageAttachment Layout Style. 2042 * 2043 * @interface ImageAttachmentLayoutStyle 2044 * @syscap SystemCapability.ArkUI.ArkUI.Full 2045 * @crossplatform 2046 * @atomicservice 2047 * @since arkts {'1.1':'12','1.2':'20'} 2048 * @arkts 1.1&1.2 2049 */ 2050declare interface ImageAttachmentLayoutStyle { 2051 /** 2052 * Outer Margin. 2053 * 2054 * @type { ?(LengthMetrics | Margin) } 2055 * @syscap SystemCapability.ArkUI.ArkUI.Full 2056 * @crossplatform 2057 * @atomicservice 2058 * @since arkts {'1.1':'12','1.2':'20'} 2059 * @arkts 1.1&1.2 2060 */ 2061 margin?: LengthMetrics | Margin; 2062 2063 /** 2064 * Inner margin. 2065 * 2066 * @type { ?(LengthMetrics | Padding) } 2067 * @syscap SystemCapability.ArkUI.ArkUI.Full 2068 * @crossplatform 2069 * @atomicservice 2070 * @since arkts {'1.1':'12','1.2':'20'} 2071 * @arkts 1.1&1.2 2072 */ 2073 padding?: LengthMetrics | Padding; 2074 2075 /** 2076 * Border radius. 2077 * 2078 * @type { ?(LengthMetrics | BorderRadiuses) } 2079 * @syscap SystemCapability.ArkUI.ArkUI.Full 2080 * @crossplatform 2081 * @atomicservice 2082 * @since arkts {'1.1':'12','1.2':'20'} 2083 * @arkts 1.1&1.2 2084 */ 2085 borderRadius?: LengthMetrics | BorderRadiuses; 2086} 2087 2088/** 2089 * Defines the CustomSpanMetrics interface. 2090 * 2091 * @interface CustomSpanMetrics 2092 * @syscap SystemCapability.ArkUI.ArkUI.Full 2093 * @crossplatform 2094 * @atomicservice 2095 * @since arkts {'1.1':'12','1.2':'20'} 2096 * @arkts 1.1&1.2 2097 */ 2098declare interface CustomSpanMetrics { 2099 /** 2100 * CustomSpan Width. 2101 * The unit is vp. 2102 * 2103 * @type { number } 2104 * @default 0 2105 * @syscap SystemCapability.ArkUI.ArkUI.Full 2106 * @crossplatform 2107 * @atomicservice 2108 * @since arkts {'1.1':'12','1.2':'20'} 2109 * @arkts 1.1&1.2 2110 */ 2111 width: number; 2112 2113 /** 2114 * CustomSpan Height. 2115 * The unit is vp. 2116 * 2117 * @type { ?number } 2118 * @syscap SystemCapability.ArkUI.ArkUI.Full 2119 * @crossplatform 2120 * @atomicservice 2121 * @since arkts {'1.1':'12','1.2':'20'} 2122 * @arkts 1.1&1.2 2123 */ 2124 height?: number; 2125} 2126 2127/** 2128 * Defines the CustomSpanDrawInfo interface. 2129 * 2130 * @interface CustomSpanDrawInfo 2131 * @syscap SystemCapability.ArkUI.ArkUI.Full 2132 * @crossplatform 2133 * @atomicservice 2134 * @since arkts {'1.1':'12','1.2':'20'} 2135 * @arkts 1.1&1.2 2136 */ 2137declare interface CustomSpanDrawInfo { 2138 /** 2139 * CustomSpan's offset relative to the parent component. 2140 * The unit is px. 2141 * 2142 * @type { number } 2143 * @syscap SystemCapability.ArkUI.ArkUI.Full 2144 * @crossplatform 2145 * @atomicservice 2146 * @since arkts {'1.1':'12','1.2':'20'} 2147 * @arkts 1.1&1.2 2148 */ 2149 x: number; 2150 2151 /** 2152 * The top position of the line where customSpan is located. 2153 * The unit is px. 2154 * 2155 * @type { number } 2156 * @syscap SystemCapability.ArkUI.ArkUI.Full 2157 * @crossplatform 2158 * @atomicservice 2159 * @since arkts {'1.1':'12','1.2':'20'} 2160 * @arkts 1.1&1.2 2161 */ 2162 lineTop: number; 2163 2164 /** 2165 * The bottom position of the line where customSpan is located. 2166 * The unit is px. 2167 * 2168 * @type { number } 2169 * @syscap SystemCapability.ArkUI.ArkUI.Full 2170 * @crossplatform 2171 * @atomicservice 2172 * @since arkts {'1.1':'12','1.2':'20'} 2173 * @arkts 1.1&1.2 2174 */ 2175 lineBottom: number; 2176 2177 /** 2178 * The baseline offset of the line where customSpan is located. 2179 * The unit is px. 2180 * 2181 * @type { number } 2182 * @syscap SystemCapability.ArkUI.ArkUI.Full 2183 * @crossplatform 2184 * @atomicservice 2185 * @since arkts {'1.1':'12','1.2':'20'} 2186 * @arkts 1.1&1.2 2187 */ 2188 baseline: number; 2189} 2190 2191/** 2192 * Defines the CustomSpanMeasureInfo interface. 2193 * 2194 * @interface CustomSpanMeasureInfo 2195 * @syscap SystemCapability.ArkUI.ArkUI.Full 2196 * @crossplatform 2197 * @atomicservice 2198 * @since arkts {'1.1':'12','1.2':'20'} 2199 * @arkts 1.1&1.2 2200 */ 2201declare interface CustomSpanMeasureInfo { 2202 /** 2203 * Current component's fontSize value. 2204 * The unit is fp. 2205 * 2206 * @type { number } 2207 * @syscap SystemCapability.ArkUI.ArkUI.Full 2208 * @crossplatform 2209 * @atomicservice 2210 * @since arkts {'1.1':'12','1.2':'20'} 2211 * @arkts 1.1&1.2 2212 */ 2213 fontSize: number; 2214} 2215 2216/** 2217 * Defines CustomSpan. 2218 * 2219 * @syscap SystemCapability.ArkUI.ArkUI.Full 2220 * @crossplatform 2221 * @atomicservice 2222 * @since arkts {'1.1':'12','1.2':'20'} 2223 * @arkts 1.1&1.2 2224 */ 2225declare abstract class CustomSpan { 2226 /** 2227 * Measure the size of custom span. 2228 * 2229 * @param { CustomSpanMeasureInfo } measureInfo 2230 * @returns { CustomSpanMetrics } - CustomSpan Size 2231 * @syscap SystemCapability.ArkUI.ArkUI.Full 2232 * @crossplatform 2233 * @atomicservice 2234 * @since arkts {'1.1':'12','1.2':'20'} 2235 * @arkts 1.1&1.2 2236 */ 2237 abstract onMeasure(measureInfo: CustomSpanMeasureInfo) : CustomSpanMetrics; 2238 2239 /** 2240 * Draw the custom span. 2241 * 2242 * @param { DrawContext } context 2243 * @param { CustomSpanDrawInfo } drawInfo 2244 * @syscap SystemCapability.ArkUI.ArkUI.Full 2245 * @crossplatform 2246 * @atomicservice 2247 * @since arkts {'1.1':'12','1.2':'20'} 2248 * @arkts 1.1&1.2 2249 */ 2250 abstract onDraw(context: DrawContext, drawInfo: CustomSpanDrawInfo): void; 2251 2252 /** 2253 * Invalidate all components that use the object, which will cause a re-render of all components. 2254 * 2255 * @syscap SystemCapability.ArkUI.ArkUI.Full 2256 * @crossplatform 2257 * @atomicservice 2258 * @since arkts {'1.1':'13','1.2':'20'} 2259 * @arkts 1.1&1.2 2260 */ 2261 invalidate(): void; 2262} 2263 2264/** 2265 * Defines UserDataSpan. Used to store and obtain user data. 2266 * 2267 * @syscap SystemCapability.ArkUI.ArkUI.Full 2268 * @crossplatform 2269 * @atomicservice 2270 * @since arkts {'1.1':'12','1.2':'20'} 2271 * @arkts 1.1&1.2 2272 */ 2273declare abstract class UserDataSpan {}