1/* 2 * Copyright (c) 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/// <reference path='./import.ts' /> 17class SpanFontSizeModifier extends ModifierWithKey<Length> { 18 constructor(value: Length) { 19 super(value); 20 } 21 static identity: Symbol = Symbol('spanFontSize'); 22 applyPeer(node: KNode, reset: boolean): void { 23 if (reset) { 24 getUINativeModule().span.resetFontSize(node); 25 } else { 26 getUINativeModule().span.setFontSize(node, this.value!); 27 } 28 } 29 30 checkObjectDiff(): boolean { 31 return !isBaseOrResourceEqual(this.stageValue, this.value); 32 } 33} 34class SpanFontFamilyModifier extends ModifierWithKey<string | Resource> { 35 constructor(value: string | Resource) { 36 super(value); 37 } 38 static identity: Symbol = Symbol('spanFontFamily'); 39 applyPeer(node: KNode, reset: boolean): void { 40 if (reset) { 41 getUINativeModule().span.resetFontFamily(node); 42 } else { 43 getUINativeModule().span.setFontFamily(node, this.value!); 44 } 45 } 46 47 checkObjectDiff(): boolean { 48 return !isBaseOrResourceEqual(this.stageValue, this.value); 49 } 50} 51class SpanLineHeightModifier extends ModifierWithKey<Length> { 52 constructor(value: Length) { 53 super(value); 54 } 55 static identity: Symbol = Symbol('spanLineHeight'); 56 applyPeer(node: KNode, reset: boolean): void { 57 if (reset) { 58 getUINativeModule().span.resetLineHeight(node); 59 } else { 60 getUINativeModule().span.setLineHeight(node, this.value!); 61 } 62 } 63 64 checkObjectDiff(): boolean { 65 return !isBaseOrResourceEqual(this.stageValue, this.value); 66 } 67} 68class SpanFontStyleModifier extends ModifierWithKey<number> { 69 constructor(value: number) { 70 super(value); 71 } 72 static identity: Symbol = Symbol('spanFontStyle'); 73 applyPeer(node: KNode, reset: boolean): void { 74 if (reset) { 75 getUINativeModule().span.resetFontStyle(node); 76 } else { 77 getUINativeModule().span.setFontStyle(node, this.value!); 78 } 79 } 80 checkObjectDiff(): boolean { 81 return !isBaseOrResourceEqual(this.stageValue, this.value); 82 } 83} 84class SpanTextCaseModifier extends ModifierWithKey<number> { 85 constructor(value: number) { 86 super(value); 87 } 88 static identity: Symbol = Symbol('spanTextCase'); 89 applyPeer(node: KNode, reset: boolean): void { 90 if (reset) { 91 getUINativeModule().span.resetTextCase(node); 92 } else { 93 getUINativeModule().span.setTextCase(node, this.value!); 94 } 95 } 96 checkObjectDiff(): boolean { 97 return !isBaseOrResourceEqual(this.stageValue, this.value); 98 } 99} 100class SpanTextBackgroundStyleModifier extends ModifierWithKey<TextBackgroundStyle> { 101 constructor(value: TextBackgroundStyle) { 102 super(value); 103 } 104 static identity: Symbol = Symbol('spanTextBackgroundStyle'); 105 applyPeer(node: KNode, reset: boolean): void { 106 if (reset) { 107 getUINativeModule().span.resetTextBackgroundStyle(node); 108 } 109 else { 110 let textBackgroundStyle = new ArkTextBackGroundStyle(); 111 if (!textBackgroundStyle.convertTextBackGroundStyleOptions(this.value)) { 112 getUINativeModule().span.resetTextBackgroundStyle(node); 113 } 114 else { 115 getUINativeModule().span.setTextBackgroundStyle(node, textBackgroundStyle.color, textBackgroundStyle.radius.topLeft, 116 textBackgroundStyle.radius.topRight, textBackgroundStyle.radius.bottomLeft, textBackgroundStyle.radius.bottomRight); 117 } 118 } 119 } 120 checkObjectDiff(): boolean { 121 let textBackgroundStyle = new ArkTextBackGroundStyle(); 122 let stageTextBackGroundStyle = new ArkTextBackGroundStyle(); 123 if (!textBackgroundStyle.convertTextBackGroundStyleOptions(this.value) || !stageTextBackGroundStyle.convertTextBackGroundStyleOptions(this.stageValue)) { 124 return false; 125 } 126 else { 127 return textBackgroundStyle.checkObjectDiff(stageTextBackGroundStyle); 128 } 129 } 130} 131class SpanTextShadowModifier extends ModifierWithKey<ShadowOptions | Array<ShadowOptions>> { 132 constructor(value: ShadowOptions | Array<ShadowOptions>) { 133 super(value); 134 } 135 static identity: Symbol = Symbol('spanTextShadow'); 136 applyPeer(node: KNode, reset: boolean): void { 137 if (reset) { 138 getUINativeModule().span.resetTextShadow(node); 139 } else { 140 let shadow: ArkShadowInfoToArray = new ArkShadowInfoToArray(); 141 if (!shadow.convertShadowOptions(this.value)) { 142 getUINativeModule().span.resetTextShadow(node); 143 } else { 144 getUINativeModule().span.setTextShadow(node, shadow.radius, 145 shadow.type, shadow.color, shadow.offsetX, shadow.offsetY, shadow.fill, shadow.radius.length); 146 } 147 } 148 } 149 150 checkObjectDiff(): boolean { 151 let checkDiff = true; 152 let arkShadow = new ArkShadowInfoToArray(); 153 if (Object.getPrototypeOf(this.stageValue).constructor === Object && 154 Object.getPrototypeOf(this.value).constructor === Object) { 155 checkDiff = arkShadow.checkDiff(<ShadowOptions> this.stageValue, <ShadowOptions> this.value); 156 } else if (Object.getPrototypeOf(this.stageValue).constructor === Array && 157 Object.getPrototypeOf(this.value).constructor === Array && 158 (<Array<ShadowOptions>> this.stageValue).length === (<Array<ShadowOptions>> this.value).length) { 159 let isDiffItem = false; 160 for (let i: number = 0; i < (<Array<ShadowOptions>> this.value).length; i++) { 161 if (arkShadow.checkDiff(this.stageValue[i], this.value[1])) { 162 isDiffItem = true; 163 break; 164 } 165 } 166 if (!isDiffItem) { 167 checkDiff = false; 168 } 169 } 170 return checkDiff; 171 } 172} 173class SpanFontColorModifier extends ModifierWithKey<ResourceColor> { 174 constructor(value: ResourceColor) { 175 super(value); 176 } 177 static identity = Symbol('spanFontColor'); 178 applyPeer(node: KNode, reset: boolean): void { 179 if (reset) { 180 getUINativeModule().span.resetFontColor(node); 181 } else { 182 getUINativeModule().span.setFontColor(node, this.value!); 183 } 184 } 185 checkObjectDiff(): boolean { 186 return !isBaseOrResourceEqual(this.stageValue, this.value); 187 } 188} 189class SpanLetterSpacingModifier extends ModifierWithKey<string> { 190 constructor(value: string) { 191 super(value); 192 } 193 static identity = Symbol('spanLetterSpacing'); 194 applyPeer(node: KNode, reset: boolean): void { 195 if (reset) { 196 getUINativeModule().span.resetLetterSpacing(node); 197 } else { 198 getUINativeModule().span.setLetterSpacing(node, this.value!); 199 } 200 } 201} 202class SpanBaselineOffsetModifier extends ModifierWithKey<LengthMetrics> { 203 constructor(value: LengthMetrics) { 204 super(value); 205 } 206 static identity = Symbol('spanBaselineOffset'); 207 applyPeer(node: KNode, reset: boolean): void { 208 if (reset) { 209 getUINativeModule().span.resetBaselineOffset(node); 210 } else { 211 getUINativeModule().span.setBaselineOffset(node, this.value!); 212 } 213 } 214} 215class SpanFontModifier extends ModifierWithKey<Font> { 216 constructor(value: Font) { 217 super(value); 218 } 219 static identity = Symbol('spanFont'); 220 applyPeer(node: KNode, reset: boolean): void { 221 if (reset) { 222 getUINativeModule().span.resetFont(node); 223 } else { 224 getUINativeModule().span.setFont(node, this.value.size, this.value.weight, this.value.family, this.value.style); 225 } 226 } 227 228 checkObjectDiff(): boolean { 229 if (this.stageValue.weight !== this.value.weight || this.stageValue.style !== this.value.style) { 230 return true; 231 } 232 if (((isResource(this.stageValue.size) && isResource(this.value.size) && 233 isResourceEqual(this.stageValue.size, this.value.size)) || 234 (!isResource(this.stageValue.size) && !isResource(this.value.size) && 235 this.stageValue.size === this.value.size)) && 236 ((isResource(this.stageValue.family) && isResource(this.value.family) && 237 isResourceEqual(this.stageValue.family, this.value.family)) || 238 (!isResource(this.stageValue.family) && !isResource(this.value.family) && 239 this.stageValue.family === this.value.family))) { 240 return false; 241 } else { 242 return true; 243 } 244 } 245} 246class SpanDecorationModifier extends ModifierWithKey<{ type: TextDecorationType, color?: ResourceColor; style?: TextDecorationStyle }> { 247 constructor(value: { type: TextDecorationType, color?: ResourceColor; style?: TextDecorationStyle }) { 248 super(value); 249 } 250 static identity = Symbol('spanDecoration'); 251 applyPeer(node: KNode, reset: boolean): void { 252 if (reset) { 253 getUINativeModule().span.resetDecoration(node); 254 } else { 255 getUINativeModule().span.setDecoration(node, this.value.type, this.value.color, this.value.style); 256 } 257 } 258 259 checkObjectDiff(): boolean { 260 if (this.stageValue.type !== this.value.type || this.stageValue.style !== this.value.style) { 261 return true; 262 } 263 if (isResource(this.stageValue.color) && isResource(this.value.color)) { 264 return !isResourceEqual(this.stageValue.color, this.value.color); 265 } else if (!isResource(this.stageValue.color) && !isResource(this.value.color)) { 266 return !(this.stageValue.color === this.value.color); 267 } else { 268 return true; 269 } 270 } 271} 272class SpanFontWeightModifier extends ModifierWithKey<string> { 273 constructor(value: string) { 274 super(value); 275 } 276 static identity = Symbol('spanfontweight'); 277 applyPeer(node: KNode, reset: boolean): void { 278 if (reset) { 279 getUINativeModule().span.resetFontWeight(node); 280 } else { 281 getUINativeModule().span.setFontWeight(node, this.value!); 282 } 283 } 284} 285 286class SpanInputModifier extends ModifierWithKey<ResourceStr> { 287 constructor(value: ResourceStr) { 288 super(value); 289 } 290 static identity: Symbol = Symbol('spanInput'); 291 applyPeer(node: KNode, reset: boolean): void { 292 if (reset) { 293 getUINativeModule().span.setSpanSrc(node, ''); 294 } 295 else { 296 getUINativeModule().span.setSpanSrc(node, this.value); 297 } 298 } 299} 300 301class SpanAccessibilityTextModifier extends ModifierWithKey<string> { 302 constructor(value: string) { 303 super(value); 304 } 305 static identity = Symbol('spanAccessibilityText'); 306 applyPeer(node: KNode, reset: boolean): void { 307 if (reset) { 308 getUINativeModule().span.resetAccessibilityText(node); 309 } else { 310 getUINativeModule().span.setAccessibilityText(node, this.value); 311 } 312 } 313} 314 315class SpanAccessibilityDescriptionModifier extends ModifierWithKey<string> { 316 constructor(value: string) { 317 super(value); 318 } 319 static identity = Symbol('spanAccessibilityDescription'); 320 applyPeer(node: KNode, reset: boolean): void { 321 if (reset) { 322 getUINativeModule().span.resetAccessibilityDescription(node); 323 } else { 324 getUINativeModule().span.setAccessibilityDescription(node, this.value); 325 } 326 } 327} 328 329class SpanAccessibilityLevelModifier extends ModifierWithKey<string> { 330 constructor(value: string) { 331 super(value); 332 } 333 static identity = Symbol('spanAccessibilityLevel'); 334 applyPeer(node: KNode, reset: boolean): void { 335 if (reset) { 336 getUINativeModule().span.resetAccessibilityLevel(node); 337 } else { 338 getUINativeModule().span.setAccessibilityLevel(node, this.value); 339 } 340 } 341} 342 343class ArkSpanComponent implements CommonMethod<SpanAttribute> { 344 _modifiersWithKeys: Map<Symbol, AttributeModifierWithKey>; 345 _changed: boolean; 346 nativePtr: KNode; 347 _weakPtr: JsPointerClass; 348 _classType: ModifierType | undefined; 349 _nativePtrChanged: boolean; 350 351 constructor(nativePtr: KNode, classType?: ModifierType) { 352 this._modifiersWithKeys = new Map(); 353 this.nativePtr = nativePtr; 354 this._changed = false; 355 this._classType = classType; 356 this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr); 357 this._nativePtrChanged = false; 358 } 359 initialize(value: Object[]) { 360 modifierWithKey(this._modifiersWithKeys, SpanInputModifier.identity, SpanInputModifier, value[0]); 361 return this; 362 } 363 cleanStageValue(): void { 364 if (!this._modifiersWithKeys) { 365 return; 366 } 367 this._modifiersWithKeys.forEach((value, key) => { 368 value.stageValue = undefined; 369 }); 370 } 371 372 applyStateUpdatePtr(instance: ArkComponent): void { 373 if (this.nativePtr !== instance.nativePtr) { 374 this.nativePtr = instance.nativePtr; 375 this._nativePtrChanged = true; 376 if (instance._weakPtr) { 377 this._weakPtr = instance._weakPtr; 378 } else { 379 this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(this.nativePtr); 380 } 381 } 382 } 383 384 applyModifierPatch(): void { 385 let expiringItemsWithKeys = []; 386 this._modifiersWithKeys.forEach((value, key) => { 387 if (value.applyStage(this.nativePtr, this)) { 388 expiringItemsWithKeys.push(key); 389 } 390 }); 391 expiringItemsWithKeys.forEach(key => { 392 this._modifiersWithKeys.delete(key); 393 }); 394 } 395 onGestureJudgeBegin(callback: (gestureInfo: GestureInfo, event: BaseGestureEvent) => GestureJudgeResult): this { 396 throw new Error('Method not implemented.'); 397 } 398 outline(value: OutlineOptions): this { 399 throw new Error('Method not implemented.'); 400 } 401 outlineColor(value: ResourceColor | EdgeColors): this { 402 throw new Error('Method not implemented.'); 403 } 404 outlineRadius(value: Dimension | OutlineRadiuses): this { 405 throw new Error('Method not implemented.'); 406 } 407 outlineStyle(value: OutlineStyle | EdgeOutlineStyles): this { 408 throw new Error('Method not implemented.'); 409 } 410 outlineWidth(value: Dimension | EdgeOutlineWidths): this { 411 throw new Error('Method not implemented.'); 412 } 413 width(value: Length): this { 414 throw new Error('Method not implemented.'); 415 } 416 417 height(value: Length): this { 418 throw new Error('Method not implemented.'); 419 } 420 421 expandSafeArea(types?: Array<SafeAreaType>, edges?: Array<SafeAreaEdge>): this { 422 throw new Error('Method not implemented.'); 423 } 424 425 responseRegion(value: Array<Rectangle> | Rectangle): this { 426 throw new Error('Method not implemented.'); 427 } 428 429 mouseResponseRegion(value: Array<Rectangle> | Rectangle): this { 430 throw new Error('Method not implemented.'); 431 } 432 433 size(value: SizeOptions): this { 434 throw new Error('Method not implemented.'); 435 } 436 437 constraintSize(value: ConstraintSizeOptions): this { 438 throw new Error('Method not implemented.'); 439 } 440 441 touchable(value: boolean): this { 442 throw new Error('Method not implemented.'); 443 } 444 445 hitTestBehavior(value: HitTestMode): this { 446 throw new Error('Method not implemented.'); 447 } 448 449 layoutWeight(value: number | string): this { 450 throw new Error('Method not implemented.'); 451 } 452 453 padding(value: Padding | Length): this { 454 throw new Error('Method not implemented.'); 455 } 456 457 margin(value: Margin | Length): this { 458 throw new Error('Method not implemented.'); 459 } 460 461 background(builder: CustomBuilder, options?: { align?: Alignment }): this { 462 throw new Error('Method not implemented.'); 463 } 464 465 backgroundColor(value: ResourceColor): this { 466 throw new Error('Method not implemented.'); 467 } 468 469 backgroundImage(src: ResourceStr, repeat?: ImageRepeat): this { 470 throw new Error('Method not implemented.'); 471 } 472 473 backgroundImageSize(value: SizeOptions | ImageSize): this { 474 throw new Error('Method not implemented.'); 475 } 476 477 backgroundImagePosition(value: Position | Alignment): this { 478 throw new Error('Method not implemented.'); 479 } 480 481 backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): this { 482 throw new Error('Method not implemented.'); 483 } 484 485 foregroundBlurStyle(value: BlurStyle, options?: ForegroundBlurStyleOptions): this { 486 throw new Error('Method not implemented.'); 487 } 488 489 opacity(value: number | Resource): this { 490 throw new Error('Method not implemented.'); 491 } 492 493 border(value: BorderOptions): this { 494 throw new Error('Method not implemented.'); 495 } 496 497 borderStyle(value: BorderStyle | EdgeStyles): this { 498 throw new Error('Method not implemented.'); 499 } 500 501 borderWidth(value: Length | EdgeWidths): this { 502 throw new Error('Method not implemented.'); 503 } 504 505 borderColor(value: ResourceColor | EdgeColors): this { 506 throw new Error('Method not implemented.'); 507 } 508 509 borderRadius(value: Length | BorderRadiuses): this { 510 throw new Error('Method not implemented.'); 511 } 512 513 514 borderImage(value: BorderImageOption): this { 515 throw new Error('Method not implemented.'); 516 } 517 518 foregroundColor(value: ResourceColor | ColoringStrategy): this { 519 throw new Error('Method not implemented.'); 520 } 521 522 onClick(event: (event?: ClickEvent) => void): this { 523 throw new Error('Method not implemented.'); 524 } 525 526 onHover(event: (isHover?: boolean, event?: HoverEvent) => void): this { 527 throw new Error('Method not implemented.'); 528 } 529 530 hoverEffect(value: HoverEffect): this { 531 throw new Error('Method not implemented.'); 532 } 533 534 onMouse(event: (event?: MouseEvent) => void): this { 535 throw new Error('Method not implemented.'); 536 } 537 538 onTouch(event: (event?: TouchEvent) => void): this { 539 throw new Error('Method not implemented.'); 540 } 541 542 onKeyEvent(event: (event?: KeyEvent) => void): this { 543 throw new Error('Method not implemented.'); 544 } 545 546 focusable(value: boolean): this { 547 throw new Error('Method not implemented.'); 548 } 549 550 onFocus(event: () => void): this { 551 throw new Error('Method not implemented.'); 552 } 553 554 onBlur(event: () => void): this { 555 throw new Error('Method not implemented.'); 556 } 557 558 tabIndex(index: number): this { 559 throw new Error('Method not implemented.'); 560 } 561 562 defaultFocus(value: boolean): this { 563 throw new Error('Method not implemented.'); 564 } 565 566 groupDefaultFocus(value: boolean): this { 567 throw new Error('Method not implemented.'); 568 } 569 570 focusOnTouch(value: boolean): this { 571 throw new Error('Method not implemented.'); 572 } 573 574 animation(value: AnimateParam): this { 575 throw new Error('Method not implemented.'); 576 } 577 578 transition(value: TransitionOptions | TransitionEffect): this { 579 throw new Error('Method not implemented.'); 580 } 581 582 gesture(gesture: GestureType, mask?: GestureMask): this { 583 throw new Error('Method not implemented.'); 584 } 585 586 priorityGesture(gesture: GestureType, mask?: GestureMask): this { 587 throw new Error('Method not implemented.'); 588 } 589 590 parallelGesture(gesture: GestureType, mask?: GestureMask): this { 591 throw new Error('Method not implemented.'); 592 } 593 594 blur(value: number): this { 595 throw new Error('Method not implemented.'); 596 } 597 598 linearGradientBlur(value: number, options: LinearGradientBlurOptions): this { 599 throw new Error('Method not implemented.'); 600 } 601 602 brightness(value: number): this { 603 throw new Error('Method not implemented.'); 604 } 605 606 contrast(value: number): this { 607 throw new Error('Method not implemented.'); 608 } 609 610 grayscale(value: number): this { 611 throw new Error('Method not implemented.'); 612 } 613 614 colorBlend(value: Color | string | Resource): this { 615 throw new Error('Method not implemented.'); 616 } 617 618 saturate(value: number): this { 619 throw new Error('Method not implemented.'); 620 } 621 622 sepia(value: number): this { 623 throw new Error('Method not implemented.'); 624 } 625 626 invert(value: number): this { 627 throw new Error('Method not implemented.'); 628 } 629 630 hueRotate(value: number | string): this { 631 throw new Error('Method not implemented.'); 632 } 633 634 useEffect(value: boolean): this { 635 throw new Error('Method not implemented.'); 636 } 637 638 backdropBlur(value: number): this { 639 throw new Error('Method not implemented.'); 640 } 641 642 renderGroup(value: boolean): this { 643 throw new Error('Method not implemented.'); 644 } 645 646 translate(value: TranslateOptions): this { 647 throw new Error('Method not implemented.'); 648 } 649 650 scale(value: ScaleOptions): this { 651 throw new Error('Method not implemented.'); 652 } 653 gridSpan(value: number): this { 654 throw new Error('Method not implemented.'); 655 } 656 657 gridOffset(value: number): this { 658 throw new Error('Method not implemented.'); 659 } 660 661 rotate(value: RotateOptions): this { 662 throw new Error('Method not implemented.'); 663 } 664 665 transform(value: object): this { 666 throw new Error('Method not implemented.'); 667 } 668 669 onAppear(event: () => void): this { 670 throw new Error('Method not implemented.'); 671 } 672 673 onDisAppear(event: () => void): this { 674 throw new Error('Method not implemented.'); 675 } 676 677 onAttach(event: () => void): this { 678 throw new Error('Method not implemented.'); 679 } 680 681 onDetach(event: () => void): this { 682 throw new Error('Method not implemented.'); 683 } 684 685 onAreaChange(event: (oldValue: Area, newValue: Area) => void): this { 686 throw new Error('Method not implemented.'); 687 } 688 689 visibility(value: Visibility): this { 690 throw new Error('Method not implemented.'); 691 } 692 693 flexGrow(value: number): this { 694 throw new Error('Method not implemented.'); 695 } 696 697 flexShrink(value: number): this { 698 throw new Error('Method not implemented.'); 699 } 700 701 flexBasis(value: number | string): this { 702 throw new Error('Method not implemented.'); 703 } 704 705 alignSelf(value: ItemAlign): this { 706 throw new Error('Method not implemented.'); 707 } 708 709 displayPriority(value: number): this { 710 throw new Error('Method not implemented.'); 711 } 712 713 zIndex(value: number): this { 714 throw new Error('Method not implemented.'); 715 } 716 717 sharedTransition(id: string, options?: sharedTransitionOptions): this { 718 throw new Error('Method not implemented.'); 719 } 720 721 direction(value: Direction): this { 722 throw new Error('Method not implemented.'); 723 } 724 725 align(value: Alignment): this { 726 throw new Error('Method not implemented.'); 727 } 728 729 position(value: Position): this { 730 throw new Error('Method not implemented.'); 731 } 732 733 markAnchor(value: Position): this { 734 throw new Error('Method not implemented.'); 735 } 736 737 offset(value: Position): this { 738 throw new Error('Method not implemented.'); 739 } 740 741 enabled(value: boolean): this { 742 throw new Error('Method not implemented.'); 743 } 744 745 useSizeType(value: { 746 xs?: number | { span: number; offset: number }; 747 sm?: number | { span: number; offset: number }; 748 md?: number | { span: number; offset: number }; 749 lg?: number | { span: number; offset: number }; 750 }): this { 751 throw new Error('Method not implemented.'); 752 } 753 754 alignRules(value: AlignRuleOption): this { 755 throw new Error('Method not implemented.'); 756 } 757 758 aspectRatio(value: number): this { 759 throw new Error('Method not implemented.'); 760 } 761 762 clickEffect(value: ClickEffect | null): this { 763 throw new Error('Method not implemented.'); 764 } 765 766 onDragStart(event: (event?: DragEvent, extraParams?: string) => CustomBuilder | DragItemInfo): this { 767 throw new Error('Method not implemented.'); 768 } 769 770 onDragEnter(event: (event?: DragEvent, extraParams?: string) => void): this { 771 throw new Error('Method not implemented.'); 772 } 773 774 onDragMove(event: (event?: DragEvent, extraParams?: string) => void): this { 775 throw new Error('Method not implemented.'); 776 } 777 778 onDragLeave(event: (event?: DragEvent, extraParams?: string) => void): this { 779 throw new Error('Method not implemented.'); 780 } 781 782 onDrop(event: (event?: DragEvent, extraParams?: string) => void): this { 783 throw new Error('Method not implemented.'); 784 } 785 786 onDragEnd(event: (event: DragEvent, extraParams?: string) => void): this { 787 throw new Error('Method not implemented.'); 788 } 789 790 allowDrop(value: Array<UniformDataType>): this { 791 throw new Error('Method not implemented.'); 792 } 793 794 draggable(value: boolean): this { 795 throw new Error('Method not implemented.'); 796 } 797 798 overlay(value: string | CustomBuilder, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): this { 799 throw new Error('Method not implemented.'); 800 } 801 802 linearGradient(value: { 803 angle?: number | string; 804 direction?: GradientDirection; 805 colors: Array<any>; 806 repeating?: boolean; 807 }): this { 808 throw new Error('Method not implemented.'); 809 } 810 811 sweepGradient(value: { 812 center: Array<any>; 813 start?: number | string; 814 end?: number | string; 815 rotation?: number | string; 816 colors: Array<any>; 817 repeating?: boolean; 818 }): this { 819 throw new Error('Method not implemented.'); 820 } 821 822 radialGradient(value: { center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }): this { 823 throw new Error('Method not implemented.'); 824 } 825 826 motionPath(value: MotionPathOptions): this { 827 throw new Error('Method not implemented.'); 828 } 829 830 shadow(value: ShadowOptions | ShadowStyle): this { 831 throw new Error('Method not implemented.'); 832 } 833 834 mask(value: CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute | ProgressMask): this { 835 throw new Error('Method not implemented.'); 836 } 837 838 key(value: string): this { 839 throw new Error('Method not implemented.'); 840 } 841 842 id(value: string): this { 843 throw new Error('Method not implemented.'); 844 } 845 846 geometryTransition(id: string): this { 847 throw new Error('Method not implemented.'); 848 } 849 850 bindPopup(show: boolean, popup: PopupOptions | CustomPopupOptions): this { 851 throw new Error('Method not implemented.'); 852 } 853 854 bindMenu(content: Array<MenuElement> | CustomBuilder, options?: MenuOptions): this { 855 throw new Error('Method not implemented.'); 856 } 857 858 bindContextMenu(content: CustomBuilder, responseType: ResponseType, options?: ContextMenuOptions): this { 859 throw new Error('Method not implemented.'); 860 } 861 862 bindContentCover(isShow: boolean, builder: CustomBuilder, type?: ModalTransition | ContentCoverOptions): this { 863 throw new Error('Method not implemented.'); 864 } 865 866 blendMode(value: BlendMode): this { 867 throw new Error('Method not implemented.'); 868 } 869 870 clip(value: boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute): this { 871 throw new Error('Method not implemented.'); 872 } 873 874 bindSheet(isShow: boolean, builder: CustomBuilder, options?: SheetOptions): this { 875 throw new Error('Method not implemented.'); 876 } 877 878 stateStyles(value: StateStyles): this { 879 throw new Error('Method not implemented.'); 880 } 881 882 restoreId(value: number): this { 883 throw new Error('Method not implemented.'); 884 } 885 886 onVisibleAreaChange(ratios: Array<number>, event: (isVisible: boolean, currentRatio: number) => void): this { 887 throw new Error('Method not implemented.'); 888 } 889 890 sphericalEffect(value: number): this { 891 throw new Error('Method not implemented.'); 892 } 893 894 lightUpEffect(value: number): this { 895 throw new Error('Method not implemented.'); 896 } 897 898 pixelStretchEffect(options: PixelStretchEffectOptions): this { 899 throw new Error('Method not implemented.'); 900 } 901 902 keyboardShortcut(value: string | FunctionKey, keys: Array<ModifierKey>, action?: () => void): this { 903 throw new Error('Method not implemented.'); 904 } 905 906 accessibilityGroup(value: boolean): this { 907 throw new Error('Method not implemented.'); 908 } 909 910 accessibilityText(value: string): this { 911 if (typeof value === 'string') { 912 modifierWithKey(this._modifiersWithKeys, SpanAccessibilityTextModifier.identity, SpanAccessibilityTextModifier, value); 913 } else { 914 modifierWithKey(this._modifiersWithKeys, SpanAccessibilityTextModifier.identity, SpanAccessibilityTextModifier, undefined); 915 } 916 return this; 917 } 918 919 accessibilityDescription(value: string): this { 920 if (typeof value === 'string') { 921 modifierWithKey(this._modifiersWithKeys, SpanAccessibilityDescriptionModifier.identity, SpanAccessibilityDescriptionModifier, value); 922 } else { 923 modifierWithKey(this._modifiersWithKeys, SpanAccessibilityDescriptionModifier.identity, SpanAccessibilityDescriptionModifier, undefined); 924 } 925 return this; 926 } 927 928 accessibilityLevel(value: string): this { 929 if (typeof value === 'string') { 930 modifierWithKey(this._modifiersWithKeys, SpanAccessibilityLevelModifier.identity, SpanAccessibilityLevelModifier, value); 931 } else { 932 modifierWithKey(this._modifiersWithKeys, SpanAccessibilityLevelModifier.identity, SpanAccessibilityLevelModifier, undefined); 933 } 934 return this; 935 } 936 937 obscured(reasons: Array<ObscuredReasons>): this { 938 throw new Error('Method not implemented.'); 939 } 940 941 reuseId(id: string): this { 942 throw new Error('Method not implemented.'); 943 } 944 945 renderFit(fitMode: RenderFit): this { 946 throw new Error('Method not implemented.'); 947 } 948 949 attributeModifier(modifier: AttributeModifier<CommonAttribute>): this { 950 return this; 951 } 952 decoration(value: { type: TextDecorationType, color?: ResourceColor; style?: TextDecorationStyle }): SpanAttribute { 953 modifierWithKey(this._modifiersWithKeys, SpanDecorationModifier.identity, SpanDecorationModifier, value); 954 return this; 955 } 956 font(value: Font): SpanAttribute { 957 modifierWithKey(this._modifiersWithKeys, SpanFontSizeModifier.identity, SpanFontSizeModifier, value?.size); 958 modifierWithKey(this._modifiersWithKeys, SpanFontWeightModifier.identity, SpanFontWeightModifier, value?.weight); 959 modifierWithKey(this._modifiersWithKeys, SpanFontFamilyModifier.identity, SpanFontFamilyModifier, value?.family); 960 modifierWithKey(this._modifiersWithKeys, SpanFontStyleModifier.identity, SpanFontStyleModifier, value?.style); 961 return this; 962 } 963 lineHeight(value: Length): SpanAttribute { 964 modifierWithKey(this._modifiersWithKeys, SpanLineHeightModifier.identity, SpanLineHeightModifier, value); 965 return this; 966 } 967 fontSize(value: Length): SpanAttribute { 968 modifierWithKey(this._modifiersWithKeys, SpanFontSizeModifier.identity, SpanFontSizeModifier, value); 969 return this; 970 } 971 fontColor(value: ResourceColor): SpanAttribute { 972 modifierWithKey(this._modifiersWithKeys, SpanFontColorModifier.identity, SpanFontColorModifier, value); 973 return this; 974 } 975 fontStyle(value: FontStyle): SpanAttribute { 976 modifierWithKey(this._modifiersWithKeys, SpanFontStyleModifier.identity, SpanFontStyleModifier, value); 977 return this; 978 } 979 fontWeight(value: number | FontWeight | string): SpanAttribute { 980 modifierWithKey(this._modifiersWithKeys, SpanFontWeightModifier.identity, SpanFontWeightModifier, value); 981 return this; 982 } 983 fontFamily(value: string | Resource): SpanAttribute { 984 modifierWithKey(this._modifiersWithKeys, SpanFontFamilyModifier.identity, SpanFontFamilyModifier, value); 985 return this; 986 } 987 letterSpacing(value: number | string): SpanAttribute { 988 modifierWithKey(this._modifiersWithKeys, SpanLetterSpacingModifier.identity, SpanLetterSpacingModifier, value); 989 return this; 990 } 991 baselineOffset(value: LengthMetrics): SpanAttribute { 992 modifierWithKey(this._modifiersWithKeys, SpanBaselineOffsetModifier.identity, SpanBaselineOffsetModifier, value); 993 return this; 994 } 995 textCase(value: TextCase): SpanAttribute { 996 modifierWithKey(this._modifiersWithKeys, SpanTextCaseModifier.identity, SpanTextCaseModifier, value); 997 return this; 998 } 999 textBackgroundStyle(value: TextBackgroundStyle): SpanAttribute { 1000 modifierWithKey(this._modifiersWithKeys, SpanTextBackgroundStyleModifier.identity, SpanTextBackgroundStyleModifier, value); 1001 return this; 1002 } 1003 textShadow(value: ShadowOptions | Array<ShadowOptions>): SpanAttribute { 1004 modifierWithKey(this._modifiersWithKeys, SpanTextShadowModifier.identity, SpanTextShadowModifier, value); 1005 return this; 1006 } 1007} 1008// @ts-ignore 1009globalThis.Span.attributeModifier = function (modifier: ArkComponent): void { 1010 attributeModifierFuncWithoutStateStyles.call(this, modifier, (nativePtr: KNode) => { 1011 return new ArkSpanComponent(nativePtr); 1012 }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => { 1013 return new modifierJS.SpanModifier(nativePtr, classType); 1014 }); 1015}; 1016