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/** 22 * Declare the jump method. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 7 27 */ 28/** 29 * Declare the jump method. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * Declare the jump method. 38 * 39 * @enum { number } 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45declare enum RouteType { 46 /** 47 * The page is not redirected. 48 * 49 * @syscap SystemCapability.ArkUI.ArkUI.Full 50 * @since 7 51 */ 52 /** 53 * The page is not redirected. 54 * 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @crossplatform 57 * @since 10 58 */ 59 /** 60 * The page is not redirected. 61 * 62 * @syscap SystemCapability.ArkUI.ArkUI.Full 63 * @crossplatform 64 * @atomicservice 65 * @since 11 66 */ 67 None, 68 69 /** 70 * Go to the next page. 71 * 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @since 7 74 */ 75 /** 76 * Go to the next page. 77 * 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @since 10 81 */ 82 /** 83 * Go to the next page. 84 * 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @crossplatform 87 * @atomicservice 88 * @since 11 89 */ 90 Push, 91 92 /** 93 * Redirect to a specified page. 94 * 95 * @syscap SystemCapability.ArkUI.ArkUI.Full 96 * @since 7 97 */ 98 /** 99 * Redirect to a specified page. 100 * 101 * @syscap SystemCapability.ArkUI.ArkUI.Full 102 * @crossplatform 103 * @since 10 104 */ 105 /** 106 * Redirect to a specified page. 107 * 108 * @syscap SystemCapability.ArkUI.ArkUI.Full 109 * @crossplatform 110 * @atomicservice 111 * @since 11 112 */ 113 Pop, 114} 115 116/** 117 * Declare the sliding effect of transition. 118 * 119 * @enum { number } 120 * @syscap SystemCapability.ArkUI.ArkUI.Full 121 * @since 7 122 */ 123/** 124 * Declare the sliding effect of transition. 125 * 126 * @enum { number } 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @crossplatform 129 * @since 10 130 */ 131/** 132 * Declare the sliding effect of transition. 133 * 134 * @enum { number } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @crossplatform 137 * @atomicservice 138 * @since 11 139 */ 140declare enum SlideEffect { 141 /** 142 * Swipe left. 143 * 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @since 7 146 */ 147 /** 148 * Swipe left. 149 * 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @crossplatform 152 * @since 10 153 */ 154 /** 155 * Swipe left. 156 * 157 * @syscap SystemCapability.ArkUI.ArkUI.Full 158 * @crossplatform 159 * @atomicservice 160 * @since 11 161 */ 162 Left, 163 164 /** 165 * Swipe right. 166 * 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @since 7 169 */ 170 /** 171 * Swipe right. 172 * 173 * @syscap SystemCapability.ArkUI.ArkUI.Full 174 * @crossplatform 175 * @since 10 176 */ 177 /** 178 * Swipe right. 179 * 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @crossplatform 182 * @atomicservice 183 * @since 11 184 */ 185 Right, 186 187 /** 188 * Swipe top. 189 * 190 * @syscap SystemCapability.ArkUI.ArkUI.Full 191 * @since 7 192 */ 193 /** 194 * Swipe top. 195 * 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @crossplatform 198 * @since 10 199 */ 200 /** 201 * Swipe top. 202 * 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @crossplatform 205 * @atomicservice 206 * @since 11 207 */ 208 Top, 209 210 /** 211 * Swipe bottom. 212 * 213 * @syscap SystemCapability.ArkUI.ArkUI.Full 214 * @since 7 215 */ 216 /** 217 * Swipe bottom. 218 * 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @crossplatform 221 * @since 10 222 */ 223 /** 224 * Swipe bottom. 225 * 226 * @syscap SystemCapability.ArkUI.ArkUI.Full 227 * @crossplatform 228 * @atomicservice 229 * @since 11 230 */ 231 Bottom, 232 233 /** 234 * Swipe start. 235 * 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @atomicservice 239 * @since 12 240 */ 241 START = 5, 242 243 /** 244 * Swipe end. 245 * 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @crossplatform 248 * @atomicservice 249 * @since 12 250 */ 251 END = 6, 252} 253 254/** 255 * Provides interfaces for common transitions. 256 * 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @since 7 259 */ 260/** 261 * Provides interfaces for common transitions. 262 * 263 * @syscap SystemCapability.ArkUI.ArkUI.Full 264 * @crossplatform 265 * @since 10 266 */ 267/** 268 * Provides interfaces for common transitions. 269 * 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @atomicservice 273 * @since 11 274 */ 275declare class CommonTransition<T> { 276 /** 277 * Called when a transition method is required. 278 * 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @since 7 281 */ 282 /** 283 * Called when a transition method is required. 284 * 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @crossplatform 287 * @since 10 288 */ 289 /** 290 * Called when a transition method is required. 291 * 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @crossplatform 294 * @atomicservice 295 * @since 11 296 */ 297 constructor(); 298 299 /** 300 * Called when the slide in effect of the transition is set. 301 * 302 * @param { SlideEffect } value 303 * @returns { T } 304 * @syscap SystemCapability.ArkUI.ArkUI.Full 305 * @since 7 306 */ 307 /** 308 * Called when the slide in effect of the transition is set. 309 * 310 * @param { SlideEffect } value 311 * @returns { T } 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @since 10 315 */ 316 /** 317 * Called when the slide in effect of the transition is set. 318 * 319 * @param { SlideEffect } value 320 * @returns { T } 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @crossplatform 323 * @atomicservice 324 * @since 11 325 */ 326 slide(value: SlideEffect): T; 327 328 /** 329 * Called when the translation effect of page transition is set. 330 * 331 * @param { object } value 332 * @returns { T } 333 * @syscap SystemCapability.ArkUI.ArkUI.Full 334 * @since 7 335 */ 336 /** 337 * Called when the translation effect of page transition is set. 338 * 339 * @param { object } value 340 * @returns { T } 341 * @syscap SystemCapability.ArkUI.ArkUI.Full 342 * @crossplatform 343 * @since 10 344 */ 345 /** 346 * Called when the translation effect of page transition is set. 347 * 348 * @param { object } value 349 * @returns { T } 350 * @syscap SystemCapability.ArkUI.ArkUI.Full 351 * @crossplatform 352 * @atomicservice 353 * @since 11 354 */ 355 /** 356 * Called when the translation effect of page transition is set. 357 * 358 * @param { TranslateOptions } value 359 * @returns { T } 360 * @syscap SystemCapability.ArkUI.ArkUI.Full 361 * @crossplatform 362 * @atomicservice 363 * @since 13 364 */ 365 translate(value: TranslateOptions): T; 366 367 /** 368 * Called when setting the zoom effect of page transition. 369 * 370 * @param { object } value 371 * @returns { T } 372 * @syscap SystemCapability.ArkUI.ArkUI.Full 373 * @since 7 374 */ 375 /** 376 * Called when setting the zoom effect of page transition. 377 * 378 * @param { object } value 379 * @returns { T } 380 * @syscap SystemCapability.ArkUI.ArkUI.Full 381 * @crossplatform 382 * @since 10 383 */ 384 /** 385 * Called when setting the zoom effect of page transition. 386 * 387 * @param { object } value 388 * @returns { T } 389 * @syscap SystemCapability.ArkUI.ArkUI.Full 390 * @crossplatform 391 * @atomicservice 392 * @since 11 393 */ 394 /** 395 * Called when setting the zoom effect of page transition. 396 * 397 * @param { ScaleOptions } value 398 * @returns { T } 399 * @syscap SystemCapability.ArkUI.ArkUI.Full 400 * @crossplatform 401 * @atomicservice 402 * @since 13 403 */ 404 scale(value: ScaleOptions): T; 405 406 /** 407 * Called when the transparency value of the starting point of entry or the ending point of exit is set. 408 * 409 * @param { number } value 410 * @returns { T } 411 * @syscap SystemCapability.ArkUI.ArkUI.Full 412 * @since 7 413 */ 414 /** 415 * Called when the transparency value of the starting point of entry or the ending point of exit is set. 416 * 417 * @param { number } value 418 * @returns { T } 419 * @syscap SystemCapability.ArkUI.ArkUI.Full 420 * @crossplatform 421 * @since 10 422 */ 423 /** 424 * Called when the transparency value of the starting point of entry or the ending point of exit is set. 425 * 426 * @param { number } value 427 * @returns { T } 428 * @syscap SystemCapability.ArkUI.ArkUI.Full 429 * @crossplatform 430 * @atomicservice 431 * @since 11 432 */ 433 opacity(value: number): T; 434} 435 436/** 437 * Defines pageTransition constructor parameters. 438 * 439 * @interface PageTransitionOptions 440 * @syscap SystemCapability.ArkUI.ArkUI.Full 441 * @since 7 442 */ 443/** 444 * Defines pageTransition constructor parameters. 445 * 446 * @interface PageTransitionOptions 447 * @syscap SystemCapability.ArkUI.ArkUI.Full 448 * @crossplatform 449 * @since 10 450 */ 451/** 452 * Defines pageTransition constructor parameters. 453 * 454 * @interface PageTransitionOptions 455 * @syscap SystemCapability.ArkUI.ArkUI.Full 456 * @crossplatform 457 * @atomicservice 458 * @since 11 459 */ 460declare interface PageTransitionOptions { 461 /** 462 * RouteType in which the pageTransition can work. 463 * @type { ?RouteType } 464 * @syscap SystemCapability.ArkUI.ArkUI.Full 465 * @since 7 466 */ 467 /** 468 * RouteType in which the pageTransition can work. 469 * @type { ?RouteType } 470 * @syscap SystemCapability.ArkUI.ArkUI.Full 471 * @crossplatform 472 * @since 10 473 */ 474 /** 475 * RouteType in which the pageTransition can work. 476 * @type { ?RouteType } 477 * @syscap SystemCapability.ArkUI.ArkUI.Full 478 * @crossplatform 479 * @atomicservice 480 * @since 11 481 */ 482 type?: RouteType; 483 /** 484 * PageTransition animation duration, in ms. 485 * @type { ?number } 486 * @syscap SystemCapability.ArkUI.ArkUI.Full 487 * @since 7 488 */ 489 /** 490 * PageTransition animation duration, in ms. 491 * @type { ?number } 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @crossplatform 494 * @since 10 495 */ 496 /** 497 * PageTransition animation duration, in ms. 498 * @type { ?number } 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @crossplatform 501 * @atomicservice 502 * @since 11 503 */ 504 duration?: number; 505 /** 506 * PageTransition animation curve. 507 * @type { ?(Curve | string) } 508 * @default Curve.Linear 509 * @syscap SystemCapability.ArkUI.ArkUI.Full 510 * @since 7 511 */ 512 /** 513 * PageTransition animation curve. 514 * @type { ?(Curve | string | ICurve) } 515 * @default Curve.Linear 516 * @syscap SystemCapability.ArkUI.ArkUI.Full 517 * @crossplatform 518 * @since 10 519 */ 520 /** 521 * PageTransition animation curve. 522 * @type { ?(Curve | string | ICurve) } 523 * @default Curve.Linear 524 * @syscap SystemCapability.ArkUI.ArkUI.Full 525 * @crossplatform 526 * @atomicservice 527 * @since 11 528 */ 529 curve?: Curve | string | ICurve; 530 /** 531 * PageTransition animation delay time, in ms. 532 * @type { ?number } 533 * @default 0 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @since 7 536 */ 537 /** 538 * PageTransition animation delay time, in ms. 539 * @type { ?number } 540 * @default 0 541 * @syscap SystemCapability.ArkUI.ArkUI.Full 542 * @crossplatform 543 * @since 10 544 */ 545 /** 546 * PageTransition animation delay time, in ms. 547 * @type { ?number } 548 * @default 0 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @crossplatform 551 * @atomicservice 552 * @since 11 553 */ 554 delay?: number; 555} 556 557/** 558 * Callback used to report page trasition events. 559 * 560 * @typedef { function } PageTransitionCallback 561 * @param { RouteType } type - transition route type 562 * @param { number } progress - transition progess 563 * @syscap SystemCapability.ArkUI.ArkUI.Full 564 * @crossplatform 565 * @atomicservice 566 * @since 13 567 */ 568declare type PageTransitionCallback = (type: RouteType, progress: number) => void 569 570/** 571 * Provides an interface for page rotation mode. 572 * 573 * @interface PageTransitionEnterInterface 574 * @syscap SystemCapability.ArkUI.ArkUI.Full 575 * @since 7 576 */ 577/** 578 * Provides an interface to set transition style when a page enters. 579 * 580 * @interface PageTransitionEnterInterface 581 * @syscap SystemCapability.ArkUI.ArkUI.Full 582 * @crossplatform 583 * @since 10 584 */ 585/** 586 * Provides an interface to set transition style when a page enters. 587 * 588 * @interface PageTransitionEnterInterface 589 * @syscap SystemCapability.ArkUI.ArkUI.Full 590 * @crossplatform 591 * @atomicservice 592 * @since 11 593 */ 594interface PageTransitionEnterInterface extends CommonTransition<PageTransitionEnterInterface> { 595 /** 596 * Called when page Jump animation is used. 597 * 598 * @param { PageTransitionOptions } value 599 * @returns { PageTransitionEnterInterface } 600 * @syscap SystemCapability.ArkUI.ArkUI.Full 601 * @since 7 602 */ 603 /** 604 * Called when page Jump animation is used. 605 * 606 * @param { PageTransitionOptions } value - pageTransition options 607 * @returns { PageTransitionEnterInterface } 608 * @syscap SystemCapability.ArkUI.ArkUI.Full 609 * @crossplatform 610 * @since 10 611 */ 612 /** 613 * Called when page Jump animation is used. 614 * 615 * @param { PageTransitionOptions } value - pageTransition options 616 * @returns { PageTransitionEnterInterface } 617 * @syscap SystemCapability.ArkUI.ArkUI.Full 618 * @crossplatform 619 * @atomicservice 620 * @since 11 621 */ 622 (value: PageTransitionOptions): PageTransitionEnterInterface; 623 624 /** 625 * Called when the incoming parameter is the normalized progress of the current incoming animation. 626 * 627 * @param { function } event 628 * @returns { PageTransitionEnterInterface } 629 * @syscap SystemCapability.ArkUI.ArkUI.Full 630 * @since 7 631 */ 632 /** 633 * Called frame by frame to customize pageTransition animation when the page enters. 634 * The incoming parameter is the normalized progress of the current incoming animation. 635 * 636 * @param { function } event - animation callback frame by frame 637 * @returns { PageTransitionEnterInterface } 638 * @syscap SystemCapability.ArkUI.ArkUI.Full 639 * @crossplatform 640 * @since 10 641 */ 642 /** 643 * Called frame by frame to customize pageTransition animation when the page enters. 644 * The incoming parameter is the normalized progress of the current incoming animation. 645 * 646 * @param { function } event - animation callback frame by frame 647 * @returns { PageTransitionEnterInterface } 648 * @syscap SystemCapability.ArkUI.ArkUI.Full 649 * @crossplatform 650 * @atomicservice 651 * @since 11 652 */ 653 /** 654 * Called frame by frame to customize pageTransition animation when the page enters. 655 * The incoming parameter is the normalized progress of the current incoming animation. 656 * 657 * @param { PageTransitionCallback } event - animation callback frame by frame 658 * @returns { PageTransitionEnterInterface } 659 * @syscap SystemCapability.ArkUI.ArkUI.Full 660 * @crossplatform 661 * @atomicservice 662 * @since 13 663 */ 664 onEnter(event: PageTransitionCallback): PageTransitionEnterInterface; 665} 666 667/** 668 * Provide an interface to exit the transition. 669 * 670 * @interface PageTransitionExitInterface 671 * @syscap SystemCapability.ArkUI.ArkUI.Full 672 * @since 7 673 */ 674/** 675 * Provide an interface to set transition style when a page exits. 676 * 677 * @interface PageTransitionExitInterface 678 * @syscap SystemCapability.ArkUI.ArkUI.Full 679 * @crossplatform 680 * @since 10 681 */ 682/** 683 * Provide an interface to set transition style when a page exits. 684 * 685 * @interface PageTransitionExitInterface 686 * @syscap SystemCapability.ArkUI.ArkUI.Full 687 * @crossplatform 688 * @atomicservice 689 * @since 11 690 */ 691interface PageTransitionExitInterface extends CommonTransition<PageTransitionExitInterface> { 692 /** 693 * Called when the transition is delayed. 694 * 695 * @param { PageTransitionOptions } value 696 * @returns { PageTransitionExitInterface } 697 * @syscap SystemCapability.ArkUI.ArkUI.Full 698 * @since 7 699 */ 700 /** 701 * Called when page Jump animation is used. 702 * 703 * @param { PageTransitionOptions } value - pageTransition options 704 * @returns { PageTransitionExitInterface } 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @crossplatform 707 * @since 10 708 */ 709 /** 710 * Called when page Jump animation is used. 711 * 712 * @param { PageTransitionOptions } value - pageTransition options 713 * @returns { PageTransitionExitInterface } 714 * @syscap SystemCapability.ArkUI.ArkUI.Full 715 * @crossplatform 716 * @atomicservice 717 * @since 11 718 */ 719 (value: PageTransitionOptions): PageTransitionExitInterface; 720 721 /** 722 * Called when the input parameter is the normalized progress of the current exit animation. 723 * 724 * @param { function } event 725 * @returns { PageTransitionExitInterface } 726 * @syscap SystemCapability.ArkUI.ArkUI.Full 727 * @since 7 728 */ 729 /** 730 * Called frame by frame to customize pageTransition animation when the page exits. 731 * The input parameter is the normalized progress of the current exit animation. 732 * 733 * @param { function } event 734 * @returns { PageTransitionExitInterface } 735 * @syscap SystemCapability.ArkUI.ArkUI.Full 736 * @crossplatform 737 * @since 10 738 */ 739 /** 740 * Called frame by frame to customize pageTransition animation when the page exits. 741 * The input parameter is the normalized progress of the current exit animation. 742 * 743 * @param { function } event 744 * @returns { PageTransitionExitInterface } 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since 11 749 */ 750 /** 751 * Called frame by frame to customize pageTransition animation when the page exits. 752 * The input parameter is the normalized progress of the current exit animation. 753 * 754 * @param { PageTransitionCallback } event 755 * @returns { PageTransitionExitInterface } 756 * @syscap SystemCapability.ArkUI.ArkUI.Full 757 * @crossplatform 758 * @atomicservice 759 * @since 13 760 */ 761 onExit(event: PageTransitionCallback): PageTransitionExitInterface; 762} 763 764/** 765 * Defines PageTransitionEnter Component. 766 * 767 * @syscap SystemCapability.ArkUI.ArkUI.Full 768 * @since 7 769 */ 770/** 771 * Defines PageTransitionEnter Component. 772 * 773 * @syscap SystemCapability.ArkUI.ArkUI.Full 774 * @crossplatform 775 * @since 10 776 */ 777/** 778 * Defines PageTransitionEnter Component. 779 * 780 * @syscap SystemCapability.ArkUI.ArkUI.Full 781 * @crossplatform 782 * @atomicservice 783 * @since 11 784 */ 785declare const PageTransitionEnter: PageTransitionEnterInterface; 786 787/** 788 * Defines PageTransitionExit Component. 789 * 790 * @syscap SystemCapability.ArkUI.ArkUI.Full 791 * @since 7 792 */ 793/** 794 * Defines PageTransitionExit Component. 795 * 796 * @syscap SystemCapability.ArkUI.ArkUI.Full 797 * @crossplatform 798 * @since 10 799 */ 800/** 801 * Defines PageTransitionExit Component. 802 * 803 * @syscap SystemCapability.ArkUI.ArkUI.Full 804 * @crossplatform 805 * @atomicservice 806 * @since 11 807 */ 808declare const PageTransitionExit: PageTransitionExitInterface; 809