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