• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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' />
17const arkUINativeModule = globalThis.getArkUINativeModule();
18function getUINativeModule(): any {
19  if (arkUINativeModule) {
20    return arkUINativeModule;
21  }
22  return arkUINativeModule;
23}
24
25const UI_STATE_NORMAL = 0;
26const UI_STATE_PRESSED = 1;
27const UI_STATE_FOCUSED = 1 << 1;
28const UI_STATE_DISABLED = 1 << 2;
29const UI_STATE_SELECTED = 1 << 3;
30
31function applyUIAttributes(modifier: AttributeModifier<CommonAttribute>, nativeNode: KNode, component: ArkComponent): void {
32  let state = 0;
33  if (modifier.applyPressedAttribute !== undefined) {
34    state |= UI_STATE_PRESSED;
35  }
36  if (modifier.applyFocusedAttribute !== undefined) {
37    state |= UI_STATE_FOCUSED;
38  }
39  if (modifier.applyDisabledAttribute !== undefined) {
40    state |= UI_STATE_DISABLED;
41  }
42  if (modifier.applySelectedAttribute !== undefined) {
43    state |= UI_STATE_SELECTED;
44  }
45
46  getUINativeModule().setSupportedUIState(nativeNode, state);
47  const currentUIState = getUINativeModule().getUIState(nativeNode);
48
49  if (modifier.applyNormalAttribute !== undefined) {
50    modifier.applyNormalAttribute(component);
51  }
52  if ((currentUIState & UI_STATE_PRESSED) && (modifier.applyPressedAttribute !== undefined)) {
53    modifier.applyPressedAttribute(component);
54  }
55  if ((currentUIState & UI_STATE_FOCUSED) && (modifier.applyFocusedAttribute !== undefined)) {
56    modifier.applyFocusedAttribute(component);
57  }
58  if ((currentUIState & UI_STATE_DISABLED) && (modifier.applyDisabledAttribute !== undefined)) {
59    modifier.applyDisabledAttribute(component);
60  }
61  if ((currentUIState & UI_STATE_SELECTED) && (modifier.applySelectedAttribute !== undefined)) {
62    modifier.applySelectedAttribute(component);
63  }
64}
65
66function isResource(variable: any): variable is Resource {
67  return (variable as Resource)?.bundleName !== undefined;
68}
69
70function isResourceEqual(stageValue: Resource, value: Resource): boolean {
71  return (stageValue.bundleName === value.bundleName) &&
72    (stageValue.moduleName === value.moduleName) &&
73    (stageValue.id === value.id) &&
74    (stageValue.params === value.params) &&
75    (stageValue.type === value.type);
76}
77function isBaseOrResourceEqual(stageValue: any, value: any): boolean {
78  if (isResource(stageValue) && isResource(value)) {
79    return isResourceEqual(stageValue, value);
80  } else if (!isResource(stageValue) && !isResource(value)) {
81    return (stageValue === value);
82  }
83  return false;
84}
85
86const SAFE_AREA_TYPE_NONE = 0;
87const SAFE_AREA_TYPE_SYSTEM = 1;
88const SAFE_AREA_TYPE_CUTOUT = 2;
89const SAFE_AREA_TYPE_KEYBOARD = 4;
90const SAFE_AREA_TYPE_ALL = 7;
91
92const SAFE_AREA_EDGE_NONE = 0;
93const SAFE_AREA_EDGE_TOP = 1;
94const SAFE_AREA_EDGE_BOTTOM = 2;
95const SAFE_AREA_EDGE_START = 4;
96const SAFE_AREA_EDGE_END = 8;
97const SAFE_AREA_EDGE_ALL = 15;
98
99const SAFE_AREA_TYPE_LIMIT = 3;
100const SAFE_AREA_EDGE_LIMIT = 4;
101const DIRECTION_RANGE = 3;
102
103type KNode = number | null
104
105interface Equable {
106  isEqual(value: Equable): boolean;
107}
108
109class Modifier<T extends number | string | boolean | Equable | Resource | object> {
110  stageValue?: T;
111  value?: T;
112  constructor(value: T) {
113    this.stageValue = value;
114  }
115
116  applyStage(node: KNode): boolean {
117    if (this.stageValue === this.value) {
118      if (this.value === undefined) {
119        this.applyPeer(node, true);
120      }
121      delete this.stageValue;
122      return;
123    }
124    if (typeof this.stageValue === 'object' && typeof this.value === 'object') {
125      if ((this.stageValue as Equable).isEqual(this.value as Equable)) {
126        delete this.stageValue;
127        return;
128      }
129    }
130    this.value = this.stageValue;
131    delete this.stageValue;
132    this.applyPeer(node, this.value === undefined);
133    return (this.value === undefined);
134  }
135
136  applyPeer(node: KNode, reset: boolean): void { }
137}
138
139class ModifierWithKey<T extends number | string | boolean | object> {
140  stageValue?: T;
141  value?: T;
142  constructor(value: T) {
143    this.stageValue = value;
144  }
145
146  applyStage(node: KNode): boolean {
147    if (this.stageValue === undefined || this.stageValue === null) {
148      this.value = this.stageValue;
149      this.applyPeer(node, true);
150      return true;
151    }
152    const stageTypeInfo: string = typeof this.stageValue;
153    const valueTypeInfo: string = typeof this.value;
154    let different: boolean = false;
155    if (stageTypeInfo !== valueTypeInfo) {
156      different = true;
157    } else if (stageTypeInfo === 'number' || stageTypeInfo === 'string' || stageTypeInfo === 'boolean') {
158      different = (this.stageValue !== this.value);
159    } else {
160      different = this.checkObjectDiff();
161    }
162    if (different) {
163      this.value = this.stageValue;
164      this.applyPeer(node, false);
165    }
166    this.stageValue = undefined;
167    return false;
168  }
169
170  applyPeer(node: KNode, reset: boolean): void { }
171
172  checkObjectDiff(): boolean {
173    return true;
174  }
175}
176
177class BackgroundColorModifier extends ModifierWithKey<ResourceColor> {
178  constructor(value: ResourceColor) {
179    super(value);
180  }
181  static identity: Symbol = Symbol('backgroundColor');
182  applyPeer(node: KNode, reset: boolean): void {
183    if (reset) {
184      getUINativeModule().common.resetBackgroundColor(node);
185    } else {
186      getUINativeModule().common.setBackgroundColor(node, this.value);
187    }
188  }
189
190  checkObjectDiff(): boolean {
191    return !isBaseOrResourceEqual(this.stageValue, this.value);
192  }
193}
194
195class WidthModifier extends ModifierWithKey<Length> {
196  constructor(value: Length) {
197    super(value);
198  }
199  static identity: Symbol = Symbol('width');
200  applyPeer(node: KNode, reset: boolean): void {
201    if (reset) {
202      getUINativeModule().common.resetWidth(node);
203    } else {
204      getUINativeModule().common.setWidth(node, this.value);
205    }
206  }
207
208  checkObjectDiff(): boolean {
209    return !isBaseOrResourceEqual(this.stageValue, this.value);
210  }
211}
212
213class BorderWidthModifier extends ModifierWithKey<Length | EdgeWidths> {
214  constructor(value: Length | EdgeWidths) {
215    super(value);
216  }
217  static identity: Symbol = Symbol('borderWidth');
218  applyPeer(node: KNode, reset: boolean): void {
219    if (reset) {
220      getUINativeModule().common.resetBorderWidth(node);
221    } else {
222      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
223        getUINativeModule().common.setBorderWidth(node, this.value, this.value, this.value, this.value);
224      } else {
225        getUINativeModule().common.setBorderWidth(node,
226          (this.value as EdgeWidths).left,
227          (this.value as EdgeWidths).right,
228          (this.value as EdgeWidths).top,
229          (this.value as EdgeWidths).bottom);
230      }
231    }
232  }
233
234  checkObjectDiff(): boolean {
235    if (isResource(this.stageValue) && isResource(this.value)) {
236      return !isResourceEqual(this.stageValue, this.value);
237    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
238      return !((this.stageValue as EdgeWidths).left === (this.value as EdgeWidths).left &&
239        (this.stageValue as EdgeWidths).right === (this.value as EdgeWidths).right &&
240        (this.stageValue as EdgeWidths).top === (this.value as EdgeWidths).top &&
241        (this.stageValue as EdgeWidths).bottom === (this.value as EdgeWidths).bottom);
242    } else {
243      return true;
244    }
245  }
246}
247
248class HeightModifier extends ModifierWithKey<Length> {
249  constructor(value: Length) {
250    super(value);
251  }
252  static identity: Symbol = Symbol('height');
253  applyPeer(node: KNode, reset: boolean): void {
254    if (reset) {
255      getUINativeModule().common.resetHeight(node);
256    } else {
257      getUINativeModule().common.setHeight(node, this.value);
258    }
259  }
260
261  checkObjectDiff(): boolean {
262    return !isBaseOrResourceEqual(this.stageValue, this.value);
263  }
264}
265
266class BorderRadiusModifier extends ModifierWithKey<Length | BorderRadiuses> {
267  constructor(value: Length | BorderRadiuses) {
268    super(value);
269  }
270  static identity: Symbol = Symbol('borderRadius');
271  applyPeer(node: KNode, reset: boolean): void {
272    if (reset) {
273      getUINativeModule().common.resetBorderRadius(node);
274    } else {
275      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
276        getUINativeModule().common.setBorderRadius(node, this.value, this.value, this.value, this.value);
277      } else {
278        getUINativeModule().common.setBorderRadius(node,
279          (this.value as BorderRadiuses).topLeft,
280          (this.value as BorderRadiuses).topRight,
281          (this.value as BorderRadiuses).bottomLeft,
282          (this.value as BorderRadiuses).bottomRight);
283      }
284    }
285  }
286
287  checkObjectDiff(): boolean {
288    if (isResource(this.stageValue) && isResource(this.value)) {
289      return !isResourceEqual(this.stageValue, this.value);
290    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
291      return !((this.stageValue as BorderRadiuses).topLeft === (this.value as BorderRadiuses).topLeft &&
292        (this.stageValue as BorderRadiuses).topRight === (this.value as BorderRadiuses).topRight &&
293        (this.stageValue as BorderRadiuses).bottomLeft === (this.value as BorderRadiuses).bottomLeft &&
294        (this.stageValue as BorderRadiuses).bottomRight === (this.value as BorderRadiuses).bottomRight);
295    } else {
296      return true;
297    }
298  }
299}
300
301class PositionModifier extends ModifierWithKey<Position> {
302  constructor(value: Position) {
303    super(value);
304  }
305  static identity: Symbol = Symbol('position');
306  applyPeer(node: KNode, reset: boolean): void {
307    if (reset) {
308      getUINativeModule().common.resetPosition(node);
309    } else {
310      getUINativeModule().common.setPosition(node, this.value.x, this.value.y);
311    }
312  }
313  checkObjectDiff(): boolean {
314    return !isBaseOrResourceEqual(this.stageValue.x, this.value.x) ||
315      !isBaseOrResourceEqual(this.stageValue.y, this.value.y);
316  }
317}
318
319class BorderColorModifier extends ModifierWithKey<ResourceColor | EdgeColors> {
320  constructor(value: ResourceColor | EdgeColors) {
321    super(value);
322  }
323  static identity: Symbol = Symbol('borderColor');
324  applyPeer(node: KNode, reset: boolean): void {
325    if (reset) {
326      getUINativeModule().common.resetBorderColor(node);
327    } else {
328      const valueType: string = typeof this.value;
329      if (valueType === 'number' || valueType === 'string' || isResource(this.value)) {
330        getUINativeModule().common.setBorderColor(node, this.value, this.value, this.value, this.value);
331      } else {
332        getUINativeModule().common.setBorderColor(node, (this.value as EdgeColors).left,
333          (this.value as EdgeColors).right, (this.value as EdgeColors).top,
334          (this.value as EdgeColors).bottom);
335      }
336
337    }
338  }
339
340  checkObjectDiff(): boolean {
341    if (isResource(this.stageValue) && isResource(this.value)) {
342      return !isResourceEqual(this.stageValue, this.value);
343    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
344      return !((this.stageValue as EdgeColors).left === (this.value as EdgeColors).left &&
345        (this.stageValue as EdgeColors).right === (this.value as EdgeColors).right &&
346        (this.stageValue as EdgeColors).top === (this.value as EdgeColors).top &&
347        (this.stageValue as EdgeColors).bottom === (this.value as EdgeColors).bottom);
348    } else {
349      return true;
350    }
351  }
352}
353
354interface Matrix {
355  matrix4x4: []
356}
357
358
359class TransformModifier extends ModifierWithKey<object> {
360  constructor(value: object) {
361    super(value);
362  }
363  static identity: Symbol = Symbol('transform');
364  applyPeer(node: KNode, reset: boolean): void {
365    if (reset) {
366      getUINativeModule().common.resetTransform(node);
367    } else {
368      getUINativeModule().common.setTransform(node, (this.value as Matrix).matrix4x4);
369    }
370  }
371  checkObjectDiff(): boolean {
372    return !deepCompareArrays((this.stageValue as Matrix).matrix4x4, (this.value as Matrix).matrix4x4);
373  }
374}
375
376class BorderStyleModifier extends ModifierWithKey<BorderStyle | EdgeStyles> {
377  constructor(value: BorderStyle | EdgeStyles) {
378    super(value);
379  }
380  static identity: Symbol = Symbol('borderStyle');
381  applyPeer(node: KNode, reset: boolean): void {
382    if (reset) {
383      getUINativeModule().common.resetBorderStyle(node);
384    } else {
385      let type: boolean;
386      let style: BorderStyle;
387      let top: BorderStyle;
388      let right: BorderStyle;
389      let bottom: BorderStyle;
390      let left: BorderStyle;
391      if (isNumber(this.value)) {
392        style = this.value as BorderStyle;
393        type = true;
394      } else if (isObject(this.value)) {
395        top = (this.value as EdgeStyles)?.top;
396        right = (this.value as EdgeStyles)?.right;
397        bottom = (this.value as EdgeStyles)?.bottom;
398        left = (this.value as EdgeStyles)?.left;
399        type = true;
400      }
401      if (type === true) {
402        getUINativeModule().common.setBorderStyle(node, type, style, top, right, bottom, left);
403      } else {
404        getUINativeModule().common.resetBorderStyle(node);
405      }
406    }
407  }
408  checkObjectDiff(): boolean {
409    return !((this.value as EdgeStyles)?.top === (this.stageValue as EdgeStyles)?.top &&
410      (this.value as EdgeStyles)?.right === (this.stageValue as EdgeStyles)?.right &&
411      (this.value as EdgeStyles)?.bottom === (this.stageValue as EdgeStyles)?.bottom &&
412      (this.value as EdgeStyles)?.left === (this.stageValue as EdgeStyles)?.left);
413  }
414}
415
416class ShadowModifier extends ModifierWithKey<ShadowOptions | ShadowStyle> {
417  constructor(value: ShadowOptions | ShadowStyle) {
418    super(value);
419  }
420  static identity: Symbol = Symbol('shadow');
421  applyPeer(node: KNode, reset: boolean): void {
422    if (reset) {
423      getUINativeModule().common.resetShadow(node);
424    } else {
425      if (isNumber(this.value)) {
426        getUINativeModule().common.setShadow(node, this.value, undefined, undefined, undefined, undefined, undefined, undefined);
427      } else {
428        getUINativeModule().common.setShadow(node, undefined,
429          (this.value as ShadowOptions).radius,
430          (this.value as ShadowOptions).type,
431          (this.value as ShadowOptions).color,
432          (this.value as ShadowOptions).offsetX,
433          (this.value as ShadowOptions).offsetY,
434          (this.value as ShadowOptions).fill);
435      }
436    }
437  }
438
439  checkObjectDiff(): boolean {
440    return !((this.stageValue as ShadowOptions).radius === (this.value as ShadowOptions).radius &&
441      (this.stageValue as ShadowOptions).type === (this.value as ShadowOptions).type &&
442      (this.stageValue as ShadowOptions).color === (this.value as ShadowOptions).color &&
443      (this.stageValue as ShadowOptions).offsetX === (this.value as ShadowOptions).offsetX &&
444      (this.stageValue as ShadowOptions).offsetY === (this.value as ShadowOptions).offsetY &&
445      (this.stageValue as ShadowOptions).fill === (this.value as ShadowOptions).fill);
446  }
447}
448
449class HitTestBehaviorModifier extends ModifierWithKey<number> {
450  constructor(value: number) {
451    super(value);
452  }
453  static identity: Symbol = Symbol('hitTestBehavior');
454  applyPeer(node: KNode, reset: boolean): void {
455    if (reset) {
456      getUINativeModule().common.resetHitTestBehavior(node);
457    } else {
458      getUINativeModule().common.setHitTestBehavior(node, this.value);
459    }
460  }
461}
462
463class ZIndexModifier extends ModifierWithKey<number> {
464  constructor(value: number) {
465    super(value);
466  }
467  static identity: Symbol = Symbol('zIndex');
468  applyPeer(node: KNode, reset: boolean): void {
469    if (reset) {
470      getUINativeModule().common.resetZIndex(node);
471    } else {
472      getUINativeModule().common.setZIndex(node, this.value);
473    }
474  }
475}
476
477class OpacityModifier extends ModifierWithKey<number | Resource> {
478  constructor(value: number | Resource) {
479    super(value);
480  }
481  static identity: Symbol = Symbol('opacity');
482  applyPeer(node: KNode, reset: boolean): void {
483    if (reset) {
484      getUINativeModule().common.resetOpacity(node);
485    } else {
486      getUINativeModule().common.setOpacity(node, this.value);
487    }
488  }
489
490  checkObjectDiff(): boolean {
491    return !isBaseOrResourceEqual(this.stageValue, this.value);
492  }
493}
494
495class AlignModifier extends ModifierWithKey<number> {
496  constructor(value: number) {
497    super(value);
498  }
499  static identity: Symbol = Symbol('align');
500  applyPeer(node: KNode, reset: boolean): void {
501    if (reset) {
502      getUINativeModule().common.resetAlign(node);
503    } else {
504      getUINativeModule().common.setAlign(node, this.value);
505    }
506  }
507}
508
509class BackdropBlurModifier extends ModifierWithKey<number> {
510  constructor(value: number) {
511    super(value);
512  }
513  static identity: Symbol = Symbol('backdropBlur');
514  applyPeer(node: KNode, reset: boolean): void {
515    if (reset) {
516      getUINativeModule().common.resetBackdropBlur(node);
517    } else {
518      getUINativeModule().common.setBackdropBlur(node, this.value);
519    }
520  }
521}
522
523class HueRotateModifier extends ModifierWithKey<number | string> {
524  constructor(value: number | string) {
525    super(value);
526  }
527  static identity: Symbol = Symbol('hueRotate');
528  applyPeer(node: KNode, reset: boolean): void {
529    if (reset) {
530      getUINativeModule().common.resetHueRotate(node);
531    } else {
532      getUINativeModule().common.setHueRotate(node, this.value);
533    }
534  }
535}
536
537class InvertModifier extends ModifierWithKey<number> {
538  constructor(value: number) {
539    super(value);
540  }
541  static identity: Symbol = Symbol('invert');
542  applyPeer(node: KNode, reset: boolean): void {
543    if (reset) {
544      getUINativeModule().common.resetInvert(node);
545    } else {
546      getUINativeModule().common.setInvert(node, this.value);
547    }
548  }
549}
550
551class SepiaModifier extends ModifierWithKey<number> {
552  constructor(value: number) {
553    super(value);
554  }
555  static identity: Symbol = Symbol('sepia');
556  applyPeer(node: KNode, reset: boolean): void {
557    if (reset) {
558      getUINativeModule().common.resetSepia(node);
559    } else {
560      getUINativeModule().common.setSepia(node, this.value);
561    }
562  }
563}
564
565class SaturateModifier extends ModifierWithKey<number> {
566  constructor(value: number) {
567    super(value);
568  }
569  static identity: Symbol = Symbol('saturate');
570  applyPeer(node: KNode, reset: boolean): void {
571    if (reset) {
572      getUINativeModule().common.resetSaturate(node);
573    } else {
574      getUINativeModule().common.setSaturate(node, this.value);
575    }
576  }
577}
578
579class ColorBlendModifier extends ModifierWithKey<Color | string | Resource> {
580  constructor(value: Color | string | Resource) {
581    super(value);
582  }
583  static identity: Symbol = Symbol('colorBlend');
584  applyPeer(node: KNode, reset: boolean): void {
585    if (reset) {
586      getUINativeModule().common.resetColorBlend(node);
587    } else {
588      getUINativeModule().common.setColorBlend(node, this.value);
589    }
590  }
591
592  checkObjectDiff(): boolean {
593    return !isBaseOrResourceEqual(this.stageValue, this.value);
594  }
595}
596
597class GrayscaleModifier extends ModifierWithKey<number> {
598  constructor(value: number) {
599    super(value);
600  }
601  static identity: Symbol = Symbol('grayscale');
602  applyPeer(node: KNode, reset: boolean): void {
603    if (reset) {
604      getUINativeModule().common.resetGrayscale(node);
605    } else {
606      getUINativeModule().common.setGrayscale(node, this.value);
607    }
608  }
609}
610
611class ContrastModifier extends ModifierWithKey<number> {
612  constructor(value: number) {
613    super(value);
614  }
615  static identity: Symbol = Symbol('contrast');
616  applyPeer(node: KNode, reset: boolean): void {
617    if (reset) {
618      getUINativeModule().common.resetContrast(node);
619    } else {
620      getUINativeModule().common.setContrast(node, this.value);
621    }
622  }
623}
624
625class BrightnessModifier extends ModifierWithKey<number> {
626  constructor(value: number) {
627    super(value);
628  }
629  static identity: Symbol = Symbol('brightness');
630  applyPeer(node: KNode, reset: boolean): void {
631    if (reset) {
632      getUINativeModule().common.resetBrightness(node);
633    } else {
634      getUINativeModule().common.setBrightness(node, this.value);
635    }
636  }
637}
638
639class BlurModifier extends ModifierWithKey<number> {
640  constructor(value: number) {
641    super(value);
642  }
643  static identity: Symbol = Symbol('blur');
644  applyPeer(node: KNode, reset: boolean): void {
645    if (reset) {
646      getUINativeModule().common.resetBlur(node);
647    } else {
648      getUINativeModule().common.setBlur(node, this.value);
649    }
650  }
651}
652
653class LinearGradientModifier extends ModifierWithKey<{
654  angle?: number | string;
655  direction?: GradientDirection; colors: Array<any>; repeating?: boolean;
656}> {
657  constructor(value: {
658    angle?: number | string; direction?: GradientDirection;
659    colors: Array<any>; repeating?: boolean;
660  }) {
661    super(value);
662  }
663  static identity: Symbol = Symbol('linearGradient');
664  applyPeer(node: KNode, reset: boolean): void {
665    if (reset) {
666      getUINativeModule().common.resetLinearGradient(node);
667    } else {
668      getUINativeModule().common.setLinearGradient(node,
669        this.value.angle, this.value.direction,
670        this.value.colors, this.value.repeating);
671    }
672  }
673  checkObjectDiff(): boolean {
674    return !((this.stageValue.angle === this.value.angle) &&
675      (this.stageValue.direction === this.value.direction) &&
676      (this.stageValue.colors === this.value.colors) &&
677      (this.stageValue.repeating === this.value.repeating));
678  }
679}
680
681class RadialGradientModifier extends ModifierWithKey<{ center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }> {
682  constructor(value: { center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }) {
683    super(value);
684  }
685  static identity: Symbol = Symbol('radialGradient');
686  applyPeer(node: KNode, reset: boolean): void {
687    if (reset) {
688      getUINativeModule().common.resetRadialGradient(node);
689    } else {
690      getUINativeModule().common.setRadialGradient(node,
691        this.value.center, this.value.radius, this.value.colors, this.value.repeating);
692    }
693  }
694  checkObjectDiff(): boolean {
695    return !((this.stageValue.center === this.value.center) &&
696      (this.stageValue.radius === this.value.radius) &&
697      (this.stageValue.colors === this.value.colors) &&
698      (this.stageValue.repeating === this.value.repeating));
699  }
700}
701
702class SweepGradientModifier extends ModifierWithKey<{
703  center: Array<any>; start?: number |
704  string; end?: number | string; rotation?: number | string;
705  colors: Array<any>; repeating?: boolean;
706}> {
707  constructor(value: {
708    center: Array<any>;
709    start?: number | string; end?: number | string;
710    rotation?: number | string; colors: Array<any>; repeating?: boolean;
711  }) {
712    super(value);
713  }
714  static identity: Symbol = Symbol('sweepGradient');
715  applyPeer(node: KNode, reset: boolean): void {
716    if (reset) {
717      getUINativeModule().common.resetSweepGradient(node);
718    } else {
719      getUINativeModule().common.setSweepGradient(node,
720        this.value.center,
721        this.value.start, this.value.end, this.value.rotation,
722        this.value.colors, this.value.repeating);
723    }
724  }
725  checkObjectDiff(): boolean {
726    return !((this.stageValue.center === this.value.center) &&
727      (this.stageValue.start === this.value.start) &&
728      (this.stageValue.end === this.value.end) &&
729      (this.stageValue.rotation === this.value.rotation) &&
730      (this.stageValue.colors === this.value.colors) &&
731      (this.stageValue.repeating === this.value.repeating));
732  }
733}
734
735class OverlayModifier extends ModifierWithKey<ArkOverlay> {
736  constructor(value: ArkOverlay) {
737    super(value);
738  }
739  static identity: Symbol = Symbol('overlay');
740  applyPeer(node: KNode, reset: boolean): void {
741    if (reset) {
742      getUINativeModule().common.resetOverlay(node);
743    } else {
744      getUINativeModule().common.setOverlay(node,
745        this.value.value, this.value.align,
746        this.value.offsetX, this.value.offsetY,
747        this.value.hasOptions, this.value.hasOffset);
748    }
749  }
750  checkObjectDiff(): boolean {
751    if (isUndefined(this.value)) {
752      return !isUndefined(this.stageValue);
753    }
754    return this.value.checkObjectDiff(this.stageValue);
755  }
756}
757
758class BorderImageModifier extends ModifierWithKey<BorderImageOption> {
759  constructor(value: BorderImageOption) {
760    super(value);
761  }
762  static identity: Symbol = Symbol('borderImage');
763  applyPeer(node: KNode, reset: boolean): void {
764    if (reset) {
765      getUINativeModule().common.resetBorderImage(node);
766    } else {
767      let sliceTop: Length | undefined;
768      let sliceRight: Length | undefined;
769      let sliceBottom: Length | undefined;
770      let sliceLeft: Length | undefined;
771      let repeat: RepeatMode | undefined;
772      let source: string | Resource | LinearGradient | undefined;
773      let sourceAngle: number | string | undefined;
774      let sourceDirection: GradientDirection | undefined;
775      let sourceColors: Array<any> | undefined;
776      let sourceRepeating: boolean | undefined;
777      let widthTop: Length | undefined;
778      let widthRight: Length | undefined;
779      let widthBottom: Length | undefined;
780      let widthLeft: Length | undefined;
781      let outsetTop: Length | undefined;
782      let outsetRight: Length | undefined;
783      let outsetBottom: Length | undefined;
784      let outsetLeft: Length | undefined;
785      let fill: boolean | undefined;
786
787      if (!isUndefined(this.value.slice)) {
788        if (isLengthType(this.value.slice) || isResource(this.value.slice)) {
789          let tmpSlice = this.value.slice as Length;
790          sliceTop = tmpSlice;
791          sliceRight = tmpSlice;
792          sliceBottom = tmpSlice;
793          sliceLeft = tmpSlice;
794        } else {
795          let tmpSlice = this.value.slice as EdgeWidths;
796          sliceTop = tmpSlice.top;
797          sliceRight = tmpSlice.right;
798          sliceBottom = tmpSlice.bottom;
799          sliceLeft = tmpSlice.left;
800        }
801      }
802      repeat = this.value.repeat;
803      if (!isUndefined(this.value.source)) {
804        if (isString(this.value.source) || isResource(this.value.source)) {
805          source = this.value.source;
806        } else {
807          let tmpSource = this.value.source as LinearGradient;
808          sourceAngle = tmpSource.angle;
809          sourceDirection = tmpSource.direction;
810          sourceColors = tmpSource.colors;
811          sourceRepeating = tmpSource.repeating;
812        }
813      }
814      if (!isUndefined(this.value.width)) {
815        if (isLengthType(this.value.width) || isResource(this.value.width)) {
816          let tmpWidth = this.value.width as Length;
817          widthTop = tmpWidth;
818          widthRight = tmpWidth;
819          widthBottom = tmpWidth;
820          widthLeft = tmpWidth;
821        } else {
822          let tmpWidth = this.value.width as EdgeWidths;
823          widthTop = tmpWidth.top;
824          widthRight = tmpWidth.right;
825          widthBottom = tmpWidth.bottom;
826          widthLeft = tmpWidth.left;
827        }
828      }
829      if (!isUndefined(this.value.outset)) {
830        if (isLengthType(this.value.outset) || isResource(this.value.outset)) {
831          let tmpOutset = this.value.outset as Length;
832          outsetTop = tmpOutset;
833          outsetRight = tmpOutset;
834          outsetBottom = tmpOutset;
835          outsetLeft = tmpOutset;
836        } else {
837          let tmpOutset = this.value.outset as EdgeWidths;
838          outsetTop = tmpOutset.top;
839          outsetRight = tmpOutset.right;
840          outsetBottom = tmpOutset.bottom;
841          outsetLeft = tmpOutset.left;
842        }
843      }
844      fill = this.value.fill;
845      getUINativeModule().common.setBorderImage(node,
846        sliceTop, sliceRight, sliceBottom, sliceLeft,
847        repeat,
848        source, sourceAngle, sourceDirection, sourceColors, sourceRepeating,
849        widthTop, widthRight, widthBottom, widthLeft,
850        outsetTop, outsetRight, outsetBottom, outsetLeft,
851        fill);
852    }
853  }
854}
855
856class BorderModifier extends ModifierWithKey<ArkBorder> {
857  constructor(value: ArkBorder) {
858    super(value);
859  }
860  static identity: Symbol = Symbol('border');
861  applyPeer(node: KNode, reset: boolean): void {
862    if (reset) {
863      getUINativeModule().common.resetBorder(node);
864    } else {
865      getUINativeModule().common.setBorder(node,
866        this.value.arkWidth.left, this.value.arkWidth.right, this.value.arkWidth.top, this.value.arkWidth.bottom,
867        this.value.arkColor.leftColor, this.value.arkColor.rightColor, this.value.arkColor.topColor, this.value.arkColor.bottomColor,
868        this.value.arkRadius.topLeft, this.value.arkRadius.topRight, this.value.arkRadius.bottomLeft, this.value.arkRadius.bottomRight,
869        this.value.arkStyle.top, this.value.arkStyle.right, this.value.arkStyle.bottom, this.value.arkStyle.left);
870    }
871  }
872
873  checkObjectDiff(): boolean {
874    return this.value.checkObjectDiff(this.stageValue);
875  }
876}
877
878class OutlineColorModifier extends ModifierWithKey<ResourceColor | EdgeColors> {
879  constructor(value: ResourceColor | EdgeColors) {
880    super(value);
881  }
882  static identity: Symbol = Symbol('outlineColor');
883  applyPeer(node: KNode, reset: boolean): void {
884    if (reset) {
885      getUINativeModule().common.resetOutlineColor(node);
886    } else {
887      const valueType: string = typeof this.value;
888      if (valueType === 'number' || valueType === 'string' || isResource(this.value)) {
889        getUINativeModule().common.setOutlineColor(node, this.value, this.value, this.value, this.value);
890      } else {
891        getUINativeModule().common.setOutlineColor(node, (this.value as EdgeColors).left,
892          (this.value as EdgeColors).right, (this.value as EdgeColors).top,
893          (this.value as EdgeColors).bottom);
894      }
895    }
896  }
897
898  checkObjectDiff(): boolean {
899    if (isResource(this.stageValue) && isResource(this.value)) {
900      return !isResourceEqual(this.stageValue, this.value);
901    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
902      return !((this.stageValue as EdgeColors).left === (this.value as EdgeColors).left &&
903        (this.stageValue as EdgeColors).right === (this.value as EdgeColors).right &&
904        (this.stageValue as EdgeColors).top === (this.value as EdgeColors).top &&
905        (this.stageValue as EdgeColors).bottom === (this.value as EdgeColors).bottom);
906    } else {
907      return true;
908    }
909  }
910}
911
912class OutlineRadiusModifier extends ModifierWithKey<Dimension | OutlineRadiuses> {
913  constructor(value: Dimension | OutlineRadiuses) {
914    super(value);
915  }
916  static identity: Symbol = Symbol('outlineRadius');
917  applyPeer(node: KNode, reset: boolean): void {
918    if (reset) {
919      getUINativeModule().common.resetOutlineRadius(node);
920    } else {
921      const valueType: string = typeof this.value;
922      if (valueType === 'number' || valueType === 'string' || isResource(this.value)) {
923        getUINativeModule().common.setOutlineRadius(node, this.value, this.value, this.value, this.value);
924      } else {
925        getUINativeModule().common.setOutlineRadius(node, (this.value as OutlineRadiuses).topLeft,
926          (this.value as OutlineRadiuses).topRight, (this.value as OutlineRadiuses).bottomLeft,
927          (this.value as OutlineRadiuses).bottomRight);
928      }
929    }
930  }
931  checkObjectDiff(): boolean {
932    if (isResource(this.stageValue) && isResource(this.value)) {
933      return !isResourceEqual(this.stageValue, this.value);
934    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
935      return !((this.stageValue as BorderRadiuses).topLeft === (this.value as BorderRadiuses).topLeft &&
936        (this.stageValue as BorderRadiuses).topRight === (this.value as BorderRadiuses).topRight &&
937        (this.stageValue as BorderRadiuses).bottomLeft === (this.value as BorderRadiuses).bottomLeft &&
938        (this.stageValue as BorderRadiuses).bottomRight === (this.value as BorderRadiuses).bottomRight);
939    } else {
940      return true;
941    }
942  }
943}
944
945class OutlineStyleModifier extends ModifierWithKey<OutlineStyle | EdgeOutlineStyles> {
946  constructor(value: OutlineStyle | EdgeOutlineStyles) {
947    super(value);
948  }
949  static identity: Symbol = Symbol('outlineStyle');
950  applyPeer(node: KNode, reset: boolean): void {
951    if (reset) {
952      getUINativeModule().common.resetOutlineStyle(node);
953    } else {
954      if (isNumber(this.value)) {
955        getUINativeModule().common.setOutlineStyle(node, this.value, this.value, this.value, this.value);
956      } else {
957        getUINativeModule().common.setOutlineStyle(node,
958          (this.value as EdgeOutlineStyles).top,
959          (this.value as EdgeOutlineStyles).right,
960          (this.value as EdgeOutlineStyles).bottom,
961          (this.value as EdgeOutlineStyles).left);
962      }
963    }
964  }
965  checkObjectDiff(): boolean {
966    return !((this.value as EdgeOutlineStyles).top === (this.stageValue as EdgeOutlineStyles).top &&
967      (this.value as EdgeOutlineStyles).right === (this.stageValue as EdgeOutlineStyles).right &&
968      (this.value as EdgeOutlineStyles).bottom === (this.stageValue as EdgeOutlineStyles).bottom &&
969      (this.value as EdgeOutlineStyles).left === (this.stageValue as EdgeOutlineStyles).left);
970  }
971}
972
973class OutlineWidthModifier extends ModifierWithKey<Dimension | EdgeOutlineWidths> {
974  constructor(value: Dimension | EdgeOutlineWidths) {
975    super(value);
976  }
977  static identity: Symbol = Symbol('outlineWidth');
978  applyPeer(node: KNode, reset: boolean): void {
979    if (reset) {
980      getUINativeModule().common.resetOutlineWidth(node);
981    } else {
982      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
983        getUINativeModule().common.setOutlineWidth(node, this.value, this.value, this.value, this.value);
984      } else {
985        getUINativeModule().common.setOutlineWidth(node,
986          (this.value as EdgeOutlineWidths).left,
987          (this.value as EdgeOutlineWidths).right,
988          (this.value as EdgeOutlineWidths).top,
989          (this.value as EdgeOutlineWidths).bottom);
990      }
991    }
992  }
993
994  checkObjectDiff(): boolean {
995    if (isResource(this.stageValue) && isResource(this.value)) {
996      return !isResourceEqual(this.stageValue, this.value);
997    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
998      return !((this.stageValue as EdgeOutlineWidths).left === (this.value as EdgeOutlineWidths).left &&
999        (this.stageValue as EdgeOutlineWidths).right === (this.value as EdgeOutlineWidths).right &&
1000        (this.stageValue as EdgeOutlineWidths).top === (this.value as EdgeOutlineWidths).top &&
1001        (this.stageValue as EdgeOutlineWidths).bottom === (this.value as EdgeOutlineWidths).bottom);
1002    } else {
1003      return true;
1004    }
1005  }
1006}
1007
1008class OutlineModifier extends ModifierWithKey<OutlineOptions> {
1009  constructor(value: OutlineOptions) {
1010    super(value);
1011  }
1012  static identity: Symbol = Symbol('outline');
1013  applyPeer(node: KNode, reset: boolean): void {
1014    if (reset) {
1015      getUINativeModule().common.resetOutline(node);
1016    } else {
1017      let widthLeft;
1018      let widthRight;
1019      let widthTop;
1020      let widthBottom;
1021      if (!isUndefined(this.value.width) && this.value.width != null) {
1022        if (isNumber(this.value.width) || isString(this.value.width) || isResource(this.value.width)) {
1023          widthLeft = this.value.width;
1024          widthRight = this.value.width;
1025          widthTop = this.value.width;
1026          widthBottom = this.value.width;
1027        } else {
1028          widthLeft = (this.value.width as EdgeOutlineWidths).left;
1029          widthRight = (this.value.width as EdgeOutlineWidths).right;
1030          widthTop = (this.value.width as EdgeOutlineWidths).top;
1031          widthBottom = (this.value.width as EdgeOutlineWidths).bottom;
1032        }
1033      }
1034      let leftColor;
1035      let rightColor;
1036      let topColor;
1037      let bottomColor;
1038      if (!isUndefined(this.value.color) && this.value.color != null) {
1039        if (isNumber(this.value.color) || isString(this.value.color) || isResource(this.value.color)) {
1040          leftColor = this.value.color;
1041          rightColor = this.value.color;
1042          topColor = this.value.color;
1043          bottomColor = this.value.color;
1044        } else {
1045          leftColor = (this.value.color as EdgeColors).left;
1046          rightColor = (this.value.color as EdgeColors).right;
1047          topColor = (this.value.color as EdgeColors).top;
1048          bottomColor = (this.value.color as EdgeColors).bottom;
1049        }
1050      }
1051      let topLeft;
1052      let topRight;
1053      let bottomLeft;
1054      let bottomRight;
1055      if (!isUndefined(this.value.radius) && this.value.radius != null) {
1056        if (isNumber(this.value.radius) || isString(this.value.radius) || isResource(this.value.radius)) {
1057          topLeft = this.value.radius;
1058          topRight = this.value.radius;
1059          bottomLeft = this.value.radius;
1060          bottomRight = this.value.radius;
1061        } else {
1062          topLeft = (this.value.radius as OutlineRadiuses).topLeft;
1063          topRight = (this.value.radius as OutlineRadiuses).topRight;
1064          bottomLeft = (this.value.radius as OutlineRadiuses).bottomLeft;
1065          bottomRight = (this.value.radius as OutlineRadiuses).bottomRight;
1066        }
1067      }
1068      let styleTop;
1069      let styleRight;
1070      let styleBottom;
1071      let styleLeft;
1072      if (!isUndefined(this.value.style) && this.value.style != null) {
1073        if (isNumber(this.value.style) || isString(this.value.style) || isResource(this.value.style)) {
1074          styleTop = this.value.style;
1075          styleRight = this.value.style;
1076          styleBottom = this.value.style;
1077          styleLeft = this.value.style;
1078        } else {
1079          styleTop = (this.value.style as EdgeOutlineStyles).top;
1080          styleRight = (this.value.style as EdgeOutlineStyles).right;
1081          styleBottom = (this.value.style as EdgeOutlineStyles).bottom;
1082          styleLeft = (this.value.style as EdgeOutlineStyles).left;
1083        }
1084      }
1085      getUINativeModule().common.setOutline(node, widthLeft, widthRight, widthTop, widthBottom,
1086        leftColor, rightColor, topColor, bottomColor,
1087        topLeft, topRight, bottomLeft, bottomRight,
1088        styleTop, styleRight, styleBottom, styleLeft);
1089    }
1090  }
1091
1092  checkObjectDiff(): boolean {
1093    return !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
1094      !isBaseOrResourceEqual(this.stageValue.color, this.value.color) ||
1095      !isBaseOrResourceEqual(this.stageValue.radius, this.value.radius) ||
1096      !isBaseOrResourceEqual(this.stageValue.style, this.value.style);
1097  }
1098}
1099
1100class ForegroundBlurStyleModifier extends ModifierWithKey<ArkForegroundBlurStyle> {
1101  constructor(value: ArkForegroundBlurStyle) {
1102    super(value);
1103  }
1104  static identity: Symbol = Symbol('foregroundBlurStyle');
1105  applyPeer(node: KNode, reset: boolean): void {
1106    if (reset) {
1107      getUINativeModule().common.resetForegroundBlurStyle(node);
1108    } else {
1109      getUINativeModule().common.setForegroundBlurStyle(node,
1110        this.value.blurStyle, this.value.colorMode, this.value.adaptiveColor, this.value.scale);
1111    }
1112  }
1113
1114  checkObjectDiff(): boolean {
1115    return !((this.stageValue as ArkForegroundBlurStyle).blurStyle === (this.value as ArkForegroundBlurStyle).blurStyle &&
1116      (this.stageValue as ArkForegroundBlurStyle).colorMode === (this.value as ArkForegroundBlurStyle).colorMode &&
1117      (this.stageValue as ArkForegroundBlurStyle).adaptiveColor === (this.value as ArkForegroundBlurStyle).adaptiveColor &&
1118      (this.stageValue as ArkForegroundBlurStyle).scale === (this.value as ArkForegroundBlurStyle).scale);
1119  }
1120}
1121
1122class BackgroundImagePositionModifier extends ModifierWithKey<Position | Alignment> {
1123  constructor(value: Position | Alignment) {
1124    super(value);
1125  }
1126  static identity: Symbol = Symbol('backgroundImagePosition');
1127  applyPeer(node: KNode, reset: boolean): void {
1128    if (reset) {
1129      getUINativeModule().common.resetBackgroundImagePosition(node);
1130    } else {
1131      if (isNumber(this.value)) {
1132        getUINativeModule().common.setBackgroundImagePosition(node, this.value, undefined, undefined);
1133      } else {
1134        getUINativeModule().common.setBackgroundImagePosition(node, undefined, (this.value as Position)?.x, (this.value as Position)?.y);
1135      }
1136    }
1137  }
1138  checkObjectDiff(): boolean {
1139    return !((this.value as Position)?.x === (this.stageValue as Position)?.x &&
1140      (this.value as Position)?.y === (this.stageValue as Position)?.y);
1141  }
1142}
1143
1144class LinearGradientBlurModifier extends ModifierWithKey<ArkLinearGradientBlur> {
1145  constructor(value: ArkLinearGradientBlur) {
1146    super(value);
1147  }
1148  static identity: Symbol = Symbol('linearGradientBlur');
1149  applyPeer(node: KNode, reset: boolean): void {
1150    if (reset) {
1151      getUINativeModule().common.resetLinearGradientBlur(node);
1152    } else {
1153      getUINativeModule().common.setLinearGradientBlur(node,
1154        this.value.blurRadius, this.value.fractionStops, this.value.direction);
1155    }
1156  }
1157  checkObjectDiff(): boolean {
1158    return !this.value.isEqual(this.stageValue);
1159  }
1160}
1161
1162class BackgroundImageModifier extends ModifierWithKey<ArkBackgroundImage> {
1163  constructor(value: ArkBackgroundImage) {
1164    super(value);
1165  }
1166  static identity: Symbol = Symbol('backgroundImage');
1167  applyPeer(node: KNode, reset: boolean): void {
1168    if (reset) {
1169      getUINativeModule().common.resetBackgroundImage(node);
1170    } else {
1171      getUINativeModule().common.setBackgroundImage(node, this.value.src, this.value.repeat);
1172    }
1173  }
1174  checkObjectDiff(): boolean {
1175    return !((this.stageValue as ArkBackgroundImage).src === (this.value as ArkBackgroundImage).src &&
1176      (this.stageValue as ArkBackgroundImage).repeat === (this.value as ArkBackgroundImage).repeat);
1177  }
1178}
1179
1180class BackgroundBlurStyleModifier extends ModifierWithKey<ArkBackgroundBlurStyle> {
1181  constructor(value: ArkBackgroundBlurStyle) {
1182    super(value);
1183  }
1184  static identity: Symbol = Symbol('backgroundBlurStyle');
1185  applyPeer(node: KNode, reset: boolean): void {
1186    if (reset) {
1187      getUINativeModule().common.resetBackgroundBlurStyle(node);
1188    } else {
1189      getUINativeModule().common.setBackgroundBlurStyle(node,
1190        this.value.blurStyle, this.value.colorMode, this.value.adaptiveColor, this.value.scale);
1191    }
1192  }
1193}
1194
1195class BackgroundImageSizeModifier extends ModifierWithKey<SizeOptions | ImageSize> {
1196  constructor(value: SizeOptions | ImageSize) {
1197    super(value);
1198  }
1199  static identity: Symbol = Symbol('backgroundImageSize');
1200  applyPeer(node: KNode, reset: boolean): void {
1201    if (reset) {
1202      getUINativeModule().common.resetBackgroundImageSize(node);
1203    } else {
1204      if (isNumber(this.value)) {
1205        getUINativeModule().common.setBackgroundImageSize(node, this.value, undefined, undefined);
1206      } else {
1207        getUINativeModule().common.setBackgroundImageSize(node, undefined, (this.value as SizeOptions)?.width, (this.value as SizeOptions)?.height);
1208      }
1209    }
1210  }
1211  checkObjectDiff(): boolean {
1212    return !((this.value as SizeOptions).width === (this.stageValue as SizeOptions).width &&
1213      (this.value as SizeOptions).height === (this.stageValue as SizeOptions).height);
1214  }
1215}
1216
1217class TranslateModifier extends ModifierWithKey<TranslateOptions> {
1218  constructor(value: TranslateOptions) {
1219    super(value);
1220  }
1221  static identity: Symbol = Symbol('translate');
1222  applyPeer(node: KNode, reset: boolean): void {
1223    if (reset) {
1224      getUINativeModule().common.resetTranslate(node);
1225    } else {
1226      getUINativeModule().common.setTranslate(node, this.value.x, this.value.y, this.value.z);
1227    }
1228  }
1229  checkObjectDiff(): boolean {
1230    return !(this.value.x === this.stageValue.x &&
1231      this.value.y === this.stageValue.y &&
1232      this.value.z === this.stageValue.z);
1233  }
1234}
1235
1236class ScaleModifier extends ModifierWithKey<ScaleOptions> {
1237  constructor(value: ScaleOptions) {
1238    super(value);
1239  }
1240  static identity: Symbol = Symbol('scale');
1241  applyPeer(node: KNode, reset: boolean): void {
1242    if (reset) {
1243      getUINativeModule().common.resetScale(node);
1244    } else {
1245      getUINativeModule().common.setScale(node, this.value.x, this.value.y, this.value.z, this.value.centerX, this.value.centerY);
1246    }
1247  }
1248  checkObjectDiff(): boolean {
1249    return !(
1250      this.value.x === this.stageValue.x &&
1251      this.value.y === this.stageValue.y &&
1252      this.value.z === this.stageValue.z &&
1253      this.value.centerX === this.stageValue.centerX &&
1254      this.value.centerY === this.stageValue.centerY
1255    );
1256  }
1257}
1258
1259class RotateModifier extends ModifierWithKey<RotateOptions> {
1260  constructor(value: RotateOptions) {
1261    super(value);
1262  }
1263  static identity: Symbol = Symbol('rotate');
1264  applyPeer(node: KNode, reset: boolean): void {
1265    if (reset) {
1266      getUINativeModule().common.resetRotate(node);
1267    } else {
1268      getUINativeModule().common.setRotate(node, this.value.x, this.value.y, this.value.z, this.value.angle,
1269        this.value.centerX, this.value.centerY, this.value.centerY, this.value.perspective);
1270    }
1271  }
1272  checkObjectDiff(): boolean {
1273    return !(
1274      this.value.x === this.stageValue.x &&
1275      this.value.y === this.stageValue.y &&
1276      this.value.z === this.stageValue.z &&
1277      this.value.angle === this.stageValue.angle &&
1278      this.value.centerX === this.stageValue.centerX &&
1279      this.value.centerY === this.stageValue.centerY &&
1280      this.value.centerZ === this.stageValue.centerZ &&
1281      this.value.perspective === this.stageValue.perspective
1282    );
1283  }
1284}
1285
1286class GeometryTransitionModifier extends ModifierWithKey<string> {
1287  constructor(value: string) {
1288    super(value);
1289  }
1290  static identity: Symbol = Symbol('geometryTransition');
1291  applyPeer(node: KNode, reset: boolean): void {
1292    if (reset) {
1293      getUINativeModule().common.resetGeometryTransition(node);
1294    } else {
1295      getUINativeModule().common.setGeometryTransition(node, this.value);
1296    }
1297  }
1298}
1299
1300class BlendModeModifier extends ModifierWithKey<ArkBlendMode> {
1301  constructor(value: ArkBlendMode) {
1302    super(value);
1303  }
1304  static identity: Symbol = Symbol('blendMode');
1305  applyPeer(node: KNode, reset: boolean): void {
1306    if (reset) {
1307      getUINativeModule().common.resetBlendMode(node);
1308    } else {
1309      getUINativeModule().common.setBlendMode(node, this.value.blendMode, this.value.blendApplyType);
1310    }
1311  }
1312}
1313
1314class ClipModifier extends ModifierWithKey<boolean | object> {
1315  constructor(value: boolean | object) {
1316    super(value);
1317  }
1318  static identity: Symbol = Symbol('clip');
1319  applyPeer(node: KNode, reset: boolean): void {
1320    if (reset) {
1321      getUINativeModule().common.resetClip(node);
1322    } else {
1323      getUINativeModule().common.setClip(node, this.value);
1324    }
1325  }
1326
1327  checkObjectDiff(): boolean {
1328    return true;
1329  }
1330}
1331
1332class MaskModifier extends ModifierWithKey<boolean | object> {
1333  constructor(value: boolean | object) {
1334    super(value);
1335  }
1336  static identity: Symbol = Symbol('mask');
1337  applyPeer(node: KNode, reset: boolean): void {
1338    if (reset) {
1339      getUINativeModule().common.resetMask(node);
1340    } else {
1341      getUINativeModule().common.setMask(node, this.value);
1342    }
1343  }
1344
1345  checkObjectDiff(): boolean {
1346    return true;
1347  }
1348}
1349
1350class PixelStretchEffectModifier extends ModifierWithKey<PixelStretchEffectOptions> {
1351  constructor(value: PixelStretchEffectOptions) {
1352    super(value);
1353  }
1354  static identity: Symbol = Symbol('pixelStretchEffect');
1355  applyPeer(node: KNode, reset: boolean): void {
1356    if (reset) {
1357      getUINativeModule().common.resetPixelStretchEffect(node);
1358    } else {
1359      getUINativeModule().common.setPixelStretchEffect(node,
1360        this.value.top, this.value.right, this.value.bottom, this.value.left);
1361    }
1362  }
1363
1364  checkObjectDiff(): boolean {
1365    return !((this.stageValue as PixelStretchEffectOptions).left === (this.value as PixelStretchEffectOptions).left &&
1366      (this.stageValue as PixelStretchEffectOptions).right === (this.value as PixelStretchEffectOptions).right &&
1367      (this.stageValue as PixelStretchEffectOptions).top === (this.value as PixelStretchEffectOptions).top &&
1368      (this.stageValue as PixelStretchEffectOptions).bottom === (this.value as PixelStretchEffectOptions).bottom);
1369  }
1370}
1371
1372class LightUpEffectModifier extends ModifierWithKey<number> {
1373  constructor(value: number) {
1374    super(value);
1375  }
1376  static identity: Symbol = Symbol('lightUpEffect');
1377  applyPeer(node: KNode, reset: boolean): void {
1378    if (reset) {
1379      getUINativeModule().common.resetLightUpEffect(node);
1380    } else {
1381      getUINativeModule().common.setLightUpEffect(node, this.value);
1382    }
1383  }
1384}
1385
1386class SphericalEffectModifier extends ModifierWithKey<number> {
1387  constructor(value: number) {
1388    super(value);
1389  }
1390  static identity: Symbol = Symbol('sphericalEffect');
1391  applyPeer(node: KNode, reset: boolean): void {
1392    if (reset) {
1393      getUINativeModule().common.resetSphericalEffect(node);
1394    } else {
1395      getUINativeModule().common.setSphericalEffect(node, this.value);
1396    }
1397  }
1398}
1399
1400class RenderGroupModifier extends ModifierWithKey<boolean> {
1401  constructor(value: boolean) {
1402    super(value);
1403  }
1404  static identity: Symbol = Symbol('renderGroup');
1405  applyPeer(node: KNode, reset: boolean): void {
1406    if (reset) {
1407      getUINativeModule().common.resetRenderGroup(node);
1408    } else {
1409      getUINativeModule().common.setRenderGroup(node, this.value);
1410    }
1411  }
1412}
1413
1414class RenderFitModifier extends ModifierWithKey<number> {
1415  constructor(value: number) {
1416    super(value);
1417  }
1418  static identity: Symbol = Symbol('renderFit');
1419  applyPeer(node: KNode, reset: boolean): void {
1420    if (reset) {
1421      getUINativeModule().common.resetRenderFit(node);
1422    } else {
1423      getUINativeModule().common.setRenderFit(node, this.value);
1424    }
1425  }
1426}
1427
1428class UseEffectModifier extends ModifierWithKey<boolean> {
1429  constructor(value: boolean) {
1430    super(value);
1431  }
1432  static identity: Symbol = Symbol('useEffect');
1433  applyPeer(node: KNode, reset: boolean): void {
1434    if (reset) {
1435      getUINativeModule().common.resetUseEffect(node);
1436    } else {
1437      getUINativeModule().common.setUseEffect(node, this.value);
1438    }
1439  }
1440}
1441
1442class ForegroundColorModifier extends ModifierWithKey<ResourceColor | ColoringStrategy> {
1443  constructor(value: ResourceColor | ColoringStrategy) {
1444    super(value);
1445  }
1446  static identity: Symbol = Symbol('foregroundColor');
1447  applyPeer(node: KNode, reset: boolean): void {
1448    if (reset) {
1449      getUINativeModule().common.resetForegroundColor(node);
1450    } else {
1451      getUINativeModule().common.setForegroundColor(node, this.value);
1452    }
1453  }
1454
1455  checkObjectDiff(): boolean {
1456    return !isBaseOrResourceEqual(this.stageValue, this.value);
1457  }
1458}
1459
1460class MotionPathModifier extends ModifierWithKey<MotionPathOptions> {
1461  constructor(value: MotionPathOptions) {
1462    super(value);
1463  }
1464  static identity: Symbol = Symbol('motionPath');
1465  applyPeer(node: KNode, reset: boolean): void {
1466    if (reset) {
1467      getUINativeModule().common.resetMotionPath(node);
1468    } else {
1469      let path: string;
1470      let rotatable: boolean;
1471      let from: number;
1472      let to: number;
1473      if (isString(this.value.path)) {
1474        path = this.value.path;
1475      }
1476      if (isBoolean(this.value.rotatable)) {
1477        rotatable = this.value.rotatable;
1478      }
1479      if (isNumber(this.value.from) && isNumber(this.value.to)) {
1480        from = this.value.from;
1481        to = this.value.to;
1482      }
1483      getUINativeModule().common.setMotionPath(node, path, from, to, rotatable);
1484    }
1485  }
1486  checkObjectDiff(): boolean {
1487    return !(this.value.path === this.stageValue.path &&
1488      this.value.from === this.stageValue.from &&
1489      this.value.to === this.stageValue.to &&
1490      this.value.rotatable === this.stageValue.rotatable);
1491  }
1492}
1493
1494class GroupDefaultFocusModifier extends ModifierWithKey<boolean> {
1495  constructor(value: boolean) {
1496    super(value);
1497  }
1498  static identity: Symbol = Symbol('groupDefaultFocus');
1499  applyPeer(node: KNode, reset: boolean): void {
1500    if (reset) {
1501      getUINativeModule().common.resetGroupDefaultFocus(node);
1502    } else {
1503      getUINativeModule().common.setGroupDefaultFocus(node, this.value);
1504    }
1505  }
1506}
1507
1508class FocusOnTouchModifier extends ModifierWithKey<boolean> {
1509  constructor(value: boolean) {
1510    super(value);
1511  }
1512  static identity: Symbol = Symbol('focusOnTouch');
1513  applyPeer(node: KNode, reset: boolean): void {
1514    if (reset) {
1515      getUINativeModule().common.resetFocusOnTouch(node);
1516    } else {
1517      getUINativeModule().common.setFocusOnTouch(node, this.value);
1518    }
1519  }
1520}
1521class OffsetModifier extends ModifierWithKey<Position> {
1522  constructor(value: Position) {
1523    super(value);
1524  }
1525  static identity: Symbol = Symbol('offset');
1526  applyPeer(node: KNode, reset: boolean): void {
1527    if (reset) {
1528      getUINativeModule().common.resetOffset(node);
1529    } else {
1530      getUINativeModule().common.setOffset(node, this.value?.x, this.value?.y);
1531    }
1532  }
1533
1534  checkObjectDiff(): boolean {
1535    return !isBaseOrResourceEqual(this.stageValue.x, this.value.x) ||
1536      !isBaseOrResourceEqual(this.stageValue.y, this.value.y);
1537  }
1538}
1539
1540class MarkAnchorModifier extends ModifierWithKey<Position> {
1541  constructor(value: Position) {
1542    super(value);
1543  }
1544  static identity: Symbol = Symbol('markAnchor');
1545  applyPeer(node: KNode, reset: boolean): void {
1546    if (reset) {
1547      getUINativeModule().common.resetMarkAnchor(node);
1548    } else {
1549      getUINativeModule().common.setMarkAnchor(node, this.value?.x, this.value?.y);
1550    }
1551  }
1552
1553  checkObjectDiff(): boolean {
1554    return !isBaseOrResourceEqual(this.stageValue.x, this.value.x) ||
1555      !isBaseOrResourceEqual(this.stageValue.y, this.value.y);
1556  }
1557}
1558class DefaultFocusModifier extends ModifierWithKey<boolean> {
1559  constructor(value: boolean) {
1560    super(value);
1561  }
1562  static identity: Symbol = Symbol('defaultFocus');
1563  applyPeer(node: KNode, reset: boolean): void {
1564    if (reset) {
1565      getUINativeModule().common.resetDefaultFocus(node);
1566    } else {
1567      getUINativeModule().common.setDefaultFocus(node, this.value);
1568    }
1569  }
1570}
1571
1572class FocusableModifier extends ModifierWithKey<boolean> {
1573  constructor(value: boolean) {
1574    super(value);
1575  }
1576  static identity: Symbol = Symbol('focusable');
1577  applyPeer(node: KNode, reset: boolean): void {
1578    if (reset) {
1579      getUINativeModule().common.resetFocusable(node);
1580    } else {
1581      getUINativeModule().common.setFocusable(node, this.value);
1582    }
1583  }
1584}
1585
1586class TouchableModifier extends ModifierWithKey<boolean> {
1587  constructor(value: boolean) {
1588    super(value);
1589  }
1590  static identity: Symbol = Symbol('touchable');
1591  applyPeer(node: KNode, reset: boolean): void {
1592    if (reset) {
1593      getUINativeModule().common.resetTouchable(node);
1594    } else {
1595      getUINativeModule().common.setTouchable(node, this.value);
1596    }
1597  }
1598}
1599
1600class MarginModifier extends ModifierWithKey<ArkPadding> {
1601  constructor(value: ArkPadding) {
1602    super(value);
1603  }
1604  static identity: Symbol = Symbol('margin');
1605  applyPeer(node: KNode, reset: boolean): void {
1606    if (reset) {
1607      getUINativeModule().common.resetMargin(node);
1608    } else {
1609      getUINativeModule().common.setMargin(node, this.value.top,
1610        this.value.right, this.value.bottom, this.value.left);
1611    }
1612  }
1613
1614  checkObjectDiff(): boolean {
1615    return !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
1616      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
1617      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
1618      !isBaseOrResourceEqual(this.stageValue.left, this.value.left);
1619  }
1620}
1621
1622class PaddingModifier extends ModifierWithKey<ArkPadding> {
1623  constructor(value: ArkPadding) {
1624    super(value);
1625  }
1626  static identity: Symbol = Symbol('padding');
1627  applyPeer(node: KNode, reset: boolean): void {
1628    if (reset) {
1629      getUINativeModule().common.resetPadding(node);
1630    } else {
1631      getUINativeModule().common.setPadding(node, this.value.top,
1632        this.value.right, this.value.bottom, this.value.left);
1633    }
1634  }
1635
1636  checkObjectDiff(): boolean {
1637    return !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
1638      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
1639      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
1640      !isBaseOrResourceEqual(this.stageValue.left, this.value.left);
1641  }
1642}
1643
1644class VisibilityModifier extends ModifierWithKey<number> {
1645  constructor(value: number) {
1646    super(value);
1647  }
1648  static identity: Symbol = Symbol('visibility');
1649  applyPeer(node: KNode, reset: boolean): void {
1650    if (reset) {
1651      getUINativeModule().common.resetVisibility(node);
1652    } else {
1653      getUINativeModule().common.setVisibility(node, this.value!);
1654    }
1655  }
1656  checkObjectDiff(): boolean {
1657    return this.stageValue !== this.value;
1658  }
1659}
1660
1661class AccessibilityTextModifier extends ModifierWithKey<string> {
1662  constructor(value: string) {
1663    super(value);
1664  }
1665  static identity: Symbol = Symbol('accessibilityText');
1666  applyPeer(node: KNode, reset: boolean): void {
1667    if (reset) {
1668      getUINativeModule().common.resetAccessibilityText(node);
1669    } else {
1670      getUINativeModule().common.setAccessibilityText(node, this.value);
1671    }
1672  }
1673}
1674
1675class AllowDropModifier extends ModifierWithKey<Array<UniformDataType>> {
1676  constructor(value: Array<UniformDataType>) {
1677    super(value);
1678  }
1679  static identity: Symbol = Symbol('allowDrop');
1680  applyPeer(node: KNode, reset: boolean): void {
1681    if (reset) {
1682      getUINativeModule().common.resetAllowDrop(node);
1683    } else {
1684      getUINativeModule().common.setAllowDrop(node, this.value);
1685    }
1686  }
1687  checkObjectDiff(): boolean {
1688    return !(Array.isArray(this.value) && Array.isArray(this.stageValue) &&
1689      this.value.length === this.stageValue.length &&
1690      this.value.every((value, index) => value === this.stageValue[index]));
1691  }
1692}
1693
1694class AccessibilityLevelModifier extends ModifierWithKey<string> {
1695  constructor(value: string) {
1696    super(value);
1697  }
1698  static identity: Symbol = Symbol('accessibilityLevel');
1699  applyPeer(node: KNode, reset: boolean): void {
1700    if (reset) {
1701      getUINativeModule().common.resetAccessibilityLevel(node);
1702    } else {
1703      getUINativeModule().common.setAccessibilityLevel(node, this.value);
1704    }
1705  }
1706}
1707
1708class AccessibilityDescriptionModifier extends ModifierWithKey<string> {
1709  constructor(value: string) {
1710    super(value);
1711  }
1712  static identity: Symbol = Symbol('accessibilityDescription');
1713  applyPeer(node: KNode, reset: boolean): void {
1714    if (reset) {
1715      getUINativeModule().common.resetAccessibilityDescription(node);
1716    } else {
1717      getUINativeModule().common.setAccessibilityDescription(node, this.value);
1718    }
1719  }
1720}
1721
1722class DirectionModifier extends ModifierWithKey<number> {
1723  constructor(value: number) {
1724    super(value);
1725  }
1726  static identity: Symbol = Symbol('direction');
1727  applyPeer(node: KNode, reset: boolean): void {
1728    if (reset) {
1729      getUINativeModule().common.resetDirection(node);
1730    } else {
1731      getUINativeModule().common.setDirection(node, this.value!);
1732    }
1733  }
1734  checkObjectDiff(): boolean {
1735    return !isBaseOrResourceEqual(this.stageValue, this.value);
1736  }
1737}
1738class AlignRulesModifier extends ModifierWithKey<ArkAlignRules> {
1739  constructor(value: ArkAlignRules) {
1740    super(value);
1741  }
1742  static identity: Symbol = Symbol('alignRules');
1743  applyPeer(node: KNode, reset: boolean): void {
1744    if (reset) {
1745      getUINativeModule().common.resetAlignRules(node);
1746    } else {
1747      getUINativeModule().common.setAlignRules(node, this.value.left,
1748        this.value.middle, this.value.right, this.value.top, this.value.center, this.value.bottom);
1749    }
1750  }
1751  checkObjectDiff(): boolean {
1752    return !isBaseOrResourceEqual(this.stageValue.left, this.value.left) ||
1753      !isBaseOrResourceEqual(this.stageValue.middle, this.value.middle) ||
1754      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
1755      !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
1756      !isBaseOrResourceEqual(this.stageValue.center, this.value.center) ||
1757      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom);
1758  }
1759}
1760
1761class ExpandSafeAreaModifier extends ModifierWithKey<ArkSafeAreaExpandOpts | undefined> {
1762  constructor(value: ArkSafeAreaExpandOpts | undefined) {
1763    super(value);
1764  }
1765  static identity: Symbol = Symbol('expandSafeArea');
1766  applyPeer(node: KNode, reset: boolean): void {
1767    if (reset) {
1768      getUINativeModule().common.resetExpandSafeArea(node);
1769    } else {
1770      getUINativeModule().common.setExpandSafeArea(node, this.value.type, this.value.edges);
1771    }
1772  }
1773  checkObjectDiff(): boolean {
1774    return !isBaseOrResourceEqual(this.stageValue.type, this.value.type) ||
1775      !isBaseOrResourceEqual(this.stageValue.edges, this.value.edges);
1776  }
1777}
1778
1779class GridSpanModifier extends ModifierWithKey<number> {
1780  constructor(value: number) {
1781    super(value);
1782  }
1783  static identity: Symbol = Symbol('gridSpan');
1784  applyPeer(node: KNode, reset: boolean): void {
1785    if (reset) {
1786      getUINativeModule().common.resetGridSpan(node);
1787    } else {
1788      getUINativeModule().common.setGridSpan(node, this.value!);
1789    }
1790  }
1791}
1792
1793class GridOffsetModifier extends ModifierWithKey<number> {
1794  constructor(value: number) {
1795    super(value);
1796  }
1797  static identity: Symbol = Symbol('gridOffset');
1798  applyPeer(node: KNode, reset: boolean): void {
1799    if (reset) {
1800      getUINativeModule().common.resetGridOffset(node);
1801    } else {
1802      getUINativeModule().common.setGridOffset(node, this.value!);
1803    }
1804  }
1805}
1806
1807class AlignSelfModifier extends ModifierWithKey<number> {
1808  constructor(value: number) {
1809    super(value);
1810  }
1811  static identity: Symbol = Symbol('alignSelf');
1812  applyPeer(node: KNode, reset: boolean): void {
1813    if (reset) {
1814      getUINativeModule().common.resetAlignSelf(node);
1815    } else {
1816      getUINativeModule().common.setAlignSelf(node, this.value!);
1817    }
1818  }
1819  checkObjectDiff(): boolean {
1820    return !isBaseOrResourceEqual(this.stageValue, this.value);
1821  }
1822}
1823
1824class SizeModifier extends ModifierWithKey<SizeOptions> {
1825  constructor(value: SizeOptions) {
1826    super(value);
1827  }
1828  static identity: Symbol = Symbol('size');
1829  applyPeer(node: KNode, reset: boolean): void {
1830    if (reset) {
1831      getUINativeModule().common.resetSize(node);
1832    } else {
1833      getUINativeModule().common.setSize(node, this.value.width, this.value.height);
1834    }
1835  }
1836
1837  checkObjectDiff(): boolean {
1838    return !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
1839      !isBaseOrResourceEqual(this.stageValue.height, this.value.height);
1840  }
1841}
1842
1843class DisplayPriorityModifier extends ModifierWithKey<number> {
1844  constructor(value: number) {
1845    super(value);
1846  }
1847  static identity: Symbol = Symbol('displayPriority');
1848  applyPeer(node: KNode, reset: boolean): void {
1849    if (reset) {
1850      getUINativeModule().common.resetDisplayPriority(node);
1851    } else {
1852      getUINativeModule().common.setDisplayPriority(node, this.value!);
1853    }
1854  }
1855  checkObjectDiff(): boolean {
1856    return !isBaseOrResourceEqual(this.stageValue, this.value);
1857  }
1858}
1859
1860class IdModifier extends ModifierWithKey<string> {
1861  constructor(value: string) {
1862    super(value);
1863  }
1864  static identity: Symbol = Symbol('id');
1865  applyPeer(node: KNode, reset: boolean): void {
1866    if (reset) {
1867      getUINativeModule().common.resetId(node);
1868    } else {
1869      getUINativeModule().common.setId(node, this.value);
1870    }
1871  }
1872}
1873
1874class KeyModifier extends ModifierWithKey<string> {
1875  constructor(value: string) {
1876    super(value);
1877  }
1878  static identity: Symbol = Symbol('key');
1879  applyPeer(node: KNode, reset: boolean): void {
1880    if (reset) {
1881      getUINativeModule().common.resetKey(node);
1882    } else {
1883      getUINativeModule().common.setKey(node, this.value);
1884    }
1885  }
1886}
1887
1888class RestoreIdModifier extends ModifierWithKey<number> {
1889  constructor(value: number) {
1890    super(value);
1891  }
1892  static identity: Symbol = Symbol('restoreId');
1893  applyPeer(node: KNode, reset: boolean): void {
1894    if (reset) {
1895      getUINativeModule().common.resetRestoreId(node);
1896    } else {
1897      getUINativeModule().common.setRestoreId(node, this.value);
1898    }
1899  }
1900}
1901
1902class TabIndexModifier extends ModifierWithKey<number> {
1903  constructor(value: number) {
1904    super(value);
1905  }
1906  static identity: Symbol = Symbol('tabIndex');
1907  applyPeer(node: KNode, reset: boolean): void {
1908    if (reset) {
1909      getUINativeModule().common.resetTabIndex(node);
1910    } else {
1911      getUINativeModule().common.setTabIndex(node, this.value);
1912    }
1913  }
1914}
1915
1916class ObscuredModifier extends ModifierWithKey<Array<ObscuredReasons>> {
1917  constructor(value: Array<ObscuredReasons>) {
1918    super(value);
1919  }
1920  static identity: Symbol = Symbol('obscured');
1921  applyPeer(node: KNode, reset: boolean): void {
1922    if (reset || (!Array.isArray(this.value))) {
1923      getUINativeModule().common.resetObscured(node);
1924    } else {
1925      getUINativeModule().common.setObscured(node, this.value);
1926    }
1927  }
1928  checkObjectDiff(): boolean {
1929    return !(Array.isArray(this.value) && Array.isArray(this.stageValue) &&
1930      this.value.length === this.stageValue.length &&
1931      this.value.every((value, index) => value === this.stageValue[index]));
1932  }
1933}
1934
1935class BackgroundEffectModifier extends ModifierWithKey<BackgroundEffectOptions> {
1936  constructor(options: BackgroundEffectOptions) {
1937    super(options);
1938  }
1939  static identity: Symbol = Symbol('backgroundEffect');
1940  applyPeer(node: KNode, reset: boolean): void {
1941    if (reset) {
1942      getUINativeModule().common.resetBackgroundEffect(node);
1943    } else {
1944      getUINativeModule().common.setBackgroundEffect(node, this.value.radius, this.value.saturation,
1945        this.value.brightness, this.value.color, this.value.adaptiveColor, this.value.blurOptions?.grayscale);
1946    }
1947  }
1948
1949  checkObjectDiff(): boolean {
1950    return !(this.value.radius === this.stageValue.radius && this.value.saturation === this.stageValue.saturation &&
1951      this.value.brightness === this.stageValue.brightness &&
1952      isBaseOrResourceEqual(this.stageValue.color, this.value.color) &&
1953      this.value.adaptiveColor === this.stageValue.adaptiveColor &&
1954      this.value.blurOptions?.grayscale === this.stageValue.blurOptions?.grayscale);
1955  }
1956}
1957
1958class BackgroundBrightnessModifier extends ModifierWithKey<BackgroundBrightnessOptions> {
1959  constructor(params: BackgroundBrightnessOptions) {
1960    super(params);
1961  }
1962  static identity: Symbol = Symbol('backgroundBrightness');
1963  applyPeer(node: KNode, reset: boolean): void {
1964    if (reset) {
1965      getUINativeModule().common.resetBackgroundBrightness(node);
1966    } else {
1967      getUINativeModule().common.setBackgroundBrightness(node, this.value.rate, this.value.lightUpDegree);
1968    }
1969  }
1970
1971  checkObjectDiff(): boolean {
1972    return !(this.value.rate === this.stageValue.rate && this.value.lightUpDegree === this.stageValue.lightUpDegree);
1973  }
1974}
1975
1976class DragPreviewOptionsModifier extends ModifierWithKey<DragPreviewOptions> {
1977  constructor(value: DragPreviewOptions) {
1978    super(value);
1979  }
1980  static identity: Symbol = Symbol('dragPreviewOptions');
1981  applyPeer(node: KNode, reset: boolean): void {
1982    if (reset) {
1983      getUINativeModule().common.resetDragPreviewOptions(node);
1984    } else {
1985      getUINativeModule().common.setDragPreviewOptions(node, this.value.mode);
1986    }
1987  }
1988
1989  checkObjectDiff(): boolean {
1990    return !(this.value.mode === this.stageValue.mode);
1991  }
1992}
1993
1994class MouseResponseRegionModifier extends ModifierWithKey<Array<Rectangle> | Rectangle> {
1995  constructor(value: Array<Rectangle> | Rectangle) {
1996    super(value);
1997  }
1998  static identity = Symbol('mouseResponseRegion');
1999  applyPeer(node: KNode, reset: boolean): void {
2000    if (reset) {
2001      getUINativeModule().common.resetMouseResponseRegion(node);
2002    } else {
2003      let responseRegion: (number | string | Resource)[] = [];
2004      if (Array.isArray(this.value)) {
2005        for (let i = 0; i < this.value.length; i++) {
2006          responseRegion.push(this.value[i].x ?? 'PLACEHOLDER');
2007          responseRegion.push(this.value[i].y ?? 'PLACEHOLDER');
2008          responseRegion.push(this.value[i].width ?? 'PLACEHOLDER');
2009          responseRegion.push(this.value[i].height ?? 'PLACEHOLDER');
2010        }
2011      } else {
2012        responseRegion.push(this.value.x ?? 'PLACEHOLDER');
2013        responseRegion.push(this.value.y ?? 'PLACEHOLDER');
2014        responseRegion.push(this.value.width ?? 'PLACEHOLDER');
2015        responseRegion.push(this.value.height ?? 'PLACEHOLDER');
2016      }
2017      getUINativeModule().common.setMouseResponseRegion(node, responseRegion, responseRegion.length);
2018    }
2019  }
2020
2021  checkObjectDiff(): boolean {
2022    if (Array.isArray(this.value) && Array.isArray(this.stageValue)) {
2023      if (this.value.length !== this.stageValue.length) {
2024        return true;
2025      } else {
2026        for (let i = 0; i < this.value.length; i++) {
2027          if (!(isBaseOrResourceEqual(this.stageValue[i].x, this.value[i].x) &&
2028            isBaseOrResourceEqual(this.stageValue[i].y, this.value[i].y) &&
2029            isBaseOrResourceEqual(this.stageValue[i].width, this.value[i].width) &&
2030            isBaseOrResourceEqual(this.stageValue[i].height, this.value[i].height)
2031          )) {
2032            return true;
2033          }
2034        }
2035        return false;
2036      }
2037    } else if (!Array.isArray(this.value) && !Array.isArray(this.stageValue)) {
2038      return (!(isBaseOrResourceEqual(this.stageValue.x, this.value.x) &&
2039        isBaseOrResourceEqual(this.stageValue.y, this.value.y) &&
2040        isBaseOrResourceEqual(this.stageValue.width, this.value.width) &&
2041        isBaseOrResourceEqual(this.stageValue.height, this.value.height)
2042      ));
2043    } else {
2044      return false;
2045    }
2046  }
2047}
2048
2049class ResponseRegionModifier extends ModifierWithKey<Array<Rectangle> | Rectangle> {
2050  constructor(value: Array<Rectangle> | Rectangle) {
2051    super(value);
2052  }
2053  static identity = Symbol('responseRegion');
2054  applyPeer(node: KNode, reset: boolean): void {
2055    if (reset) {
2056      getUINativeModule().common.resetResponseRegion(node);
2057    } else {
2058      let responseRegion: (number | string | Resource)[] = [];
2059      if (Array.isArray(this.value)) {
2060        for (let i = 0; i < this.value.length; i++) {
2061          responseRegion.push(this.value[i].x ?? 'PLACEHOLDER');
2062          responseRegion.push(this.value[i].y ?? 'PLACEHOLDER');
2063          responseRegion.push(this.value[i].width ?? 'PLACEHOLDER');
2064          responseRegion.push(this.value[i].height ?? 'PLACEHOLDER');
2065        }
2066      } else {
2067        responseRegion.push(this.value.x ?? 'PLACEHOLDER');
2068        responseRegion.push(this.value.y ?? 'PLACEHOLDER');
2069        responseRegion.push(this.value.width ?? 'PLACEHOLDER');
2070        responseRegion.push(this.value.height ?? 'PLACEHOLDER');
2071      }
2072      getUINativeModule().common.setResponseRegion(node, responseRegion, responseRegion.length);
2073    }
2074  }
2075
2076  checkObjectDiff(): boolean {
2077    if (Array.isArray(this.value) && Array.isArray(this.stageValue)) {
2078      if (this.value.length !== this.stageValue.length) {
2079        return true;
2080      } else {
2081        for (let i = 0; i < this.value.length; i++) {
2082          if (!(isBaseOrResourceEqual(this.stageValue[i].x, this.value[i].x) &&
2083            isBaseOrResourceEqual(this.stageValue[i].y, this.value[i].y) &&
2084            isBaseOrResourceEqual(this.stageValue[i].width, this.value[i].width) &&
2085            isBaseOrResourceEqual(this.stageValue[i].height, this.value[i].height)
2086          )) {
2087            return true;
2088          }
2089        }
2090        return false;
2091      }
2092    } else if (!Array.isArray(this.value) && !Array.isArray(this.stageValue)) {
2093      return (!(isBaseOrResourceEqual(this.stageValue.x, this.value.x) &&
2094        isBaseOrResourceEqual(this.stageValue.y, this.value.y) &&
2095        isBaseOrResourceEqual(this.stageValue.width, this.value.width) &&
2096        isBaseOrResourceEqual(this.stageValue.height, this.value.height)
2097      ));
2098    } else {
2099      return false;
2100    }
2101  }
2102}
2103class FlexGrowModifier extends ModifierWithKey<number> {
2104  constructor(value: number) {
2105    super(value);
2106  }
2107  static identity: Symbol = Symbol('flexGrow');
2108  applyPeer(node: KNode, reset: boolean): void {
2109    if (reset) {
2110      getUINativeModule().common.resetFlexGrow(node);
2111    } else {
2112      getUINativeModule().common.setFlexGrow(node, this.value!);
2113    }
2114  }
2115  checkObjectDiff(): boolean {
2116    return this.stageValue !== this.value;
2117  }
2118}
2119
2120class FlexShrinkModifier extends ModifierWithKey<number> {
2121  constructor(value: number) {
2122    super(value);
2123  }
2124  static identity: Symbol = Symbol('flexShrink');
2125  applyPeer(node: KNode, reset: boolean): void {
2126    if (reset) {
2127      getUINativeModule().common.resetFlexShrink(node);
2128    } else {
2129      getUINativeModule().common.setFlexShrink(node, this.value!);
2130    }
2131  }
2132  checkObjectDiff(): boolean {
2133    return this.stageValue !== this.value;
2134  }
2135}
2136
2137class AspectRatioModifier extends ModifierWithKey<number> {
2138  constructor(value: number) {
2139    super(value);
2140  }
2141  static identity: Symbol = Symbol('aspectRatio');
2142  applyPeer(node: KNode, reset: boolean): void {
2143    if (reset) {
2144      getUINativeModule().common.resetAspectRatio(node);
2145    } else {
2146      getUINativeModule().common.setAspectRatio(node, this.value!);
2147    }
2148  }
2149  checkObjectDiff(): boolean {
2150    return this.stageValue !== this.value;
2151  }
2152}
2153
2154class ConstraintSizeModifier extends ModifierWithKey<ConstraintSizeOptions> {
2155  constructor(value: ConstraintSizeOptions) {
2156    super(value);
2157  }
2158  static identity: Symbol = Symbol('constraintSize');
2159  applyPeer(node: KNode, reset: boolean): void {
2160    if (reset) {
2161      getUINativeModule().common.resetConstraintSize(node);
2162    } else {
2163      getUINativeModule().common.setConstraintSize(node, this.value.minWidth,
2164        this.value.maxWidth, this.value.minHeight, this.value.maxHeight);
2165    }
2166  }
2167
2168  checkObjectDiff(): boolean {
2169    return !isBaseOrResourceEqual(this.stageValue.minWidth, this.value.minWidth) ||
2170      !isBaseOrResourceEqual(this.stageValue.maxWidth, this.value.maxWidth) ||
2171      !isBaseOrResourceEqual(this.stageValue.minHeight, this.value.minHeight) ||
2172      !isBaseOrResourceEqual(this.stageValue.maxHeight, this.value.maxHeight);
2173  }
2174}
2175
2176class FlexBasisModifier extends ModifierWithKey<number | string> {
2177  constructor(value: number | string) {
2178    super(value);
2179  }
2180  static identity: Symbol = Symbol('flexBasis');
2181  applyPeer(node: KNode, reset: boolean): void {
2182    if (reset) {
2183      getUINativeModule().common.resetFlexBasis(node);
2184    } else {
2185      getUINativeModule().common.setFlexBasis(node, this.value!);
2186    }
2187  }
2188  checkObjectDiff(): boolean {
2189    return this.stageValue !== this.value;
2190  }
2191}
2192
2193class LayoutWeightModifier extends ModifierWithKey<number | string> {
2194  constructor(value: number | string) {
2195    super(value);
2196  }
2197  static identity: Symbol = Symbol('layoutWeight');
2198  applyPeer(node: KNode, reset: boolean): void {
2199    if (reset) {
2200      getUINativeModule().common.resetLayoutWeight(node);
2201    } else {
2202      getUINativeModule().common.setLayoutWeight(node, this.value!);
2203    }
2204  }
2205}
2206
2207class EnabledModifier extends ModifierWithKey<boolean> {
2208  constructor(value: boolean) {
2209    super(value);
2210  }
2211  static identity: Symbol = Symbol('enabled');
2212  applyPeer(node: KNode, reset: boolean): void {
2213    if (reset) {
2214      getUINativeModule().common.resetEnabled(node);
2215
2216    } else {
2217      getUINativeModule().common.setEnabled(node, this.value);
2218    }
2219  }
2220}
2221
2222class UseShadowBatchingModifier extends ModifierWithKey<boolean> {
2223  constructor(value: boolean) {
2224    super(value);
2225  }
2226  static identity: Symbol = Symbol('useShadowBatching');
2227  applyPeer(node: KNode, reset: boolean): void {
2228    if (reset) {
2229      getUINativeModule().common.resetUseShadowBatching(node);
2230
2231    } else {
2232      getUINativeModule().common.setUseShadowBatching(node, this.value);
2233    }
2234  }
2235}
2236
2237class MonopolizeEventsModifier extends ModifierWithKey<boolean> {
2238  constructor(value: boolean) {
2239    super(value);
2240  }
2241  static identity: Symbol = Symbol('monopolizeEvents');
2242  applyPeer(node: KNode, reset: boolean): void {
2243    if (reset) {
2244      getUINativeModule().common.resetMonopolizeEvents(node);
2245
2246    } else {
2247      getUINativeModule().common.setMonopolizeEvents(node, this.value);
2248    }
2249  }
2250}
2251
2252class DraggableModifier extends ModifierWithKey<boolean> {
2253  constructor(value: boolean) {
2254    super(value);
2255  }
2256  static identity: Symbol = Symbol('draggable');
2257  applyPeer(node: KNode, reset: boolean): void {
2258    if (reset) {
2259      getUINativeModule().common.resetDraggable(node);
2260    } else {
2261      getUINativeModule().common.setDraggable(node, this.value);
2262    }
2263  }
2264}
2265
2266class AccessibilityGroupModifier extends ModifierWithKey<boolean> {
2267  constructor(value: boolean) {
2268    super(value);
2269  }
2270  static identity: Symbol = Symbol('accessibilityGroup');
2271  applyPeer(node: KNode, reset: boolean): void {
2272    if (reset) {
2273      getUINativeModule().common.resetAccessibilityGroup(node);
2274    } else {
2275      getUINativeModule().common.setAccessibilityGroup(node, this.value);
2276    }
2277  }
2278}
2279
2280class HoverEffectModifier extends Modifier<HoverEffect> {
2281  constructor(value: HoverEffect) {
2282    super(value);
2283  }
2284  static identity: Symbol = Symbol('hoverEffect');
2285  applyPeer(node: KNode, reset: boolean): void {
2286    if (reset) {
2287      getUINativeModule().common.resetHoverEffect(node);
2288    } else {
2289      getUINativeModule().common.setHoverEffect(node, this.value);
2290    }
2291  }
2292}
2293
2294class ClickEffectModifier extends ModifierWithKey<ClickEffect | null> {
2295  constructor(value: ClickEffect | null) {
2296    super(value);
2297  }
2298  static identity: Symbol = Symbol('clickEffect');
2299  applyPeer(node: KNode, reset: boolean): void {
2300    if (reset || !this.value) {
2301      getUINativeModule().common.resetClickEffect(node);
2302    } else {
2303      getUINativeModule().common.setClickEffect(node, this.value.level, this.value.scale);
2304    }
2305  }
2306  checkObjectDiff(): boolean {
2307    return !((this.value.level === this.stageValue.level) && (this.value.scale === this.stageValue.scale));
2308  }
2309}
2310
2311class KeyBoardShortCutModifier extends ModifierWithKey<ArkKeyBoardShortCut> {
2312  constructor(value: ArkKeyBoardShortCut) {
2313    super(value);
2314  }
2315  static identity: Symbol = Symbol('keyboardShortcut');
2316  applyPeer(node: KNode, reset: boolean): void {
2317    if (reset) {
2318      getUINativeModule().common.resetKeyBoardShortCut(node);
2319    } else {
2320      getUINativeModule().common.setKeyBoardShortCut(node, this.value.value, this.value.keys);
2321    }
2322  }
2323  checkObjectDiff(): boolean {
2324    return !this.value.isEqual(this.stageValue);
2325  }
2326}
2327
2328class TransitionModifier extends ModifierWithKey<object> {
2329  constructor(value: object) {
2330    super(value);
2331  }
2332  static identity: Symbol = Symbol('transition');
2333  applyPeer(node: KNode, reset: boolean): void {
2334    if (reset) {
2335      getUINativeModule().common.resetTransition(node);
2336    } else {
2337      getUINativeModule().common.setTransition(node, this.value);
2338    }
2339  }
2340}
2341
2342class SharedTransitionModifier extends ModifierWithKey<ArkSharedTransition> {
2343  constructor(value: ArkSharedTransition) {
2344    super(value);
2345  }
2346  static identity: Symbol = Symbol('sharedTransition');
2347  applyPeer(node: KNode, reset: boolean): void {
2348    if (reset) {
2349      getUINativeModule().common.resetSharedTransition(node);
2350    } else {
2351      getUINativeModule().common.setSharedTransition(node, this.value.id, this.value.options);
2352    }
2353  }
2354}
2355
2356const JSCallbackInfoType = { STRING: 0, NUMBER: 1, OBJECT: 2, BOOLEAN: 3, FUNCTION: 4 };
2357type basicType = string | number | bigint | boolean | symbol | undefined | object | null;
2358const isString = (val: basicType): boolean => typeof val === 'string';
2359const isNumber = (val: basicType): boolean => typeof val === 'number';
2360const isBigint = (val: basicType): boolean => typeof val === 'bigint';
2361const isBoolean = (val: basicType): boolean => typeof val === 'boolean';
2362const isSymbol = (val: basicType): boolean => typeof val === 'symbol';
2363const isUndefined = (val: basicType): boolean => typeof val === 'undefined';
2364const isObject = (val: basicType): boolean => typeof val === 'object';
2365const isFunction = (val: basicType): boolean => typeof val === 'function';
2366const isLengthType = (val: any): boolean => typeof val === 'string' || typeof val === 'number';
2367
2368function modifier<T extends number | string | boolean | Equable, M extends Modifier<T>>(
2369  modifiers: Map<Symbol, Modifier<number | string | boolean | Equable>>,
2370  modifierClass: new (value: T) => M,
2371  value: T
2372) {
2373  const identity: Symbol = (modifierClass as any)['identity'];
2374  const item = modifiers.get(identity);
2375  if (item) {
2376    item.stageValue = value;
2377  } else {
2378    modifiers.set(identity, new modifierClass(value));
2379  }
2380}
2381
2382function modifierWithKey<T extends number | string | boolean | object, M extends ModifierWithKey<T>>(
2383  modifiers: Map<Symbol, ModifierWithKey<number | string | boolean | object>>,
2384  identity: Symbol,
2385  modifierClass: new (value: T) => M,
2386  value: T
2387) {
2388  const item = modifiers.get(identity);
2389  if (item) {
2390    item.stageValue = value;
2391  } else {
2392    modifiers.set(identity, new modifierClass(value));
2393  }
2394}
2395
2396class ArkComponent implements CommonMethod<CommonAttribute> {
2397  _modifiers: Map<Symbol, Modifier<number | string | boolean | Equable>>;
2398  _modifiersWithKeys: Map<Symbol, ModifierWithKey<number | string | boolean | object>>;
2399  nativePtr: KNode;
2400
2401  constructor(nativePtr: KNode) {
2402    this._modifiers = new Map();
2403    this._modifiersWithKeys = new Map();
2404    this.nativePtr = nativePtr;
2405  }
2406
2407  applyModifierPatch(): void {
2408    let expiringItems = [];
2409    let expiringItemsWithKeys = [];
2410    this._modifiers.forEach((value, key) => {
2411      if (value.applyStage(this.nativePtr)) {
2412        expiringItems.push(key);
2413      }
2414    });
2415    this._modifiersWithKeys.forEach((value, key) => {
2416      if (value.applyStage(this.nativePtr)) {
2417        expiringItemsWithKeys.push(key);
2418      }
2419    });
2420    expiringItems.forEach(key => {
2421      this._modifiers.delete(key);
2422    });
2423    expiringItemsWithKeys.forEach(key => {
2424      this._modifiersWithKeys.delete(key);
2425    });
2426  }
2427  onGestureJudgeBegin(callback: (gestureInfo: GestureInfo, event: BaseGestureEvent) => GestureJudgeResult): this {
2428    throw new Error('Method not implemented.');
2429  }
2430  outline(value: OutlineOptions): this {
2431    modifierWithKey(this._modifiersWithKeys, OutlineModifier.identity, OutlineModifier, value);
2432    return this;
2433  }
2434  outlineColor(value: ResourceColor | EdgeColors): this {
2435    modifierWithKey(this._modifiersWithKeys, OutlineColorModifier.identity, OutlineColorModifier, value);
2436    return this;
2437  }
2438  outlineRadius(value: Dimension | OutlineRadiuses): this {
2439    modifierWithKey(this._modifiersWithKeys, OutlineRadiusModifier.identity, OutlineRadiusModifier, value);
2440    return this;
2441  }
2442  outlineStyle(value: OutlineStyle | EdgeOutlineStyles): this {
2443    modifierWithKey(this._modifiersWithKeys, OutlineStyleModifier.identity, OutlineStyleModifier, value);
2444    return this;
2445  }
2446  outlineWidth(value: Dimension | EdgeOutlineWidths): this {
2447    modifierWithKey(this._modifiersWithKeys, OutlineWidthModifier.identity, OutlineWidthModifier, value);
2448    return this;
2449  }
2450  width(value: Length): this {
2451    modifierWithKey(this._modifiersWithKeys, WidthModifier.identity, WidthModifier, value);
2452    return this;
2453  }
2454
2455  height(value: Length): this {
2456    modifierWithKey(this._modifiersWithKeys, HeightModifier.identity, HeightModifier, value);
2457    return this;
2458  }
2459
2460  expandSafeArea(types?: Array<SafeAreaType>, edges?: Array<SafeAreaEdge>): this {
2461    let opts = new ArkSafeAreaExpandOpts();
2462    if (types && types.length > 0) {
2463      let safeAreaType: string | number = '';
2464      for (let param of types) {
2465        if (!isNumber(param) || param >= SAFE_AREA_TYPE_LIMIT) {
2466          safeAreaType = undefined;
2467          break;
2468        }
2469        if (safeAreaType) {
2470          safeAreaType += '|';
2471        } else {
2472          safeAreaType += param.toString();
2473        }
2474      }
2475      opts.type = safeAreaType;
2476    }
2477    if (edges && edges.length > 0) {
2478      let safeAreaEdge: string | number = '';
2479      for (let param of edges) {
2480        if (!isNumber(param) || param >= SAFE_AREA_EDGE_LIMIT) {
2481          safeAreaEdge = undefined;
2482          break;
2483        }
2484        if (safeAreaEdge) {
2485          safeAreaEdge += '|';
2486        } else {
2487          safeAreaEdge += param.toString();
2488        }
2489      }
2490      opts.edges = safeAreaEdge;
2491    }
2492    if (opts.type === undefined && opts.edges === undefined) {
2493      modifierWithKey(this._modifiersWithKeys, ExpandSafeAreaModifier.identity, ExpandSafeAreaModifier, undefined);
2494    } else {
2495      modifierWithKey(this._modifiersWithKeys, ExpandSafeAreaModifier.identity, ExpandSafeAreaModifier, opts);
2496    }
2497    return this;
2498  }
2499
2500  backgroundEffect(options: BackgroundEffectOptions): this {
2501    modifierWithKey(this._modifiersWithKeys, BackgroundEffectModifier.identity,
2502      BackgroundEffectModifier, options);
2503    return this;
2504  }
2505
2506  backgroundBrightness(params: BackgroundBrightnessOptions): this {
2507    modifierWithKey(this._modifiersWithKeys, BackgroundBrightnessModifier.identity,
2508      BackgroundBrightnessModifier, params);
2509    return this;
2510  }
2511
2512  dragPreviewOptions(value: DragPreviewOptions): this {
2513    modifierWithKey(this._modifiersWithKeys, DragPreviewOptionsModifier.identity,
2514      DragPreviewOptionsModifier, value);
2515    return this;
2516  }
2517
2518  responseRegion(value: Array<Rectangle> | Rectangle): this {
2519    modifierWithKey(this._modifiersWithKeys, ResponseRegionModifier.identity,
2520      ResponseRegionModifier, value);
2521    return this;
2522  }
2523
2524  mouseResponseRegion(value: Array<Rectangle> | Rectangle): this {
2525    modifierWithKey(this._modifiersWithKeys, MouseResponseRegionModifier.identity,
2526      MouseResponseRegionModifier, value);
2527    return this;
2528  }
2529
2530  size(value: SizeOptions): this {
2531    modifierWithKey(this._modifiersWithKeys, SizeModifier.identity, SizeModifier, value);
2532    return this;
2533  }
2534
2535  constraintSize(value: ConstraintSizeOptions): this {
2536    modifierWithKey(this._modifiersWithKeys, ConstraintSizeModifier.identity,
2537      ConstraintSizeModifier, value);
2538    return this;
2539  }
2540
2541  touchable(value: boolean): this {
2542    if (typeof value === 'boolean') {
2543      modifierWithKey(this._modifiersWithKeys, TouchableModifier.identity, TouchableModifier, value);
2544    } else {
2545      modifierWithKey(this._modifiersWithKeys, TouchableModifier.identity, TouchableModifier, undefined);
2546    }
2547    return this;
2548  }
2549
2550  hitTestBehavior(value: HitTestMode): this {
2551    if (value) {
2552      modifierWithKey(this._modifiersWithKeys, HitTestBehaviorModifier.identity, HitTestBehaviorModifier, value);
2553    } else {
2554      modifierWithKey(this._modifiersWithKeys, HitTestBehaviorModifier.identity, HitTestBehaviorModifier, undefined);
2555    }
2556    return this;
2557  }
2558
2559  layoutWeight(value: number | string): this {
2560    if (isNumber(value)) {
2561      modifierWithKey(this._modifiersWithKeys, LayoutWeightModifier.identity, LayoutWeightModifier, value);
2562    } else if (isString(value) && !isNaN(Number(value))) {
2563      modifierWithKey(this._modifiersWithKeys, LayoutWeightModifier.identity, LayoutWeightModifier, parseInt(value.toString()));
2564    } else {
2565      modifierWithKey(this._modifiersWithKeys, LayoutWeightModifier.identity, LayoutWeightModifier, undefined);
2566    }
2567    return this;
2568  }
2569
2570  padding(value: Padding | Length): this {
2571    let arkValue = new ArkPadding();
2572    if (value !== null && value !== undefined) {
2573      if (isLengthType(value) || isResource(value)) {
2574        arkValue.top = <Length>value;
2575        arkValue.right = <Length>value;
2576        arkValue.bottom = <Length>value;
2577        arkValue.left = <Length>value;
2578      } else {
2579        arkValue.top = (<Margin>value).top;
2580        arkValue.right = (<Margin>value).right;
2581        arkValue.bottom = (<Margin>value).bottom;
2582        arkValue.left = (<Margin>value).left;
2583      }
2584      modifierWithKey(this._modifiersWithKeys, PaddingModifier.identity, PaddingModifier, arkValue);
2585    } else {
2586      modifierWithKey(this._modifiersWithKeys, PaddingModifier.identity, PaddingModifier, undefined);
2587    }
2588    return this;
2589  }
2590
2591  margin(value: Margin | Length): this {
2592    let arkValue = new ArkPadding();
2593    if (value !== null && value !== undefined) {
2594      if (isLengthType(value) || isResource(value)) {
2595        arkValue.top = <Length>value;
2596        arkValue.right = <Length>value;
2597        arkValue.bottom = <Length>value;
2598        arkValue.left = <Length>value;
2599      } else {
2600        arkValue.top = (<Margin>value).top;
2601        arkValue.right = (<Margin>value).right;
2602        arkValue.bottom = (<Margin>value).bottom;
2603        arkValue.left = (<Margin>value).left;
2604      }
2605      modifierWithKey(this._modifiersWithKeys, MarginModifier.identity, MarginModifier, arkValue);
2606    } else {
2607      modifierWithKey(this._modifiersWithKeys, MarginModifier.identity, MarginModifier, undefined);
2608    }
2609    return this;
2610  }
2611
2612  background(builder: CustomBuilder, options?: { align?: Alignment }): this {
2613    throw new Error('Method not implemented.');
2614  }
2615
2616  backgroundColor(value: ResourceColor): this {
2617    modifierWithKey(this._modifiersWithKeys, BackgroundColorModifier.identity, BackgroundColorModifier, value);
2618    return this;
2619  }
2620
2621  backgroundImage(src: ResourceStr, repeat?: ImageRepeat): this {
2622    let arkBackgroundImage = new ArkBackgroundImage();
2623    arkBackgroundImage.src = src;
2624    arkBackgroundImage.repeat = repeat;
2625    modifierWithKey(this._modifiersWithKeys, BackgroundImageModifier.identity, BackgroundImageModifier, arkBackgroundImage);
2626    return this;
2627  }
2628
2629  backgroundImageSize(value: SizeOptions | ImageSize): this {
2630    modifierWithKey(this._modifiersWithKeys, BackgroundImageSizeModifier.identity, BackgroundImageSizeModifier, value);
2631    return this;
2632  }
2633
2634  backgroundImagePosition(value: Position | Alignment): this {
2635    modifierWithKey(this._modifiersWithKeys, BackgroundImagePositionModifier.identity, BackgroundImagePositionModifier, value);
2636    return this;
2637  }
2638
2639  backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): this {
2640    if (isUndefined(value)) {
2641      modifierWithKey(this._modifiersWithKeys, BackgroundBlurStyleModifier.identity,
2642        BackgroundBlurStyleModifier, undefined);
2643      return this;
2644    }
2645    let arkBackgroundBlurStyle = new ArkBackgroundBlurStyle();
2646    arkBackgroundBlurStyle.blurStyle = value;
2647    if (typeof options === 'object') {
2648      arkBackgroundBlurStyle.colorMode = options.colorMode;
2649      arkBackgroundBlurStyle.adaptiveColor = options.adaptiveColor;
2650      arkBackgroundBlurStyle.scale = options.scale;
2651    }
2652    modifierWithKey(this._modifiersWithKeys, BackgroundBlurStyleModifier.identity,
2653      BackgroundBlurStyleModifier, arkBackgroundBlurStyle);
2654    return this;
2655  }
2656
2657  foregroundBlurStyle(value: BlurStyle, options?: ForegroundBlurStyleOptions): this {
2658    if (isUndefined(value)) {
2659      modifierWithKey(this._modifiersWithKeys, ForegroundBlurStyleModifier.identity,
2660        ForegroundBlurStyleModifier, undefined);
2661      return this;
2662    }
2663    let arkForegroundBlurStyle = new ArkForegroundBlurStyle();
2664    arkForegroundBlurStyle.blurStyle = value;
2665    if (typeof options === 'object') {
2666      arkForegroundBlurStyle.colorMode = options.colorMode;
2667      arkForegroundBlurStyle.adaptiveColor = options.adaptiveColor;
2668      arkForegroundBlurStyle.scale = options.scale;
2669    }
2670    modifierWithKey(this._modifiersWithKeys, ForegroundBlurStyleModifier.identity,
2671      ForegroundBlurStyleModifier, arkForegroundBlurStyle);
2672    return this;
2673  }
2674
2675  opacity(value: number | Resource): this {
2676    modifierWithKey(this._modifiersWithKeys, OpacityModifier.identity, OpacityModifier, value);
2677    return this;
2678  }
2679
2680  border(value: BorderOptions): this {
2681    let arkBorder = new ArkBorder();
2682    if (isUndefined(value)) {
2683      arkBorder = undefined;
2684    }
2685
2686    if (!isUndefined(value?.width) && value?.width !== null) {
2687      if (isNumber(value.width) || isString(value.width) || isResource(value.width)) {
2688        arkBorder.arkWidth.left = value.width;
2689        arkBorder.arkWidth.right = value.width;
2690        arkBorder.arkWidth.top = value.width;
2691        arkBorder.arkWidth.bottom = value.width;
2692      } else {
2693        arkBorder.arkWidth.left = (value.width as EdgeWidths).left;
2694        arkBorder.arkWidth.right = (value.width as EdgeWidths).right;
2695        arkBorder.arkWidth.top = (value.width as EdgeWidths).top;
2696        arkBorder.arkWidth.bottom = (value.width as EdgeWidths).bottom;
2697      }
2698    }
2699    if (!isUndefined(value?.color) && value?.color !== null) {
2700      if (isNumber(value.color) || isString(value.color) || isResource(value.color)) {
2701        arkBorder.arkColor.leftColor = value.color;
2702        arkBorder.arkColor.rightColor = value.color;
2703        arkBorder.arkColor.topColor = value.color;
2704        arkBorder.arkColor.bottomColor = value.color;
2705      } else {
2706        arkBorder.arkColor.leftColor = (value.color as EdgeColors).left;
2707        arkBorder.arkColor.rightColor = (value.color as EdgeColors).right;
2708        arkBorder.arkColor.topColor = (value.color as EdgeColors).top;
2709        arkBorder.arkColor.bottomColor = (value.color as EdgeColors).bottom;
2710      }
2711    }
2712    if (!isUndefined(value?.radius) && value?.radius !== null) {
2713      if (isNumber(value.radius) || isString(value.radius) || isResource(value.radius)) {
2714        arkBorder.arkRadius.topLeft = value.radius;
2715        arkBorder.arkRadius.topRight = value.radius;
2716        arkBorder.arkRadius.bottomLeft = value.radius;
2717        arkBorder.arkRadius.bottomRight = value.radius;
2718      } else {
2719        arkBorder.arkRadius.topLeft = (value.radius as BorderRadiuses)?.topLeft;
2720        arkBorder.arkRadius.topRight = (value.radius as BorderRadiuses)?.topRight;
2721        arkBorder.arkRadius.bottomLeft = (value.radius as BorderRadiuses)?.bottomLeft;
2722        arkBorder.arkRadius.bottomRight = (value.radius as BorderRadiuses)?.bottomRight;
2723      }
2724    }
2725    if (!isUndefined(value?.style) && value?.style !== null) {
2726      let arkBorderStyle = new ArkBorderStyle();
2727      if (arkBorderStyle.parseBorderStyle(value.style)) {
2728        if (!isUndefined(arkBorderStyle.style)) {
2729          arkBorder.arkStyle.top = arkBorderStyle.style;
2730          arkBorder.arkStyle.left = arkBorderStyle.style;
2731          arkBorder.arkStyle.bottom = arkBorderStyle.style;
2732          arkBorder.arkStyle.right = arkBorderStyle.style;
2733        } else {
2734          arkBorder.arkStyle.top = arkBorderStyle.top;
2735          arkBorder.arkStyle.left = arkBorderStyle.left;
2736          arkBorder.arkStyle.bottom = arkBorderStyle.bottom;
2737          arkBorder.arkStyle.right = arkBorderStyle.right;
2738        }
2739      }
2740    }
2741    modifierWithKey(this._modifiersWithKeys, BorderModifier.identity, BorderModifier, arkBorder);
2742    return this;
2743  }
2744
2745  borderStyle(value: BorderStyle | EdgeStyles): this {
2746    modifierWithKey(this._modifiersWithKeys, BorderStyleModifier.identity, BorderStyleModifier, value);
2747    return this;
2748  }
2749
2750  borderWidth(value: Length | EdgeWidths): this {
2751    modifierWithKey(this._modifiersWithKeys, BorderWidthModifier.identity, BorderWidthModifier, value);
2752    return this;
2753  }
2754
2755  borderColor(value: ResourceColor | EdgeColors): this {
2756    modifierWithKey(this._modifiersWithKeys, BorderColorModifier.identity, BorderColorModifier, value);
2757    return this;
2758  }
2759
2760  borderRadius(value: Length | BorderRadiuses): this {
2761    modifierWithKey(this._modifiersWithKeys, BorderRadiusModifier.identity, BorderRadiusModifier, value);
2762    return this;
2763  }
2764
2765
2766  borderImage(value: BorderImageOption): this {
2767    modifierWithKey(this._modifiersWithKeys, BorderImageModifier.identity, BorderImageModifier, value);
2768    return this;
2769  }
2770
2771  foregroundColor(value: ResourceColor | ColoringStrategy): this {
2772    modifierWithKey(this._modifiersWithKeys, ForegroundColorModifier.identity, ForegroundColorModifier, value);
2773    return this;
2774  }
2775
2776  onClick(event: (event?: ClickEvent) => void): this {
2777    throw new Error('Method not implemented.');
2778  }
2779
2780  onHover(event: (isHover?: boolean, event?: HoverEvent) => void): this {
2781    throw new Error('Method not implemented.');
2782  }
2783
2784  hoverEffect(value: HoverEffect): this {
2785    modifier(this._modifiers, HoverEffectModifier, value);
2786    return this;
2787  }
2788
2789  onMouse(event: (event?: MouseEvent) => void): this {
2790    throw new Error('Method not implemented.');
2791  }
2792
2793  onTouch(event: (event?: TouchEvent) => void): this {
2794    throw new Error('Method not implemented.');
2795  }
2796
2797  onKeyEvent(event: (event?: KeyEvent) => void): this {
2798    throw new Error('Method not implemented.');
2799  }
2800
2801  focusable(value: boolean): this {
2802    if (typeof value === 'boolean') {
2803      modifierWithKey(this._modifiersWithKeys, FocusableModifier.identity, FocusableModifier, value);
2804    } else {
2805      modifierWithKey(this._modifiersWithKeys, FocusableModifier.identity, FocusableModifier, undefined);
2806    }
2807    return this;
2808  }
2809
2810  onFocus(event: () => void): this {
2811    throw new Error('Method not implemented.');
2812  }
2813
2814  onBlur(event: () => void): this {
2815    throw new Error('Method not implemented.');
2816  }
2817
2818  tabIndex(index: number): this {
2819    if (typeof index !== 'number') {
2820      modifierWithKey(this._modifiersWithKeys, TabIndexModifier.identity, TabIndexModifier, undefined);
2821    } else {
2822      modifierWithKey(this._modifiersWithKeys, TabIndexModifier.identity, TabIndexModifier, index);
2823    }
2824    return this;
2825  }
2826
2827  defaultFocus(value: boolean): this {
2828    if (typeof value === 'boolean') {
2829      modifierWithKey(this._modifiersWithKeys, DefaultFocusModifier.identity, DefaultFocusModifier, value);
2830    } else {
2831      modifierWithKey(this._modifiersWithKeys, DefaultFocusModifier.identity, DefaultFocusModifier, undefined);
2832    }
2833    return this;
2834  }
2835
2836  groupDefaultFocus(value: boolean): this {
2837    if (typeof value === 'boolean') {
2838      modifierWithKey(this._modifiersWithKeys, GroupDefaultFocusModifier.identity, GroupDefaultFocusModifier, value);
2839    } else {
2840      modifierWithKey(this._modifiersWithKeys, GroupDefaultFocusModifier.identity, GroupDefaultFocusModifier, undefined);
2841    }
2842    return this;
2843  }
2844
2845  focusOnTouch(value: boolean): this {
2846    if (typeof value === 'boolean') {
2847      modifierWithKey(this._modifiersWithKeys, FocusOnTouchModifier.identity, FocusOnTouchModifier, value);
2848    } else {
2849      modifierWithKey(this._modifiersWithKeys, FocusOnTouchModifier.identity, FocusOnTouchModifier, undefined);
2850    }
2851    return this;
2852  }
2853
2854  animation(value: AnimateParam): this {
2855    throw new Error('Method not implemented.');
2856  }
2857
2858  transition(value: TransitionOptions | TransitionEffect): this {
2859    modifierWithKey(this._modifiersWithKeys, TransitionModifier.identity, TransitionModifier, value);
2860    return this;
2861  }
2862
2863  gesture(gesture: GestureType, mask?: GestureMask): this {
2864    throw new Error('Method not implemented.');
2865  }
2866
2867  priorityGesture(gesture: GestureType, mask?: GestureMask): this {
2868    throw new Error('Method not implemented.');
2869  }
2870
2871  parallelGesture(gesture: GestureType, mask?: GestureMask): this {
2872    throw new Error('Method not implemented.');
2873  }
2874
2875  blur(value: number): this {
2876    if (!isNumber(value)) {
2877      modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, undefined);
2878    } else {
2879      modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, value);
2880    }
2881    return this;
2882  }
2883
2884  linearGradientBlur(value: number, options: LinearGradientBlurOptions): this {
2885    if (isUndefined(value) || isNull(value) || isUndefined(options) || isNull(options)) {
2886      modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier,
2887        undefined);
2888      return this;
2889    }
2890    let arkLinearGradientBlur = new ArkLinearGradientBlur();
2891    arkLinearGradientBlur.blurRadius = value;
2892    arkLinearGradientBlur.fractionStops = options.fractionStops;
2893    arkLinearGradientBlur.direction = options.direction;
2894    modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier,
2895      arkLinearGradientBlur);
2896    return this;
2897  }
2898
2899  brightness(value: number): this {
2900    if (!isNumber(value)) {
2901      modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, undefined);
2902    } else {
2903      modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, value);
2904    }
2905    return this;
2906  }
2907
2908  contrast(value: number): this {
2909    if (!isNumber(value)) {
2910      modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, undefined);
2911    } else {
2912      modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, value);
2913    }
2914    return this;
2915  }
2916
2917  grayscale(value: number): this {
2918    if (!isNumber(value)) {
2919      modifierWithKey(this._modifiersWithKeys, GrayscaleModifier.identity, GrayscaleModifier, undefined);
2920    } else {
2921      modifierWithKey(this._modifiersWithKeys, GrayscaleModifier.identity, GrayscaleModifier, value);
2922    }
2923    return this;
2924  }
2925
2926  colorBlend(value: Color | string | Resource): this {
2927    modifierWithKey(this._modifiersWithKeys, ColorBlendModifier.identity, ColorBlendModifier, value);
2928    return this;
2929  }
2930
2931  saturate(value: number): this {
2932    if (!isNumber(value)) {
2933      modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, undefined);
2934    } else {
2935      modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, value);
2936    }
2937    return this;
2938  }
2939
2940  sepia(value: number): this {
2941    if (!isNumber(value)) {
2942      modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, undefined);
2943    } else {
2944      modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, value);
2945    }
2946    return this;
2947  }
2948
2949  invert(value: number): this {
2950    if (!isNumber(value)) {
2951      modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined);
2952    } else {
2953      modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value);
2954    }
2955    return this;
2956  }
2957
2958  hueRotate(value: number | string): this {
2959    if (!isNumber(value) && !isString(value)) {
2960      modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, undefined);
2961    } else {
2962      modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, value);
2963    }
2964    return this;
2965  }
2966
2967  useEffect(value: boolean): this {
2968    modifierWithKey(this._modifiersWithKeys, UseEffectModifier.identity, UseEffectModifier, value);
2969    return this;
2970  }
2971
2972  backdropBlur(value: number): this {
2973    if (!isNumber(value)) {
2974      modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, undefined);
2975    } else {
2976      modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, value);
2977    }
2978    return this;
2979  }
2980
2981  renderGroup(value: boolean): this {
2982    modifierWithKey(this._modifiersWithKeys, RenderGroupModifier.identity, RenderGroupModifier, value);
2983    return this;
2984  }
2985
2986  translate(value: TranslateOptions): this {
2987    modifierWithKey(this._modifiersWithKeys, TranslateModifier.identity, TranslateModifier, value);
2988    return this;
2989  }
2990
2991  scale(value: ScaleOptions): this {
2992    modifierWithKey(this._modifiersWithKeys, ScaleModifier.identity, ScaleModifier, value);
2993    return this;
2994  }
2995  gridSpan(value: number): this {
2996    if (isNumber(value)) {
2997      modifierWithKey(this._modifiersWithKeys, GridSpanModifier.identity, GridSpanModifier, value);
2998    } else {
2999      modifierWithKey(this._modifiersWithKeys, GridSpanModifier.identity, GridSpanModifier, undefined);
3000    }
3001    return this;
3002  }
3003
3004  gridOffset(value: number): this {
3005    if (isNumber(value)) {
3006      modifierWithKey(this._modifiersWithKeys, GridOffsetModifier.identity, GridOffsetModifier, value);
3007    } else {
3008      modifierWithKey(this._modifiersWithKeys, GridOffsetModifier.identity, GridOffsetModifier, undefined);
3009    }
3010    return this;
3011  }
3012
3013  rotate(value: RotateOptions): this {
3014    modifierWithKey(this._modifiersWithKeys, RotateModifier.identity, RotateModifier, value);
3015    return this;
3016  }
3017
3018  transform(value: object): this {
3019    modifierWithKey(this._modifiersWithKeys, TransformModifier.identity, TransformModifier, value);
3020    return this;
3021  }
3022
3023  onAppear(event: () => void): this {
3024    throw new Error('Method not implemented.');
3025  }
3026
3027  onDisAppear(event: () => void): this {
3028    throw new Error('Method not implemented.');
3029  }
3030
3031  onAreaChange(event: (oldValue: Area, newValue: Area) => void): this {
3032    throw new Error('Method not implemented.');
3033  }
3034
3035  visibility(value: Visibility): this {
3036    modifierWithKey(this._modifiersWithKeys, VisibilityModifier.identity, VisibilityModifier, value);
3037    return this;
3038  }
3039
3040  flexGrow(value: number): this {
3041    modifierWithKey(this._modifiersWithKeys, FlexGrowModifier.identity, FlexGrowModifier, value);
3042    return this;
3043  }
3044
3045  flexShrink(value: number): this {
3046    modifierWithKey(this._modifiersWithKeys, FlexShrinkModifier.identity, FlexShrinkModifier, value);
3047    return this;
3048  }
3049
3050  flexBasis(value: number | string): this {
3051    modifierWithKey(this._modifiersWithKeys, FlexBasisModifier.identity, FlexBasisModifier, value);
3052    return this;
3053  }
3054
3055  alignSelf(value: ItemAlign): this {
3056    modifierWithKey(this._modifiersWithKeys, AlignSelfModifier.identity, AlignSelfModifier, value);
3057    return this;
3058  }
3059
3060  displayPriority(value: number): this {
3061    modifierWithKey(this._modifiersWithKeys, DisplayPriorityModifier.identity, DisplayPriorityModifier, value);
3062    return this;
3063  }
3064
3065  zIndex(value: number): this {
3066    if (value !== null) {
3067      let zIndex = 0;
3068      if (typeof (value) === 'number') {
3069        zIndex = value;
3070      }
3071      modifierWithKey(this._modifiersWithKeys, ZIndexModifier.identity, ZIndexModifier, zIndex);
3072    }
3073    return this;
3074  }
3075
3076  sharedTransition(id: string, options?: sharedTransitionOptions): this {
3077    let arkSharedTransition = new ArkSharedTransition();
3078    if (isString(id)) {
3079      arkSharedTransition.id = id;
3080    }
3081    if (typeof options === 'object') {
3082      arkSharedTransition.options = options;
3083    }
3084    modifierWithKey(
3085      this._modifiersWithKeys, SharedTransitionModifier.identity, SharedTransitionModifier, arkSharedTransition);
3086    return this;
3087  }
3088
3089  direction(value: Direction): this {
3090    modifierWithKey(this._modifiersWithKeys, DirectionModifier.identity, DirectionModifier, value);
3091    return this;
3092  }
3093
3094  align(value: Alignment): this {
3095    if (isNumber(value)) {
3096      modifierWithKey(this._modifiersWithKeys, AlignModifier.identity, AlignModifier, value);
3097    } else {
3098      modifierWithKey(this._modifiersWithKeys, AlignModifier.identity, AlignModifier, undefined);
3099    }
3100    return this;
3101  }
3102
3103  position(value: Position): this {
3104    modifierWithKey(this._modifiersWithKeys, PositionModifier.identity, PositionModifier, value);
3105    return this;
3106  }
3107
3108  markAnchor(value: Position): this {
3109    modifierWithKey(this._modifiersWithKeys, MarkAnchorModifier.identity, MarkAnchorModifier, value);
3110    return this;
3111  }
3112
3113  offset(value: Position): this {
3114    modifierWithKey(this._modifiersWithKeys, OffsetModifier.identity, OffsetModifier, value);
3115    return this;
3116  }
3117
3118  enabled(value: boolean): this {
3119    if (typeof value === 'boolean') {
3120      modifierWithKey(this._modifiersWithKeys, EnabledModifier.identity, EnabledModifier, value);
3121    } else {
3122      modifierWithKey(this._modifiersWithKeys, EnabledModifier.identity, EnabledModifier, undefined);
3123    }
3124    return this;
3125  }
3126
3127  useShadowBatching(value: boolean): this {
3128    modifierWithKey(this._modifiersWithKeys, UseShadowBatchingModifier.identity, UseShadowBatchingModifier, value);
3129    return this;
3130  }
3131
3132  monopolizeEvents(value: boolean): this {
3133    modifierWithKey(this._modifiersWithKeys, MonopolizeEventsModifier.identity, MonopolizeEventsModifier, value);
3134    return this;
3135  }
3136
3137  useSizeType(value: {
3138    xs?: number | { span: number; offset: number };
3139    sm?: number | { span: number; offset: number };
3140    md?: number | { span: number; offset: number };
3141    lg?: number | { span: number; offset: number };
3142  }): this {
3143    throw new Error('Method not implemented.');
3144  }
3145
3146  alignRules(value: AlignRuleOption): this {
3147    if (!isObject(value) || JSON.stringify(value) === '{}') {
3148      modifierWithKey(this._modifiersWithKeys, AlignRulesModifier.identity, AlignRulesModifier, undefined);
3149      return this;
3150    }
3151    let keys: string[] = ['left', 'middle', 'right', 'top', 'center', 'bottom'];
3152    let arkValue = new ArkAlignRules();
3153    for (let i = 0; i < keys.length; i++) {
3154      let rule = value[keys[i]];
3155      let alignRule: string = '';
3156      if (isObject(rule)) {
3157        let alignSign = false;
3158        let anchorSign = false;
3159        let align = rule.align;
3160        let anchor = rule.anchor;
3161        if (isString(anchor)) {
3162          anchorSign = true;
3163        }
3164        if (i < DIRECTION_RANGE) {
3165          if (align in HorizontalAlign) {
3166            alignSign = true;
3167          }
3168        } else {
3169          if (align in VerticalAlign) {
3170            alignSign = true;
3171          }
3172        }
3173        if (!alignSign && !anchorSign) {
3174          alignRule += '';
3175        } else if (!anchorSign) {
3176          alignRule += align.toString();
3177          alignRule += '|';
3178          alignRule += '__container__';
3179        } else if (!alignSign) {
3180          alignRule += '2';
3181          alignRule += '|';
3182          alignRule += anchor;
3183        } else {
3184          alignRule += align.toString();
3185          alignRule += '|';
3186          alignRule += anchor;
3187        }
3188      } else {
3189        alignRule += '';
3190      }
3191      switch (keys[i]) {
3192        case 'left':
3193          arkValue.left = alignRule;
3194          break;
3195        case 'middle':
3196          arkValue.middle = alignRule;
3197          break;
3198        case 'right':
3199          arkValue.right = alignRule;
3200          break;
3201        case 'top':
3202          arkValue.top = alignRule;
3203          break;
3204        case 'center':
3205          arkValue.center = alignRule;
3206          break;
3207        case 'bottom':
3208          arkValue.bottom = alignRule;
3209          break;
3210      }
3211    }
3212    modifierWithKey(this._modifiersWithKeys, AlignRulesModifier.identity, AlignRulesModifier, arkValue);
3213    return this;
3214  }
3215
3216  aspectRatio(value: number): this {
3217    modifierWithKey(this._modifiersWithKeys, AspectRatioModifier.identity, AspectRatioModifier, value);
3218    return this;
3219  }
3220
3221  clickEffect(value: ClickEffect | null): this {
3222    modifierWithKey(this._modifiersWithKeys, ClickEffectModifier.identity, ClickEffectModifier, value);
3223    return this;
3224  }
3225
3226  onDragStart(event: (event?: DragEvent, extraParams?: string) => CustomBuilder | DragItemInfo): this {
3227    throw new Error('Method not implemented.');
3228  }
3229
3230  onDragEnter(event: (event?: DragEvent, extraParams?: string) => void): this {
3231    throw new Error('Method not implemented.');
3232  }
3233
3234  onDragMove(event: (event?: DragEvent, extraParams?: string) => void): this {
3235    throw new Error('Method not implemented.');
3236  }
3237
3238  onDragLeave(event: (event?: DragEvent, extraParams?: string) => void): this {
3239    throw new Error('Method not implemented.');
3240  }
3241
3242  onDrop(event: (event?: DragEvent, extraParams?: string) => void): this {
3243    throw new Error('Method not implemented.');
3244  }
3245
3246  onDragEnd(event: (event: DragEvent, extraParams?: string) => void): this {
3247    throw new Error('Method not implemented.');
3248  }
3249
3250  allowDrop(value: Array<UniformDataType>): this {
3251    modifierWithKey(this._modifiersWithKeys, AllowDropModifier.identity, AllowDropModifier, value);
3252    return this;
3253  }
3254
3255  draggable(value: boolean): this {
3256    if (typeof value === 'boolean') {
3257      modifierWithKey(this._modifiersWithKeys, DraggableModifier.identity, DraggableModifier, value);
3258    } else {
3259      modifierWithKey(this._modifiersWithKeys, DraggableModifier.identity, DraggableModifier, undefined);
3260
3261    }
3262    return this;
3263  }
3264
3265  overlay(value: string | CustomBuilder, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): this {
3266    if (typeof value === 'undefined') {
3267      modifierWithKey(this._modifiersWithKeys, OverlayModifier.identity, OverlayModifier, undefined);
3268      return this;
3269    }
3270    let arkOverlay = new ArkOverlay();
3271    if (arkOverlay.splitOverlayValue(value, options)) {
3272      modifierWithKey(this._modifiersWithKeys, OverlayModifier.identity, OverlayModifier, arkOverlay);
3273    } else {
3274      modifierWithKey(this._modifiersWithKeys, OverlayModifier.identity, OverlayModifier, undefined);
3275    }
3276    return this;
3277  }
3278
3279  linearGradient(value: {
3280    angle?: number | string;
3281    direction?: GradientDirection;
3282    colors: Array<any>;
3283    repeating?: boolean;
3284  }): this {
3285    modifierWithKey(this._modifiersWithKeys, LinearGradientModifier.identity, LinearGradientModifier, value);
3286    return this;
3287  }
3288
3289  sweepGradient(value: {
3290    center: Array<any>;
3291    start?: number | string;
3292    end?: number | string;
3293    rotation?: number | string;
3294    colors: Array<any>;
3295    repeating?: boolean;
3296  }): this {
3297    modifierWithKey(this._modifiersWithKeys, SweepGradientModifier.identity, SweepGradientModifier, value);
3298    return this;
3299  }
3300
3301  radialGradient(value: { center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }): this {
3302    modifierWithKey(this._modifiersWithKeys, RadialGradientModifier.identity, RadialGradientModifier, value);
3303    return this;
3304  }
3305
3306  motionPath(value: MotionPathOptions): this {
3307    modifierWithKey(this._modifiersWithKeys, MotionPathModifier.identity, MotionPathModifier, value);
3308    return this;
3309  }
3310
3311  shadow(value: ShadowOptions | ShadowStyle): this {
3312    modifierWithKey(this._modifiersWithKeys, ShadowModifier.identity, ShadowModifier, value);
3313    return this;
3314  }
3315
3316  mask(value: CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute | ProgressMask): this {
3317    modifierWithKey(this._modifiersWithKeys, MaskModifier.identity, MaskModifier, value);
3318    return this;
3319  }
3320
3321  key(value: string): this {
3322    if (typeof value === 'string') {
3323      modifierWithKey(this._modifiersWithKeys, KeyModifier.identity, KeyModifier, value);
3324    } else {
3325      modifierWithKey(this._modifiersWithKeys, KeyModifier.identity, KeyModifier, undefined);
3326    }
3327    return this;
3328  }
3329
3330  id(value: string): this {
3331    if (typeof value === 'string') {
3332      modifierWithKey(this._modifiersWithKeys, IdModifier.identity, IdModifier, value);
3333    } else {
3334      modifierWithKey(this._modifiersWithKeys, IdModifier.identity, IdModifier, undefined);
3335    }
3336    return this;
3337  }
3338
3339  geometryTransition(id: string): this {
3340    if (isString(id)) {
3341      modifierWithKey(this._modifiersWithKeys, GeometryTransitionModifier.identity, GeometryTransitionModifier, id);
3342    }
3343    return this;
3344  }
3345
3346  bindPopup(show: boolean, popup: PopupOptions | CustomPopupOptions): this {
3347    throw new Error('Method not implemented.');
3348  }
3349
3350  bindMenu(content: Array<MenuElement> | CustomBuilder, options?: MenuOptions): this {
3351    throw new Error('Method not implemented.');
3352  }
3353
3354  bindContextMenu(content: CustomBuilder, responseType: ResponseType, options?: ContextMenuOptions): this {
3355    throw new Error('Method not implemented.');
3356  }
3357
3358  bindContentCover(isShow: boolean, builder: CustomBuilder, type?: ModalTransition | ContentCoverOptions): this {
3359    throw new Error('Method not implemented.');
3360  }
3361
3362  blendMode(blendMode: BlendMode, blendApplyType?: BlendApplyType): this {
3363    let arkBlendMode = new ArkBlendMode();
3364    arkBlendMode.blendMode = blendMode;
3365    arkBlendMode.blendApplyType = blendApplyType;
3366    modifierWithKey(this._modifiersWithKeys, BlendModeModifier.identity, BlendModeModifier, arkBlendMode);
3367    return this;
3368  }
3369
3370  clip(value: boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute): this {
3371    modifierWithKey(this._modifiersWithKeys, ClipModifier.identity, ClipModifier, value);
3372    return this;
3373  }
3374
3375  bindSheet(isShow: boolean, builder: CustomBuilder, options?: SheetOptions): this {
3376    throw new Error('Method not implemented.');
3377  }
3378
3379  stateStyles(value: StateStyles): this {
3380    throw new Error('Method not implemented.');
3381  }
3382
3383  restoreId(value: number): this {
3384    if (typeof value !== 'number') {
3385      modifierWithKey(this._modifiersWithKeys, RestoreIdModifier.identity, RestoreIdModifier, undefined);
3386    } else {
3387      modifierWithKey(this._modifiersWithKeys, RestoreIdModifier.identity, RestoreIdModifier, value);
3388    }
3389    return this;
3390  }
3391
3392  onVisibleAreaChange(ratios: Array<number>, event: (isVisible: boolean, currentRatio: number) => void): this {
3393    throw new Error('Method not implemented.');
3394  }
3395
3396  sphericalEffect(value: number): this {
3397    modifierWithKey(this._modifiersWithKeys, SphericalEffectModifier.identity, SphericalEffectModifier, value);
3398    return this;
3399  }
3400
3401  lightUpEffect(value: number): this {
3402    modifierWithKey(this._modifiersWithKeys, LightUpEffectModifier.identity, LightUpEffectModifier, value);
3403    return this;
3404  }
3405
3406  pixelStretchEffect(options: PixelStretchEffectOptions): this {
3407    modifierWithKey(this._modifiersWithKeys, PixelStretchEffectModifier.identity, PixelStretchEffectModifier, options);
3408    return this;
3409  }
3410
3411  keyboardShortcut(value: string | FunctionKey, keys: Array<ModifierKey>, action?: () => void): this {
3412    let keyboardShortCut = new ArkKeyBoardShortCut();
3413    keyboardShortCut.value = value;
3414    keyboardShortCut.keys = keys;
3415    modifierWithKey(this._modifiersWithKeys, KeyBoardShortCutModifier.identity, KeyBoardShortCutModifier, keyboardShortCut);
3416    return this;
3417  }
3418
3419  accessibilityGroup(value: boolean): this {
3420    if (typeof value === 'boolean') {
3421      modifierWithKey(this._modifiersWithKeys, AccessibilityGroupModifier.identity, AccessibilityGroupModifier, value);
3422    } else {
3423      modifierWithKey(this._modifiersWithKeys, AccessibilityGroupModifier.identity, AccessibilityGroupModifier, undefined);
3424
3425    }
3426    return this;
3427  }
3428
3429  accessibilityText(value: string): this {
3430    if (typeof value === 'string') {
3431      modifierWithKey(this._modifiersWithKeys, AccessibilityTextModifier.identity, AccessibilityTextModifier, value);
3432    } else {
3433      modifierWithKey(this._modifiersWithKeys, AccessibilityTextModifier.identity, AccessibilityTextModifier, undefined);
3434    }
3435    return this;
3436  }
3437
3438  accessibilityDescription(value: string): this {
3439    if (typeof value !== 'string') {
3440      modifierWithKey(this._modifiersWithKeys, AccessibilityDescriptionModifier.identity, AccessibilityDescriptionModifier, undefined);
3441    } else {
3442      modifierWithKey(this._modifiersWithKeys, AccessibilityDescriptionModifier.identity, AccessibilityDescriptionModifier, value);
3443    }
3444    return this;
3445  }
3446
3447  accessibilityLevel(value: string): this {
3448    if (typeof value !== 'string') {
3449      modifierWithKey(this._modifiersWithKeys, AccessibilityLevelModifier.identity, AccessibilityLevelModifier, undefined);
3450    } else {
3451      modifierWithKey(this._modifiersWithKeys, AccessibilityLevelModifier.identity, AccessibilityLevelModifier, value);
3452    }
3453    return this;
3454  }
3455
3456  obscured(reasons: Array<ObscuredReasons>): this {
3457    modifierWithKey(this._modifiersWithKeys, ObscuredModifier.identity, ObscuredModifier, reasons);
3458    return this;
3459  }
3460
3461  reuseId(id: string): this {
3462    throw new Error('Method not implemented.');
3463  }
3464
3465  renderFit(fitMode: RenderFit): this {
3466    modifierWithKey(this._modifiersWithKeys, RenderFitModifier.identity, RenderFitModifier, fitMode);
3467    return this;
3468  }
3469
3470  attributeModifier(modifier: AttributeModifier<CommonAttribute>): this {
3471    return this;
3472  }
3473}
3474
3475const isNull = (val: any) => typeof val === 'object' && val === null;
3476const isArray = (val: any) => Array.isArray(val);
3477const isDate = (val: any) => val instanceof Date;
3478const isRegExp = (val: any) => val instanceof RegExp;
3479const isError = (val: any) => val instanceof Error;
3480const isFloat = (val: any) => Number.isFinite(val) && !Number.isInteger(val);
3481const isInteger = (val: any) => Number.isInteger(val);
3482const isNonEmptyMap = (val: any) => val instanceof Map && val.size > 0;
3483const isTruthyString = (val: any) => typeof val === 'string' && val.trim() !== '';
3484