1/* 2 * Copyright (c) 2022 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/// <reference path='./import.ts' /> 17 18class ArkBorderStyle { 19 type: boolean | undefined; 20 style: BorderStyle | undefined; 21 top: BorderStyle | undefined; 22 right: BorderStyle | undefined; 23 bottom: BorderStyle | undefined; 24 left: BorderStyle | undefined; 25 26 constructor() { 27 this.type = undefined; 28 this.style = undefined; 29 this.top = undefined; 30 this.right = undefined; 31 this.bottom = undefined; 32 this.left = undefined; 33 } 34 isEqual(another: ArkBorderStyle): boolean { 35 return ( 36 this.type === another.type && 37 this.style === another.style && 38 this.top === another.top && 39 this.right === another.right && 40 this.bottom === another.bottom && 41 this.left === another.left 42 ); 43 } 44 parseBorderStyle(value: BorderStyle | EdgeStyles): boolean { 45 if (typeof value === 'number') { 46 this.style = value; 47 this.type = true; 48 return true; 49 } else if (typeof value === 'object') { 50 return this.parseEdgeStyles(value as EdgeStyles); 51 } 52 return false; 53 } 54 parseEdgeStyles(options: EdgeStyles): boolean { 55 this.top = options.top; 56 this.right = options.right; 57 this.bottom = options.bottom; 58 this.left = options.left; 59 this.type = true; 60 return true; 61 } 62} 63 64class ArkBorderColor { 65 startColor: LocalizedEdgeColors; 66 endColor: LocalizedEdgeColors; 67 leftColor: EdgeColors | ResourceColor; 68 rightColor: EdgeColors | ResourceColor; 69 topColor: EdgeColors | ResourceColor | LocalizedEdgeColors; 70 bottomColor: EdgeColors | ResourceColor | LocalizedEdgeColors; 71 72 constructor() { 73 this.startColor = undefined; 74 this.endColor = undefined; 75 this.leftColor = undefined; 76 this.rightColor = undefined; 77 this.topColor = undefined; 78 this.bottomColor = undefined; 79 } 80 81 isEqual(another: ArkBorderColor): boolean { 82 return ( 83 this.startColor === another.startColor && 84 this.endColor === another.endColor && 85 this.leftColor === another.leftColor && 86 this.rightColor === another.rightColor && 87 this.topColor === another.topColor && 88 this.bottomColor === another.bottomColor 89 ); 90 } 91} 92 93class ArkBorderWidth { 94 left: EdgeWidths | Length; 95 right: EdgeWidths | Length; 96 top: EdgeWidths | Length | LocalizedEdgeWidths; 97 bottom: EdgeWidths | Length | LocalizedEdgeWidths; 98 start: LocalizedEdgeWidths; 99 end: LocalizedEdgeWidths; 100 101 constructor() { 102 this.left = undefined; 103 this.right = undefined; 104 this.top = undefined; 105 this.bottom = undefined; 106 this.start = undefined; 107 this.end = undefined; 108 } 109 110 isEqual(another: ArkBorderWidth): boolean { 111 return ( 112 this.left === another.left && 113 this.right === another.right && 114 this.top === another.top && 115 this.bottom === another.bottom && 116 this.start === another.start && 117 this.end === another.end 118 ); 119 } 120} 121 122class ArkBorderRadius { 123 topLeft: BorderRadiuses | Length; 124 topRight: BorderRadiuses | Length; 125 bottomLeft: BorderRadiuses | Length; 126 bottomRight: BorderRadiuses | Length; 127 topStart: LocalizedBorderRadius; 128 topEnd: LocalizedBorderRadius; 129 bottomStart: LocalizedBorderRadius; 130 bottomEnd: LocalizedBorderRadius; 131 132 constructor() { 133 this.topLeft = undefined; 134 this.topRight = undefined; 135 this.bottomLeft = undefined; 136 this.bottomRight = undefined; 137 this.topStart = undefined; 138 this.topEnd = undefined; 139 this.bottomStart = undefined; 140 this.bottomEnd = undefined; 141 } 142 143 isEqual(another: ArkBorderRadius): boolean { 144 return ( 145 (this.topLeft === another.topLeft && 146 this.topRight === another.topRight && 147 this.bottomLeft === another.bottomLeft && 148 this.bottomRight === another.bottomRight) || 149 (this.topStart === another.topStart && 150 this.topEnd === another.topEnd && 151 this.bottomStart === another.bottomStart && 152 this.bottomEnd === another.bottomEnd) 153 ); 154 } 155} 156 157class ArkLabelFont { 158 size: number | string | undefined | Resource; 159 weight: FontWeight | number | string | undefined; 160 family: string | undefined | Resource; 161 style: FontStyle | number | undefined; 162 constructor() { 163 this.size = undefined; 164 this.weight = undefined; 165 this.family = undefined; 166 this.style = undefined; 167 } 168 169 isEqual(another: ArkLabelFont): boolean { 170 return ( 171 this.size === another.size && 172 this.weight === another.weight && 173 this.family === another.family && 174 this.style === another.style 175 ); 176 } 177} 178 179function deepCompareArrays(arr1: Array<any>, arr2: Array<any>): boolean { 180 return ( 181 Array.isArray(arr1) && 182 Array.isArray(arr2) && 183 arr1.length === arr2.length && 184 arr1.every((value, index) => { 185 if (Array.isArray(value) && Array.isArray(arr2[index])) { 186 return deepCompareArrays(value, arr2[index]); 187 } else { 188 return value === arr2[index]; 189 } 190 }) 191 ); 192} 193 194class ArkLinearGradient { 195 angle: number | string | undefined; 196 direction: number | undefined; 197 colors: Array<any>; 198 repeating: boolean | undefined; 199 200 constructor(angle: number | string | undefined, 201 direction: number | undefined, 202 colors: Array<any>, 203 repeating: boolean | undefined) { 204 this.angle = angle; 205 this.direction = direction; 206 this.colors = colors; 207 this.repeating = repeating; 208 } 209 210 isEqual(another: ArkLinearGradient): boolean { 211 return ( 212 this.angle === another.angle && 213 this.direction === another.direction && 214 deepCompareArrays(this.colors, another.colors) && 215 this.repeating === another.repeating 216 ); 217 } 218} 219 220class ArkSweepGradient { 221 center: Array<any>; 222 start: number | string | undefined; 223 end: number | string | undefined; 224 rotation: number | string | undefined; 225 colors: Array<any>; 226 repeating: boolean | undefined; 227 228 constructor(center: Array<any>, 229 start: number | string | undefined, 230 end: number | string | undefined, 231 rotation: number | string | undefined, 232 colors: Array<any>, 233 repeating: boolean | undefined) { 234 this.center = center; 235 this.start = start; 236 this.end = end; 237 this.rotation = rotation; 238 this.colors = colors; 239 this.repeating = repeating; 240 } 241 242 isEqual(another: ArkSweepGradient): boolean { 243 return ( 244 deepCompareArrays(this.center, another.center) && 245 this.start === another.start && 246 this.end === another.end && 247 this.rotation === another.rotation && 248 deepCompareArrays(this.colors, another.colors) && 249 this.repeating === another.repeating 250 ); 251 } 252} 253 254class ArkForegroundBlurStyle { 255 blurStyle: number | undefined; 256 colorMode: number | undefined; 257 adaptiveColor: number | undefined; 258 scale: number | undefined; 259 blurOptions: BlurOptions | undefined; 260 261 constructor() { 262 this.blurStyle = undefined; 263 this.colorMode = undefined; 264 this.adaptiveColor = undefined; 265 this.scale = undefined; 266 this.blurOptions = undefined; 267 } 268 269 isEqual(another: ArkForegroundBlurStyle): boolean { 270 return ( 271 this.blurStyle === another.blurStyle && 272 this.colorMode === another.colorMode && 273 this.adaptiveColor === another.adaptiveColor && 274 this.scale === another.scale && 275 this.blurOptions === another.blurOptions 276 ); 277 } 278} 279 280class ArkLinearGradientBlur { 281 blurRadius: number | undefined; 282 fractionStops: FractionStop[] | undefined; 283 direction: number | undefined; 284 285 constructor() { 286 this.blurRadius = undefined; 287 this.fractionStops = undefined; 288 this.direction = undefined; 289 } 290 291 isEqual(another: ArkLinearGradientBlur): boolean { 292 return ( 293 this.blurRadius === another.blurRadius && 294 deepCompareArrays(this.fractionStops, another.fractionStops) && 295 this.direction === another.direction 296 ); 297 } 298} 299 300class ArkOverlay { 301 value: string | CustomBuilder | undefined; 302 align: number | undefined; 303 offsetX: number | undefined; 304 offsetY: number | undefined; 305 hasOptions: boolean | undefined; 306 hasOffset: boolean | undefined; 307 308 constructor() { 309 this.value = undefined; 310 this.align = undefined; 311 this.offsetX = undefined; 312 this.offsetY = undefined; 313 this.hasOptions = undefined; 314 this.hasOffset = undefined; 315 } 316 317 private splitOption(options?: { align?: Alignment; offset?: { x?: number; y?: number } }): boolean { 318 if (isUndefined(options)) { 319 return true; 320 } 321 this.hasOptions = true; 322 this.align = options.align; 323 if (isUndefined(options.offset)) { 324 return true; 325 } 326 this.hasOffset = true; 327 this.offsetX = options.offset.x; 328 this.offsetY = options.offset.y; 329 return true; 330 } 331 332 splitOverlayValue(value: string | CustomBuilder, 333 options?: { align?: Alignment; offset?: { x?: number; y?: number } }): boolean { 334 if (typeof value === 'string') { 335 this.value = value; 336 return this.splitOption(options); 337 } 338 return false; 339 } 340 341 private isEqual(another: ArkOverlay): boolean { 342 return ((this.value === another.value) && (this.align === another.align) && 343 (this.offsetX === another.offsetX) && (this.offsetY === another.offsetY) && 344 (this.hasOptions === another.hasOptions) && (this.hasOffset === another.hasOffset)); 345 } 346 347 checkObjectDiff(another: ArkOverlay): boolean { 348 return !this.isEqual(another); 349 } 350} 351 352class ArkSharedTransition { 353 id: string | undefined; 354 options: sharedTransitionOptions | undefined; 355 constructor() { 356 this.id = undefined; 357 this.options = undefined; 358 } 359 isEqual(another: ArkSharedTransition): boolean { 360 return (this.id === another.id) && (this.options === another.options); 361 } 362} 363 364class ArkChainMode { 365 direction: Axis | undefined; 366 style: ChainStyle | undefined; 367 constructor() { 368 this.direction = undefined; 369 this.style = undefined; 370 } 371 isEqual(another: ArkChainMode): boolean { 372 return (this.direction === another.direction) && (this.style === another.style); 373 } 374} 375 376class ArkListEdgeEffect { 377 value: EdgeEffect; 378 options?: EdgeEffectOptions | undefined; 379 constructor() { 380 this.value = undefined; 381 this.options = undefined; 382 } 383 isEqual(another: ArkListEdgeEffect): boolean { 384 return (this.value === another.value) && 385 (this.options === another.options); 386 } 387} 388 389class ArkScrollEdgeEffect { 390 value: EdgeEffect; 391 options?: EdgeEffectOptions | undefined; 392 constructor() { 393 this.value = undefined; 394 this.options = undefined; 395 } 396 isEqual(another: ArkScrollEdgeEffect): boolean { 397 return (this.value === another.value) && 398 (this.options === another.options); 399 } 400} 401 402class ArkBlurOptions { 403 value: number; 404 options?: BlurOptions | undefined; 405 constructor() { 406 this.value = undefined; 407 this.options = undefined; 408 } 409} 410 411class InvertOptions { 412 high: number; 413 low: number; 414 threshold: number; 415 thresholdRange: number; 416 constructor() { 417 this.high = undefined; 418 this.low = undefined; 419 this.threshold = undefined; 420 this.thresholdRange = undefined; 421 } 422} 423 424class ArkMenuAlignType { 425 alignType: number | MenuAlignType; 426 dx: Length; 427 dy: Length; 428 429 constructor(alignType: MenuAlignType, offset?: Offset) { 430 this.alignType = alignType; 431 if (!isUndefined(offset) && isObject(offset)) { 432 this.dx = offset.dx; 433 this.dy = offset.dy; 434 } 435 } 436 437 isEqual(another: ArkMenuAlignType): boolean { 438 return this.alignType === another.alignType && this.dx === another.dx && this.dy === another.dy; 439 } 440} 441 442class ArkSliderTips { 443 showTip: boolean; 444 tipText: string | ResourceStr; 445 446 constructor(value: boolean, content?: string | ResourceStr) { 447 this.showTip = value; 448 this.tipText = content; 449 } 450 451 isEqual(another: ArkSliderTips): boolean { 452 return this.showTip === another.showTip && this.tipText === another.tipText; 453 } 454} 455 456class ArkStarStyle { 457 backgroundUri: string | undefined; 458 foregroundUri: string | undefined; 459 secondaryUri: string | undefined; 460 461 constructor() { 462 this.backgroundUri = undefined; 463 this.foregroundUri = undefined; 464 this.secondaryUri = undefined; 465 } 466 467 isEqual(another: ArkStarStyle): boolean { 468 return ( 469 this.backgroundUri === another.backgroundUri && 470 this.foregroundUri === another.foregroundUri && 471 this.secondaryUri === another.secondaryUri 472 ); 473 } 474} 475 476class ArkBackgroundBlurStyle { 477 blurStyle: number | undefined; 478 colorMode: number | undefined; 479 adaptiveColor: number | undefined; 480 scale: number | undefined; 481 blurOptions: BlurOptions | undefined; 482 483 constructor() { 484 this.blurStyle = undefined; 485 this.colorMode = undefined; 486 this.adaptiveColor = undefined; 487 this.scale = undefined; 488 this.blurOptions = undefined; 489 } 490 491 isEqual(another: ArkBackgroundBlurStyle): boolean { 492 return ( 493 this.blurStyle === another.blurStyle && 494 this.colorMode === another.colorMode && 495 this.adaptiveColor === another.adaptiveColor && 496 this.scale === another.scale && 497 this.blurOptions === another.blurOptions 498 ); 499 } 500} 501 502class ArkBorderDashGap { 503 left: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 504 right: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 505 top: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 506 bottom: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 507 508 constructor() { 509 this.left = undefined; 510 this.right = undefined; 511 this.top = undefined; 512 this.bottom = undefined; 513 } 514 515 isEqual(another: ArkBorderDashGap): boolean { 516 return ( 517 this.left === another.left && 518 this.right === another.right && 519 this.top === another.top && 520 this.bottom === another.bottom 521 ); 522 } 523} 524 525class ArkBorderDashWidth { 526 left: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 527 right: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 528 top: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 529 bottom: EdgeWidths | LengthMetrics | LocalizedEdgeWidths; 530 531 constructor() { 532 this.left = undefined; 533 this.right = undefined; 534 this.top = undefined; 535 this.bottom = undefined; 536 } 537 538 isEqual(another: ArkBorderDashWidth): boolean { 539 return ( 540 this.left === another.left && 541 this.right === another.right && 542 this.top === another.top && 543 this.bottom === another.bottom 544 ); 545 } 546} 547 548class ArkBorder { 549 arkWidth: ArkBorderWidth; 550 arkColor: ArkBorderColor; 551 arkRadius: ArkBorderRadius; 552 arkStyle: ArkBorderStyle; 553 arkDashGap: ArkBorderDashGap; 554 arkDashWidth: ArkBorderDashWidth; 555 556 constructor() { 557 this.arkWidth = new ArkBorderWidth(); 558 this.arkColor = new ArkBorderColor(); 559 this.arkRadius = new ArkBorderRadius(); 560 this.arkStyle = new ArkBorderStyle(); 561 this.arkDashGap = new ArkBorderDashGap(); 562 this.arkDashWidth = new ArkBorderDashWidth(); 563 } 564 isEqual(another: ArkBorder): boolean { 565 return ( 566 this.arkWidth.isEqual(another.arkWidth) && 567 this.arkColor.isEqual(another.arkColor) && 568 this.arkRadius.isEqual(another.arkRadius) && 569 this.arkStyle.isEqual(another.arkStyle) && 570 this.arkDashGap.isEqual(another.arkDashGap) && 571 this.arkDashWidth.isEqual(another.arkDashWidth) 572 ); 573 } 574 575 checkObjectDiff(another: ArkBorder): boolean { 576 return !this.isEqual(another); 577 } 578} 579 580class ArkBackgroundImageSize { 581 imageSize: ImageSize | undefined | SizeOptions; 582 width: number | string | undefined | Resource; 583 height: number | string | undefined | Resource; 584 constructor() { 585 this.imageSize = undefined; 586 this.width = undefined; 587 this.height = undefined; 588 } 589 isEqual(another: ArkBackgroundImageSize): boolean { 590 return this.imageSize === another.imageSize && this.width === another.width && this.height === another.height; 591 } 592} 593 594class ArkBackgroundImage { 595 src: string | undefined | Resource | PixelMap; 596 repeat: number | undefined; 597 constructor() { 598 this.src = undefined; 599 this.repeat = undefined; 600 } 601 isEqual(another: ArkBackgroundImage): boolean { 602 return this.src === another.src && this.repeat === another.repeat; 603 } 604} 605 606class ArkGridColColumnOption implements Equable { 607 xs?: number; 608 sm?: number; 609 md?: number; 610 lg?: number; 611 xl?: number; 612 xxl?: number; 613 constructor() { 614 this.xs = undefined; 615 this.sm = undefined; 616 this.md = undefined; 617 this.lg = undefined; 618 this.xl = undefined; 619 this.xxl = undefined; 620 } 621 isEqual(another: ArkGridColColumnOption): boolean { 622 return (this.xs === another.xs && 623 this.sm === another.sm && 624 this.md === another.md && 625 this.lg === another.lg && 626 this.xl === another.xl && 627 this.xxl === another.xxl); 628 } 629} 630 631class ArkPadding { 632 top: Length | undefined; 633 right: Length | undefined; 634 bottom: Length | undefined; 635 left: Length | undefined; 636 constructor() { 637 this.top = undefined; 638 this.right = undefined; 639 this.bottom = undefined; 640 this.left = undefined; 641 } 642 isEqual(another: ArkPadding) { 643 return ( 644 this.top === another.top && 645 this.right === another.right && 646 this.bottom === another.bottom && 647 this.left === another.left 648 ); 649 } 650} 651 652class ArkBarMode { 653 barMode: number; 654 options?: ScrollableBarModeOptions | undefined; 655 656 isEqual(another: ArkBarMode): boolean { 657 return (this.barMode === another.barMode) && (this.options === another.options); 658 } 659} 660 661class ArkDivider { 662 divider: DividerStyle; 663 664 isEqual(another: ArkDivider): boolean { 665 return (this.divider === another.divider); 666 } 667} 668 669class ArkBarGridAlign { 670 barGridAlign: BarGridColumnOptions; 671 672 isEqual(another: ArkBarGridAlign): boolean { 673 return (this.barGridAlign === another.barGridAlign); 674 } 675} 676 677 678class ArkScrollableBarModeOptions { 679 value: ScrollableBarModeOptions; 680 681 isEqual(another: ArkScrollableBarModeOptions): boolean { 682 return (this.value === another.value); 683 } 684} 685 686class ArkAlignRules { 687 left: string | undefined; 688 middle: string | undefined; 689 right: string | undefined; 690 top: string | undefined; 691 center: string | undefined; 692 bottom: string | undefined; 693 constructor() { 694 this.left = undefined; 695 this.middle = undefined; 696 this.right = undefined; 697 this.top = undefined; 698 this.center = undefined; 699 this.bottom = undefined; 700 } 701 isEqual(another: ArkAlignRules) { 702 return ( 703 this.left === another.left && 704 this.middle === another.middle && 705 this.right === another.right && 706 this.top === another.top && 707 this.center === another.center && 708 this.bottom === another.bottom 709 ); 710 } 711} 712 713class ArkSafeAreaExpandOpts { 714 type: string | number | undefined = undefined; 715 edges: string | number | undefined = undefined; 716 isEqual(another: ArkSafeAreaExpandOpts): boolean { 717 return (this.type === another.type) && (this.edges === another.edges); 718 } 719} 720 721class ArkButtonStyle { 722 left?: number; 723 top?: number; 724 width?: number; 725 height?: number; 726 icons?: { 727 shown?: string; 728 hidden?: string; 729 switching?: string; 730 }; 731 constructor() { 732 this.left = 16; 733 this.top = 48; 734 this.width = 24; 735 this.height = 24; 736 this.icons = { 737 shown: undefined, 738 hidden: undefined, 739 switching: undefined 740 }; 741 } 742 isEqual(another: ArkButtonStyle): boolean { 743 return ( 744 this.left === another.left && 745 this.top === another.top && 746 this.width === another.width && 747 this.height === another.height && 748 this.icons === another.icons 749 ); 750 } 751} 752 753class ArkShadowInfoToArray { 754 radius: (number | string)[]; 755 type: ShadowType[]; 756 color: (Color | string | Resource | ColoringStrategy)[]; 757 offsetX: (number | string)[]; 758 offsetY: (number | string)[]; 759 fill: boolean[]; 760 constructor() { 761 this.radius = []; 762 this.type = []; 763 this.color = []; 764 this.offsetX = []; 765 this.offsetX = []; 766 this.offsetY = []; 767 this.fill = []; 768 } 769 isEqual(another: ArkShadowInfoToArray): boolean { 770 return (this.radius === another.radius) && 771 (this.color === another.color) && 772 (this.offsetX === another.offsetX) && 773 (this.offsetY === another.offsetY) && 774 (this.fill === another.fill); 775 } 776 777 convertShadowOptions(value: ShadowOptions | Array<ShadowOptions>): boolean { 778 if (Object.getPrototypeOf(value).constructor === Object) { 779 if ((<ShadowOptions>value).radius === null || (<ShadowOptions>value).radius === undefined) { 780 return false; 781 } else { 782 this.radius.push(<number | string>(<ShadowOptions>value).radius); 783 this.type.push((<ShadowOptions>value).type); 784 this.color.push((<ShadowOptions>value).color); 785 this.offsetX.push(((<ShadowOptions>value).offsetX === undefined || 786 (<ShadowOptions>value).offsetX === null) ? 0 : <number | string>(<ShadowOptions>value).offsetX); 787 this.offsetY.push(((<ShadowOptions>value).offsetY === undefined || 788 (<ShadowOptions>value).offsetY === null) ? 0 : <number | string>(<ShadowOptions>value).offsetY); 789 this.fill.push(((<ShadowOptions>value).fill === undefined || 790 (<ShadowOptions>value).fill === null) ? false : (<ShadowOptions>value).fill); 791 return true; 792 } 793 } else if (Object.getPrototypeOf(value).constructor === Array) { 794 let isFlag: boolean = true; 795 for (let item of (value as Array<ShadowOptions>)) { 796 if (item.radius === undefined || item.radius === null) { 797 isFlag = false; 798 break; 799 } 800 } 801 if (isFlag) { 802 for (let objValue of (value as Array<ShadowOptions>)) { 803 this.radius.push(<number | string>objValue.radius); 804 this.type.push(objValue.type); 805 this.color.push(objValue.color); 806 this.offsetX.push((objValue.offsetX === undefined || objValue.offsetX === null) ? 0 : <number | string>objValue.offsetX); 807 this.offsetY.push((objValue.offsetY === undefined || objValue.offsetY === null) ? 0 : <number | string>objValue.offsetY); 808 this.fill.push((objValue.fill === undefined || objValue.fill === null) ? false : objValue.fill); 809 } 810 return true; 811 } else { 812 return false; 813 } 814 } 815 } 816 817 checkDiff(value: ShadowOptions, stageValue: ShadowOptions): boolean { 818 if (!value || !stageValue || !value.radius || !stageValue.radius) { 819 return true; 820 } 821 if (!((isResource(stageValue.radius) && isResource(value.radius) && 822 isResourceEqual(stageValue.radius, value.radius)) || 823 (isNumber(stageValue.radius) && isNumber(value.radius) && 824 stageValue.radius === value.radius))) { 825 return true; 826 } 827 if (!(isNumber(stageValue.type) && isNumber(value.type) && 828 stageValue.type === value.type)) { 829 return true; 830 } 831 if (!((isResource(stageValue.color) && isResource(value.color) && 832 isResourceEqual(stageValue.color, value.color)) || 833 (!isResource(stageValue.color) && !isResource(value.color) && 834 stageValue.color === value.color))) { 835 return true; 836 } 837 if (!((isResource(stageValue.offsetX) && isResource(value.offsetX) && 838 isResourceEqual(stageValue.offsetX, value.offsetX)) || 839 (isNumber(stageValue.offsetX) && isNumber(value.offsetX) && 840 stageValue.offsetX === value.offsetX))) { 841 return true; 842 } 843 if (!((isResource(stageValue.offsetY) && isResource(value.offsetY) && 844 isResourceEqual(stageValue.offsetY, value.offsetY)) || 845 (isNumber(stageValue.offsetY) && isNumber(value.offsetY) && 846 stageValue.offsetY === value.offsetY))) { 847 return true; 848 } 849 if (!(isBoolean(stageValue.fill) && isBoolean(value.fill) && 850 stageValue.fill === value.fill)) { 851 return true; 852 } 853 return false; 854 } 855} 856 857class ArkSearchButton { 858 value: string | undefined; 859 fontSize: Length | undefined; 860 fontColor: ResourceColor | undefined; 861 constructor() { 862 this.value = undefined; 863 this.fontSize = undefined; 864 this.fontColor = undefined; 865 } 866 isEqual(another: ArkSearchButton): boolean { 867 return (this.value === another.value) && 868 (this.fontSize === another.fontSize) && 869 (this.fontColor === another.fontColor); 870 } 871} 872 873class ArkSearchInputFilter { 874 value: ResourceStr | undefined; 875 error?: (value: string) => void; 876 constructor() { 877 this.value = undefined; 878 this.error = undefined; 879 } 880 isEqual(another: ArkSearchInputFilter): boolean { 881 return (this.value === another.value); 882 } 883} 884class ArkImageFrameInfoToArray { 885 arrSrc: Array<string> | undefined; 886 arrWidth: Array<number | string> | undefined; 887 arrHeight: Array<number | string> | undefined; 888 arrTop: Array<number | string> | undefined; 889 arrLeft: Array<number | string> | undefined; 890 arrDuration: Array<number> | undefined; 891 constructor() { 892 this.arrSrc = []; 893 this.arrWidth = []; 894 this.arrHeight = []; 895 this.arrTop = []; 896 this.arrLeft = []; 897 this.arrDuration = []; 898 } 899 isEqual(another: ArkImageFrameInfoToArray): boolean { 900 return (this.arrSrc.toString() === another.arrSrc.toString()) && 901 (this.arrWidth.toString() === another.arrWidth.toString()) && 902 (this.arrHeight.toString() === another.arrHeight.toString()) && 903 (this.arrTop.toString() === another.arrTop.toString()) && 904 (this.arrLeft.toString() === another.arrLeft.toString()) && 905 (this.arrDuration.toString() === another.arrDuration.toString()); 906 } 907} 908 909class ArkEdgeAlign { 910 alignType: number; 911 offset?: Offset | undefined; 912 913 constructor() { 914 this.alignType = undefined; 915 this.offset = undefined; 916 } 917 918 isEqual(another: ArkEdgeAlign): boolean { 919 return (this.alignType === another.alignType && this.offset === another.offset); 920 } 921} 922 923class ArkKeyBoardShortCut { 924 value: string | number; 925 keys: Array<ModifierKey>; 926 action: () => void | undefined; 927 928 constructor() { 929 this.value = undefined; 930 this.keys = undefined; 931 this.action = undefined; 932 } 933 934 isEqual(another: ArkKeyBoardShortCut): boolean { 935 return (this.value === another.value) && (this.keys === another.keys) && 936 (this.action === another.action); 937 } 938} 939 940class ArkCustomProperty { 941 key: string; 942 value: object; 943 944 constructor() { 945 this.key = undefined; 946 this.value = undefined; 947 } 948} 949 950class ArkBlendMode { 951 blendMode: number | Blender; 952 blendApplyType: number; 953 constructor() { 954 this.blendMode = undefined; 955 this.blendApplyType = undefined; 956 } 957 isEqual(another: ArkBlendMode): boolean { 958 return (this.blendMode === another.blendMode) && (this.blendApplyType === another.blendApplyType); 959 } 960} 961 962class ArkAlignStyle { 963 indexerAlign: number; 964 offset?: number | string | undefined | Resource; 965 966 constructor() { 967 this.indexerAlign = undefined; 968 this.offset = undefined; 969 } 970 971 isEqual(another: ArkAlignStyle): boolean { 972 return (this.indexerAlign === another.indexerAlign && this.offset === another.offset); 973 } 974} 975 976class ArkNestedScrollOptions { 977 scrollForward: NestedScrollMode | undefined; 978 scrollBackward: NestedScrollMode | undefined; 979 constructor() { 980 this.scrollForward = undefined; 981 this.scrollBackward = undefined; 982 } 983 isEqual(another: ArkNestedScrollOptions): boolean { 984 return ((this.scrollForward === another.scrollForward) && (this.scrollBackward === another.scrollBackward)); 985 } 986} 987 988class ArkConstraintSizeOptions { 989 minWidth?: Length | undefined; 990 maxWidth?: Length | undefined; 991 minHeight?: Length | undefined; 992 maxHeight?: Length | undefined; 993 994 constructor() { 995 this.minWidth = undefined; 996 this.maxWidth = undefined; 997 this.minHeight = undefined; 998 this.maxHeight = undefined; 999 } 1000 1001 isEqual(another: ArkConstraintSizeOptions): boolean { 1002 return ( 1003 this.minWidth === another.minWidth && 1004 this.maxWidth === another.maxWidth && 1005 this.minHeight === another.minHeight && 1006 this.maxHeight === another.maxHeight 1007 ); 1008 } 1009} 1010 1011class ArkTextFieldShowCounter { 1012 value: boolean; 1013 highlightBorder?: boolean; 1014 thresholdPercentage?: number; 1015 constructor() { 1016 this.value = undefined; 1017 this.highlightBorder = undefined; 1018 this.thresholdPercentage = undefined; 1019 } 1020 isEqual(another: ArkTextFieldShowCounter): boolean { 1021 return (this.value === another.value) && 1022 (this.highlightBorder === another.highlightBorder) && 1023 (this.thresholdPercentage === another.thresholdPercentage); 1024 } 1025} 1026 1027class ArkTextInputFilter { 1028 value: ResourceStr | undefined; 1029 error?: (value: string) => void; 1030 constructor() { 1031 this.value = undefined; 1032 this.error = undefined; 1033 } 1034 isEqual(another: ArkSearchInputFilter): boolean { 1035 return (this.value === another.value); 1036 } 1037} 1038 1039class ArkDotIndicator extends DotIndicator { 1040 type: string | undefined; 1041 leftValue: Length | undefined; 1042 topValue: Length | undefined; 1043 rightValue: Length | undefined; 1044 bottomValue: Length | undefined; 1045 itemWidthValue: Length | undefined; 1046 itemHeightValue: Length | undefined; 1047 selectedItemWidthValue: Length | undefined; 1048 selectedItemHeightValue: Length | undefined; 1049 maskValue: boolean | undefined; 1050 colorValue: ResourceColor | undefined; 1051 selectedColorValue: ResourceColor | undefined; 1052 maxDisplayCountValue: ResourceColor | undefined; 1053 1054 constructor() { 1055 super(); 1056 this.type = undefined; 1057 this.leftValue = undefined; 1058 this.topValue = undefined; 1059 this.rightValue = undefined; 1060 this.bottomValue = undefined; 1061 this.itemWidthValue = undefined; 1062 this.itemHeightValue = undefined; 1063 this.selectedItemWidthValue = undefined; 1064 this.selectedItemHeightValue = undefined; 1065 this.maskValue = undefined; 1066 this.colorValue = undefined; 1067 this.selectedColorValue = undefined; 1068 this.maxDisplayCountValue = undefined; 1069 } 1070 1071 isEqual(another: ArkDotIndicator): boolean { 1072 return ( 1073 this.type === another.type && 1074 this.leftValue === another.leftValue && 1075 this.topValue === another.topValue && 1076 this.rightValue === another.rightValue && 1077 this.bottomValue === another.bottomValue && 1078 this.itemWidthValue === another.itemWidthValue && 1079 this.itemHeightValue === another.itemHeightValue && 1080 this.selectedItemWidthValue === another.selectedItemWidthValue && 1081 this.selectedItemHeightValue === another.selectedItemHeightValue && 1082 this.maskValue === another.maskValue && 1083 this.colorValue === another.colorValue && 1084 this.selectedColorValue === another.selectedColorValue && 1085 this.maxDisplayCountValue === another.maxDisplayCountValue 1086 ); 1087 } 1088} 1089 1090class ArkDigitIndicator extends DigitIndicator { 1091 type: string | undefined; 1092 leftValue: Length | undefined; 1093 topValue: Length | undefined; 1094 rightValue: Length | undefined; 1095 bottomValue: Length | undefined; 1096 fontColorValue: ResourceColor | undefined; 1097 selectedFontColorValue: ResourceColor | undefined; 1098 digitFontValue: ArkDigitFont | undefined; 1099 selectedDigitFontValue: ArkDigitFont | undefined; 1100 1101 constructor() { 1102 super(); 1103 this.type = undefined; 1104 this.leftValue = undefined; 1105 this.topValue = undefined; 1106 this.rightValue = undefined; 1107 this.bottomValue = undefined; 1108 this.fontColorValue = undefined; 1109 this.selectedFontColorValue = undefined; 1110 this.digitFontValue = undefined; 1111 this.selectedDigitFontValue = undefined; 1112 } 1113 1114 isEqual(another: ArkDigitIndicator): boolean { 1115 return ( 1116 this.type === another.type && 1117 this.leftValue === another.leftValue && 1118 this.topValue === another.topValue && 1119 this.rightValue === another.rightValue && 1120 this.bottomValue === another.bottomValue && 1121 this.digitFontValue === another.digitFontValue && 1122 this.selectedDigitFontValue === another.selectedDigitFontValue 1123 ); 1124 } 1125} 1126 1127class ArkDigitFont { 1128 size: Length | undefined; 1129 weight: number | FontWeight | string | undefined; 1130 1131 constructor() { 1132 this.size = undefined; 1133 this.weight = undefined; 1134 } 1135 1136 isEqual(another: ArkDigitFont): boolean { 1137 return this.size === another.size && this.weight === another.weight; 1138 } 1139 1140 parseFontWeight(value: string | number | undefined) { 1141 const valueWeightMap = { 1142 [0]: 'lighter', 1143 [1]: 'normal', 1144 [2]: 'regular', 1145 [3]: 'medium', 1146 [4]: 'bold', 1147 [5]: 'bolder' 1148 }; 1149 if (isUndefined(value)) { 1150 this.weight = '-'; 1151 } else if (value in valueWeightMap) { 1152 this.weight = valueWeightMap[value]; 1153 } else { 1154 this.weight = value.toString(); 1155 } 1156 return this.weight; 1157 } 1158} 1159 1160class ArkDisplayArrow { 1161 value: boolean | ArrowStyle; 1162 isHoverShow: boolean | undefined; 1163 1164 constructor() { 1165 this.value = undefined; 1166 this.isHoverShow = undefined; 1167 } 1168 1169 isEqual(another: ArkDisplayArrow): boolean { 1170 return this.value === another.value && this.isHoverShow === another.isHoverShow; 1171 } 1172} 1173 1174class ArkDisplayCount { 1175 value: string | number | SwiperAutoFill; 1176 swipeByGroup: boolean | undefined; 1177 1178 constructor() { 1179 this.value = undefined; 1180 this.swipeByGroup = undefined; 1181 } 1182 1183 isEqual(another: ArkDisplayCount): boolean { 1184 return this.value === another.value && this.swipeByGroup === another.swipeByGroup; 1185 } 1186} 1187 1188class ArkGridEdgeEffect { 1189 value: EdgeEffect; 1190 options?: EdgeEffectOptions | undefined; 1191 constructor() { 1192 this.value = undefined; 1193 this.options = undefined; 1194 } 1195 isEqual(another: ArkGridEdgeEffect): boolean { 1196 return (this.value === another.value) && 1197 (this.options === another.options); 1198 } 1199} 1200 1201class ArkMesh { 1202 value: Array<any> | undefined; 1203 column: number | undefined; 1204 row: number | undefined; 1205 1206 constructor() { 1207 this.value = undefined; 1208 this.column = undefined; 1209 this.row = undefined; 1210 } 1211 isEqual(another: ArkMesh): boolean { 1212 return ( 1213 deepCompareArrays(this.value, another.value) && 1214 this.column === another.column && 1215 this.row === another.row 1216 ); 1217 } 1218} 1219 1220class ArkLanesOpt { 1221 lanesNum: number | undefined; 1222 minLength: Length | undefined; 1223 maxLength: Length | undefined; 1224 gutter?: undefined; 1225 constructor() { 1226 this.lanesNum = undefined; 1227 this.minLength = undefined; 1228 this.maxLength = undefined; 1229 this.gutter = undefined; 1230 } 1231 1232 isEqual(another: ArkLanesOpt): boolean { 1233 return (this.lanesNum === another.lanesNum && this.minLength === another.minLength 1234 && this.maxLength === another.maxLength && this.gutter === another.gutter); 1235 } 1236} 1237 1238class ArkScrollSnapOptions { 1239 snapAlign: ScrollSnapAlign; 1240 snapPagination: Dimension | Array<Dimension>; 1241 enableSnapToStart: boolean; 1242 enableSnapToEnd: boolean; 1243 constructor() { 1244 this.snapAlign = undefined; 1245 this.snapPagination = undefined; 1246 this.enableSnapToStart = undefined; 1247 this.enableSnapToEnd = undefined; 1248 } 1249 isEqual(another: ArkScrollSnapOptions): boolean { 1250 return ((this.snapAlign === another.snapAlign) && 1251 (this.snapPagination === another.snapPagination) && 1252 (this.enableSnapToStart === another.enableSnapToStart) && 1253 (this.enableSnapToEnd === another.enableSnapToEnd)); 1254 } 1255} 1256 1257class ArkGeometryTransition { 1258 id: string | undefined; 1259 options: GeometryTransitionOptions | undefined; 1260 1261 constructor() { 1262 this.id = undefined; 1263 this.options = undefined; 1264 } 1265 1266 isEqual(another: ArkGeometryTransition): boolean { 1267 return (this.id === another.id && this.options === another.options); 1268 } 1269} 1270 1271class ArkSymbolEffect { 1272 symbolEffect: SymbolEffect; 1273 action: boolean | number | undefined; 1274 1275 constructor() { 1276 this.symbolEffect = undefined; 1277 this.action = undefined; 1278 } 1279 isEqual(another: ArkSymbolEffect): boolean { 1280 return (this.symbolEffect === another.symbolEffect) && (this.action === another.action); 1281 } 1282} 1283 1284class ArkTextBackGroundStyle { 1285 color: ResourceColor; 1286 radius: Dimension | BorderRadiuses; 1287 constructor() { 1288 this.color = undefined; 1289 this.radius = new ArkBorderRadius(); 1290 } 1291 isEqual(another: ArkTextBackGroundStyle): boolean { 1292 return (this.color === another.color && 1293 this.radius.isEqual(another.radius)); 1294 } 1295 checkObjectDiff(another: ArkTextBackGroundStyle): boolean { 1296 return !this.isEqual(another); 1297 } 1298 convertTextBackGroundStyleOptions(value: TextBackgroundStyle): boolean { 1299 if (isUndefined(value)) { 1300 return false; 1301 } 1302 if (!isUndefined(value?.color) && value?.color !== null) { 1303 if (isNumber(value.color) || isString(value.color) || isResource(value.color)) { 1304 this.color = value.color; 1305 } 1306 } 1307 1308 if (!isUndefined(value?.radius) && value?.radius !== null) { 1309 if (isNumber(value.radius) || isString(value.radius) || isResource(value.radius)) { 1310 this.radius.topLeft = value.radius; 1311 this.radius.topRight = value.radius; 1312 this.radius.bottomLeft = value.radius; 1313 this.radius.bottomRight = value.radius; 1314 } 1315 else { 1316 this.radius.topLeft = (value.radius as BorderRadiuses)?.topLeft; 1317 this.radius.topRight = (value.radius as BorderRadiuses)?.topRight; 1318 this.radius.bottomLeft = (value.radius as BorderRadiuses)?.bottomLeft; 1319 this.radius.bottomRight = (value.radius as BorderRadiuses)?.bottomRight; 1320 } 1321 } 1322 return true; 1323 } 1324} 1325 1326class ArkScrollOffsetOptions { 1327 xOffset: Dimension; 1328 yOffset: Dimension; 1329 constructor() { 1330 this.xOffset = undefined; 1331 this.yOffset = undefined; 1332 } 1333 isEqual(another: ArkScrollOffsetOptions): boolean { 1334 return this.xOffset === another.xOffset && this.yOffset === another.yOffset; 1335 } 1336} 1337 1338class ArkWaterFlowEdgeEffect { 1339 value: EdgeEffect; 1340 options?: EdgeEffectOptions | undefined; 1341 constructor() { 1342 this.value = undefined; 1343 this.options = undefined; 1344 } 1345 isEqual(another: ArkWaterFlowEdgeEffect): boolean { 1346 return (this.value === another.value) && 1347 (this.options === another.options); 1348 } 1349} 1350 1351class ArkSelection { 1352 selectionStart: number; 1353 selectionEnd: number; 1354 constructor() { 1355 this.selectionStart = undefined; 1356 this.selectionEnd = undefined; 1357 } 1358 isEqual(another: ArkSelection): boolean { 1359 return this.selectionStart === another.selectionStart && 1360 this.selectionEnd === another.selectionEnd; 1361 } 1362} 1363 1364class TextDataDetectorConfig { 1365 types: TextDataDetectorType; 1366 onDetectResultUpdate: (result: string) => void; 1367 constructor() { 1368 this.types = undefined; 1369 this.onDetectResultUpdate = undefined; 1370 } 1371 isEqual(another: TextDataDetectorConfig): boolean { 1372 return (this.types === another.types) && 1373 (this.onDetectResultUpdate === another.onDetectResultUpdate); 1374 } 1375} 1376 1377class ArkDragPreviewOptions { 1378 mode: DragPreviewMode | Array<DragPreviewMode> | undefined; 1379 numberBadge: boolean | number | undefined; 1380 isMultiSelectionEnabled: boolean | undefined; 1381 defaultAnimationBeforeLifting: boolean | undefined; 1382 1383 constructor() { 1384 this.mode = undefined; 1385 this.numberBadge = undefined; 1386 this.isMultiSelectionEnabled = undefined; 1387 this.defaultAnimationBeforeLifting = undefined; 1388 } 1389 1390 isEqual(another: ArkDragPreviewOptions): boolean { 1391 return ( 1392 this.mode === another.mode && 1393 this.numberBadge === another.numberBadge && 1394 this.isMultiSelectionEnabled === another.isMultiSelectionEnabled && 1395 this.defaultAnimationBeforeLifting === another.defaultAnimationBeforeLifting 1396 ); 1397 } 1398} 1399 1400class ArkDragPreview { 1401 inspetorId : string; 1402 constructor() { 1403 this.inspetorId = undefined; 1404 } 1405 1406 isEqual(another: ArkDragPreview) : boolean { 1407 return this.inspetorId === another.inspetorId; 1408 } 1409} 1410 1411class ArkRelativeContainerGuideLine { 1412 ids: Array<string> | undefined; 1413 directions: Array<Axis> | undefined; 1414 positions: Array<GuideLinePosition> | undefined; 1415 1416 constructor() { 1417 this.ids = undefined; 1418 this.directions = undefined; 1419 this.positions = undefined; 1420 } 1421 1422 isEqual(another: ArkRelativeContainerGuideLine): boolean { 1423 return ( 1424 this.ids === another.ids && 1425 this.directions === another.directions && 1426 this.positions === another.positions 1427 ); 1428 } 1429} 1430 1431class ArkRelativeContainerBarrier { 1432 ids: Array<string> | undefined; 1433 directions: Array<BarrierDirection> | undefined; 1434 referencedIds: Array<Array<string>> | undefined; 1435 1436 constructor() { 1437 this.ids = undefined; 1438 this.directions = undefined; 1439 this.referencedIds = undefined; 1440 } 1441 1442 isEqual(another: ArkRelativeContainerGuideLine): boolean { 1443 return ( 1444 this.ids === another.ids && 1445 this.directions === another.directions && 1446 this.referencedIds === another.positions 1447 ); 1448 } 1449} 1450 1451class ArkFocusScopeId { 1452 id: string | undefined; 1453 isGroup: boolean | undefined; 1454 constructor() { 1455 this.id = undefined; 1456 this.isGroup = undefined; 1457 } 1458 isEqual(another: ArkFocusScopeId): boolean { 1459 return (this.id === another.id) && (this.isGroup === another.isGroup); 1460 } 1461} 1462 1463class ArkFocusScopePriority { 1464 scopeId: string | undefined; 1465 priority: number | undefined; 1466 constructor() { 1467 this.scopeId = undefined; 1468 this.priority = undefined; 1469 } 1470 isEqual(another: ArkFocusScopePriority): boolean { 1471 return (this.scopeId === another.scopeId) && (this.priority === another.priority); 1472 } 1473} 1474 1475class ArkTextFont { 1476 value: Font; 1477 enableVariableFontWeight: boolean; 1478 1479 constructor() { 1480 this.value = undefined; 1481 this.enableVariableFontWeight = undefined; 1482 } 1483 1484 isEqual(another: ArkTextFont): boolean { 1485 return (this.value === another.value && this.enableVariableFontWeight === another.enableVariableFontWeight); 1486 } 1487 1488 checkObjectDiff(another: ArkTextFont): boolean { 1489 return !this.isEqual(another); 1490 } 1491} 1492 1493class ArkFontWeight { 1494 value: number | FontWeight | string; 1495 enableVariableFontWeight: boolean; 1496 1497 constructor() { 1498 this.value = undefined; 1499 this.enableVariableFontWeight = undefined; 1500 } 1501 1502 isEqual(another: ArkTextFont): boolean { 1503 return (this.value === another.value && this.enableVariableFontWeight === another.enableVariableFontWeight); 1504 } 1505 1506 checkObjectDiff(another: ArkTextFont): boolean { 1507 return !this.isEqual(another); 1508 } 1509} 1510 1511class ArkNavigationTitle { 1512 navigationTitleOptions?: NavigationTitleOptions | undefined; 1513 1514 constructor() { 1515 this.navigationTitleOptions = undefined; 1516 } 1517 isEqual(another: ArkNavigationTitle): boolean { 1518 return this.navigationTitleOptions === another.navigationTitleOptions; 1519 } 1520} 1521 1522class ArkNavHideTitleBarOrToolBar { 1523 isHide: boolean; 1524 animated: boolean; 1525 1526 constructor() { 1527 this.isHide = undefined; 1528 this.animated = undefined; 1529 } 1530 isEqual(another: ArkNavHideTitleBarOrToolBar): boolean { 1531 return (this.isHide === another.isHide) && (this.animated === another.animated); 1532 } 1533}