1/* 2 * Copyright (c) 2021-2023 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 { ResourceColor, Dimension, BorderRadiuses, Length, Font } from './units'; 23import { CommonMethod, ShadowOptions } from './common'; 24import { LengthMetrics } from './../Graphics'; 25import { Resource } from './../../../api/global/resource'; 26import { FontStyle, FontWeight, TextCase } from './enums'; 27import { DecorationStyleInterface } from './styledString'; 28/*** endif */ 29 30/** 31 * Define the background style of span. 32 * 33 * @interface TextBackgroundStyle 34 * @syscap SystemCapability.ArkUI.ArkUI.Full 35 * @crossplatform 36 * @since 11 37 */ 38/** 39 * Define the background style of span. 40 * 41 * @interface TextBackgroundStyle 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @crossplatform 44 * @atomicservice 45 * @since arkts {'1.1':'12','1.2':'20'} 46 * @arkts 1.1&1.2 47 */ 48declare interface TextBackgroundStyle { 49 /** 50 * Background color of span. 51 * 52 * @type { ?ResourceColor } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @crossplatform 55 * @since 11 56 */ 57 /** 58 * Background color of span. 59 * 60 * @type { ?ResourceColor } 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @crossplatform 63 * @atomicservice 64 * @since arkts {'1.1':'12','1.2':'20'} 65 * @arkts 1.1&1.2 66 */ 67 color?: ResourceColor; 68 69 /** 70 * Background radius of span. 71 * 72 * @type { ?(Dimension | BorderRadiuses) } 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @crossplatform 75 * @since 11 76 */ 77 /** 78 * Background radius of span. 79 * 80 * @type { ?(Dimension | BorderRadiuses) } 81 * @syscap SystemCapability.ArkUI.ArkUI.Full 82 * @crossplatform 83 * @atomicservice 84 * @since arkts {'1.1':'12','1.2':'20'} 85 * @arkts 1.1&1.2 86 */ 87 radius?: Dimension | BorderRadiuses; 88} 89 90/** 91 * Define the BaseSpan class, contains the common methods of span. 92 * 93 * @extends CommonMethod<T> 94 * @syscap SystemCapability.ArkUI.ArkUI.Full 95 * @crossplatform 96 * @since 11 97 */ 98/** 99 * Define the BaseSpan class, contains the common methods of span. 100 * 101 * @extends CommonMethod<T> 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @crossplatform 104 * @atomicservice 105 * @since arkts {'1.1':'12','1.2':'20'} 106 * @arkts 1.1&1.2 107 */ 108declare class BaseSpan<T> extends CommonMethod<T> { 109 /** 110 * Span background style. 111 * 112 * @param { TextBackgroundStyle } style - The background style of span. 113 * @returns { T } 114 * @syscap SystemCapability.ArkUI.ArkUI.Full 115 * @crossplatform 116 * @since 11 117 */ 118 /** 119 * Span background style. 120 * 121 * @param { TextBackgroundStyle } style - The background style of span. 122 * @returns { T } 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @crossplatform 125 * @atomicservice 126 * @since arkts {'1.1':'12','1.2':'20'} 127 * @arkts 1.1&1.2 128 */ 129 textBackgroundStyle(style: TextBackgroundStyle): T; 130 131 /** 132 * Base line offset of the Span. 133 * 134 * @param { LengthMetrics } value - The base line offset of the Span. 135 * @returns { T } The attribute of the Span. 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @crossplatform 138 * @atomicservice 139 * @since arkts {'1.1':'12','1.2':'20'} 140 * @arkts 1.1&1.2 141 */ 142 baselineOffset(value: LengthMetrics): T; 143} 144 145/** 146 * Provide text decoration. 147 * 148 * @interface SpanInterface 149 * @syscap SystemCapability.ArkUI.ArkUI.Full 150 * @since 7 151 */ 152/** 153 * Provide text decoration. 154 * 155 * @interface SpanInterface 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @form 158 * @since 9 159 */ 160/** 161 * Provide text decoration. 162 * 163 * @interface SpanInterface 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @crossplatform 166 * @form 167 * @since 10 168 */ 169/** 170 * Provide text decoration. 171 * 172 * @interface SpanInterface 173 * @syscap SystemCapability.ArkUI.ArkUI.Full 174 * @crossplatform 175 * @form 176 * @atomicservice 177 * @since arkts {'1.1':'11','1.2':'20'} 178 * @arkts 1.1&1.2 179 */ 180interface SpanInterface { 181 /** 182 * Called when text is entered in span. 183 * 184 * @param { string | Resource } value 185 * @returns { SpanAttribute } 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @since 7 188 */ 189 /** 190 * Called when text is entered in span. 191 * 192 * @param { string | Resource } value 193 * @returns { SpanAttribute } 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @form 196 * @since 9 197 */ 198 /** 199 * Called when text is entered in span. 200 * 201 * @param { string | Resource } value 202 * @returns { SpanAttribute } 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @crossplatform 205 * @form 206 * @since 10 207 */ 208 /** 209 * Called when text is entered in span. 210 * 211 * @param { string | Resource } value 212 * @returns { SpanAttribute } 213 * @syscap SystemCapability.ArkUI.ArkUI.Full 214 * @crossplatform 215 * @form 216 * @atomicservice 217 * @since arkts {'1.1':'11','1.2':'20'} 218 * @arkts 1.1&1.2 219 */ 220 (value: string | Resource): SpanAttribute; 221} 222 223/** 224 * @extends CommonMethod<SpanAttribute> 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @since 7 227 */ 228/** 229 * @extends CommonMethod<SpanAttribute> 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @form 232 * @since 9 233 */ 234/** 235 * @extends CommonMethod<SpanAttribute> 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @form 239 * @since 10 240 */ 241/** 242 * @extends BaseSpan<SpanAttribute> 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @crossplatform 245 * @form 246 * @atomicservice 247 * @since arkts {'1.1':'11','1.2':'20'} 248 * @arkts 1.1&1.2 249 */ 250declare class SpanAttribute extends BaseSpan<SpanAttribute> { 251 /** 252 * Called when the font is set. 253 * 254 * @param { Font } value - the span font size and weight and family and style. 255 * @returns { SpanAttribute } The attribute of the span. 256 * @syscap SystemCapability.ArkUI.ArkUI.Full 257 * @since 10 258 */ 259 /** 260 * Called when the font is set. 261 * 262 * @param { Font } value - the span font size and weight and family and style. 263 * @returns { SpanAttribute } The attribute of the span. 264 * @syscap SystemCapability.ArkUI.ArkUI.Full 265 * @crossplatform 266 * @atomicservice 267 * @since arkts {'1.1':'11','1.2':'20'} 268 * @arkts 1.1&1.2 269 */ 270 font(value: Font): SpanAttribute; 271 272 /** 273 * Called when the font color is set. 274 * 275 * @param { ResourceColor } value 276 * @returns { SpanAttribute } 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @since 7 279 */ 280 /** 281 * Called when the font color is set. 282 * 283 * @param { ResourceColor } value 284 * @returns { SpanAttribute } 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @form 287 * @since 9 288 */ 289 /** 290 * Called when the font color is set. 291 * 292 * @param { ResourceColor } value 293 * @returns { SpanAttribute } 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @crossplatform 296 * @form 297 * @since 10 298 */ 299 /** 300 * Called when the font color is set. 301 * 302 * @param { ResourceColor } value 303 * @returns { SpanAttribute } 304 * @syscap SystemCapability.ArkUI.ArkUI.Full 305 * @crossplatform 306 * @form 307 * @atomicservice 308 * @since arkts {'1.1':'11','1.2':'20'} 309 * @arkts 1.1&1.2 310 */ 311 fontColor(value: ResourceColor): SpanAttribute; 312 313 /** 314 * Called when the font size is set. 315 * 316 * @param { number | string | Resource } value 317 * @returns { SpanAttribute } 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @since 7 320 */ 321 /** 322 * Called when the font size is set. 323 * 324 * @param { number | string | Resource } value 325 * @returns { SpanAttribute } 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @form 328 * @since 9 329 */ 330 /** 331 * Called when the font size is set. 332 * 333 * @param { number | string | Resource } value 334 * @returns { SpanAttribute } 335 * @syscap SystemCapability.ArkUI.ArkUI.Full 336 * @crossplatform 337 * @form 338 * @since 10 339 */ 340 /** 341 * Called when the font size is set. 342 * 343 * @param { number | string | Resource } value 344 * @returns { SpanAttribute } 345 * @syscap SystemCapability.ArkUI.ArkUI.Full 346 * @crossplatform 347 * @form 348 * @atomicservice 349 * @since arkts {'1.1':'11','1.2':'20'} 350 * @arkts 1.1&1.2 351 */ 352 fontSize(value: number | string | Resource): SpanAttribute; 353 354 /** 355 * Called when the font style of a font is set. 356 * 357 * @param { FontStyle } value 358 * @returns { SpanAttribute } 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @since 7 361 */ 362 /** 363 * Called when the font style of a font is set. 364 * 365 * @param { FontStyle } value 366 * @returns { SpanAttribute } 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @form 369 * @since 9 370 */ 371 /** 372 * Called when the font style of a font is set. 373 * 374 * @param { FontStyle } value 375 * @returns { SpanAttribute } 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @crossplatform 378 * @form 379 * @since 10 380 */ 381 /** 382 * Called when the font style of a font is set. 383 * 384 * @param { FontStyle } value 385 * @returns { SpanAttribute } 386 * @syscap SystemCapability.ArkUI.ArkUI.Full 387 * @crossplatform 388 * @form 389 * @atomicservice 390 * @since arkts {'1.1':'11','1.2':'20'} 391 * @arkts 1.1&1.2 392 */ 393 fontStyle(value: FontStyle): SpanAttribute; 394 395 /** 396 * Called when the font weight is set. 397 * 398 * @param { number | FontWeight | string } value 399 * @returns { SpanAttribute } 400 * @syscap SystemCapability.ArkUI.ArkUI.Full 401 * @since 7 402 */ 403 /** 404 * Called when the font weight is set. 405 * 406 * @param { number | FontWeight | string } value 407 * @returns { SpanAttribute } 408 * @syscap SystemCapability.ArkUI.ArkUI.Full 409 * @form 410 * @since 9 411 */ 412 /** 413 * Called when the font weight is set. 414 * 415 * @param { number | FontWeight | string } value 416 * @returns { SpanAttribute } 417 * @syscap SystemCapability.ArkUI.ArkUI.Full 418 * @crossplatform 419 * @form 420 * @since 10 421 */ 422 /** 423 * Called when the font weight is set. 424 * 425 * @param { number | FontWeight | string } value 426 * @returns { SpanAttribute } 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @crossplatform 429 * @form 430 * @atomicservice 431 * @since 11 432 */ 433 /** 434 * Called when the font weight is set. 435 * 436 * @param { number | FontWeight | ResourceStr } value 437 * @returns { SpanAttribute } 438 * @syscap SystemCapability.ArkUI.ArkUI.Full 439 * @crossplatform 440 * @form 441 * @atomicservice 442 * @since 20 443 */ 444 fontWeight(value: number | FontWeight | ResourceStr): SpanAttribute; 445 446 /** 447 * Called when the font weight is set. 448 * 449 * @param { number | FontWeight | string } value 450 * @returns { SpanAttribute } 451 * @syscap SystemCapability.ArkUI.ArkUI.Full 452 * @crossplatform 453 * @form 454 * @atomicservice 455 * @since 20 456 * @arkts 1.2 457 */ 458 fontWeight(value: number | FontWeight | string): SpanAttribute; 459 460 /** 461 * Called when the font list of text is set. 462 * 463 * @param { string | Resource } value 464 * @returns { SpanAttribute } 465 * @syscap SystemCapability.ArkUI.ArkUI.Full 466 * @since 7 467 */ 468 /** 469 * Called when the font list of text is set. 470 * 471 * @param { string | Resource } value 472 * @returns { SpanAttribute } 473 * @syscap SystemCapability.ArkUI.ArkUI.Full 474 * @form 475 * @since 9 476 */ 477 /** 478 * Called when the font list of text is set. 479 * 480 * @param { string | Resource } value 481 * @returns { SpanAttribute } 482 * @syscap SystemCapability.ArkUI.ArkUI.Full 483 * @crossplatform 484 * @form 485 * @since 10 486 */ 487 /** 488 * Called when the font list of text is set. 489 * 490 * @param { string | Resource } value 491 * @returns { SpanAttribute } 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @crossplatform 494 * @form 495 * @atomicservice 496 * @since arkts {'1.1':'11','1.2':'20'} 497 * @arkts 1.1&1.2 498 */ 499 fontFamily(value: string | Resource): SpanAttribute; 500 501 /** 502 * Called when the text decoration of the text is set. 503 * 504 * @param { object } value 505 * @returns { SpanAttribute } 506 * @syscap SystemCapability.ArkUI.ArkUI.Full 507 * @since 7 508 */ 509 /** 510 * Called when the text decoration of the text is set. 511 * 512 * @param { object } value 513 * @returns { SpanAttribute } 514 * @syscap SystemCapability.ArkUI.ArkUI.Full 515 * @form 516 * @since 9 517 */ 518 /** 519 * Called when the text decoration of the text is set. 520 * 521 * @param { object } value 522 * @returns { SpanAttribute } 523 * @syscap SystemCapability.ArkUI.ArkUI.Full 524 * @crossplatform 525 * @form 526 * @since 10 527 */ 528 /** 529 * Called when the text decoration of the text is set. 530 * 531 * @param { object } value 532 * @returns { SpanAttribute } 533 * @syscap SystemCapability.ArkUI.ArkUI.Full 534 * @crossplatform 535 * @form 536 * @atomicservice 537 * @since 11 538 */ 539 /** 540 * Called when the text decoration of the text is set. 541 * 542 * @param { DecorationStyleInterface } value 543 * @returns { SpanAttribute } 544 * @syscap SystemCapability.ArkUI.ArkUI.Full 545 * @crossplatform 546 * @form 547 * @atomicservice 548 * @since arkts {'1.1':'12','1.2':'20'} 549 * @arkts 1.1&1.2 550 */ 551 decoration(value: DecorationStyleInterface): SpanAttribute; 552 553 /** 554 * Called when the distance between text fonts is set. 555 * 556 * @param { number | string } value 557 * @returns { SpanAttribute } 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @since 7 560 */ 561 /** 562 * Called when the distance between text fonts is set. 563 * 564 * @param { number | string } value 565 * @returns { SpanAttribute } 566 * @syscap SystemCapability.ArkUI.ArkUI.Full 567 * @form 568 * @since 9 569 */ 570 /** 571 * Called when the distance between text fonts is set. 572 * 573 * @param { number | string } value 574 * @returns { SpanAttribute } 575 * @syscap SystemCapability.ArkUI.ArkUI.Full 576 * @crossplatform 577 * @form 578 * @since 10 579 */ 580 /** 581 * Called when the distance between text fonts is set. 582 * 583 * @param { number | string } value 584 * @returns { SpanAttribute } 585 * @syscap SystemCapability.ArkUI.ArkUI.Full 586 * @crossplatform 587 * @form 588 * @atomicservice 589 * @since 11 590 */ 591 /** 592 * Called when the distance between text fonts is set. 593 * 594 * @param { number | ResourceStr } value 595 * @returns { SpanAttribute } 596 * @syscap SystemCapability.ArkUI.ArkUI.Full 597 * @crossplatform 598 * @form 599 * @atomicservice 600 * @since 20 601 */ 602 letterSpacing(value: number | ResourceStr): SpanAttribute; 603 604 /** 605 * Called when the distance between text fonts is set. 606 * 607 * @param { number | string } value 608 * @returns { SpanAttribute } 609 * @syscap SystemCapability.ArkUI.ArkUI.Full 610 * @crossplatform 611 * @form 612 * @atomicservice 613 * @since 20 614 * @arkts 1.2 615 */ 616 letterSpacing(value: number | string): SpanAttribute; 617 618 /** 619 * Called when the type of letter in the text font is set. 620 * 621 * @param { TextCase } value 622 * @returns { SpanAttribute } 623 * @syscap SystemCapability.ArkUI.ArkUI.Full 624 * @since 7 625 */ 626 /** 627 * Called when the type of letter in the text font is set. 628 * 629 * @param { TextCase } value 630 * @returns { SpanAttribute } 631 * @syscap SystemCapability.ArkUI.ArkUI.Full 632 * @form 633 * @since 9 634 */ 635 /** 636 * Called when the type of letter in the text font is set. 637 * 638 * @param { TextCase } value 639 * @returns { SpanAttribute } 640 * @syscap SystemCapability.ArkUI.ArkUI.Full 641 * @crossplatform 642 * @form 643 * @since 10 644 */ 645 /** 646 * Called when the type of letter in the text font is set. 647 * 648 * @param { TextCase } value 649 * @returns { SpanAttribute } 650 * @syscap SystemCapability.ArkUI.ArkUI.Full 651 * @crossplatform 652 * @form 653 * @atomicservice 654 * @since arkts {'1.1':'11','1.2':'20'} 655 * @arkts 1.1&1.2 656 */ 657 textCase(value: TextCase): SpanAttribute; 658 659 /** 660 * Called when the line height of the span is set. 661 * 662 * @param { Length } value - The line height of the span. 663 * @returns { SpanAttribute } The attribute of the span. 664 * @syscap SystemCapability.ArkUI.ArkUI.Full 665 * @since 10 666 */ 667 /** 668 * Called when the line height of the span is set. 669 * 670 * @param { Length } value - The line height of the span. 671 * @returns { SpanAttribute } The attribute of the span. 672 * @syscap SystemCapability.ArkUI.ArkUI.Full 673 * @crossplatform 674 * @atomicservice 675 * @since arkts {'1.1':'11','1.2':'20'} 676 * @arkts 1.1&1.2 677 */ 678 lineHeight(value: Length): SpanAttribute; 679 680 /** 681 * Called when the text shadow is set. 682 * 683 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 684 * @returns { SpanAttribute } 685 * @syscap SystemCapability.ArkUI.ArkUI.Full 686 * @crossplatform 687 * @since 11 688 */ 689 /** 690 * Called when the text shadow is set. 691 * 692 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 693 * @returns { SpanAttribute } 694 * @syscap SystemCapability.ArkUI.ArkUI.Full 695 * @crossplatform 696 * @atomicservice 697 * @since arkts {'1.1':'12','1.2':'20'} 698 * @arkts 1.1&1.2 699 */ 700 textShadow(value: ShadowOptions | Array<ShadowOptions>): SpanAttribute; 701} 702 703/** 704 * Defines Span Component. 705 * 706 * @syscap SystemCapability.ArkUI.ArkUI.Full 707 * @since 7 708 */ 709/** 710 * Defines Span Component. 711 * 712 * @syscap SystemCapability.ArkUI.ArkUI.Full 713 * @form 714 * @since 9 715 */ 716/** 717 * Defines Span Component. 718 * 719 * @syscap SystemCapability.ArkUI.ArkUI.Full 720 * @crossplatform 721 * @form 722 * @since 10 723 */ 724/** 725 * Defines Span Component. 726 * 727 * @syscap SystemCapability.ArkUI.ArkUI.Full 728 * @crossplatform 729 * @form 730 * @atomicservice 731 * @since 11 732 */ 733declare const Span: SpanInterface; 734 735/** 736 * Defines Span Component instance. 737 * 738 * @syscap SystemCapability.ArkUI.ArkUI.Full 739 * @since 7 740 */ 741/** 742 * Defines Span Component instance. 743 * 744 * @syscap SystemCapability.ArkUI.ArkUI.Full 745 * @form 746 * @since 9 747 */ 748/** 749 * Defines Span Component instance. 750 * 751 * @syscap SystemCapability.ArkUI.ArkUI.Full 752 * @crossplatform 753 * @form 754 * @since 10 755 */ 756/** 757 * Defines Span Component instance. 758 * 759 * @syscap SystemCapability.ArkUI.ArkUI.Full 760 * @crossplatform 761 * @form 762 * @atomicservice 763 * @since 11 764 */ 765declare const SpanInstance: SpanAttribute; 766