• 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
25enum ModifierType {
26  ORIGIN = 0,
27  STATE = 1,
28  FRAME_NODE = 2,
29  EXPOSE_MODIFIER = 3,
30}
31
32type AttributeModifierWithKey = ModifierWithKey<number | string | boolean | object>;
33
34class ObservedMap {
35  private map_: Map<Symbol, AttributeModifierWithKey>;
36  private changeCallback: ((key: Symbol, value: AttributeModifierWithKey) => void) | undefined;
37  private isFrameNode_: boolean = false;
38
39  constructor() {
40    this.map_ = new Map();
41  }
42
43  public clear(): void {
44    this.map_.clear();
45  }
46
47  public delete(key: Symbol): boolean {
48    return this.map_.delete(key);
49  }
50
51  public forEach(callbackfn: (value: AttributeModifierWithKey, key: Symbol,
52    map: Map<Symbol, AttributeModifierWithKey>) => void, thisArg?: any): void {
53    this.map_.forEach(callbackfn, thisArg);
54  }
55  public get(key: Symbol): AttributeModifierWithKey | undefined {
56    return this.map_.get(key);
57  }
58  public has(key: Symbol): boolean {
59    return this.map_.has(key);
60  }
61  public set(key: Symbol, value: AttributeModifierWithKey): this {
62    const _a = this.changeCallback;
63    this.map_.set(key, value);
64    _a === null || _a === void 0 ? void 0 : _a(key, value);
65    return this;
66  }
67  public get size(): number {
68    return this.map_.size;
69  }
70  public entries(): IterableIterator<[Symbol, AttributeModifierWithKey]> {
71    return this.map_.entries();
72  }
73  public keys(): IterableIterator<Symbol> {
74    return this.map_.keys();
75  }
76  public values(): IterableIterator<AttributeModifierWithKey> {
77    return this.map_.values();
78  }
79  public [Symbol.iterator](): IterableIterator<[Symbol, AttributeModifierWithKey]> {
80    return this.map_.entries();
81  }
82  public get [Symbol.toStringTag](): string {
83    return 'ObservedMapTag';
84  }
85  public setOnChange(callback: (key: Symbol, value: AttributeModifierWithKey) => void): void {
86    if (this.changeCallback === undefined) {
87      this.changeCallback = callback;
88    }
89  }
90  public setFrameNode(isFrameNode: boolean): void {
91    this.isFrameNode_ = isFrameNode;
92  }
93  public isFrameNode(): boolean {
94    return this.isFrameNode_;
95  }
96}
97
98const UI_STATE_NORMAL = 0;
99const UI_STATE_PRESSED = 1;
100const UI_STATE_FOCUSED = 1 << 1;
101const UI_STATE_DISABLED = 1 << 2;
102const UI_STATE_SELECTED = 1 << 3;
103
104function applyUIAttributesInit(modifier: AttributeModifier<CommonAttribute>, nativeNode: KNode): void {
105  if (modifier.applyPressedAttribute == undefined && modifier.applyFocusedAttribute == undefined &&
106    modifier.applyDisabledAttribute == undefined && modifier.applySelectedAttribute == undefined) {
107    return;
108  }
109  let state = 0;
110  if (modifier.applyPressedAttribute !== undefined) {
111    state |= UI_STATE_PRESSED;
112  }
113  if (modifier.applyFocusedAttribute !== undefined) {
114    state |= UI_STATE_FOCUSED;
115  }
116  if (modifier.applyDisabledAttribute !== undefined) {
117    state |= UI_STATE_DISABLED;
118  }
119  if (modifier.applySelectedAttribute !== undefined) {
120    state |= UI_STATE_SELECTED;
121  }
122
123  getUINativeModule().setSupportedUIState(nativeNode, state);
124}
125
126function applyUIAttributes(modifier: AttributeModifier<CommonAttribute>, nativeNode: KNode, component: ArkComponent): void {
127  applyUIAttributesInit(modifier, nativeNode);
128  const currentUIState = getUINativeModule().getUIState(nativeNode);
129
130  if (modifier.applyNormalAttribute !== undefined) {
131    modifier.applyNormalAttribute(component);
132  }
133  if ((currentUIState & UI_STATE_PRESSED) && (modifier.applyPressedAttribute !== undefined)) {
134    modifier.applyPressedAttribute(component);
135  }
136  if ((currentUIState & UI_STATE_FOCUSED) && (modifier.applyFocusedAttribute !== undefined)) {
137    modifier.applyFocusedAttribute(component);
138  }
139  if ((currentUIState & UI_STATE_DISABLED) && (modifier.applyDisabledAttribute !== undefined)) {
140    modifier.applyDisabledAttribute(component);
141  }
142  if ((currentUIState & UI_STATE_SELECTED) && (modifier.applySelectedAttribute !== undefined)) {
143    modifier.applySelectedAttribute(component);
144  }
145}
146
147function isResource(variable: any): variable is Resource {
148  return (variable as Resource)?.bundleName !== undefined;
149}
150
151function isResourceEqual(stageValue: Resource, value: Resource): boolean {
152  return false;
153}
154function isBaseOrResourceEqual(stageValue: any, value: any): boolean {
155  if (isResource(stageValue) && isResource(value)) {
156    return isResourceEqual(stageValue, value);
157  } else if (!isResource(stageValue) && !isResource(value)) {
158    return (stageValue === value);
159  }
160  return false;
161}
162
163const SAFE_AREA_TYPE_NONE = 0;
164const SAFE_AREA_TYPE_SYSTEM = 1;
165const SAFE_AREA_TYPE_CUTOUT = 2;
166const SAFE_AREA_TYPE_KEYBOARD = 4;
167const SAFE_AREA_TYPE_ALL = 7;
168
169const SAFE_AREA_EDGE_NONE = 0;
170const SAFE_AREA_EDGE_TOP = 1;
171const SAFE_AREA_EDGE_BOTTOM = 2;
172const SAFE_AREA_EDGE_START = 4;
173const SAFE_AREA_EDGE_END = 8;
174const SAFE_AREA_EDGE_ALL = 15;
175
176const SAFE_AREA_TYPE_LIMIT = 3;
177const SAFE_AREA_EDGE_LIMIT = 4;
178const DIRECTION_RANGE = 3;
179
180type KNode = number | null
181
182interface Equable {
183  isEqual(value: Equable): boolean;
184}
185
186class ModifierWithKey<T extends number | string | boolean | object | Function> {
187  stageValue?: T;
188  value?: T;
189  constructor(value: T) {
190    this.stageValue = value;
191  }
192
193  applyStage(node: KNode, component?: ArkComponent): boolean {
194    if (this.stageValue === undefined || this.stageValue === null) {
195      this.value = this.stageValue;
196      this.applyPeer(node, true, component);
197      return true;
198    }
199    if (component && component._needDiff) {
200      const stageTypeInfo: string = typeof this.stageValue;
201      const valueTypeInfo: string = typeof this.value;
202      let different: boolean = false;
203      if (stageTypeInfo !== valueTypeInfo) {
204        different = true;
205      } else if (stageTypeInfo === 'number' || stageTypeInfo === 'string' || stageTypeInfo === 'boolean') {
206        different = (this.stageValue !== this.value);
207      } else {
208        different = this.checkObjectDiff();
209      }
210      if (different) {
211        this.value = this.stageValue;
212        this.applyPeer(node, false, component);
213      }
214    } else {
215      this.value = this.stageValue;
216      this.applyPeer(node, false, component);
217    }
218    return false;
219  }
220
221  applyStageImmediately(node: KNode, component?: ArkComponent): void {
222    this.value = this.stageValue;
223    if (this.stageValue === undefined || this.stageValue === null) {
224      this.applyPeer(node, true, component);
225      return;
226    }
227    this.applyPeer(node, false, component);
228  }
229
230  applyPeer(node: KNode, reset: boolean, component?: ArkComponent): void { }
231
232  checkObjectDiff(): boolean {
233    return true;
234  }
235}
236
237class BackgroundColorModifier extends ModifierWithKey<ResourceColor> {
238  constructor(value: ResourceColor) {
239    super(value);
240  }
241  static identity: Symbol = Symbol('backgroundColor');
242  applyPeer(node: KNode, reset: boolean): void {
243    if (reset) {
244      getUINativeModule().common.resetBackgroundColor(node);
245    } else {
246      getUINativeModule().common.setBackgroundColor(node, this.value);
247    }
248  }
249
250  checkObjectDiff(): boolean {
251    return !isBaseOrResourceEqual(this.stageValue, this.value);
252  }
253}
254
255class BindMenuModifier extends ModifierWithKey<ArkBindMenu> {
256  constructor(value: ArkBindMenu) {
257    super(value);
258  }
259  static identity: Symbol = Symbol('bindMenu');
260  applyPeer(node: KNode, reset: boolean): void {
261    if (reset) {
262      getUINativeModule().common.resetBindMenu(node);
263    } else {
264      getUINativeModule().common.setBindMenu(node, this.value.content, this.value.options);
265    }
266  }
267}
268
269class WidthModifier extends ModifierWithKey<Length> {
270  constructor(value: Length) {
271    super(value);
272  }
273  static identity: Symbol = Symbol('width');
274  applyPeer(node: KNode, reset: boolean): void {
275    if (reset) {
276      getUINativeModule().common.resetWidth(node);
277    } else {
278      getUINativeModule().common.setWidth(node, this.value);
279    }
280  }
281
282  checkObjectDiff(): boolean {
283    return !isBaseOrResourceEqual(this.stageValue, this.value);
284  }
285}
286
287class BorderWidthModifier extends ModifierWithKey<Length | EdgeWidths> {
288  constructor(value: Length | EdgeWidths | LocalizedEdgeWidths) {
289    super(value);
290  }
291  static identity: Symbol = Symbol('borderWidth');
292  applyPeer(node: KNode, reset: boolean): void {
293    if (reset) {
294      getUINativeModule().common.resetBorderWidth(node);
295    } else {
296      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
297        getUINativeModule().common.setBorderWidth(node, this.value, this.value, this.value, this.value);
298      } else {
299        if ((Object.keys(this.value).indexOf('start') >= 0) ||
300            (Object.keys(this.value).indexOf('end') >= 0)) {
301          getUINativeModule().common.setBorderWidth(node,
302            (this.value as LocalizedEdgeWidths).top,
303            (this.value as LocalizedEdgeWidths).end,
304            (this.value as LocalizedEdgeWidths).bottom,
305            (this.value as LocalizedEdgeWidths).start);
306        } else {
307          getUINativeModule().common.setBorderWidth(node,
308            (this.value as EdgeWidths).top,
309            (this.value as EdgeWidths).right,
310            (this.value as EdgeWidths).bottom,
311            (this.value as EdgeWidths).left);
312        }
313      }
314    }
315  }
316
317  checkObjectDiff(): boolean {
318    if (isResource(this.stageValue) && isResource(this.value)) {
319      return !isResourceEqual(this.stageValue, this.value);
320    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
321      if ((Object.keys(this.value).indexOf('start') >= 0) ||
322          (Object.keys(this.value).indexOf('end') >= 0)) {
323        return !((this.stageValue as LocalizedEdgeWidths).start === (this.value as LocalizedEdgeWidths).start &&
324          (this.stageValue as LocalizedEdgeWidths).end === (this.value as LocalizedEdgeWidths).end &&
325          (this.stageValue as LocalizedEdgeWidths).top === (this.value as LocalizedEdgeWidths).top &&
326          (this.stageValue as LocalizedEdgeWidths).bottom === (this.value as LocalizedEdgeWidths).bottom);
327      }
328      return !((this.stageValue as EdgeWidths).left === (this.value as EdgeWidths).left &&
329        (this.stageValue as EdgeWidths).right === (this.value as EdgeWidths).right &&
330        (this.stageValue as EdgeWidths).top === (this.value as EdgeWidths).top &&
331        (this.stageValue as EdgeWidths).bottom === (this.value as EdgeWidths).bottom);
332    } else {
333      return true;
334    }
335  }
336}
337
338class HeightModifier extends ModifierWithKey<Length> {
339  constructor(value: Length) {
340    super(value);
341  }
342  static identity: Symbol = Symbol('height');
343  applyPeer(node: KNode, reset: boolean): void {
344    if (reset) {
345      getUINativeModule().common.resetHeight(node);
346    } else {
347      getUINativeModule().common.setHeight(node, this.value);
348    }
349  }
350
351  checkObjectDiff(): boolean {
352    return !isBaseOrResourceEqual(this.stageValue, this.value);
353  }
354}
355
356class ChainModeifier extends ModifierWithKey<Length> {
357  constructor(value: Length) {
358    super(value);
359  }
360  static identity: Symbol = Symbol('chainMode');
361  applyPeer(node: KNode, reset: boolean): void {
362    if (reset) {
363      getUINativeModule().common.resetChainMode(node);
364    } else {
365      getUINativeModule().common.setChainMode(node, this.value.direction, this.value.style);
366    }
367  }
368
369  checkObjectDiff(): boolean {
370    return !isBaseOrResourceEqual(this.stageValue, this.value);
371  }
372}
373
374class BorderRadiusModifier extends ModifierWithKey<Length | BorderRadiuses | LocalizedBorderRadius> {
375  constructor(value: Length | BorderRadiuses | LocalizedBorderRadius) {
376    super(value);
377  }
378  static identity: Symbol = Symbol('borderRadius');
379  applyPeer(node: KNode, reset: boolean): void {
380    if (reset) {
381      getUINativeModule().common.resetBorderRadius(node);
382    } else {
383      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
384        getUINativeModule().common.setBorderRadius(node, this.value, this.value, this.value, this.value);
385      } else {
386        if ((Object.keys(this.value).indexOf('topStart') >= 0) ||
387            (Object.keys(this.value).indexOf('topEnd') >= 0) ||
388            (Object.keys(this.value).indexOf('bottomStart') >= 0) ||
389            (Object.keys(this.value).indexOf('bottomEnd') >= 0)) {
390          getUINativeModule().common.setBorderRadius(node,
391            (this.value as LocalizedBorderRadius).topStart,
392            (this.value as LocalizedBorderRadius).topEnd,
393            (this.value as LocalizedBorderRadius).bottomStart,
394            (this.value as LocalizedBorderRadius).bottomEnd);
395        } else {
396          getUINativeModule().common.setBorderRadius(node,
397            (this.value as BorderRadiuses).topLeft,
398            (this.value as BorderRadiuses).topRight,
399            (this.value as BorderRadiuses).bottomLeft,
400            (this.value as BorderRadiuses).bottomRight);
401        }
402      }
403    }
404  }
405
406  checkObjectDiff(): boolean {
407    if (isResource(this.stageValue) && isResource(this.value)) {
408      return !isResourceEqual(this.stageValue, this.value);
409    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
410      if ((Object.keys(this.value).indexOf('topStart') >= 0) ||
411          (Object.keys(this.value).indexOf('topEnd') >= 0) ||
412          (Object.keys(this.value).indexOf('bottomStart') >= 0) ||
413          (Object.keys(this.value).indexOf('bottomEnd') >= 0)) {
414        return !((this.stageValue as LocalizedBorderRadius).topStart === (this.value as LocalizedBorderRadius).topStart &&
415          (this.stageValue as LocalizedBorderRadius).topEnd === (this.value as LocalizedBorderRadius).topEnd &&
416          (this.stageValue as LocalizedBorderRadius).bottomStart === (this.value as LocalizedBorderRadius).bottomStart &&
417          (this.stageValue as LocalizedBorderRadius).bottomEnd === (this.value as LocalizedBorderRadius).bottomEnd);
418      }
419      return !((this.stageValue as BorderRadiuses).topLeft === (this.value as BorderRadiuses).topLeft &&
420        (this.stageValue as BorderRadiuses).topRight === (this.value as BorderRadiuses).topRight &&
421        (this.stageValue as BorderRadiuses).bottomLeft === (this.value as BorderRadiuses).bottomLeft &&
422        (this.stageValue as BorderRadiuses).bottomRight === (this.value as BorderRadiuses).bottomRight);
423    } else {
424      return true;
425    }
426  }
427}
428
429class PositionModifier extends ModifierWithKey<Position | Edges | LocalizedEdges> {
430  constructor(value: Position | Edges | LocalizedEdges) {
431    super(value);
432  }
433  static identity: Symbol = Symbol('position');
434  applyPeer(node: KNode, reset: boolean): void {
435    if (reset) {
436      getUINativeModule().common.resetPosition(node);
437    } else {
438      if (isUndefined(this.value)) {
439        getUINativeModule().common.resetPosition(node);
440      } else if (('x' in this.value) || ('y' in this.value)) {
441        getUINativeModule().common.setPosition(node, false, this.value.x, this.value.y);
442      } else if (('top' in this.value) || ('bottom' in this.value) || ('left' in this.value) || ('start' in this.value) || ('right' in this.value) || ('end' in this.value)) {
443        if (('start' in this.value)) {
444          this.value.left = this.value.start;
445        }
446        if (('end' in this.value)) {
447          this.value.right = this.value.end;
448        }
449        getUINativeModule().common.setPosition(node, true, this.value.top, this.value.left, this.value.bottom, this.value.right);
450      } else {
451        getUINativeModule().common.resetPosition(node);
452      }
453    }
454  }
455
456  checkObjectDiff(): boolean {
457    return !isBaseOrResourceEqual(this.stageValue.x, this.value.x) ||
458      !isBaseOrResourceEqual(this.stageValue.y, this.value.y) ||
459      !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
460      !isBaseOrResourceEqual(this.stageValue.left, this.value.left) ||
461      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
462      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
463      !isBaseOrResourceEqual(this.stageValue.start, this.value.start) ||
464      !isBaseOrResourceEqual(this.stageValue.end, this.value.end);
465  }
466}
467
468class BorderColorModifier extends ModifierWithKey<ResourceColor | EdgeColors | LocalizedEdgeColors> {
469  constructor(value: ResourceColor | EdgeColors | LocalizedEdgeColors) {
470    super(value);
471  }
472  static identity: Symbol = Symbol('borderColor');
473  applyPeer(node: KNode, reset: boolean): void {
474    if (reset) {
475      getUINativeModule().common.resetBorderColor(node);
476    } else {
477      const valueType: string = typeof this.value;
478      if (valueType === 'number' || valueType === 'string' || isResource(this.value)) {
479        getUINativeModule().common.setBorderColor(node, this.value, this.value, this.value, this.value);
480      } else {
481        if ((Object.keys(this.value).indexOf('start') >= 0) ||
482            (Object.keys(this.value).indexOf('end') >= 0)) {
483          getUINativeModule().common.setBorderColor(node,
484            (this.value as LocalizedEdgeColors).top,
485            (this.value as LocalizedEdgeColors).end,
486            (this.value as LocalizedEdgeColors).bottom,
487            (this.value as LocalizedEdgeColors).start,
488            true);
489        } else {
490          getUINativeModule().common.setBorderColor(node,
491            (this.value as EdgeColors).top,
492            (this.value as EdgeColors).right,
493            (this.value as EdgeColors).bottom,
494            (this.value as EdgeColors).left,
495            false);
496        }
497      }
498
499    }
500  }
501
502  checkObjectDiff(): boolean {
503    if (isResource(this.stageValue) && isResource(this.value)) {
504      return !isResourceEqual(this.stageValue, this.value);
505    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
506      if ((Object.keys(this.value).indexOf('start') >= 0) ||
507          (Object.keys(this.value).indexOf('end') >= 0)) {
508        return !((this.stageValue as LocalizedEdgeColors).start === (this.value as LocalizedEdgeColors).start &&
509          (this.stageValue as LocalizedEdgeColors).end === (this.value as LocalizedEdgeColors).end &&
510          (this.stageValue as LocalizedEdgeColors).top === (this.value as LocalizedEdgeColors).top &&
511          (this.stageValue as LocalizedEdgeColors).bottom === (this.value as LocalizedEdgeColors).bottom);
512      }
513      return !((this.stageValue as EdgeColors).left === (this.value as EdgeColors).left &&
514        (this.stageValue as EdgeColors).right === (this.value as EdgeColors).right &&
515        (this.stageValue as EdgeColors).top === (this.value as EdgeColors).top &&
516        (this.stageValue as EdgeColors).bottom === (this.value as EdgeColors).bottom);
517    } else {
518      return true;
519    }
520  }
521}
522
523interface Matrix {
524  matrix4x4: []
525}
526
527
528class TransformModifier extends ModifierWithKey<object> {
529  constructor(value: object) {
530    super(value);
531  }
532  static identity: Symbol = Symbol('transform');
533  applyPeer(node: KNode, reset: boolean): void {
534    if (reset) {
535      getUINativeModule().common.resetTransform(node);
536    } else {
537      getUINativeModule().common.setTransform(node, (this.value as Matrix).matrix4x4);
538    }
539  }
540  checkObjectDiff(): boolean {
541    return !deepCompareArrays((this.stageValue as Matrix).matrix4x4, (this.value as Matrix).matrix4x4);
542  }
543}
544
545class BorderStyleModifier extends ModifierWithKey<BorderStyle | EdgeStyles> {
546  constructor(value: BorderStyle | EdgeStyles) {
547    super(value);
548  }
549  static identity: Symbol = Symbol('borderStyle');
550  applyPeer(node: KNode, reset: boolean): void {
551    if (reset) {
552      getUINativeModule().common.resetBorderStyle(node);
553    } else {
554      let type: boolean;
555      let style: BorderStyle;
556      let top: BorderStyle;
557      let right: BorderStyle;
558      let bottom: BorderStyle;
559      let left: BorderStyle;
560      if (isNumber(this.value)) {
561        style = this.value as BorderStyle;
562        type = true;
563      } else if (isObject(this.value)) {
564        top = (this.value as EdgeStyles)?.top;
565        right = (this.value as EdgeStyles)?.right;
566        bottom = (this.value as EdgeStyles)?.bottom;
567        left = (this.value as EdgeStyles)?.left;
568        type = true;
569      }
570      if (type === true) {
571        getUINativeModule().common.setBorderStyle(node, type, style, top, right, bottom, left);
572      } else {
573        getUINativeModule().common.resetBorderStyle(node);
574      }
575    }
576  }
577  checkObjectDiff(): boolean {
578    return !((this.value as EdgeStyles)?.top === (this.stageValue as EdgeStyles)?.top &&
579      (this.value as EdgeStyles)?.right === (this.stageValue as EdgeStyles)?.right &&
580      (this.value as EdgeStyles)?.bottom === (this.stageValue as EdgeStyles)?.bottom &&
581      (this.value as EdgeStyles)?.left === (this.stageValue as EdgeStyles)?.left);
582  }
583}
584
585class ShadowModifier extends ModifierWithKey<ShadowOptions | ShadowStyle> {
586  constructor(value: ShadowOptions | ShadowStyle) {
587    super(value);
588  }
589  static identity: Symbol = Symbol('shadow');
590  applyPeer(node: KNode, reset: boolean): void {
591    if (reset) {
592      getUINativeModule().common.resetShadow(node);
593    } else {
594      if (isNumber(this.value)) {
595        getUINativeModule().common.setShadow(node, this.value, undefined, undefined, undefined, undefined, undefined, undefined);
596      } else {
597        getUINativeModule().common.setShadow(node, undefined,
598          (this.value as ShadowOptions).radius,
599          (this.value as ShadowOptions).type,
600          (this.value as ShadowOptions).color,
601          (this.value as ShadowOptions).offsetX,
602          (this.value as ShadowOptions).offsetY,
603          (this.value as ShadowOptions).fill);
604      }
605    }
606  }
607
608  checkObjectDiff(): boolean {
609    return !((this.stageValue as ShadowOptions).radius === (this.value as ShadowOptions).radius &&
610      (this.stageValue as ShadowOptions).type === (this.value as ShadowOptions).type &&
611      (this.stageValue as ShadowOptions).color === (this.value as ShadowOptions).color &&
612      (this.stageValue as ShadowOptions).offsetX === (this.value as ShadowOptions).offsetX &&
613      (this.stageValue as ShadowOptions).offsetY === (this.value as ShadowOptions).offsetY &&
614      (this.stageValue as ShadowOptions).fill === (this.value as ShadowOptions).fill);
615  }
616}
617
618class HitTestBehaviorModifier extends ModifierWithKey<number> {
619  constructor(value: number) {
620    super(value);
621  }
622  static identity: Symbol = Symbol('hitTestBehavior');
623  applyPeer(node: KNode, reset: boolean): void {
624    if (reset) {
625      getUINativeModule().common.resetHitTestBehavior(node);
626    } else {
627      getUINativeModule().common.setHitTestBehavior(node, this.value);
628    }
629  }
630}
631
632class ZIndexModifier extends ModifierWithKey<number> {
633  constructor(value: number) {
634    super(value);
635  }
636  static identity: Symbol = Symbol('zIndex');
637  applyPeer(node: KNode, reset: boolean): void {
638    if (reset) {
639      getUINativeModule().common.resetZIndex(node);
640    } else {
641      getUINativeModule().common.setZIndex(node, this.value);
642    }
643  }
644}
645
646class OpacityModifier extends ModifierWithKey<number | Resource> {
647  constructor(value: number | Resource) {
648    super(value);
649  }
650  static identity: Symbol = Symbol('opacity');
651  applyPeer(node: KNode, reset: boolean): void {
652    if (reset) {
653      getUINativeModule().common.resetOpacity(node);
654    } else {
655      getUINativeModule().common.setOpacity(node, this.value);
656    }
657  }
658
659  checkObjectDiff(): boolean {
660    return !isBaseOrResourceEqual(this.stageValue, this.value);
661  }
662}
663
664class AlignModifier extends ModifierWithKey<number> {
665  constructor(value: number) {
666    super(value);
667  }
668  static identity: Symbol = Symbol('align');
669  applyPeer(node: KNode, reset: boolean): void {
670    if (reset) {
671      getUINativeModule().common.resetAlign(node);
672    } else {
673      getUINativeModule().common.setAlign(node, this.value);
674    }
675  }
676}
677
678class BackdropBlurModifier extends ModifierWithKey<ArkBlurOptions> {
679  constructor(value: ArkBlurOptions) {
680    super(value);
681  }
682  static identity: Symbol = Symbol('backdropBlur');
683  applyPeer(node: KNode, reset: boolean): void {
684    if (reset) {
685      getUINativeModule().common.resetBackdropBlur(node);
686    } else {
687      getUINativeModule().common.setBackdropBlur(node, this.value.value, this.value.options?.grayscale);
688    }
689  }
690  checkObjectDiff(): boolean {
691    return !((this.stageValue.value === this.value.value) &&
692      (this.stageValue.options === this.value.options));
693  }
694}
695
696class HueRotateModifier extends ModifierWithKey<number | string> {
697  constructor(value: number | string) {
698    super(value);
699  }
700  static identity: Symbol = Symbol('hueRotate');
701  applyPeer(node: KNode, reset: boolean): void {
702    if (reset) {
703      getUINativeModule().common.resetHueRotate(node);
704    } else {
705      getUINativeModule().common.setHueRotate(node, this.value);
706    }
707  }
708}
709
710class InvertModifier extends ModifierWithKey<number | InvertOptions> {
711  constructor(value: number | InvertOptions) {
712    super(value);
713  }
714  static identity: Symbol = Symbol('invert');
715  applyPeer(node: KNode, reset: boolean): void {
716    if (reset) {
717      getUINativeModule().common.resetInvert(node);
718    } else {
719      if (isNumber(this.value)) {
720        getUINativeModule().common.setInvert(node, this.value, undefined, undefined, undefined, undefined);
721      } else {
722        getUINativeModule().common.setInvert(node, undefined,
723          (this.value as InvertOptions).low,
724          (this.value as InvertOptions).high,
725          (this.value as InvertOptions).threshold,
726          (this.value as InvertOptions).thresholdRange);
727      }
728    }
729  }
730  checkObjectDiff(): boolean {
731    return !((this.stageValue as InvertOptions).high === (this.value as InvertOptions).high &&
732      (this.stageValue as InvertOptions).low === (this.value as InvertOptions).low &&
733      (this.stageValue as InvertOptions).threshold === (this.value as InvertOptions).threshold &&
734      (this.stageValue as InvertOptions).thresholdRange === (this.value as InvertOptions).thresholdRange);
735  }
736}
737
738class SepiaModifier extends ModifierWithKey<number> {
739  constructor(value: number) {
740    super(value);
741  }
742  static identity: Symbol = Symbol('sepia');
743  applyPeer(node: KNode, reset: boolean): void {
744    if (reset) {
745      getUINativeModule().common.resetSepia(node);
746    } else {
747      getUINativeModule().common.setSepia(node, this.value);
748    }
749  }
750}
751
752class SaturateModifier extends ModifierWithKey<number> {
753  constructor(value: number) {
754    super(value);
755  }
756  static identity: Symbol = Symbol('saturate');
757  applyPeer(node: KNode, reset: boolean): void {
758    if (reset) {
759      getUINativeModule().common.resetSaturate(node);
760    } else {
761      getUINativeModule().common.setSaturate(node, this.value);
762    }
763  }
764}
765
766class ColorBlendModifier extends ModifierWithKey<Color | string | Resource> {
767  constructor(value: Color | string | Resource) {
768    super(value);
769  }
770  static identity: Symbol = Symbol('colorBlend');
771  applyPeer(node: KNode, reset: boolean): void {
772    if (reset) {
773      getUINativeModule().common.resetColorBlend(node);
774    } else {
775      getUINativeModule().common.setColorBlend(node, this.value);
776    }
777  }
778
779  checkObjectDiff(): boolean {
780    return !isBaseOrResourceEqual(this.stageValue, this.value);
781  }
782}
783
784class GrayscaleModifier extends ModifierWithKey<number> {
785  constructor(value: number) {
786    super(value);
787  }
788  static identity: Symbol = Symbol('grayscale');
789  applyPeer(node: KNode, reset: boolean): void {
790    if (reset) {
791      getUINativeModule().common.resetGrayscale(node);
792    } else {
793      getUINativeModule().common.setGrayscale(node, this.value);
794    }
795  }
796}
797
798class ContrastModifier extends ModifierWithKey<number> {
799  constructor(value: number) {
800    super(value);
801  }
802  static identity: Symbol = Symbol('contrast');
803  applyPeer(node: KNode, reset: boolean): void {
804    if (reset) {
805      getUINativeModule().common.resetContrast(node);
806    } else {
807      getUINativeModule().common.setContrast(node, this.value);
808    }
809  }
810}
811
812class BrightnessModifier extends ModifierWithKey<number> {
813  constructor(value: number) {
814    super(value);
815  }
816  static identity: Symbol = Symbol('brightness');
817  applyPeer(node: KNode, reset: boolean): void {
818    if (reset) {
819      getUINativeModule().common.resetBrightness(node);
820    } else {
821      getUINativeModule().common.setBrightness(node, this.value);
822    }
823  }
824}
825
826class BlurModifier extends ModifierWithKey<ArkBlurOptions> {
827  constructor(value: ArkBlurOptions) {
828    super(value);
829  }
830  static identity: Symbol = Symbol('blur');
831  applyPeer(node: KNode, reset: boolean): void {
832    if (reset) {
833      getUINativeModule().common.resetBlur(node);
834    } else {
835      getUINativeModule().common.setBlur(node, this.value.value, this.value.options?.grayscale);
836    }
837  }
838  checkObjectDiff(): boolean {
839    return !((this.stageValue.value === this.value.value) &&
840      (this.stageValue.options === this.value.options));
841  }
842}
843
844class LinearGradientModifier extends ModifierWithKey<{
845  angle?: number | string;
846  direction?: GradientDirection; colors: Array<any>; repeating?: boolean;
847}> {
848  constructor(value: {
849    angle?: number | string; direction?: GradientDirection;
850    colors: Array<any>; repeating?: boolean;
851  }) {
852    super(value);
853  }
854  static identity: Symbol = Symbol('linearGradient');
855  applyPeer(node: KNode, reset: boolean): void {
856    if (reset) {
857      getUINativeModule().common.resetLinearGradient(node);
858    } else {
859      getUINativeModule().common.setLinearGradient(node,
860        this.value.angle, this.value.direction,
861        this.value.colors, this.value.repeating);
862    }
863  }
864  checkObjectDiff(): boolean {
865    return !((this.stageValue.angle === this.value.angle) &&
866      (this.stageValue.direction === this.value.direction) &&
867      (this.stageValue.colors === this.value.colors) &&
868      (this.stageValue.repeating === this.value.repeating));
869  }
870}
871
872class RadialGradientModifier extends ModifierWithKey<{ center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }> {
873  constructor(value: { center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }) {
874    super(value);
875  }
876  static identity: Symbol = Symbol('radialGradient');
877  applyPeer(node: KNode, reset: boolean): void {
878    if (reset) {
879      getUINativeModule().common.resetRadialGradient(node);
880    } else {
881      getUINativeModule().common.setRadialGradient(node,
882        this.value.center, this.value.radius, this.value.colors, this.value.repeating);
883    }
884  }
885  checkObjectDiff(): boolean {
886    return !((this.stageValue.center === this.value.center) &&
887      (this.stageValue.radius === this.value.radius) &&
888      (this.stageValue.colors === this.value.colors) &&
889      (this.stageValue.repeating === this.value.repeating));
890  }
891}
892
893class SweepGradientModifier extends ModifierWithKey<{
894  center: Array<any>; start?: number |
895  string; end?: number | string; rotation?: number | string;
896  colors: Array<any>; repeating?: boolean;
897}> {
898  constructor(value: {
899    center: Array<any>;
900    start?: number | string; end?: number | string;
901    rotation?: number | string; colors: Array<any>; repeating?: boolean;
902  }) {
903    super(value);
904  }
905  static identity: Symbol = Symbol('sweepGradient');
906  applyPeer(node: KNode, reset: boolean): void {
907    if (reset) {
908      getUINativeModule().common.resetSweepGradient(node);
909    } else {
910      getUINativeModule().common.setSweepGradient(node,
911        this.value.center,
912        this.value.start, this.value.end, this.value.rotation,
913        this.value.colors, this.value.repeating);
914    }
915  }
916  checkObjectDiff(): boolean {
917    return !((this.stageValue.center === this.value.center) &&
918      (this.stageValue.start === this.value.start) &&
919      (this.stageValue.end === this.value.end) &&
920      (this.stageValue.rotation === this.value.rotation) &&
921      (this.stageValue.colors === this.value.colors) &&
922      (this.stageValue.repeating === this.value.repeating));
923  }
924}
925
926class OverlayModifier extends ModifierWithKey<ArkOverlay> {
927  constructor(value: ArkOverlay) {
928    super(value);
929  }
930  static identity: Symbol = Symbol('overlay');
931  applyPeer(node: KNode, reset: boolean): void {
932    if (reset) {
933      getUINativeModule().common.resetOverlay(node);
934    } else {
935      getUINativeModule().common.setOverlay(node,
936        this.value.value, this.value.align,
937        this.value.offsetX, this.value.offsetY,
938        this.value.hasOptions, this.value.hasOffset);
939    }
940  }
941  checkObjectDiff(): boolean {
942    if (isUndefined(this.value)) {
943      return !isUndefined(this.stageValue);
944    }
945    return this.value.checkObjectDiff(this.stageValue);
946  }
947}
948
949class BorderImageModifier extends ModifierWithKey<BorderImageOption> {
950  constructor(value: BorderImageOption) {
951    super(value);
952  }
953  static identity: Symbol = Symbol('borderImage');
954  applyPeer(node: KNode, reset: boolean): void {
955    if (reset) {
956      getUINativeModule().common.resetBorderImage(node);
957    } else {
958      let sliceTop: Length | undefined;
959      let sliceRight: Length | undefined;
960      let sliceBottom: Length | undefined;
961      let sliceLeft: Length | undefined;
962      let repeat: RepeatMode | undefined;
963      let source: string | Resource | LinearGradient | undefined;
964      let sourceAngle: number | string | undefined;
965      let sourceDirection: GradientDirection | undefined;
966      let sourceColors: Array<any> | undefined;
967      let sourceRepeating: boolean | undefined;
968      let widthTop: Length | undefined;
969      let widthRight: Length | undefined;
970      let widthBottom: Length | undefined;
971      let widthLeft: Length | undefined;
972      let outsetTop: Length | undefined;
973      let outsetRight: Length | undefined;
974      let outsetBottom: Length | undefined;
975      let outsetLeft: Length | undefined;
976      let fill: boolean | undefined;
977
978      if (!isUndefined(this.value.slice)) {
979        if (isLengthType(this.value.slice) || isResource(this.value.slice)) {
980          let tmpSlice = this.value.slice as Length;
981          sliceTop = tmpSlice;
982          sliceRight = tmpSlice;
983          sliceBottom = tmpSlice;
984          sliceLeft = tmpSlice;
985        } else {
986          let tmpSlice = this.value.slice as EdgeWidths;
987          sliceTop = tmpSlice.top;
988          sliceRight = tmpSlice.right;
989          sliceBottom = tmpSlice.bottom;
990          sliceLeft = tmpSlice.left;
991        }
992      }
993      repeat = this.value.repeat;
994      if (!isUndefined(this.value.source)) {
995        if (isString(this.value.source) || isResource(this.value.source)) {
996          source = this.value.source;
997        } else {
998          let tmpSource = this.value.source as LinearGradient;
999          sourceAngle = tmpSource.angle;
1000          sourceDirection = tmpSource.direction;
1001          sourceColors = tmpSource.colors;
1002          sourceRepeating = tmpSource.repeating;
1003        }
1004      }
1005      if (!isUndefined(this.value.width)) {
1006        if (isLengthType(this.value.width) || isResource(this.value.width)) {
1007          let tmpWidth = this.value.width as Length;
1008          widthTop = tmpWidth;
1009          widthRight = tmpWidth;
1010          widthBottom = tmpWidth;
1011          widthLeft = tmpWidth;
1012        } else {
1013          let tmpWidth = this.value.width as EdgeWidths;
1014          widthTop = tmpWidth.top;
1015          widthRight = tmpWidth.right;
1016          widthBottom = tmpWidth.bottom;
1017          widthLeft = tmpWidth.left;
1018        }
1019      }
1020      if (!isUndefined(this.value.outset)) {
1021        if (isLengthType(this.value.outset) || isResource(this.value.outset)) {
1022          let tmpOutset = this.value.outset as Length;
1023          outsetTop = tmpOutset;
1024          outsetRight = tmpOutset;
1025          outsetBottom = tmpOutset;
1026          outsetLeft = tmpOutset;
1027        } else {
1028          let tmpOutset = this.value.outset as EdgeWidths;
1029          outsetTop = tmpOutset.top;
1030          outsetRight = tmpOutset.right;
1031          outsetBottom = tmpOutset.bottom;
1032          outsetLeft = tmpOutset.left;
1033        }
1034      }
1035      fill = this.value.fill;
1036      getUINativeModule().common.setBorderImage(node,
1037        sliceTop, sliceRight, sliceBottom, sliceLeft,
1038        repeat,
1039        source, sourceAngle, sourceDirection, sourceColors, sourceRepeating,
1040        widthTop, widthRight, widthBottom, widthLeft,
1041        outsetTop, outsetRight, outsetBottom, outsetLeft,
1042        fill);
1043    }
1044  }
1045}
1046
1047class BorderModifier extends ModifierWithKey<ArkBorder> {
1048  constructor(value: ArkBorder) {
1049    super(value);
1050  }
1051  static identity: Symbol = Symbol('border');
1052  applyPeer(node: KNode, reset: boolean): void {
1053    if (reset) {
1054      getUINativeModule().common.resetBorder(node);
1055    } else {
1056      let isLocalizedBorderWidth;
1057      let isLocalizedBorderColor;
1058      let isLocalizedBorderRadius;
1059      if ((Object.keys(this.value.arkWidth).indexOf('start') >= 0 && isUndefined(this.value.arkWidth.start)) ||
1060        (Object.keys(this.value.arkWidth).indexOf('end') >= 0 && isUndefined(this.value.arkWidth.end))) {
1061        isLocalizedBorderWidth = true;
1062      } else {
1063        isLocalizedBorderWidth = false;
1064      }
1065      if ((Object.keys(this.value.arkColor).indexOf('startColor') >= 0 && isUndefined(this.value.arkColor.startColor)) ||
1066        (Object.keys(this.value.arkColor).indexOf('endColor') >= 0 && isUndefined(this.value.arkColor.endColor))) {
1067        isLocalizedBorderColor = true;
1068      } else {
1069        isLocalizedBorderColor = false;
1070      }
1071      if ((Object.keys(this.value.arkRadius).indexOf('topStart') >= 0 && isUndefined(this.value.arkRadius.topStart)) ||
1072        (Object.keys(this.value.arkRadius).indexOf('topEnd') >= 0 && isUndefined(this.value.arkRadius.topEnd)) ||
1073        (Object.keys(this.value.arkRadius).indexOf('bottomStart') >= 0 && isUndefined(this.value.arkRadius.bottomStart)) ||
1074        (Object.keys(this.value.arkRadius).indexOf('bottomEnd') >= 0 && isUndefined(this.value.arkRadius.bottomEnd))) {
1075        isLocalizedBorderRadius = true;
1076      } else {
1077        isLocalizedBorderRadius = false;
1078      }
1079      getUINativeModule().common.setBorderWithDashParams(node,
1080        this.value.arkWidth.left, this.value.arkWidth.right, this.value.arkWidth.top, this.value.arkWidth.bottom,
1081        this.value.arkColor.leftColor, this.value.arkColor.rightColor, this.value.arkColor.topColor, this.value.arkColor.bottomColor,
1082        this.value.arkRadius.topLeft, this.value.arkRadius.topRight, this.value.arkRadius.bottomLeft, this.value.arkRadius.bottomRight,
1083        this.value.arkStyle.top, this.value.arkStyle.right, this.value.arkStyle.bottom, this.value.arkStyle.left,
1084        this.value.arkDashGap.left, this.value.arkDashGap.right, this.value.arkDashGap.top, this.value.arkDashGap.bottom,
1085        this.value.arkDashWidth.left, this.value.arkDashWidth.right, this.value.arkDashWidth.top, this.value.arkDashWidth.bottom,
1086        this.value.arkWidth.start, this.value.arkWidth.end, this.value.arkColor.startColor, this.value.arkColor.endColor,
1087        this.value.arkRadius.topStart, this.value.arkRadius.topEnd, this.value.arkRadius.bottomStart, this.value.arkRadius.bottomEnd,
1088        isLocalizedBorderWidth, isLocalizedBorderColor, isLocalizedBorderRadius,
1089        this.value.arkDashGap.start, this.value.arkDashGap.end, this.value.arkDashWidth.start, this.value.arkDashWidth.end
1090      );
1091    }
1092  }
1093
1094  checkObjectDiff(): boolean {
1095    return this.value.checkObjectDiff(this.stageValue);
1096  }
1097}
1098
1099class OutlineColorModifier extends ModifierWithKey<ResourceColor | EdgeColors> {
1100  constructor(value: ResourceColor | EdgeColors) {
1101    super(value);
1102  }
1103  static identity: Symbol = Symbol('outlineColor');
1104  applyPeer(node: KNode, reset: boolean): void {
1105    if (reset) {
1106      getUINativeModule().common.resetOutlineColor(node);
1107    } else {
1108      const valueType: string = typeof this.value;
1109      if (valueType === 'number' || valueType === 'string' || isResource(this.value)) {
1110        getUINativeModule().common.setOutlineColor(node, this.value, this.value, this.value, this.value);
1111      } else {
1112        getUINativeModule().common.setOutlineColor(node, (this.value as EdgeColors).left,
1113          (this.value as EdgeColors).right, (this.value as EdgeColors).top,
1114          (this.value as EdgeColors).bottom);
1115      }
1116    }
1117  }
1118
1119  checkObjectDiff(): boolean {
1120    if (isResource(this.stageValue) && isResource(this.value)) {
1121      return !isResourceEqual(this.stageValue, this.value);
1122    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
1123      return !((this.stageValue as EdgeColors).left === (this.value as EdgeColors).left &&
1124        (this.stageValue as EdgeColors).right === (this.value as EdgeColors).right &&
1125        (this.stageValue as EdgeColors).top === (this.value as EdgeColors).top &&
1126        (this.stageValue as EdgeColors).bottom === (this.value as EdgeColors).bottom);
1127    } else {
1128      return true;
1129    }
1130  }
1131}
1132
1133class OutlineRadiusModifier extends ModifierWithKey<Dimension | OutlineRadiuses> {
1134  constructor(value: Dimension | OutlineRadiuses) {
1135    super(value);
1136  }
1137  static identity: Symbol = Symbol('outlineRadius');
1138  applyPeer(node: KNode, reset: boolean): void {
1139    if (reset) {
1140      getUINativeModule().common.resetOutlineRadius(node);
1141    } else {
1142      const valueType: string = typeof this.value;
1143      if (valueType === 'number' || valueType === 'string' || isResource(this.value)) {
1144        getUINativeModule().common.setOutlineRadius(node, this.value, this.value, this.value, this.value);
1145      } else {
1146        getUINativeModule().common.setOutlineRadius(node, (this.value as OutlineRadiuses).topLeft,
1147          (this.value as OutlineRadiuses).topRight, (this.value as OutlineRadiuses).bottomLeft,
1148          (this.value as OutlineRadiuses).bottomRight);
1149      }
1150    }
1151  }
1152  checkObjectDiff(): boolean {
1153    if (isResource(this.stageValue) && isResource(this.value)) {
1154      return !isResourceEqual(this.stageValue, this.value);
1155    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
1156      return !((this.stageValue as BorderRadiuses).topLeft === (this.value as BorderRadiuses).topLeft &&
1157        (this.stageValue as BorderRadiuses).topRight === (this.value as BorderRadiuses).topRight &&
1158        (this.stageValue as BorderRadiuses).bottomLeft === (this.value as BorderRadiuses).bottomLeft &&
1159        (this.stageValue as BorderRadiuses).bottomRight === (this.value as BorderRadiuses).bottomRight);
1160    } else {
1161      return true;
1162    }
1163  }
1164}
1165
1166class OutlineStyleModifier extends ModifierWithKey<OutlineStyle | EdgeOutlineStyles> {
1167  constructor(value: OutlineStyle | EdgeOutlineStyles) {
1168    super(value);
1169  }
1170  static identity: Symbol = Symbol('outlineStyle');
1171  applyPeer(node: KNode, reset: boolean): void {
1172    if (reset) {
1173      getUINativeModule().common.resetOutlineStyle(node);
1174    } else {
1175      if (isNumber(this.value)) {
1176        getUINativeModule().common.setOutlineStyle(node, this.value, this.value, this.value, this.value);
1177      } else {
1178        getUINativeModule().common.setOutlineStyle(node,
1179          (this.value as EdgeOutlineStyles).top,
1180          (this.value as EdgeOutlineStyles).right,
1181          (this.value as EdgeOutlineStyles).bottom,
1182          (this.value as EdgeOutlineStyles).left);
1183      }
1184    }
1185  }
1186  checkObjectDiff(): boolean {
1187    return !((this.value as EdgeOutlineStyles).top === (this.stageValue as EdgeOutlineStyles).top &&
1188      (this.value as EdgeOutlineStyles).right === (this.stageValue as EdgeOutlineStyles).right &&
1189      (this.value as EdgeOutlineStyles).bottom === (this.stageValue as EdgeOutlineStyles).bottom &&
1190      (this.value as EdgeOutlineStyles).left === (this.stageValue as EdgeOutlineStyles).left);
1191  }
1192}
1193
1194class OutlineWidthModifier extends ModifierWithKey<Dimension | EdgeOutlineWidths> {
1195  constructor(value: Dimension | EdgeOutlineWidths) {
1196    super(value);
1197  }
1198  static identity: Symbol = Symbol('outlineWidth');
1199  applyPeer(node: KNode, reset: boolean): void {
1200    if (reset) {
1201      getUINativeModule().common.resetOutlineWidth(node);
1202    } else {
1203      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
1204        getUINativeModule().common.setOutlineWidth(node, this.value, this.value, this.value, this.value);
1205      } else {
1206        getUINativeModule().common.setOutlineWidth(node,
1207          (this.value as EdgeOutlineWidths).left,
1208          (this.value as EdgeOutlineWidths).right,
1209          (this.value as EdgeOutlineWidths).top,
1210          (this.value as EdgeOutlineWidths).bottom);
1211      }
1212    }
1213  }
1214
1215  checkObjectDiff(): boolean {
1216    if (isResource(this.stageValue) && isResource(this.value)) {
1217      return !isResourceEqual(this.stageValue, this.value);
1218    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
1219      return !((this.stageValue as EdgeOutlineWidths).left === (this.value as EdgeOutlineWidths).left &&
1220        (this.stageValue as EdgeOutlineWidths).right === (this.value as EdgeOutlineWidths).right &&
1221        (this.stageValue as EdgeOutlineWidths).top === (this.value as EdgeOutlineWidths).top &&
1222        (this.stageValue as EdgeOutlineWidths).bottom === (this.value as EdgeOutlineWidths).bottom);
1223    } else {
1224      return true;
1225    }
1226  }
1227}
1228
1229class OutlineModifier extends ModifierWithKey<OutlineOptions> {
1230  constructor(value: OutlineOptions) {
1231    super(value);
1232  }
1233  static identity: Symbol = Symbol('outline');
1234  applyPeer(node: KNode, reset: boolean): void {
1235    if (reset) {
1236      getUINativeModule().common.resetOutline(node);
1237    } else {
1238      let widthLeft;
1239      let widthRight;
1240      let widthTop;
1241      let widthBottom;
1242      if (!isUndefined(this.value.width) && this.value.width != null) {
1243        if (isNumber(this.value.width) || isString(this.value.width) || isResource(this.value.width)) {
1244          widthLeft = this.value.width;
1245          widthRight = this.value.width;
1246          widthTop = this.value.width;
1247          widthBottom = this.value.width;
1248        } else {
1249          widthLeft = (this.value.width as EdgeOutlineWidths).left;
1250          widthRight = (this.value.width as EdgeOutlineWidths).right;
1251          widthTop = (this.value.width as EdgeOutlineWidths).top;
1252          widthBottom = (this.value.width as EdgeOutlineWidths).bottom;
1253        }
1254      }
1255      let leftColor;
1256      let rightColor;
1257      let topColor;
1258      let bottomColor;
1259      if (!isUndefined(this.value.color) && this.value.color != null) {
1260        if (isNumber(this.value.color) || isString(this.value.color) || isResource(this.value.color)) {
1261          leftColor = this.value.color;
1262          rightColor = this.value.color;
1263          topColor = this.value.color;
1264          bottomColor = this.value.color;
1265        } else {
1266          leftColor = (this.value.color as EdgeColors).left;
1267          rightColor = (this.value.color as EdgeColors).right;
1268          topColor = (this.value.color as EdgeColors).top;
1269          bottomColor = (this.value.color as EdgeColors).bottom;
1270        }
1271      }
1272      let topLeft;
1273      let topRight;
1274      let bottomLeft;
1275      let bottomRight;
1276      if (!isUndefined(this.value.radius) && this.value.radius != null) {
1277        if (isNumber(this.value.radius) || isString(this.value.radius) || isResource(this.value.radius)) {
1278          topLeft = this.value.radius;
1279          topRight = this.value.radius;
1280          bottomLeft = this.value.radius;
1281          bottomRight = this.value.radius;
1282        } else {
1283          topLeft = (this.value.radius as OutlineRadiuses).topLeft;
1284          topRight = (this.value.radius as OutlineRadiuses).topRight;
1285          bottomLeft = (this.value.radius as OutlineRadiuses).bottomLeft;
1286          bottomRight = (this.value.radius as OutlineRadiuses).bottomRight;
1287        }
1288      }
1289      let styleTop;
1290      let styleRight;
1291      let styleBottom;
1292      let styleLeft;
1293      if (!isUndefined(this.value.style) && this.value.style != null) {
1294        if (isNumber(this.value.style) || isString(this.value.style) || isResource(this.value.style)) {
1295          styleTop = this.value.style;
1296          styleRight = this.value.style;
1297          styleBottom = this.value.style;
1298          styleLeft = this.value.style;
1299        } else {
1300          styleTop = (this.value.style as EdgeOutlineStyles).top;
1301          styleRight = (this.value.style as EdgeOutlineStyles).right;
1302          styleBottom = (this.value.style as EdgeOutlineStyles).bottom;
1303          styleLeft = (this.value.style as EdgeOutlineStyles).left;
1304        }
1305      }
1306      getUINativeModule().common.setOutline(node, widthLeft, widthRight, widthTop, widthBottom,
1307        leftColor, rightColor, topColor, bottomColor,
1308        topLeft, topRight, bottomLeft, bottomRight,
1309        styleTop, styleRight, styleBottom, styleLeft);
1310    }
1311  }
1312
1313  checkObjectDiff(): boolean {
1314    return !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
1315      !isBaseOrResourceEqual(this.stageValue.color, this.value.color) ||
1316      !isBaseOrResourceEqual(this.stageValue.radius, this.value.radius) ||
1317      !isBaseOrResourceEqual(this.stageValue.style, this.value.style);
1318  }
1319}
1320
1321class ForegroundBlurStyleModifier extends ModifierWithKey<ArkForegroundBlurStyle> {
1322  constructor(value: ArkForegroundBlurStyle) {
1323    super(value);
1324  }
1325  static identity: Symbol = Symbol('foregroundBlurStyle');
1326  applyPeer(node: KNode, reset: boolean): void {
1327    if (reset) {
1328      getUINativeModule().common.resetForegroundBlurStyle(node);
1329    } else {
1330      getUINativeModule().common.setForegroundBlurStyle(node,
1331        this.value.blurStyle, this.value.colorMode, this.value.adaptiveColor, this.value.scale,
1332          this.value.blurOptions?.grayscale);
1333    }
1334  }
1335
1336  checkObjectDiff(): boolean {
1337    return !((this.stageValue as ArkForegroundBlurStyle).blurStyle === (this.value as ArkForegroundBlurStyle).blurStyle &&
1338      (this.stageValue as ArkForegroundBlurStyle).colorMode === (this.value as ArkForegroundBlurStyle).colorMode &&
1339      (this.stageValue as ArkForegroundBlurStyle).adaptiveColor === (this.value as ArkForegroundBlurStyle).adaptiveColor &&
1340      (this.stageValue as ArkForegroundBlurStyle).scale === (this.value as ArkForegroundBlurStyle).scale &&
1341      (this.stageValue as ArkForegroundBlurStyle).blurOptions === (this.value as ArkForegroundBlurStyle).blurOptions);
1342  }
1343}
1344
1345class BackgroundImagePositionModifier extends ModifierWithKey<Position | Alignment> {
1346  constructor(value: Position | Alignment) {
1347    super(value);
1348  }
1349  static identity: Symbol = Symbol('backgroundImagePosition');
1350  applyPeer(node: KNode, reset: boolean): void {
1351    if (reset) {
1352      getUINativeModule().common.resetBackgroundImagePosition(node);
1353    } else {
1354      if (isNumber(this.value)) {
1355        getUINativeModule().common.setBackgroundImagePosition(node, this.value, undefined, undefined);
1356      } else {
1357        getUINativeModule().common.setBackgroundImagePosition(node, undefined, (this.value as Position)?.x, (this.value as Position)?.y);
1358      }
1359    }
1360  }
1361  checkObjectDiff(): boolean {
1362    return !((this.value as Position)?.x === (this.stageValue as Position)?.x &&
1363      (this.value as Position)?.y === (this.stageValue as Position)?.y);
1364  }
1365}
1366
1367class BackgroundImageResizableModifier extends ModifierWithKey<ResizableOptions> {
1368  constructor(value: ResizableOptions) {
1369    super(value);
1370  }
1371  static identity: Symbol = Symbol('backgroundImageResizable');
1372  applyPeer(node: KNode, reset: boolean): void {
1373    if (reset) {
1374      getUINativeModule().common.resetBackgroundImageResizable(node);
1375    } else {
1376      let sliceTop: Length | undefined;
1377      let sliceBottom: Length | undefined;
1378      let sliceLeft: Length | undefined;
1379      let sliceRight: Length | undefined;
1380      if (!isUndefined(this.value.slice)) {
1381        let tempSlice = this.value.slice as EdgeWidths;
1382        sliceTop = tempSlice.top;
1383        sliceBottom = tempSlice.bottom;
1384        sliceLeft = tempSlice.left;
1385        sliceRight = tempSlice.right;
1386      }
1387      getUINativeModule().common.setBackgroundImageResizable(node, sliceTop, sliceBottom, sliceLeft, sliceRight);
1388    }
1389  }
1390  checkObjectDiff(): boolean {
1391    return !isBaseOrResourceEqual(this.stageValue, this.value);
1392  }
1393}
1394
1395class LinearGradientBlurModifier extends ModifierWithKey<ArkLinearGradientBlur> {
1396  constructor(value: ArkLinearGradientBlur) {
1397    super(value);
1398  }
1399  static identity: Symbol = Symbol('linearGradientBlur');
1400  applyPeer(node: KNode, reset: boolean): void {
1401    if (reset) {
1402      getUINativeModule().common.resetLinearGradientBlur(node);
1403    } else {
1404      getUINativeModule().common.setLinearGradientBlur(node,
1405        this.value.blurRadius, this.value.fractionStops, this.value.direction);
1406    }
1407  }
1408  checkObjectDiff(): boolean {
1409    return !this.value.isEqual(this.stageValue);
1410  }
1411}
1412
1413class BackgroundImageModifier extends ModifierWithKey<ArkBackgroundImage> {
1414  constructor(value: ArkBackgroundImage) {
1415    super(value);
1416  }
1417  static identity: Symbol = Symbol('backgroundImage');
1418  applyPeer(node: KNode, reset: boolean): void {
1419    if (reset) {
1420      getUINativeModule().common.resetBackgroundImage(node);
1421    } else {
1422      getUINativeModule().common.setBackgroundImage(node, this.value.src, this.value.repeat);
1423    }
1424  }
1425  checkObjectDiff(): boolean {
1426    return !((this.stageValue as ArkBackgroundImage).src === (this.value as ArkBackgroundImage).src &&
1427      (this.stageValue as ArkBackgroundImage).repeat === (this.value as ArkBackgroundImage).repeat);
1428  }
1429}
1430
1431class BackgroundBlurStyleModifier extends ModifierWithKey<ArkBackgroundBlurStyle> {
1432  constructor(value: ArkBackgroundBlurStyle) {
1433    super(value);
1434  }
1435  static identity: Symbol = Symbol('backgroundBlurStyle');
1436  applyPeer(node: KNode, reset: boolean): void {
1437    if (reset) {
1438      getUINativeModule().common.resetBackgroundBlurStyle(node);
1439    } else {
1440      getUINativeModule().common.setBackgroundBlurStyle(node,
1441        this.value.blurStyle, this.value.colorMode, this.value.adaptiveColor, this.value.scale,
1442          this.value.blurOptions?.grayscale, this.value.policy, this.value.inactiveColor, this.value.type);
1443    }
1444  }
1445}
1446
1447class BackgroundImageSizeModifier extends ModifierWithKey<SizeOptions | ImageSize> {
1448  constructor(value: SizeOptions | ImageSize) {
1449    super(value);
1450  }
1451  static identity: Symbol = Symbol('backgroundImageSize');
1452  applyPeer(node: KNode, reset: boolean): void {
1453    if (reset) {
1454      getUINativeModule().common.resetBackgroundImageSize(node);
1455    } else {
1456      if (isNumber(this.value)) {
1457        getUINativeModule().common.setBackgroundImageSize(node, this.value, undefined, undefined);
1458      } else {
1459        getUINativeModule().common.setBackgroundImageSize(node, undefined, (this.value as SizeOptions)?.width, (this.value as SizeOptions)?.height);
1460      }
1461    }
1462  }
1463  checkObjectDiff(): boolean {
1464    return !((this.value as SizeOptions).width === (this.stageValue as SizeOptions).width &&
1465      (this.value as SizeOptions).height === (this.stageValue as SizeOptions).height);
1466  }
1467}
1468
1469class TranslateModifier extends ModifierWithKey<TranslateOptions> {
1470  constructor(value: TranslateOptions) {
1471    super(value);
1472  }
1473  static identity: Symbol = Symbol('translate');
1474  applyPeer(node: KNode, reset: boolean): void {
1475    if (reset) {
1476      getUINativeModule().common.resetTranslate(node);
1477    } else {
1478      getUINativeModule().common.setTranslate(node, this.value.x, this.value.y, this.value.z);
1479    }
1480  }
1481  checkObjectDiff(): boolean {
1482    return !(this.value.x === this.stageValue.x &&
1483      this.value.y === this.stageValue.y &&
1484      this.value.z === this.stageValue.z);
1485  }
1486}
1487
1488class ScaleModifier extends ModifierWithKey<ScaleOptions> {
1489  constructor(value: ScaleOptions) {
1490    super(value);
1491  }
1492  static identity: Symbol = Symbol('scale');
1493  applyPeer(node: KNode, reset: boolean): void {
1494    if (reset) {
1495      getUINativeModule().common.resetScale(node);
1496    } else {
1497      getUINativeModule().common.setScale(node, this.value.x, this.value.y, this.value.z, this.value.centerX, this.value.centerY);
1498    }
1499  }
1500  checkObjectDiff(): boolean {
1501    return !(
1502      this.value.x === this.stageValue.x &&
1503      this.value.y === this.stageValue.y &&
1504      this.value.z === this.stageValue.z &&
1505      this.value.centerX === this.stageValue.centerX &&
1506      this.value.centerY === this.stageValue.centerY
1507    );
1508  }
1509}
1510
1511class RotateModifier extends ModifierWithKey<RotateOptions> {
1512  constructor(value: RotateOptions) {
1513    super(value);
1514  }
1515  static identity: Symbol = Symbol('rotate');
1516  applyPeer(node: KNode, reset: boolean): void {
1517    if (reset) {
1518      getUINativeModule().common.resetRotate(node);
1519    } else {
1520      getUINativeModule().common.setRotate(node, this.value.x, this.value.y, this.value.z, this.value.angle,
1521        this.value.centerX, this.value.centerY, this.value.centerY, this.value.perspective);
1522    }
1523  }
1524  checkObjectDiff(): boolean {
1525    return !(
1526      this.value.x === this.stageValue.x &&
1527      this.value.y === this.stageValue.y &&
1528      this.value.z === this.stageValue.z &&
1529      this.value.angle === this.stageValue.angle &&
1530      this.value.centerX === this.stageValue.centerX &&
1531      this.value.centerY === this.stageValue.centerY &&
1532      this.value.centerZ === this.stageValue.centerZ &&
1533      this.value.perspective === this.stageValue.perspective
1534    );
1535  }
1536}
1537
1538class GeometryTransitionModifier extends ModifierWithKey<ArkGeometryTransition> {
1539  constructor(value: ArkGeometryTransition) {
1540    super(value);
1541  }
1542  static identity: Symbol = Symbol('geometryTransition');
1543  applyPeer(node: KNode, reset: boolean): void {
1544    if (reset) {
1545      getUINativeModule().common.resetGeometryTransition(node);
1546    } else {
1547      getUINativeModule().common.setGeometryTransition(node, this.value.id,
1548        (this.value.options as GeometryTransitionOptions)?.follow,
1549        (this.value.options as GeometryTransitionOptions)?.hierarchyStrategy);
1550    }
1551  }
1552}
1553
1554class AdvancedBlendModeModifier extends ModifierWithKey<ArkBlendMode> {
1555  constructor(value: ArkBlendMode) {
1556    super(value);
1557  }
1558  static identity: Symbol = Symbol('advancedBlendMode');
1559  applyPeer(node: KNode, reset: boolean): void {
1560    if (reset) {
1561      getUINativeModule().common.resetAdvancedBlendMode(node);
1562    } else {
1563      getUINativeModule().common.setAdvancedBlendMode(node, this.value.blendMode, this.value.blendApplyType);
1564    }
1565  }
1566}
1567
1568class BlendModeModifier extends ModifierWithKey<ArkBlendMode> {
1569  constructor(value: ArkBlendMode) {
1570    super(value);
1571  }
1572  static identity: Symbol = Symbol('blendMode');
1573  applyPeer(node: KNode, reset: boolean): void {
1574    if (reset) {
1575      getUINativeModule().common.resetBlendMode(node);
1576    } else {
1577      getUINativeModule().common.setBlendMode(node, this.value.blendMode, this.value.blendApplyType);
1578    }
1579  }
1580}
1581
1582class ClipModifier extends ModifierWithKey<boolean | object> {
1583  constructor(value: boolean | object) {
1584    super(value);
1585  }
1586  static identity: Symbol = Symbol('clip');
1587  applyPeer(node: KNode, reset: boolean): void {
1588    if (reset) {
1589      getUINativeModule().common.resetClip(node);
1590    } else {
1591      getUINativeModule().common.setClip(node, this.value);
1592    }
1593  }
1594
1595  checkObjectDiff(): boolean {
1596    return true;
1597  }
1598}
1599
1600class ClipShapeModifier extends ModifierWithKey<object> {
1601  constructor(value: object) {
1602    super(value);
1603  }
1604  static identity: Symbol = Symbol('clipShape');
1605  applyPeer(node: KNode, reset: boolean): void {
1606    if (reset) {
1607      getUINativeModule().common.resetClipShape(node);
1608    } else {
1609      getUINativeModule().common.setClipShape(node, this.value);
1610    }
1611  }
1612
1613  checkObjectDiff(): boolean {
1614    return true;
1615  }
1616}
1617
1618class MaskModifier extends ModifierWithKey<boolean | object> {
1619  constructor(value: boolean | object) {
1620    super(value);
1621  }
1622  static identity: Symbol = Symbol('mask');
1623  applyPeer(node: KNode, reset: boolean): void {
1624    if (reset) {
1625      getUINativeModule().common.resetMask(node);
1626    } else {
1627      getUINativeModule().common.setMask(node, this.value);
1628    }
1629  }
1630
1631  checkObjectDiff(): boolean {
1632    return true;
1633  }
1634}
1635
1636class MaskShapeModifier extends ModifierWithKey<object> {
1637  constructor(value: object) {
1638    super(value);
1639  }
1640  static identity: Symbol = Symbol('maskShape');
1641  applyPeer(node: KNode, reset: boolean): void {
1642    if (reset) {
1643      getUINativeModule().common.resetMaskShape(node);
1644    } else {
1645      getUINativeModule().common.setMaskShape(node, this.value);
1646    }
1647  }
1648
1649  checkObjectDiff(): boolean {
1650    return true;
1651  }
1652}
1653
1654class PixelStretchEffectModifier extends ModifierWithKey<PixelStretchEffectOptions> {
1655  constructor(value: PixelStretchEffectOptions) {
1656    super(value);
1657  }
1658  static identity: Symbol = Symbol('pixelStretchEffect');
1659  applyPeer(node: KNode, reset: boolean): void {
1660    if (reset) {
1661      getUINativeModule().common.resetPixelStretchEffect(node);
1662    } else {
1663      getUINativeModule().common.setPixelStretchEffect(node,
1664        this.value.top, this.value.right, this.value.bottom, this.value.left);
1665    }
1666  }
1667
1668  checkObjectDiff(): boolean {
1669    return !((this.stageValue as PixelStretchEffectOptions).left === (this.value as PixelStretchEffectOptions).left &&
1670      (this.stageValue as PixelStretchEffectOptions).right === (this.value as PixelStretchEffectOptions).right &&
1671      (this.stageValue as PixelStretchEffectOptions).top === (this.value as PixelStretchEffectOptions).top &&
1672      (this.stageValue as PixelStretchEffectOptions).bottom === (this.value as PixelStretchEffectOptions).bottom);
1673  }
1674}
1675
1676class LightUpEffectModifier extends ModifierWithKey<number> {
1677  constructor(value: number) {
1678    super(value);
1679  }
1680  static identity: Symbol = Symbol('lightUpEffect');
1681  applyPeer(node: KNode, reset: boolean): void {
1682    if (reset) {
1683      getUINativeModule().common.resetLightUpEffect(node);
1684    } else {
1685      getUINativeModule().common.setLightUpEffect(node, this.value);
1686    }
1687  }
1688}
1689
1690class SphericalEffectModifier extends ModifierWithKey<number> {
1691  constructor(value: number) {
1692    super(value);
1693  }
1694  static identity: Symbol = Symbol('sphericalEffect');
1695  applyPeer(node: KNode, reset: boolean): void {
1696    if (reset) {
1697      getUINativeModule().common.resetSphericalEffect(node);
1698    } else {
1699      getUINativeModule().common.setSphericalEffect(node, this.value);
1700    }
1701  }
1702}
1703
1704class RenderGroupModifier extends ModifierWithKey<boolean> {
1705  constructor(value: boolean) {
1706    super(value);
1707  }
1708  static identity: Symbol = Symbol('renderGroup');
1709  applyPeer(node: KNode, reset: boolean): void {
1710    if (reset) {
1711      getUINativeModule().common.resetRenderGroup(node);
1712    } else {
1713      getUINativeModule().common.setRenderGroup(node, this.value);
1714    }
1715  }
1716}
1717
1718class RenderFitModifier extends ModifierWithKey<number> {
1719  constructor(value: number) {
1720    super(value);
1721  }
1722  static identity: Symbol = Symbol('renderFit');
1723  applyPeer(node: KNode, reset: boolean): void {
1724    if (reset) {
1725      getUINativeModule().common.resetRenderFit(node);
1726    } else {
1727      getUINativeModule().common.setRenderFit(node, this.value);
1728    }
1729  }
1730}
1731
1732class UseEffectModifier extends ModifierWithKey<ArkUseEffect> {
1733  constructor(value: ArkUseEffect) {
1734    super(value);
1735  }
1736  static identity: Symbol = Symbol('useEffect');
1737  applyPeer(node: KNode, reset: boolean): void {
1738    if (reset) {
1739      getUINativeModule().common.resetUseEffect(node);
1740    } else {
1741      getUINativeModule().common.setUseEffect(node, this.value.useEffect, this.value.effectType);
1742    }
1743  }
1744}
1745
1746class ForegroundColorModifier extends ModifierWithKey<ResourceColor | ColoringStrategy> {
1747  constructor(value: ResourceColor | ColoringStrategy) {
1748    super(value);
1749  }
1750  static identity: Symbol = Symbol('foregroundColor');
1751  applyPeer(node: KNode, reset: boolean): void {
1752    if (reset) {
1753      getUINativeModule().common.resetForegroundColor(node);
1754    } else {
1755      getUINativeModule().common.setForegroundColor(node, this.value);
1756    }
1757  }
1758
1759  checkObjectDiff(): boolean {
1760    return !isBaseOrResourceEqual(this.stageValue, this.value);
1761  }
1762}
1763
1764declare type ClickCallback = (event: ClickEvent) => void;
1765class OnClickModifier extends ModifierWithKey<ClickCallback> {
1766  constructor(value: ClickCallback) {
1767    super(value);
1768  }
1769  static identity: Symbol = Symbol('onClick');
1770  applyPeer(node: KNode, reset: boolean): void {
1771    if (reset) {
1772      getUINativeModule().common.resetOnClick(node);
1773    } else {
1774      getUINativeModule().common.setOnClick(node, this.value);
1775    }
1776  }
1777}
1778
1779declare type DragStartCallback = (event?: DragEvent, extraParams?: string) => CustomBuilder | DragItemInfo;
1780class DragStartModifier extends ModifierWithKey<DragStartCallback> {
1781  constructor(value: DragStartCallback) {
1782    super(value);
1783  }
1784  static identity: Symbol = Symbol('onDragStart');
1785  applyPeer(node: KNode, reset: boolean): void {
1786    if (reset) {
1787      getUINativeModule().common.resetOnDragStart(node);
1788    } else {
1789      getUINativeModule().common.setOnDragStart(node, this.value);
1790    }
1791  }
1792}
1793
1794declare type DragEnterCallback = (event?: DragEvent, extraParams?: string) => void;
1795class DragEnterModifier extends ModifierWithKey<DragEnterCallback> {
1796  constructor(value: DragEnterCallback) {
1797    super(value);
1798  }
1799  static identity: Symbol = Symbol('onDragEnter');
1800  applyPeer(node: KNode, reset: boolean): void {
1801    if (reset) {
1802      getUINativeModule().common.resetOnDragEnter(node);
1803    } else {
1804      getUINativeModule().common.setOnDragEnter(node, this.value);
1805    }
1806  }
1807}
1808
1809declare type DragMoveCallback = (event?: DragEvent, extraParams?: string) => void;
1810class DragMoveModifier extends ModifierWithKey<DragMoveCallback> {
1811  constructor(value: DragMoveCallback) {
1812    super(value);
1813  }
1814  static identity: Symbol = Symbol('onDragMove');
1815  applyPeer(node: KNode, reset: boolean): void {
1816    if (reset) {
1817      getUINativeModule().common.resetOnDragMove(node);
1818    } else {
1819      getUINativeModule().common.setOnDragMove(node, this.value);
1820    }
1821  }
1822}
1823
1824declare type DragLeaveCallback = (event?: DragEvent, extraParams?: string) => void;
1825class DragLeaveModifier extends ModifierWithKey<DragLeaveCallback> {
1826  constructor(value: DragLeaveCallback) {
1827    super(value);
1828  }
1829  static identity: Symbol = Symbol('onDragLeave');
1830  applyPeer(node: KNode, reset: boolean): void {
1831    if (reset) {
1832      getUINativeModule().common.resetOnDragLeave(node);
1833    } else {
1834      getUINativeModule().common.setOnDragLeave(node, this.value);
1835    }
1836  }
1837}
1838
1839declare type DropCallback = (event?: DragEvent, extraParams?: string) => void;
1840class DropModifier extends ModifierWithKey<DropCallback> {
1841  constructor(value: DropCallback) {
1842    super(value);
1843  }
1844  static identity: Symbol = Symbol('onDrop');
1845  applyPeer(node: KNode, reset: boolean): void {
1846    if (reset) {
1847      getUINativeModule().common.resetOnDrop(node);
1848    } else {
1849      getUINativeModule().common.setOnDrop(node, this.value);
1850    }
1851  }
1852}
1853
1854declare type DragEndCallback = (event?: DragEvent, extraParams?: string) => void;
1855class DragEndModifier extends ModifierWithKey<DragEndCallback> {
1856  constructor(value: DragEndCallback) {
1857    super(value);
1858  }
1859  static identity: Symbol = Symbol('onDragEnd');
1860  applyPeer(node: KNode, reset: boolean): void {
1861    if (reset) {
1862      getUINativeModule().common.resetOnDragEnd(node);
1863    } else {
1864      getUINativeModule().common.setOnDragEnd(node, this.value);
1865    }
1866  }
1867}
1868
1869declare type TouchCallback = (event: TouchEvent) => void;
1870class OnTouchModifier extends ModifierWithKey<TouchCallback> {
1871  constructor(value: TouchCallback) {
1872    super(value);
1873  }
1874  static identity: Symbol = Symbol('onTouch');
1875  applyPeer(node: KNode, reset: boolean): void {
1876    if (reset) {
1877      getUINativeModule().common.resetOnTouch(node);
1878    } else {
1879      getUINativeModule().common.setOnTouch(node, this.value);
1880    }
1881  }
1882}
1883
1884declare type VoidCallback = () => void;
1885class OnAppearModifier extends ModifierWithKey<VoidCallback> {
1886  constructor(value: VoidCallback) {
1887    super(value);
1888  }
1889  static identity: Symbol = Symbol('onAppear');
1890  applyPeer(node: KNode, reset: boolean): void {
1891    if (reset) {
1892      getUINativeModule().common.resetOnAppear(node);
1893    } else {
1894      getUINativeModule().common.setOnAppear(node, this.value);
1895    }
1896  }
1897}
1898
1899class OnDisappearModifier extends ModifierWithKey<VoidCallback> {
1900  constructor(value: VoidCallback) {
1901    super(value);
1902  }
1903  static identity: Symbol = Symbol('onDisappear');
1904  applyPeer(node: KNode, reset: boolean): void {
1905    if (reset) {
1906      getUINativeModule().common.resetOnDisappear(node);
1907    } else {
1908      getUINativeModule().common.setOnDisappear(node, this.value);
1909    }
1910  }
1911}
1912
1913class OnAttachModifier extends ModifierWithKey<VoidCallback> {
1914  constructor(value: VoidCallback) {
1915    super(value);
1916  }
1917  static identity: Symbol = Symbol('onAttach');
1918  applyPeer(node: KNode, reset: boolean): void {
1919    if (reset) {
1920      getUINativeModule().common.resetOnAttach(node);
1921    } else {
1922      getUINativeModule().common.setOnAttach(node, this.value);
1923    }
1924  }
1925}
1926
1927class OnDetachModifier extends ModifierWithKey<VoidCallback> {
1928  constructor(value: VoidCallback) {
1929    super(value);
1930  }
1931  static identity: Symbol = Symbol('onDetach');
1932  applyPeer(node: KNode, reset: boolean): void {
1933    if (reset) {
1934      getUINativeModule().common.resetOnDetach(node);
1935    } else {
1936      getUINativeModule().common.setOnDetach(node, this.value);
1937    }
1938  }
1939}
1940
1941declare type KeyEventCallback = (event: KeyEvent) => void;
1942class OnKeyEventModifier extends ModifierWithKey<KeyEventCallback> {
1943  constructor(value: KeyEventCallback) {
1944    super(value);
1945  }
1946  static identity: Symbol = Symbol('onKeyEvent');
1947  applyPeer(node: KNode, reset: boolean): void {
1948    if (reset) {
1949      getUINativeModule().common.resetOnKeyEvent(node);
1950    } else {
1951      getUINativeModule().common.setOnKeyEvent(node, this.value);
1952    }
1953  }
1954}
1955
1956class OnKeyPreImeModifier extends ModifierWithKey<Callback<KeyEvent, boolean>> {
1957  constructor(value: Callback<KeyEvent, boolean>) {
1958    super(value);
1959  }
1960  static identity: Symbol = Symbol('onKeyPreIme');
1961  applyPeer(node: KNode, reset: boolean): void {
1962    if (reset) {
1963      getUINativeModule().common.resetOnKeyPreIme(node);
1964    } else {
1965      getUINativeModule().common.setOnKeyPreIme(node, this.value);
1966    }
1967  }
1968}
1969
1970class OnKeyEventDispatchModifier extends ModifierWithKey<Callback<KeyEvent, boolean>> {
1971  private _onKeyEventDispatch: Callback<KeyEvent, boolean> = null;
1972  constructor(value: Callback<KeyEvent, boolean>) {
1973    super(value);
1974  }
1975  static identity: Symbol = Symbol('onKeyEventDispatch');
1976  applyPeer(node: KNode, reset: boolean): void {
1977    if (reset) {
1978      this._onKeyEventDispatch = null;
1979      getUINativeModule().common.resetOnKeyEventDispatch(node);
1980    } else {
1981      this._onKeyEventDispatch = this.value;
1982      getUINativeModule().common.setOnKeyEventDispatch(node, this.value);
1983    }
1984  }
1985}
1986
1987class OnFocusModifier extends ModifierWithKey<VoidCallback> {
1988  constructor(value: VoidCallback) {
1989    super(value);
1990  }
1991  static identity: Symbol = Symbol('onFocus');
1992  applyPeer(node: KNode, reset: boolean): void {
1993    if (reset) {
1994      getUINativeModule().common.resetOnFocus(node);
1995    } else {
1996      getUINativeModule().common.setOnFocus(node, this.value);
1997    }
1998  }
1999}
2000
2001class OnBlurModifier extends ModifierWithKey<VoidCallback> {
2002  constructor(value: VoidCallback) {
2003    super(value);
2004  }
2005  static identity: Symbol = Symbol('onBlur');
2006  applyPeer(node: KNode, reset: boolean): void {
2007    if (reset) {
2008      getUINativeModule().common.resetOnBlur(node);
2009    } else {
2010      getUINativeModule().common.setOnBlur(node, this.value);
2011    }
2012  }
2013}
2014
2015declare type HoverEventCallback = (isHover: boolean, event: HoverEvent) => void;
2016class OnHoverModifier extends ModifierWithKey<HoverEventCallback> {
2017  constructor(value: HoverEventCallback) {
2018    super(value);
2019  }
2020  static identity: Symbol = Symbol('onHover');
2021  applyPeer(node: KNode, reset: boolean): void {
2022    if (reset) {
2023      getUINativeModule().common.resetOnHover(node);
2024    } else {
2025      getUINativeModule().common.setOnHover(node, this.value);
2026    }
2027  }
2028}
2029
2030declare type HoverMoveEventCallback = (event: HoverEvent) => void;
2031class OnHoverMoveModifier extends ModifierWithKey<HoverMoveEventCallback> {
2032  constructor(value: HoverMoveEventCallback) {
2033    super(value);
2034  }
2035  static identity: Symbol = Symbol('onHoverMove');
2036  applyPeer(node: KNode, reset: boolean): void {
2037    if (reset) {
2038      getUINativeModule().common.resetOnHoverMove(node);
2039    } else {
2040      getUINativeModule().common.setOnHoverMove(node, this.value);
2041    }
2042  }
2043}
2044
2045declare type MouseEventCallback = (event: MouseEvent) => void;
2046class OnMouseModifier extends ModifierWithKey<MouseEventCallback> {
2047  constructor(value: MouseEventCallback) {
2048    super(value);
2049  }
2050  static identity: Symbol = Symbol('onMouse');
2051  applyPeer(node: KNode, reset: boolean): void {
2052    if (reset) {
2053      getUINativeModule().common.resetOnMouse(node);
2054    } else {
2055      getUINativeModule().common.setOnMouse(node, this.value);
2056    }
2057  }
2058}
2059
2060declare type AxisEventCallback = (event: AxisEvent) => void;
2061class OnAxisEventModifier extends ModifierWithKey<AxisEventCallback> {
2062  constructor(value: AxisEventCallback) {
2063    super(value);
2064  }
2065  static identity: Symbol = Symbol('onAxisEvent');
2066  applyPeer(node: KNode, reset: boolean): void {
2067    if (reset) {
2068      getUINativeModule().common.resetOnAxisEvent(node);
2069    } else {
2070      getUINativeModule().common.setOnAxisEvent(node, this.value);
2071    }
2072  }
2073}
2074
2075declare type SizeChangeEventCallback = (oldValue: SizeOptions, newValue: SizeOptions) => void;
2076class OnSizeChangeModifier extends ModifierWithKey<SizeChangeEventCallback> {
2077  constructor(value: SizeChangeEventCallback) {
2078    super(value);
2079  }
2080  static identity: Symbol = Symbol('onSizeChange');
2081  applyPeer(node: KNode, reset: boolean): void {
2082    if (reset) {
2083      getUINativeModule().common.resetOnSizeChange(node);
2084    } else {
2085      getUINativeModule().common.setOnSizeChange(node, this.value);
2086    }
2087  }
2088}
2089
2090declare type AreaChangeEventCallback = (oldValue: Area, newValue: Area) => void;
2091class OnAreaChangeModifier extends ModifierWithKey<AreaChangeEventCallback> {
2092  constructor(value: AreaChangeEventCallback) {
2093    super(value);
2094  }
2095  static identity: Symbol = Symbol('onAreaChange');
2096  applyPeer(node: KNode, reset: boolean): void {
2097    if (reset) {
2098      getUINativeModule().common.resetOnAreaChange(node);
2099    } else {
2100      getUINativeModule().common.setOnAreaChange(node, this.value);
2101    }
2102  }
2103}
2104
2105declare type GestureJudgeBeginCallback = (gestureInfo: GestureInfo, event: BaseGestureEvent) => GestureJudgeResult;
2106class OnGestureJudgeBeginModifier extends ModifierWithKey<GestureJudgeBeginCallback> {
2107  constructor(value: GestureJudgeBeginCallback) {
2108    super(value);
2109  }
2110  static identity: Symbol = Symbol('onGestureJudgeBegin');
2111  applyPeer(node: KNode, reset: boolean): void {
2112    if (reset) {
2113      getUINativeModule().common.resetOnGestureJudgeBegin(node);
2114    } else {
2115      getUINativeModule().common.setOnGestureJudgeBegin(node, this.value);
2116    }
2117  }
2118}
2119
2120declare type GestureRecognizerJudgeBeginCallback = (event: BaseGestureEvent, current: GestureRecognizer, recognizers: Array<GestureRecognizer>) => GestureJudgeResult;
2121class OnGestureRecognizerJudgeBeginModifier extends ModifierWithKey<GestureRecognizerJudgeBeginCallback> {
2122  constructor(value: GestureRecognizerJudgeBeginCallback) {
2123    super(value);
2124  }
2125  static identity: Symbol = Symbol('onGestureRecognizerJudgeBegin');
2126  applyPeer(node: KNode, reset: boolean): void {
2127    if (reset) {
2128      getUINativeModule().common.resetOnGestureRecognizerJudgeBegin(node);
2129    } else {
2130      getUINativeModule().common.setOnGestureRecognizerJudgeBegin(node, this.value);
2131    }
2132  }
2133}
2134
2135declare type ShouldBuiltInRecognizerParallelWithCallback = (current: GestureRecognizer, others: Array<GestureRecognizer>) => GestureRecognizer;
2136class ShouldBuiltInRecognizerParallelWithModifier extends ModifierWithKey<ShouldBuiltInRecognizerParallelWithCallback> {
2137  constructor(value: ShouldBuiltInRecognizerParallelWithCallback) {
2138    super(value);
2139  }
2140  static identity: Symbol = Symbol('shouldBuiltInRecognizerParallelWith');
2141  applyPeer(node: KNode, reset: boolean): void {
2142    if (reset) {
2143      getUINativeModule().common.resetShouldBuiltInRecognizerParallelWith(node);
2144    } else {
2145      getUINativeModule().common.setShouldBuiltInRecognizerParallelWith(node, this.value);
2146    }
2147  }
2148}
2149
2150declare type FocusAxisEventCallback = (event: FocusAxisEvent) => void;
2151class OnFocusAxisEventModifier extends ModifierWithKey<FocusAxisEventCallback> {
2152  constructor(value: FocusAxisEventCallback) {
2153    super(value);
2154  }
2155  static identity: Symbol = Symbol('onFocusAxisEvent');
2156  applyPeer(node: KNode, reset: boolean): void {
2157    if (reset) {
2158      getUINativeModule().common.resetOnKeyEvent(node);
2159    } else {
2160      getUINativeModule().common.setOnKeyEvent(node, this.value);
2161    }
2162  }
2163}
2164
2165class MotionPathModifier extends ModifierWithKey<MotionPathOptions> {
2166  constructor(value: MotionPathOptions) {
2167    super(value);
2168  }
2169  static identity: Symbol = Symbol('motionPath');
2170  applyPeer(node: KNode, reset: boolean): void {
2171    if (reset) {
2172      getUINativeModule().common.resetMotionPath(node);
2173    } else {
2174      let path: string;
2175      let rotatable: boolean;
2176      let from: number;
2177      let to: number;
2178      if (isString(this.value.path)) {
2179        path = this.value.path;
2180      }
2181      if (isBoolean(this.value.rotatable)) {
2182        rotatable = this.value.rotatable;
2183      }
2184      if (isNumber(this.value.from) && isNumber(this.value.to)) {
2185        from = this.value.from;
2186        to = this.value.to;
2187      }
2188      getUINativeModule().common.setMotionPath(node, path, from, to, rotatable);
2189    }
2190  }
2191  checkObjectDiff(): boolean {
2192    return !(this.value.path === this.stageValue.path &&
2193      this.value.from === this.stageValue.from &&
2194      this.value.to === this.stageValue.to &&
2195      this.value.rotatable === this.stageValue.rotatable);
2196  }
2197}
2198
2199class MotionBlurModifier extends ModifierWithKey<MotionBlurOptions> {
2200  constructor(value: MotionBlurOptions) {
2201    super(value);
2202  }
2203  static identity: Symbol = Symbol('motionBlur');
2204  applyPeer(node: KNode, reset: boolean): void {
2205    if (reset) {
2206      getUINativeModule().common.resetMotionBlur(node);
2207    } else {
2208      getUINativeModule().common.setMotionBlur(node, this.value.radius, this.value.anchor.x, this.value.anchor.y);
2209    }
2210  }
2211}
2212
2213class GroupDefaultFocusModifier extends ModifierWithKey<boolean> {
2214  constructor(value: boolean) {
2215    super(value);
2216  }
2217  static identity: Symbol = Symbol('groupDefaultFocus');
2218  applyPeer(node: KNode, reset: boolean): void {
2219    if (reset) {
2220      getUINativeModule().common.resetGroupDefaultFocus(node);
2221    } else {
2222      getUINativeModule().common.setGroupDefaultFocus(node, this.value);
2223    }
2224  }
2225}
2226
2227class FocusOnTouchModifier extends ModifierWithKey<boolean> {
2228  constructor(value: boolean) {
2229    super(value);
2230  }
2231  static identity: Symbol = Symbol('focusOnTouch');
2232  applyPeer(node: KNode, reset: boolean): void {
2233    if (reset) {
2234      getUINativeModule().common.resetFocusOnTouch(node);
2235    } else {
2236      getUINativeModule().common.setFocusOnTouch(node, this.value);
2237    }
2238  }
2239}
2240class OffsetModifier extends ModifierWithKey<Position | Edges | LocalizedEdges> {
2241  constructor(value: Position | Edges | LocalizedEdges) {
2242    super(value);
2243  }
2244  static identity: Symbol = Symbol('offset');
2245  applyPeer(node: KNode, reset: boolean): void {
2246    if (reset) {
2247      getUINativeModule().common.resetOffset(node);
2248    } else {
2249      if (isUndefined(this.value)) {
2250        getUINativeModule().common.resetOffset(node);
2251      } else if (('x' in this.value) || ('y' in this.value)) {
2252        getUINativeModule().common.setOffset(node, false, this.value.x, this.value.y);
2253      } else if (('top' in this.value) || ('bottom' in this.value) || ('left' in this.value) || ('start' in this.value) || ('right' in this.value) || ('end' in this.value)) {
2254        if (('start' in this.value)) {
2255          this.value.left = this.value.start;
2256        }
2257        if (('end' in this.value)) {
2258          this.value.right = this.value.end;
2259        }
2260        getUINativeModule().common.setOffset(node, true, this.value.top, this.value.left, this.value.bottom, this.value.right);
2261      } else {
2262        getUINativeModule().common.resetOffset(node);
2263      }
2264    }
2265  }
2266
2267  checkObjectDiff(): boolean {
2268    return !isBaseOrResourceEqual(this.stageValue.x, this.value.x) ||
2269      !isBaseOrResourceEqual(this.stageValue.y, this.value.y) ||
2270      !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
2271      !isBaseOrResourceEqual(this.stageValue.left, this.value.left) ||
2272      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
2273      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
2274      !isBaseOrResourceEqual(this.stageValue.start, this.value.start) ||
2275      !isBaseOrResourceEqual(this.stageValue.end, this.value.end);
2276  }
2277}
2278
2279class MarkAnchorModifier extends ModifierWithKey<Position | LocalizedPosition> {
2280  constructor(value: Position | LocalizedPosition) {
2281    super(value);
2282  }
2283  static identity: Symbol = Symbol('markAnchor');
2284  applyPeer(node: KNode, reset: boolean): void {
2285    if (reset) {
2286      getUINativeModule().common.resetMarkAnchor(node);
2287    } else {
2288      if (this.value === void 0) {
2289        getUINativeModule().common.resetMarkAnchor(node);
2290      } else {
2291        if ('start' in this.value) {
2292          this.value.x = this.value.start;
2293        }
2294        if ('top' in this.value) {
2295          this.value.y = this.value.top;
2296        }
2297      }
2298      getUINativeModule().common.setMarkAnchor(node, this.value.x, this.value.y);
2299    }
2300  }
2301
2302  checkObjectDiff(): boolean {
2303    return !isBaseOrResourceEqual(this.stageValue.x, this.value.x) ||
2304      !isBaseOrResourceEqual(this.stageValue.y, this.value.y) ||
2305      !isBaseOrResourceEqual(this.stageValue.start, this.value.start) ||
2306      !isBaseOrResourceEqual(this.stageValue.top, this.value.top);
2307  }
2308}
2309class DefaultFocusModifier extends ModifierWithKey<boolean> {
2310  constructor(value: boolean) {
2311    super(value);
2312  }
2313  static identity: Symbol = Symbol('defaultFocus');
2314  applyPeer(node: KNode, reset: boolean): void {
2315    if (reset) {
2316      getUINativeModule().common.resetDefaultFocus(node);
2317    } else {
2318      getUINativeModule().common.setDefaultFocus(node, this.value);
2319    }
2320  }
2321}
2322
2323class FocusableModifier extends ModifierWithKey<boolean> {
2324  constructor(value: boolean) {
2325    super(value);
2326  }
2327  static identity: Symbol = Symbol('focusable');
2328  applyPeer(node: KNode, reset: boolean): void {
2329    getUINativeModule().common.setFocusable(node, this.value);
2330  }
2331}
2332
2333class TabStopModifier extends ModifierWithKey<boolean> {
2334  constructor(value: boolean) {
2335    super(value);
2336  }
2337  static identity: Symbol = Symbol('tabStop');
2338  applyPeer(node: KNode, reset: boolean): void {
2339    getUINativeModule().common.setTabStop(node, this.value);
2340  }
2341}
2342
2343class TouchableModifier extends ModifierWithKey<boolean> {
2344  constructor(value: boolean) {
2345    super(value);
2346  }
2347  static identity: Symbol = Symbol('touchable');
2348  applyPeer(node: KNode, reset: boolean): void {
2349    if (reset) {
2350      getUINativeModule().common.resetTouchable(node);
2351    } else {
2352      getUINativeModule().common.setTouchable(node, this.value);
2353    }
2354  }
2355}
2356
2357class MarginModifier extends ModifierWithKey<ArkPadding> {
2358  constructor(value: ArkPadding) {
2359    super(value);
2360  }
2361  static identity: Symbol = Symbol('margin');
2362  applyPeer(node: KNode, reset: boolean): void {
2363    if (reset) {
2364      getUINativeModule().common.resetMargin(node);
2365    } else {
2366      getUINativeModule().common.setMargin(node, this.value.top,
2367        this.value.right, this.value.bottom, this.value.left);
2368    }
2369  }
2370
2371  checkObjectDiff(): boolean {
2372    return !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
2373      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
2374      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
2375      !isBaseOrResourceEqual(this.stageValue.left, this.value.left);
2376  }
2377}
2378
2379class PaddingModifier extends ModifierWithKey<ArkPadding> {
2380  constructor(value: ArkPadding) {
2381    super(value);
2382  }
2383  static identity: Symbol = Symbol('padding');
2384  applyPeer(node: KNode, reset: boolean): void {
2385    if (reset) {
2386      getUINativeModule().common.resetPadding(node);
2387    } else {
2388      getUINativeModule().common.setPadding(node, this.value.top,
2389        this.value.right, this.value.bottom, this.value.left);
2390    }
2391  }
2392
2393  checkObjectDiff(): boolean {
2394    return !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
2395      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
2396      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
2397      !isBaseOrResourceEqual(this.stageValue.left, this.value.left);
2398  }
2399}
2400
2401class SafeAreaPaddingModifier extends ModifierWithKey<ArkPadding> {
2402  constructor(value: ArkPadding) {
2403    super(value);
2404  }
2405  static identity: Symbol = Symbol('safeAreaPadding');
2406  applyPeer(node: KNode, reset: boolean): void {
2407    if (reset) {
2408      getUINativeModule().common.resetSafeAreaPadding(node);
2409    } else {
2410      getUINativeModule().common.setSafeAreaPadding(node, this.value.top,
2411        this.value.right, this.value.bottom, this.value.left);
2412    }
2413  }
2414
2415  checkObjectDiff(): boolean {
2416    return !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
2417      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
2418      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom) ||
2419      !isBaseOrResourceEqual(this.stageValue.left, this.value.left);
2420  }
2421}
2422
2423class VisibilityModifier extends ModifierWithKey<number> {
2424  constructor(value: number) {
2425    super(value);
2426  }
2427  static identity: Symbol = Symbol('visibility');
2428  applyPeer(node: KNode, reset: boolean): void {
2429    if (reset) {
2430      getUINativeModule().common.resetVisibility(node);
2431    } else {
2432      getUINativeModule().common.setVisibility(node, this.value!);
2433    }
2434  }
2435  checkObjectDiff(): boolean {
2436    return this.stageValue !== this.value;
2437  }
2438}
2439
2440class AccessibilityTextModifier extends ModifierWithKey<string> {
2441  constructor(value: string) {
2442    super(value);
2443  }
2444  static identity: Symbol = Symbol('accessibilityText');
2445  applyPeer(node: KNode, reset: boolean): void {
2446    if (reset) {
2447      getUINativeModule().common.resetAccessibilityText(node);
2448    } else {
2449      getUINativeModule().common.setAccessibilityText(node, this.value);
2450    }
2451  }
2452}
2453
2454class AccessibilityRoleModifier extends ModifierWithKey<AccessibilityRoleType> {
2455  constructor(value: AccessibilityRoleType) {
2456    super(value);
2457  }
2458  static identity: Symbol = Symbol('accessibilityRole');
2459  applyPeer(node: KNode, reset: boolean): void {
2460    if (reset) {
2461      getUINativeModule().common.resetAccessibilityRoleType(node);
2462    } else {
2463      getUINativeModule().common.setAccessibilityRoleType(node, this.value);
2464    }
2465  }
2466}
2467
2468class AccessibilityFocusCallbackModifier extends ModifierWithKey<AccessibilityFocusCallback> {
2469  constructor(value: AccessibilityFocusCallback) {
2470    super(value);
2471  }
2472  static identity: Symbol = Symbol('onAccessibilityFocus');
2473  applyPeer(node: KNode, reset: boolean): void {
2474    if (reset) {
2475      getUINativeModule().common.resetAccessibilityFocusCallback(node);
2476    } else {
2477      getUINativeModule().common.setAccessibilityFocusCallback(node, this.value);
2478    }
2479  }
2480}
2481
2482class AllowDropModifier extends ModifierWithKey<Array<UniformDataType>> {
2483  constructor(value: Array<UniformDataType>) {
2484    super(value);
2485  }
2486  static identity: Symbol = Symbol('allowDrop');
2487  applyPeer(node: KNode, reset: boolean): void {
2488    if (reset) {
2489      getUINativeModule().common.resetAllowDrop(node);
2490    } else {
2491      getUINativeModule().common.setAllowDrop(node, this.value);
2492    }
2493  }
2494  checkObjectDiff(): boolean {
2495    return !(Array.isArray(this.value) && Array.isArray(this.stageValue) &&
2496      this.value.length === this.stageValue.length &&
2497      this.value.every((value, index) => value === this.stageValue[index]));
2498  }
2499}
2500
2501class AccessibilityLevelModifier extends ModifierWithKey<string> {
2502  constructor(value: string) {
2503    super(value);
2504  }
2505  static identity: Symbol = Symbol('accessibilityLevel');
2506  applyPeer(node: KNode, reset: boolean): void {
2507    if (reset) {
2508      getUINativeModule().common.resetAccessibilityLevel(node);
2509    } else {
2510      getUINativeModule().common.setAccessibilityLevel(node, this.value);
2511    }
2512  }
2513}
2514
2515class AccessibilityDescriptionModifier extends ModifierWithKey<string> {
2516  constructor(value: string) {
2517    super(value);
2518  }
2519  static identity: Symbol = Symbol('accessibilityDescription');
2520  applyPeer(node: KNode, reset: boolean): void {
2521    if (reset) {
2522      getUINativeModule().common.resetAccessibilityDescription(node);
2523    } else {
2524      getUINativeModule().common.setAccessibilityDescription(node, this.value);
2525    }
2526  }
2527}
2528
2529class DirectionModifier extends ModifierWithKey<number> {
2530  constructor(value: number) {
2531    super(value);
2532  }
2533  static identity: Symbol = Symbol('direction');
2534  applyPeer(node: KNode, reset: boolean): void {
2535    if (reset) {
2536      getUINativeModule().common.resetDirection(node);
2537    } else {
2538      getUINativeModule().common.setDirection(node, this.value!);
2539    }
2540  }
2541  checkObjectDiff(): boolean {
2542    return !isBaseOrResourceEqual(this.stageValue, this.value);
2543  }
2544}
2545class AlignRulesModifier extends ModifierWithKey<ArkAlignRules> {
2546  constructor(value: ArkAlignRules) {
2547    super(value);
2548  }
2549  static identity: Symbol = Symbol('alignRules');
2550  applyPeer(node: KNode, reset: boolean): void {
2551    if (reset) {
2552      getUINativeModule().common.resetAlignRules(node);
2553    } else {
2554      getUINativeModule().common.setAlignRules(node, this.value.left,
2555        this.value.middle, this.value.right, this.value.top, this.value.center, this.value.bottom);
2556    }
2557  }
2558  checkObjectDiff(): boolean {
2559    return !isBaseOrResourceEqual(this.stageValue.left, this.value.left) ||
2560      !isBaseOrResourceEqual(this.stageValue.middle, this.value.middle) ||
2561      !isBaseOrResourceEqual(this.stageValue.right, this.value.right) ||
2562      !isBaseOrResourceEqual(this.stageValue.top, this.value.top) ||
2563      !isBaseOrResourceEqual(this.stageValue.center, this.value.center) ||
2564      !isBaseOrResourceEqual(this.stageValue.bottom, this.value.bottom);
2565  }
2566}
2567
2568class ExpandSafeAreaModifier extends ModifierWithKey<ArkSafeAreaExpandOpts | undefined> {
2569  constructor(value: ArkSafeAreaExpandOpts | undefined) {
2570    super(value);
2571  }
2572  static identity: Symbol = Symbol('expandSafeArea');
2573  applyPeer(node: KNode, reset: boolean): void {
2574    if (reset) {
2575      getUINativeModule().common.resetExpandSafeArea(node);
2576    } else {
2577      getUINativeModule().common.setExpandSafeArea(node, this.value.type, this.value.edges);
2578    }
2579  }
2580  checkObjectDiff(): boolean {
2581    return !isBaseOrResourceEqual(this.stageValue.type, this.value.type) ||
2582      !isBaseOrResourceEqual(this.stageValue.edges, this.value.edges);
2583  }
2584}
2585
2586class GridSpanModifier extends ModifierWithKey<number> {
2587  constructor(value: number) {
2588    super(value);
2589  }
2590  static identity: Symbol = Symbol('gridSpan');
2591  applyPeer(node: KNode, reset: boolean): void {
2592    if (reset) {
2593      getUINativeModule().common.resetGridSpan(node);
2594    } else {
2595      getUINativeModule().common.setGridSpan(node, this.value!);
2596    }
2597  }
2598}
2599
2600class GridOffsetModifier extends ModifierWithKey<number> {
2601  constructor(value: number) {
2602    super(value);
2603  }
2604  static identity: Symbol = Symbol('gridOffset');
2605  applyPeer(node: KNode, reset: boolean): void {
2606    if (reset) {
2607      getUINativeModule().common.resetGridOffset(node);
2608    } else {
2609      getUINativeModule().common.setGridOffset(node, this.value!);
2610    }
2611  }
2612}
2613
2614class AlignSelfModifier extends ModifierWithKey<number> {
2615  constructor(value: number) {
2616    super(value);
2617  }
2618  static identity: Symbol = Symbol('alignSelf');
2619  applyPeer(node: KNode, reset: boolean): void {
2620    if (reset) {
2621      getUINativeModule().common.resetAlignSelf(node);
2622    } else {
2623      getUINativeModule().common.setAlignSelf(node, this.value!);
2624    }
2625  }
2626  checkObjectDiff(): boolean {
2627    return !isBaseOrResourceEqual(this.stageValue, this.value);
2628  }
2629}
2630
2631class SizeModifier extends ModifierWithKey<SizeOptions> {
2632  constructor(value: SizeOptions) {
2633    super(value);
2634  }
2635  static identity: Symbol = Symbol('size');
2636  applyPeer(node: KNode, reset: boolean): void {
2637    if (reset) {
2638      getUINativeModule().common.resetSize(node);
2639    } else {
2640      getUINativeModule().common.setSize(node, this.value.width, this.value.height);
2641    }
2642  }
2643
2644  checkObjectDiff(): boolean {
2645    return !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
2646      !isBaseOrResourceEqual(this.stageValue.height, this.value.height);
2647  }
2648}
2649
2650class DisplayPriorityModifier extends ModifierWithKey<number> {
2651  constructor(value: number) {
2652    super(value);
2653  }
2654  static identity: Symbol = Symbol('displayPriority');
2655  applyPeer(node: KNode, reset: boolean): void {
2656    if (reset) {
2657      getUINativeModule().common.resetDisplayPriority(node);
2658    } else {
2659      getUINativeModule().common.setDisplayPriority(node, this.value!);
2660    }
2661  }
2662  checkObjectDiff(): boolean {
2663    return !isBaseOrResourceEqual(this.stageValue, this.value);
2664  }
2665}
2666
2667class IdModifier extends ModifierWithKey<string> {
2668  constructor(value: string) {
2669    super(value);
2670  }
2671  static identity: Symbol = Symbol('id');
2672  applyPeer(node: KNode, reset: boolean): void {
2673    if (reset) {
2674      getUINativeModule().common.resetId(node);
2675    } else {
2676      getUINativeModule().common.setId(node, this.value);
2677    }
2678  }
2679}
2680
2681class KeyModifier extends ModifierWithKey<string> {
2682  constructor(value: string) {
2683    super(value);
2684  }
2685  static identity: Symbol = Symbol('key');
2686  applyPeer(node: KNode, reset: boolean): void {
2687    if (reset) {
2688      getUINativeModule().common.resetKey(node);
2689    } else {
2690      getUINativeModule().common.setKey(node, this.value);
2691    }
2692  }
2693}
2694
2695class RestoreIdModifier extends ModifierWithKey<number> {
2696  constructor(value: number) {
2697    super(value);
2698  }
2699  static identity: Symbol = Symbol('restoreId');
2700  applyPeer(node: KNode, reset: boolean): void {
2701    if (reset) {
2702      getUINativeModule().common.resetRestoreId(node);
2703    } else {
2704      getUINativeModule().common.setRestoreId(node, this.value);
2705    }
2706  }
2707}
2708
2709class TabIndexModifier extends ModifierWithKey<number> {
2710  constructor(value: number) {
2711    super(value);
2712  }
2713  static identity: Symbol = Symbol('tabIndex');
2714  applyPeer(node: KNode, reset: boolean): void {
2715    if (reset) {
2716      getUINativeModule().common.resetTabIndex(node);
2717    } else {
2718      getUINativeModule().common.setTabIndex(node, this.value);
2719    }
2720  }
2721}
2722
2723class ObscuredModifier extends ModifierWithKey<Array<ObscuredReasons>> {
2724  constructor(value: Array<ObscuredReasons>) {
2725    super(value);
2726  }
2727  static identity: Symbol = Symbol('obscured');
2728  applyPeer(node: KNode, reset: boolean): void {
2729    if (reset || (!Array.isArray(this.value))) {
2730      getUINativeModule().common.resetObscured(node);
2731    } else {
2732      getUINativeModule().common.setObscured(node, this.value);
2733    }
2734  }
2735  checkObjectDiff(): boolean {
2736    return !(Array.isArray(this.value) && Array.isArray(this.stageValue) &&
2737      this.value.length === this.stageValue.length &&
2738      this.value.every((value, index) => value === this.stageValue[index]));
2739  }
2740}
2741
2742class ForegroundEffectModifier extends ModifierWithKey<ForegroundEffectOptions> {
2743  constructor(value: ForegroundEffectOptions) {
2744    super(value);
2745  }
2746  static identity: Symbol = Symbol('foregroundEffect');
2747  applyPeer(node: KNode, reset: boolean): void {
2748    if (reset) {
2749      getUINativeModule().common.resetForegroundEffect(node);
2750    } else {
2751      getUINativeModule().common.setForegroundEffect(node, this.value.radius);
2752    }
2753  }
2754
2755  checkObjectDiff(): boolean {
2756    return !(this.value.radius === this.stageValue.radius);
2757  }
2758}
2759
2760class BackgroundEffectModifier extends ModifierWithKey<BackgroundEffectOptions> {
2761  constructor(options: BackgroundEffectOptions) {
2762    super(options);
2763  }
2764  static identity: Symbol = Symbol('backgroundEffect');
2765  applyPeer(node: KNode, reset: boolean): void {
2766    if (reset) {
2767      getUINativeModule().common.resetBackgroundEffect(node);
2768    } else {
2769      getUINativeModule().common.setBackgroundEffect(node, this.value.radius, this.value.saturation,
2770        this.value.brightness, this.value.color, this.value.adaptiveColor, this.value.blurOptions?.grayscale,
2771        this.value.policy, this.value.inactiveColor, this.value.type);
2772    }
2773  }
2774
2775  checkObjectDiff(): boolean {
2776    return !(this.value.radius === this.stageValue.radius && this.value.saturation === this.stageValue.saturation &&
2777      this.value.brightness === this.stageValue.brightness &&
2778      isBaseOrResourceEqual(this.stageValue.color, this.value.color) &&
2779      this.value.adaptiveColor === this.stageValue.adaptiveColor &&
2780      this.value.policy === this.stageValue.policy &&
2781      this.value.inactiveColor === this.stageValue.inactiveColor &&
2782      this.value.type === this.stageValue.type &&
2783      this.value.blurOptions?.grayscale === this.stageValue.blurOptions?.grayscale);
2784  }
2785}
2786
2787class BackgroundBrightnessModifier extends ModifierWithKey<BackgroundBrightnessOptions> {
2788  constructor(params: BackgroundBrightnessOptions) {
2789    super(params);
2790  }
2791  static identity: Symbol = Symbol('backgroundBrightness');
2792  applyPeer(node: KNode, reset: boolean): void {
2793    if (reset) {
2794      getUINativeModule().common.resetBackgroundBrightness(node);
2795    } else {
2796      getUINativeModule().common.setBackgroundBrightness(node, this.value.rate, this.value.lightUpDegree);
2797    }
2798  }
2799
2800  checkObjectDiff(): boolean {
2801    return !(this.value.rate === this.stageValue.rate && this.value.lightUpDegree === this.stageValue.lightUpDegree);
2802  }
2803}
2804
2805class BackgroundBrightnessInternalModifier extends ModifierWithKey<BrightnessOptions> {
2806  constructor(params: BrightnessOptions) {
2807    super(params);
2808  }
2809  static identity: Symbol = Symbol('backgroundBrightnessInternal');
2810  applyPeer(node: KNode, reset: boolean): void {
2811    if (reset) {
2812      getUINativeModule().common.resetBackgroundBrightnessInternal(node);
2813    } else {
2814      getUINativeModule().common.setBackgroundBrightnessInternal(node, this.value.rate, this.value.lightUpDegree, this.value.cubicCoeff,
2815        this.value.quadCoeff, this.value.saturation, this.value.posRGB, this.value.negRGB, this.value.fraction);
2816    }
2817  }
2818
2819  checkObjectDiff(): boolean {
2820    return !(this.value.rate === this.stageValue.rate && this.value.lightUpDegree === this.stageValue.lightUpDegree
2821      && this.value.cubicCoeff === this.stageValue.cubicCoeff && this.value.quadCoeff === this.stageValue.quadCoeff
2822      && this.value.saturation === this.stageValue.saturation && this.value.posRGB === this.stageValue.posRGB
2823      && this.value.negRGB === this.stageValue.negRGB && this.value.fraction === this.stageValue.fraction);
2824  }
2825}
2826
2827class ForegroundBrightnessModifier extends ModifierWithKey<BrightnessOptions> {
2828  constructor(params: BrightnessOptions) {
2829    super(params);
2830  }
2831  static identity: Symbol = Symbol('foregroundBrightness');
2832  applyPeer(node: KNode, reset: boolean): void {
2833    if (reset) {
2834      getUINativeModule().common.resetForegroundBrightness(node);
2835    } else {
2836      getUINativeModule().common.setForegroundBrightness(node, this.value.rate, this.value.lightUpDegree, this.value.cubicCoeff,
2837        this.value.quadCoeff, this.value.saturation, this.value.posRGB, this.value.negRGB, this.value.fraction);
2838    }
2839  }
2840
2841  checkObjectDiff(): boolean {
2842    return !(this.value.rate === this.stageValue.rate && this.value.lightUpDegree === this.stageValue.lightUpDegree
2843      && this.value.cubicCoeff === this.stageValue.cubicCoeff && this.value.quadCoeff === this.stageValue.quadCoeff
2844      && this.value.saturation === this.stageValue.saturation && this.value.posRGB === this.stageValue.posRGB
2845      && this.value.negRGB === this.stageValue.negRGB && this.value.fraction === this.stageValue.fraction);
2846  }
2847}
2848
2849class DragPreviewOptionsModifier extends ModifierWithKey<ArkDragPreviewOptions> {
2850  constructor(value: ArkDragPreviewOptions) {
2851    super(value);
2852  }
2853  static identity: Symbol = Symbol('dragPreviewOptions');
2854  applyPeer(node: KNode, reset: boolean): void {
2855    if (reset) {
2856      getUINativeModule().common.resetDragPreviewOptions(node);
2857    } else {
2858      getUINativeModule().common.setDragPreviewOptions(node, this.value);
2859    }
2860  }
2861
2862  checkObjectDiff(): boolean {
2863    return !this.value.isEqual(this.stageValue);
2864  }
2865}
2866
2867class DragPreviewModifier extends ModifierWithKey<ArkDragPreview> {
2868  constructor(value: ArkDragPreview) {
2869    super(value);
2870  }
2871  static identity: Symbol = Symbol('dragPreview');
2872  applyPeer(node: KNode, reset: boolean): void {
2873    if (reset) {
2874      getUINativeModule().common.resetDragPreview(node);
2875    } else {
2876      getUINativeModule().common.setDragPreview(node, this.value);
2877    }
2878  }
2879
2880  checkObjectDiff(): boolean {
2881    return !this.value.isEqual(this.stageValue);
2882  }
2883}
2884
2885class MouseResponseRegionModifier extends ModifierWithKey<Array<Rectangle> | Rectangle> {
2886  constructor(value: Array<Rectangle> | Rectangle) {
2887    super(value);
2888  }
2889  static identity = Symbol('mouseResponseRegion');
2890  applyPeer(node: KNode, reset: boolean): void {
2891    if (reset) {
2892      getUINativeModule().common.resetMouseResponseRegion(node);
2893    } else {
2894      let responseRegion: (number | string | Resource)[] = [];
2895      if (Array.isArray(this.value)) {
2896        for (let i = 0; i < this.value.length; i++) {
2897          responseRegion.push(this.value[i].x ?? 'PLACEHOLDER');
2898          responseRegion.push(this.value[i].y ?? 'PLACEHOLDER');
2899          responseRegion.push(this.value[i].width ?? 'PLACEHOLDER');
2900          responseRegion.push(this.value[i].height ?? 'PLACEHOLDER');
2901        }
2902      } else {
2903        responseRegion.push(this.value.x ?? 'PLACEHOLDER');
2904        responseRegion.push(this.value.y ?? 'PLACEHOLDER');
2905        responseRegion.push(this.value.width ?? 'PLACEHOLDER');
2906        responseRegion.push(this.value.height ?? 'PLACEHOLDER');
2907      }
2908      getUINativeModule().common.setMouseResponseRegion(node, responseRegion, responseRegion.length);
2909    }
2910  }
2911
2912  checkObjectDiff(): boolean {
2913    if (Array.isArray(this.value) && Array.isArray(this.stageValue)) {
2914      if (this.value.length !== this.stageValue.length) {
2915        return true;
2916      } else {
2917        for (let i = 0; i < this.value.length; i++) {
2918          if (!(isBaseOrResourceEqual(this.stageValue[i].x, this.value[i].x) &&
2919            isBaseOrResourceEqual(this.stageValue[i].y, this.value[i].y) &&
2920            isBaseOrResourceEqual(this.stageValue[i].width, this.value[i].width) &&
2921            isBaseOrResourceEqual(this.stageValue[i].height, this.value[i].height)
2922          )) {
2923            return true;
2924          }
2925        }
2926        return false;
2927      }
2928    } else if (!Array.isArray(this.value) && !Array.isArray(this.stageValue)) {
2929      return (!(isBaseOrResourceEqual(this.stageValue.x, this.value.x) &&
2930        isBaseOrResourceEqual(this.stageValue.y, this.value.y) &&
2931        isBaseOrResourceEqual(this.stageValue.width, this.value.width) &&
2932        isBaseOrResourceEqual(this.stageValue.height, this.value.height)
2933      ));
2934    } else {
2935      return false;
2936    }
2937  }
2938}
2939
2940class ResponseRegionModifier extends ModifierWithKey<Array<Rectangle> | Rectangle> {
2941  constructor(value: Array<Rectangle> | Rectangle) {
2942    super(value);
2943  }
2944  static identity = Symbol('responseRegion');
2945  applyPeer(node: KNode, reset: boolean): void {
2946    if (reset) {
2947      getUINativeModule().common.resetResponseRegion(node);
2948    } else {
2949      let responseRegion: (number | string | Resource)[] = [];
2950      if (Array.isArray(this.value)) {
2951        for (let i = 0; i < this.value.length; i++) {
2952          responseRegion.push(this.value[i].x ?? 'PLACEHOLDER');
2953          responseRegion.push(this.value[i].y ?? 'PLACEHOLDER');
2954          responseRegion.push(this.value[i].width ?? 'PLACEHOLDER');
2955          responseRegion.push(this.value[i].height ?? 'PLACEHOLDER');
2956        }
2957      } else {
2958        responseRegion.push(this.value.x ?? 'PLACEHOLDER');
2959        responseRegion.push(this.value.y ?? 'PLACEHOLDER');
2960        responseRegion.push(this.value.width ?? 'PLACEHOLDER');
2961        responseRegion.push(this.value.height ?? 'PLACEHOLDER');
2962      }
2963      getUINativeModule().common.setResponseRegion(node, responseRegion, responseRegion.length);
2964    }
2965  }
2966
2967  checkObjectDiff(): boolean {
2968    if (Array.isArray(this.value) && Array.isArray(this.stageValue)) {
2969      if (this.value.length !== this.stageValue.length) {
2970        return true;
2971      } else {
2972        for (let i = 0; i < this.value.length; i++) {
2973          if (!(isBaseOrResourceEqual(this.stageValue[i].x, this.value[i].x) &&
2974            isBaseOrResourceEqual(this.stageValue[i].y, this.value[i].y) &&
2975            isBaseOrResourceEqual(this.stageValue[i].width, this.value[i].width) &&
2976            isBaseOrResourceEqual(this.stageValue[i].height, this.value[i].height)
2977          )) {
2978            return true;
2979          }
2980        }
2981        return false;
2982      }
2983    } else if (!Array.isArray(this.value) && !Array.isArray(this.stageValue)) {
2984      return (!(isBaseOrResourceEqual(this.stageValue.x, this.value.x) &&
2985        isBaseOrResourceEqual(this.stageValue.y, this.value.y) &&
2986        isBaseOrResourceEqual(this.stageValue.width, this.value.width) &&
2987        isBaseOrResourceEqual(this.stageValue.height, this.value.height)
2988      ));
2989    } else {
2990      return false;
2991    }
2992  }
2993}
2994class FlexGrowModifier extends ModifierWithKey<number> {
2995  constructor(value: number) {
2996    super(value);
2997  }
2998  static identity: Symbol = Symbol('flexGrow');
2999  applyPeer(node: KNode, reset: boolean): void {
3000    if (reset) {
3001      getUINativeModule().common.resetFlexGrow(node);
3002    } else {
3003      getUINativeModule().common.setFlexGrow(node, this.value!);
3004    }
3005  }
3006  checkObjectDiff(): boolean {
3007    return this.stageValue !== this.value;
3008  }
3009}
3010
3011class FlexShrinkModifier extends ModifierWithKey<number> {
3012  constructor(value: number) {
3013    super(value);
3014  }
3015  static identity: Symbol = Symbol('flexShrink');
3016  applyPeer(node: KNode, reset: boolean): void {
3017    if (reset) {
3018      getUINativeModule().common.resetFlexShrink(node);
3019    } else {
3020      getUINativeModule().common.setFlexShrink(node, this.value!);
3021    }
3022  }
3023  checkObjectDiff(): boolean {
3024    return this.stageValue !== this.value;
3025  }
3026}
3027
3028class AspectRatioModifier extends ModifierWithKey<number> {
3029  constructor(value: number) {
3030    super(value);
3031  }
3032  static identity: Symbol = Symbol('aspectRatio');
3033  applyPeer(node: KNode, reset: boolean): void {
3034    if (reset) {
3035      getUINativeModule().common.resetAspectRatio(node);
3036    } else {
3037      getUINativeModule().common.setAspectRatio(node, this.value!);
3038    }
3039  }
3040  checkObjectDiff(): boolean {
3041    return this.stageValue !== this.value;
3042  }
3043}
3044
3045class ConstraintSizeModifier extends ModifierWithKey<ConstraintSizeOptions> {
3046  constructor(value: ConstraintSizeOptions) {
3047    super(value);
3048  }
3049  static identity: Symbol = Symbol('constraintSize');
3050  applyPeer(node: KNode, reset: boolean): void {
3051    if (reset) {
3052      getUINativeModule().common.resetConstraintSize(node);
3053    } else {
3054      getUINativeModule().common.setConstraintSize(node, this.value.minWidth,
3055        this.value.maxWidth, this.value.minHeight, this.value.maxHeight);
3056    }
3057  }
3058
3059  checkObjectDiff(): boolean {
3060    return !isBaseOrResourceEqual(this.stageValue.minWidth, this.value.minWidth) ||
3061      !isBaseOrResourceEqual(this.stageValue.maxWidth, this.value.maxWidth) ||
3062      !isBaseOrResourceEqual(this.stageValue.minHeight, this.value.minHeight) ||
3063      !isBaseOrResourceEqual(this.stageValue.maxHeight, this.value.maxHeight);
3064  }
3065}
3066
3067class FlexBasisModifier extends ModifierWithKey<number | string> {
3068  constructor(value: number | string) {
3069    super(value);
3070  }
3071  static identity: Symbol = Symbol('flexBasis');
3072  applyPeer(node: KNode, reset: boolean): void {
3073    if (reset) {
3074      getUINativeModule().common.resetFlexBasis(node);
3075    } else {
3076      getUINativeModule().common.setFlexBasis(node, this.value!);
3077    }
3078  }
3079  checkObjectDiff(): boolean {
3080    return this.stageValue !== this.value;
3081  }
3082}
3083
3084class BindTipsModifier extends ModifierWithKey<ArkBindTipsOptions> {
3085  constructor(value: ArkBindTipsOptions) {
3086    super(value);
3087  }
3088  static identity: Symbol = Symbol('bindTips');
3089  applyPeer(node: KNode, reset: boolean): void {
3090    if (reset) {
3091      getUINativeModule().common.resetBindTips(node);
3092    } else {
3093      if (this.value.message === undefined) {
3094        return;
3095      }
3096      getUINativeModule().common.setBindTips(
3097        node,
3098        this.value.message,
3099        this.value.options?.appearingTime,
3100        this.value.options?.disappearingTime,
3101        this.value.options?.appearingTimeWithContinuousOperation,
3102        this.value.options?.disappearingTimeWithContinuousOperation,
3103        this.value.options?.enableArrow,
3104        this.value.options?.arrowPointPosition,
3105        this.value.options?.arrowWidth,
3106        this.value.options?.arrowHeight
3107      );
3108    }
3109  }
3110  checkObjectDiff(): boolean {
3111    return (
3112      !isBaseOrResourceEqual(this.stageValue.message, this.value.message) ||
3113      !isBaseOrResourceEqual(
3114        this.stageValue.options.appearingTime,
3115        this.value.options.appearingTime
3116      ) ||
3117      !isBaseOrResourceEqual(
3118        this.stageValue.options.disappearingTime,
3119        this.value.options.disappearingTime
3120      ) ||
3121      !isBaseOrResourceEqual(
3122        this.stageValue.options.appearingTimeWithContinuousOperation,
3123        this.value.options.appearingTimeWithContinuousOperation
3124      ) ||
3125      !isBaseOrResourceEqual(
3126        this.stageValue.options.disappearingTimeWithContinuousOperation,
3127        this.value.options.disappearingTimeWithContinuousOperation
3128      ) ||
3129      !isBaseOrResourceEqual(
3130        this.stageValue.options.enableArrow,
3131        this.value.options.enableArrow
3132      ) ||
3133      !isBaseOrResourceEqual(
3134        this.stageValue.options.arrowPointPosition,
3135        this.value.options.arrowPointPosition
3136      ) ||
3137      !isBaseOrResourceEqual(
3138        this.stageValue.options.arrowWidth,
3139        this.value.options.arrowWidth
3140      ) ||
3141      !isBaseOrResourceEqual(
3142        this.stageValue.options.arrowHeight,
3143        this.value.options.arrowHeight
3144      )
3145    );
3146  }
3147}
3148
3149class LayoutWeightModifier extends ModifierWithKey<number | string> {
3150  constructor(value: number | string) {
3151    super(value);
3152  }
3153  static identity: Symbol = Symbol('layoutWeight');
3154  applyPeer(node: KNode, reset: boolean): void {
3155    if (reset) {
3156      getUINativeModule().common.resetLayoutWeight(node);
3157    } else {
3158      getUINativeModule().common.setLayoutWeight(node, this.value!);
3159    }
3160  }
3161}
3162
3163class EnabledModifier extends ModifierWithKey<boolean> {
3164  constructor(value: boolean) {
3165    super(value);
3166  }
3167  static identity: Symbol = Symbol('enabled');
3168  applyPeer(node: KNode, reset: boolean): void {
3169    if (reset) {
3170      getUINativeModule().common.resetEnabled(node);
3171
3172    } else {
3173      getUINativeModule().common.setEnabled(node, this.value);
3174    }
3175  }
3176}
3177
3178class UseShadowBatchingModifier extends ModifierWithKey<boolean> {
3179  constructor(value: boolean) {
3180    super(value);
3181  }
3182  static identity: Symbol = Symbol('useShadowBatching');
3183  applyPeer(node: KNode, reset: boolean): void {
3184    if (reset) {
3185      getUINativeModule().common.resetUseShadowBatching(node);
3186
3187    } else {
3188      getUINativeModule().common.setUseShadowBatching(node, this.value);
3189    }
3190  }
3191}
3192
3193class MonopolizeEventsModifier extends ModifierWithKey<boolean> {
3194  constructor(value: boolean) {
3195    super(value);
3196  }
3197  static identity: Symbol = Symbol('monopolizeEvents');
3198  applyPeer(node: KNode, reset: boolean): void {
3199    if (reset) {
3200      getUINativeModule().common.resetMonopolizeEvents(node);
3201
3202    } else {
3203      getUINativeModule().common.setMonopolizeEvents(node, this.value);
3204    }
3205  }
3206}
3207
3208class DraggableModifier extends ModifierWithKey<boolean> {
3209  constructor(value: boolean) {
3210    super(value);
3211  }
3212  static identity: Symbol = Symbol('draggable');
3213  applyPeer(node: KNode, reset: boolean): void {
3214    if (reset) {
3215      getUINativeModule().common.resetDraggable(node);
3216    } else {
3217      getUINativeModule().common.setDraggable(node, this.value);
3218    }
3219  }
3220}
3221
3222class AccessibilityGroupModifier extends ModifierWithKey<boolean> {
3223  constructor(value: boolean) {
3224    super(value);
3225  }
3226  static identity: Symbol = Symbol('accessibilityGroup');
3227  applyPeer(node: KNode, reset: boolean): void {
3228    if (reset) {
3229      getUINativeModule().common.resetAccessibilityGroup(node);
3230    } else {
3231      getUINativeModule().common.setAccessibilityGroup(node, this.value);
3232    }
3233  }
3234}
3235
3236class AccessibilityNextFocusIdModifier extends ModifierWithKey<string> {
3237  constructor(value: string) {
3238    super(value);
3239  }
3240  static identity: Symbol = Symbol('accessibilityNextFocusId');
3241  applyPeer(node: KNode, reset: boolean): void {
3242    if (reset) {
3243      getUINativeModule().common.resetAccessibilityNextFocusId(node);
3244    } else {
3245      getUINativeModule().common.setAccessibilityNextFocusId(node, this.value);
3246    }
3247  }
3248}
3249
3250class AccessibilityDefaultFocusModifier extends ModifierWithKey<boolean> {
3251  constructor(value: boolean) {
3252    super(value);
3253  }
3254  static identity: Symbol = Symbol('accessibilityDefaultFocus');
3255  applyPeer(node: KNode, reset: boolean): void {
3256    if (reset) {
3257      getUINativeModule().common.resetAccessibilityDefaultFocus(node);
3258    } else {
3259      getUINativeModule().common.setAccessibilityDefaultFocus(node, this.value);
3260    }
3261  }
3262}
3263
3264class AccessibilityUseSamePageModifier extends ModifierWithKey<AccessibilitySamePageMode> {
3265  constructor(value: AccessibilitySamePageMode) {
3266    super(value);
3267  }
3268  static identity: Symbol = Symbol('accessibilityUseSamePage');
3269  applyPeer(node: KNode, reset: boolean): void {
3270    if (reset) {
3271      getUINativeModule().common.resetAccessibilityUseSamePage(node);
3272    } else {
3273      getUINativeModule().common.setAccessibilityUseSamePage(node, this.value);
3274    }
3275  }
3276}
3277
3278class AccessibilityScrollTriggerableModifier extends ModifierWithKey<boolean> {
3279  constructor(value: boolean) {
3280    super(value);
3281  }
3282  static identity: Symbol = Symbol('accessibilityScrollTriggerable');
3283  applyPeer(node: KNode, reset: boolean): void {
3284    if (reset) {
3285      getUINativeModule().common.resetAccessibilityScrollTriggerable(node);
3286    } else {
3287      getUINativeModule().common.setAccessibilityScrollTriggerable(node, this.value);
3288    }
3289  }
3290}
3291
3292class AccessibilityFocusDrawLevelModifier extends ModifierWithKey<FocusDrawLevel> {
3293  constructor(value: FocusDrawLevel) {
3294    super(value);
3295  }
3296  static identity: Symbol = Symbol('accessibilityFocusDrawLevel');
3297  applyPeer(node: KNode, reset: boolean): void {
3298    if (reset) {
3299      getUINativeModule().common.resetAccessibilityFocusDrawLevel(node);
3300    } else {
3301      getUINativeModule().common.setAccessibilityFocusDrawLevel(node, this.value);
3302    }
3303  }
3304}
3305
3306class HoverEffectModifier extends ModifierWithKey<HoverEffect> {
3307  constructor(value: HoverEffect) {
3308    super(value);
3309  }
3310  static identity: Symbol = Symbol('hoverEffect');
3311  applyPeer(node: KNode, reset: boolean): void {
3312    if (reset) {
3313      getUINativeModule().common.resetHoverEffect(node);
3314    } else {
3315      getUINativeModule().common.setHoverEffect(node, this.value);
3316    }
3317  }
3318}
3319
3320class ClickEffectModifier extends ModifierWithKey<ClickEffect | null> {
3321  constructor(value: ClickEffect | null) {
3322    super(value);
3323  }
3324  static identity: Symbol = Symbol('clickEffect');
3325  applyPeer(node: KNode, reset: boolean): void {
3326    if (reset || !this.value) {
3327      getUINativeModule().common.resetClickEffect(node);
3328    } else {
3329      getUINativeModule().common.setClickEffect(node, this.value.level, this.value.scale);
3330    }
3331  }
3332  checkObjectDiff(): boolean {
3333    return !((this.value.level === this.stageValue.level) && (this.value.scale === this.stageValue.scale));
3334  }
3335}
3336
3337class KeyBoardShortCutModifier extends ModifierWithKey<ArkKeyBoardShortCut> {
3338  constructor(value: ArkKeyBoardShortCut) {
3339    super(value);
3340  }
3341  static identity: Symbol = Symbol('keyboardShortcut');
3342  applyPeer(node: KNode, reset: boolean): void {
3343    if (reset) {
3344      getUINativeModule().common.resetKeyBoardShortCut(node);
3345    } else {
3346      getUINativeModule().common.setKeyBoardShortCut(node, this.value.value, this.value.keys);
3347    }
3348  }
3349  checkObjectDiff(): boolean {
3350    return !this.value.isEqual(this.stageValue);
3351  }
3352}
3353
3354class CustomPropertyModifier extends ModifierWithKey<ArkCustomProperty> {
3355  constructor(value: ArkCustomProperty) {
3356    super(value);
3357  }
3358  static identity: Symbol = Symbol('customProperty');
3359  applyPeer(node: KNode, reset: boolean): void {
3360    const nodeId = getUINativeModule().frameNode.getIdByNodePtr(node);
3361    if (reset) {
3362      __removeCustomProperty__(nodeId, this.value.key);
3363    } else {
3364      __setValidCustomProperty__(nodeId, this.value.key, this.value.value);
3365    }
3366  }
3367}
3368
3369class TransitionModifier extends ModifierWithKey<object> {
3370  constructor(value: object) {
3371    super(value);
3372  }
3373  static identity: Symbol = Symbol('transition');
3374  applyPeer(node: KNode, reset: boolean): void {
3375    if (reset) {
3376      getUINativeModule().common.resetTransition(node);
3377    } else {
3378      getUINativeModule().common.setTransition(node, this.value);
3379    }
3380  }
3381}
3382
3383class SharedTransitionModifier extends ModifierWithKey<ArkSharedTransition> {
3384  constructor(value: ArkSharedTransition) {
3385    super(value);
3386  }
3387  static identity: Symbol = Symbol('sharedTransition');
3388  applyPeer(node: KNode, reset: boolean): void {
3389    if (reset) {
3390      getUINativeModule().common.resetSharedTransition(node);
3391    } else {
3392      getUINativeModule().common.setSharedTransition(node, this.value.id, this.value.options);
3393    }
3394  }
3395}
3396
3397class SystemBarEffectModifier extends ModifierWithKey<null> {
3398  constructor(value: null) {
3399    super(value);
3400  }
3401  static identity: Symbol = Symbol('systemBarEffect');
3402  applyPeer(node: KNode, reset: boolean): void {
3403    getUINativeModule().common.setSystemBarEffect(node, true);
3404  }
3405}
3406class PixelRoundModifier extends ModifierWithKey<PixelRoundPolicy> {
3407  constructor(value: PixelRoundPolicy) {
3408    super(value);
3409  }
3410  static identity: Symbol = Symbol('pixelRound');
3411  applyPeer(node: KNode, reset: boolean): void {
3412    if (reset) {
3413      getUINativeModule().common.resetPixelRound(node);
3414    } else {
3415      let start: PixelRoundCalcPolicy;
3416      let top: PixelRoundCalcPolicy;
3417      let end: PixelRoundCalcPolicy;
3418      let bottom: PixelRoundCalcPolicy;
3419      if (isObject(this.value)) {
3420        start = (this.value as PixelRoundCalcPolicy)?.start;
3421        top = (this.value as PixelRoundCalcPolicy)?.top;
3422        end = (this.value as PixelRoundCalcPolicy)?.end;
3423        bottom = (this.value as PixelRoundCalcPolicy)?.bottom;
3424      }
3425      getUINativeModule().common.setPixelRound(node, start, top, end, bottom);
3426    }
3427  }
3428  checkObjectDiff(): boolean {
3429    return !(this.stageValue.start === this.value.start &&
3430      this.stageValue.end === this.value.end &&
3431      this.stageValue.top === this.value.top &&
3432      this.stageValue.bottom === this.value.bottom);
3433  }
3434}
3435
3436class FocusScopeIdModifier extends ModifierWithKey<ArkFocusScopeId> {
3437  constructor(value: ArkFocusScopeId) {
3438    super(value);
3439  }
3440  static identity: Symbol = Symbol('focusScopeId');
3441  applyPeer(node: KNode, reset: boolean): void {
3442    if (reset) {
3443      getUINativeModule().common.resetFocusScopeId(node);
3444    } else {
3445      getUINativeModule().common.setFocusScopeId(node, this.value.id, this.value.isGroup, this.value.arrowStepOut);
3446    }
3447  }
3448}
3449
3450class FocusScopePriorityModifier extends ModifierWithKey<ArkFocusScopePriority> {
3451  constructor(value: ArkFocusScopePriority) {
3452    super(value);
3453  }
3454  static identity: Symbol = Symbol('focusScopePriority');
3455  applyPeer(node: KNode, reset: boolean): void {
3456    if (reset) {
3457      getUINativeModule().common.resetFocusScopePriority(node);
3458    } else {
3459      getUINativeModule().common.setFocusScopePriority(node, this.value.scopeId, this.value.priority);
3460    }
3461  }
3462}
3463
3464class FocusBoxModifier extends ModifierWithKey<FocusBoxStyle> {
3465  constructor(value: FocusBoxStyle) {
3466    super(value);
3467  }
3468  static identity: Symbol = Symbol('focusBox');
3469  applyPeer(node: KNode, reset: boolean): void {
3470    if (reset) {
3471      getUINativeModule().common.resetFocusBox(node);
3472    } else {
3473      getUINativeModule().common.setFocusBox(node, this.value?.margin,
3474        this.value?.strokeWidth, this.value?.strokeColor);
3475    }
3476  }
3477}
3478
3479class NextFocusModifier extends ModifierWithKey<FocusMovement> {
3480  constructor(value: FocusMovement) {
3481    super(value);
3482  }
3483  static identity: Symbol = Symbol('nextFocus');
3484  applyPeer(node: KNode, reset: boolean): void {
3485    if (reset) {
3486      getUINativeModule().common.resetNextFocus(node);
3487    } else {
3488      getUINativeModule().common.setNextFocus(node, this.value.forward, this.value.backward,
3489        this.value.up, this.value.down, this.value.left, this.value.right);
3490    }
3491  }
3492}
3493
3494const JSCallbackInfoType = { STRING: 0, NUMBER: 1, OBJECT: 2, BOOLEAN: 3, FUNCTION: 4 };
3495type basicType = string | number | bigint | boolean | symbol | undefined | object | null;
3496const isString = (val: basicType): boolean => typeof val === 'string';
3497const isNumber = (val: basicType): boolean => typeof val === 'number';
3498const isBigint = (val: basicType): boolean => typeof val === 'bigint';
3499const isBoolean = (val: basicType): boolean => typeof val === 'boolean';
3500const isSymbol = (val: basicType): boolean => typeof val === 'symbol';
3501const isUndefined = (val: basicType): boolean => typeof val === 'undefined';
3502const isObject = (val: basicType): boolean => typeof val === 'object';
3503const isFunction = (val: basicType): boolean => typeof val === 'function';
3504const isLengthType = (val: any): boolean => typeof val === 'string' || typeof val === 'number';
3505function parseWithDefaultNumber(val, defaultValue) {
3506  if (isNumber(val)) {
3507    return val;
3508  }
3509  else { return defaultValue; }
3510}
3511
3512function modifierWithKey<T extends number | string | boolean | object, M extends ModifierWithKey<T>>(
3513  modifiers: Map<Symbol, AttributeModifierWithKey>,
3514  identity: Symbol,
3515  modifierClass: new (value: T) => M,
3516  value: T
3517) {
3518  if (typeof (modifiers as ObservedMap).isFrameNode === 'function' && (modifiers as ObservedMap).isFrameNode()) {
3519    if (!(modifierClass as any).instance) {
3520      (modifierClass as any).instance = new modifierClass(value);
3521    } else {
3522      (modifierClass as any).instance.stageValue = value;
3523    }
3524    modifiers.set(identity, (modifierClass as any).instance);
3525    return;
3526  }
3527  const item = modifiers.get(identity);
3528  if (item) {
3529    item.stageValue = value;
3530    modifiers.set(identity, item);
3531  } else {
3532    modifiers.set(identity, new modifierClass(value));
3533  }
3534}
3535
3536declare class __JSScopeUtil__ {
3537  static syncInstanceId(instanceId: number): void;
3538  static restoreInstanceId(): void;
3539}
3540
3541class ArkComponent implements CommonMethod<CommonAttribute> {
3542  _modifiersWithKeys: Map<Symbol, AttributeModifierWithKey>;
3543  _changed: boolean;
3544  nativePtr: KNode;
3545  _weakPtr: JsPointerClass;
3546  _classType: ModifierType | undefined;
3547  _nativePtrChanged: boolean;
3548  _gestureEvent: UIGestureEvent;
3549  _instanceId: number;
3550  _needDiff: boolean;
3551
3552  constructor(nativePtr: KNode, classType?: ModifierType) {
3553    this.nativePtr = nativePtr;
3554    this._changed = false;
3555    this._classType = classType;
3556    this._needDiff = true;
3557    if (classType === ModifierType.FRAME_NODE) {
3558      this._instanceId = -1;
3559      this._modifiersWithKeys = new ObservedMap();
3560      (this._modifiersWithKeys as ObservedMap).setOnChange((key, value) => {
3561        if (this.nativePtr === undefined) {
3562          return;
3563        }
3564        if (this._instanceId !== -1) {
3565          __JSScopeUtil__.syncInstanceId(this._instanceId);
3566        }
3567        value.applyStageImmediately(this.nativePtr, this);
3568        getUINativeModule().frameNode.propertyUpdate(this.nativePtr);
3569        if (this._instanceId !== -1) {
3570          __JSScopeUtil__.restoreInstanceId();
3571        }
3572      });
3573      (this._modifiersWithKeys as ObservedMap).setFrameNode(true);
3574    } else if (classType === ModifierType.EXPOSE_MODIFIER || classType === ModifierType.STATE) {
3575      this._modifiersWithKeys = new ObservedMap();
3576      this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
3577    } else {
3578      this._modifiersWithKeys = new Map();
3579      this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
3580    }
3581    this._nativePtrChanged = false;
3582  }
3583
3584  setNodePtr(nodePtr: KNode) {
3585    if (nodePtr === this.nativePtr) {
3586      return;
3587    }
3588    this.nativePtr = nodePtr;
3589    this._weakPtr = (nodePtr !== undefined && nodePtr !== null) ? getUINativeModule().nativeUtils.createNativeWeakRef(nodePtr) : undefined;
3590  }
3591
3592  setInstanceId(instanceId: number): void {
3593    this._instanceId = instanceId;
3594  }
3595
3596  getOrCreateGestureEvent() {
3597    if (this._gestureEvent !== null) {
3598      this._gestureEvent = new UIGestureEvent();
3599      this._gestureEvent.setNodePtr(this.nativePtr);
3600      this._gestureEvent.setWeakNodePtr(this._weakPtr);
3601      this._gestureEvent.registerFrameNodeDeletedCallback(this.nativePtr);
3602    }
3603    return this._gestureEvent;
3604  }
3605
3606  cleanStageValue(): void {
3607    if (!this._modifiersWithKeys) {
3608      return;
3609    }
3610    this._modifiersWithKeys.forEach((value, key) => {
3611        value.stageValue = undefined;
3612    });
3613  }
3614
3615  applyStateUpdatePtr(instance: ArkComponent): void {
3616    if (this.nativePtr !== instance.nativePtr) {
3617      this.nativePtr = instance.nativePtr;
3618      this._nativePtrChanged = true;
3619      if (instance._weakPtr) {
3620        this._weakPtr = instance._weakPtr;
3621      } else {
3622        this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(this.nativePtr);
3623      }
3624    }
3625  }
3626
3627  applyModifierPatch(): void {
3628    let expiringItemsWithKeys = [];
3629    this._modifiersWithKeys.forEach((value, key) => {
3630      if (value.applyStage(this.nativePtr, this)) {
3631        expiringItemsWithKeys.push(key);
3632      }
3633    });
3634    expiringItemsWithKeys.forEach(key => {
3635      this._modifiersWithKeys.delete(key);
3636    });
3637  }
3638  onGestureJudgeBegin(callback: (gestureInfo: GestureInfo, event: BaseGestureEvent) => GestureJudgeResult): this {
3639    modifierWithKey(this._modifiersWithKeys, OnGestureJudgeBeginModifier.identity, OnGestureJudgeBeginModifier, callback);
3640    return this;
3641  }
3642  onGestureRecognizerJudgeBegin(callback: (event: BaseGestureEvent, current: GestureRecognizer, recognizers: Array<GestureRecognizer>) => GestureJudgeResult): this {
3643    modifierWithKey(this._modifiersWithKeys, OnGestureRecognizerJudgeBeginModifier.identity, OnGestureRecognizerJudgeBeginModifier, callback);
3644    return this;
3645  }
3646  shouldBuiltInRecognizerParallelWith(callback: (current: GestureRecognizer, others: Array<GestureRecognizer>) => GestureRecognizer): this {
3647    modifierWithKey(this._modifiersWithKeys, ShouldBuiltInRecognizerParallelWithModifier.identity, ShouldBuiltInRecognizerParallelWithModifier, callback);
3648    return this;
3649  }
3650  onSizeChange(callback: (oldValue: SizeOptions, newValue: SizeOptions) => void): this {
3651    modifierWithKey(this._modifiersWithKeys, OnSizeChangeModifier.identity, OnSizeChangeModifier, callback);
3652    return this;
3653  }
3654  outline(value: OutlineOptions): this {
3655    modifierWithKey(this._modifiersWithKeys, OutlineModifier.identity, OutlineModifier, value);
3656    return this;
3657  }
3658  outlineColor(value: ResourceColor | EdgeColors): this {
3659    modifierWithKey(this._modifiersWithKeys, OutlineColorModifier.identity, OutlineColorModifier, value);
3660    return this;
3661  }
3662  outlineRadius(value: Dimension | OutlineRadiuses): this {
3663    modifierWithKey(this._modifiersWithKeys, OutlineRadiusModifier.identity, OutlineRadiusModifier, value);
3664    return this;
3665  }
3666  outlineStyle(value: OutlineStyle | EdgeOutlineStyles): this {
3667    modifierWithKey(this._modifiersWithKeys, OutlineStyleModifier.identity, OutlineStyleModifier, value);
3668    return this;
3669  }
3670  outlineWidth(value: Dimension | EdgeOutlineWidths): this {
3671    modifierWithKey(this._modifiersWithKeys, OutlineWidthModifier.identity, OutlineWidthModifier, value);
3672    return this;
3673  }
3674  width(value: Length): this {
3675    modifierWithKey(this._modifiersWithKeys, WidthModifier.identity, WidthModifier, value);
3676    return this;
3677  }
3678
3679  height(value: Length): this {
3680    modifierWithKey(this._modifiersWithKeys, HeightModifier.identity, HeightModifier, value);
3681    return this;
3682  }
3683
3684  expandSafeArea(types?: Array<SafeAreaType>, edges?: Array<SafeAreaEdge>): this {
3685    let opts = new ArkSafeAreaExpandOpts();
3686    if (types && types.length > 0) {
3687      let safeAreaType: string | number = '';
3688      for (let param of types) {
3689        if (!isNumber(param) || param >= SAFE_AREA_TYPE_LIMIT) {
3690          safeAreaType = undefined;
3691          break;
3692        }
3693        if (safeAreaType) {
3694          safeAreaType += '|';
3695          safeAreaType += param.toString();
3696        } else {
3697          safeAreaType += param.toString();
3698        }
3699      }
3700      opts.type = safeAreaType;
3701    }
3702    if (edges && edges.length > 0) {
3703      let safeAreaEdge: string | number = '';
3704      for (let param of edges) {
3705        if (!isNumber(param) || param >= SAFE_AREA_EDGE_LIMIT) {
3706          safeAreaEdge = undefined;
3707          break;
3708        }
3709        if (safeAreaEdge) {
3710          safeAreaEdge += '|';
3711          safeAreaEdge += param.toString();
3712        } else {
3713          safeAreaEdge += param.toString();
3714        }
3715      }
3716      opts.edges = safeAreaEdge;
3717    }
3718    if (opts.type === undefined && opts.edges === undefined) {
3719      modifierWithKey(this._modifiersWithKeys, ExpandSafeAreaModifier.identity, ExpandSafeAreaModifier, undefined);
3720    } else {
3721      modifierWithKey(this._modifiersWithKeys, ExpandSafeAreaModifier.identity, ExpandSafeAreaModifier, opts);
3722    }
3723    return this;
3724  }
3725
3726  backgroundEffect(options: BackgroundEffectOptions): this {
3727    modifierWithKey(this._modifiersWithKeys, BackgroundEffectModifier.identity,
3728      BackgroundEffectModifier, options);
3729    return this;
3730  }
3731
3732  backgroundBrightness(params: BackgroundBrightnessOptions): this {
3733    modifierWithKey(this._modifiersWithKeys, BackgroundBrightnessModifier.identity,
3734      BackgroundBrightnessModifier, params);
3735    return this;
3736  }
3737
3738  backgroundBrightnessInternal(params: BrightnessOptions): this {
3739    modifierWithKey(this._modifiersWithKeys, BackgroundBrightnessInternalModifier.identity,
3740      BackgroundBrightnessInternalModifier, params);
3741    return this;
3742  }
3743
3744  foregroundBrightness(params: BrightnessOptions): this {
3745    modifierWithKey(this._modifiersWithKeys, ForegroundBrightnessModifier.identity,
3746      ForegroundBrightnessModifier, params);
3747    return this;
3748  }
3749
3750  dragPreviewOptions(value: DragPreviewOptions, options?: DragInteractionOptions): this {
3751    if (isUndefined(value)) {
3752      modifierWithKey(this._modifiersWithKeys, DragPreviewOptionsModifier.identity,
3753        DragPreviewOptionsModifier, undefined);
3754      return this;
3755    }
3756    let arkDragPreviewOptions = new ArkDragPreviewOptions();
3757    if (typeof value === 'object') {
3758      arkDragPreviewOptions.mode = value.mode;
3759      arkDragPreviewOptions.numberBadge = value.numberBadge;
3760      arkDragPreviewOptions.sizeChangeEffect = value.sizeChangeEffect;
3761    }
3762    if (typeof options === 'object') {
3763      arkDragPreviewOptions.isMultiSelectionEnabled = options.isMultiSelectionEnabled;
3764      arkDragPreviewOptions.defaultAnimationBeforeLifting = options.defaultAnimationBeforeLifting;
3765      arkDragPreviewOptions.enableEdgeAutoScroll = options.enableEdgeAutoScroll;
3766      arkDragPreviewOptions.enableHapticFeedback = options.enableHapticFeedback;
3767      arkDragPreviewOptions.isLiftingDisabled = options.isLiftingDisabled;
3768    }
3769    modifierWithKey(this._modifiersWithKeys, DragPreviewOptionsModifier.identity,
3770      DragPreviewOptionsModifier, arkDragPreviewOptions);
3771    return this;
3772  }
3773
3774  responseRegion(value: Array<Rectangle> | Rectangle): this {
3775    modifierWithKey(this._modifiersWithKeys, ResponseRegionModifier.identity,
3776      ResponseRegionModifier, value);
3777    return this;
3778  }
3779
3780  mouseResponseRegion(value: Array<Rectangle> | Rectangle): this {
3781    modifierWithKey(this._modifiersWithKeys, MouseResponseRegionModifier.identity,
3782      MouseResponseRegionModifier, value);
3783    return this;
3784  }
3785
3786  size(value: SizeOptions): this {
3787    modifierWithKey(this._modifiersWithKeys, SizeModifier.identity, SizeModifier, value);
3788    return this;
3789  }
3790
3791  constraintSize(value: ConstraintSizeOptions): this {
3792    modifierWithKey(this._modifiersWithKeys, ConstraintSizeModifier.identity,
3793      ConstraintSizeModifier, value);
3794    return this;
3795  }
3796
3797  touchable(value: boolean): this {
3798    if (typeof value === 'boolean') {
3799      modifierWithKey(this._modifiersWithKeys, TouchableModifier.identity, TouchableModifier, value);
3800    } else {
3801      modifierWithKey(this._modifiersWithKeys, TouchableModifier.identity, TouchableModifier, undefined);
3802    }
3803    return this;
3804  }
3805
3806  hitTestBehavior(value: HitTestMode): this {
3807    if (value) {
3808      modifierWithKey(this._modifiersWithKeys, HitTestBehaviorModifier.identity, HitTestBehaviorModifier, value);
3809    } else {
3810      modifierWithKey(this._modifiersWithKeys, HitTestBehaviorModifier.identity, HitTestBehaviorModifier, undefined);
3811    }
3812    return this;
3813  }
3814
3815  layoutWeight(value: number | string): this {
3816    if (isNumber(value)) {
3817      modifierWithKey(this._modifiersWithKeys, LayoutWeightModifier.identity, LayoutWeightModifier, value);
3818    } else if (isString(value) && !isNaN(Number(value))) {
3819      modifierWithKey(this._modifiersWithKeys, LayoutWeightModifier.identity, LayoutWeightModifier, parseInt(value.toString()));
3820    } else {
3821      modifierWithKey(this._modifiersWithKeys, LayoutWeightModifier.identity, LayoutWeightModifier, undefined);
3822    }
3823    return this;
3824  }
3825
3826  padding(value: Padding | Length | LocalizedPadding): this {
3827    let arkValue = new ArkPadding();
3828    if (value !== null && value !== undefined) {
3829      if (isLengthType(value) || isResource(value)) {
3830        arkValue.top = <Length>value;
3831        arkValue.right = <Length>value;
3832        arkValue.bottom = <Length>value;
3833        arkValue.left = <Length>value;
3834      } else {
3835        arkValue.top = value.top;
3836        arkValue.bottom = value.bottom;
3837        if (Object.keys(value).indexOf('right') >= 0) {
3838          arkValue.right = value.right;
3839        }
3840        if (Object.keys(value).indexOf('end') >= 0) {
3841          arkValue.right = value.end;
3842        }
3843        if (Object.keys(value).indexOf('left') >= 0) {
3844          arkValue.left = value.left;
3845        }
3846        if (Object.keys(value).indexOf('start') >= 0) {
3847          arkValue.left = value.start;
3848        }
3849      }
3850      modifierWithKey(this._modifiersWithKeys, PaddingModifier.identity, PaddingModifier, arkValue);
3851    } else {
3852      modifierWithKey(this._modifiersWithKeys, PaddingModifier.identity, PaddingModifier, undefined);
3853    }
3854    return this;
3855  }
3856
3857  safeAreaPadding(value: Padding | LengthMetrics | LocalizedPadding): this {
3858    let arkValue = new ArkPadding();
3859    if (value !== null && value !== undefined) {
3860      if (isObject(value) && (Object.keys(value).indexOf('value') >= 0)) {
3861        arkValue.top = <LengthMetrics>value;
3862        arkValue.right = <LengthMetrics>value;
3863        arkValue.bottom = <LengthMetrics>value;
3864        arkValue.left = <LengthMetrics>value;
3865      } else {
3866        arkValue.top = value.top;
3867        arkValue.bottom = value.bottom;
3868        if (Object.keys(value).indexOf('right') >= 0) {
3869          arkValue.right = value.right;
3870        }
3871        if (Object.keys(value).indexOf('end') >= 0) {
3872          arkValue.right = value.end;
3873        }
3874        if (Object.keys(value).indexOf('left') >= 0) {
3875          arkValue.left = value.left;
3876        }
3877        if (Object.keys(value).indexOf('start') >= 0) {
3878          arkValue.left = value.start;
3879        }
3880      }
3881      modifierWithKey(this._modifiersWithKeys, SafeAreaPaddingModifier.identity, SafeAreaPaddingModifier, arkValue);
3882    } else {
3883      modifierWithKey(this._modifiersWithKeys, SafeAreaPaddingModifier.identity, SafeAreaPaddingModifier, undefined);
3884    }
3885    return this;
3886  }
3887
3888  margin(value: Margin | Length | LocalizedMargin): this {
3889    let arkValue = new ArkPadding();
3890    if (value !== null && value !== undefined) {
3891      if (isLengthType(value) || isResource(value)) {
3892        arkValue.top = <Length>value;
3893        arkValue.right = <Length>value;
3894        arkValue.bottom = <Length>value;
3895        arkValue.left = <Length>value;
3896      } else {
3897        arkValue.top = value.top;
3898        arkValue.bottom = value.bottom;
3899        if (Object.keys(value).indexOf('right') >= 0) {
3900          arkValue.right = value.right;
3901        }
3902        if (Object.keys(value).indexOf('end') >= 0) {
3903          arkValue.right = value.end;
3904        }
3905        if (Object.keys(value).indexOf('left') >= 0) {
3906          arkValue.left = value.left;
3907        }
3908        if (Object.keys(value).indexOf('start') >= 0) {
3909          arkValue.left = value.start;
3910        }
3911      }
3912      modifierWithKey(this._modifiersWithKeys, MarginModifier.identity, MarginModifier, arkValue);
3913    } else {
3914      modifierWithKey(this._modifiersWithKeys, MarginModifier.identity, MarginModifier, undefined);
3915    }
3916    return this;
3917  }
3918
3919  background(builder: CustomBuilder, options?: { align?: Alignment }): this {
3920    throw new Error('Method not implemented.');
3921  }
3922
3923  backgroundColor(value: ResourceColor): this {
3924    modifierWithKey(this._modifiersWithKeys, BackgroundColorModifier.identity, BackgroundColorModifier, value);
3925    return this;
3926  }
3927
3928  backgroundImage(src: ResourceStr | PixelMap, repeat?: ImageRepeat | BackgroundImageOptions): this {
3929    let arkBackgroundImage = new ArkBackgroundImage();
3930    arkBackgroundImage.src = src;
3931    arkBackgroundImage.repeat = repeat;
3932    modifierWithKey(this._modifiersWithKeys, BackgroundImageModifier.identity, BackgroundImageModifier, arkBackgroundImage);
3933    return this;
3934  }
3935
3936  backgroundImageSize(value: SizeOptions | ImageSize): this {
3937    modifierWithKey(this._modifiersWithKeys, BackgroundImageSizeModifier.identity, BackgroundImageSizeModifier, value);
3938    return this;
3939  }
3940
3941  backgroundImagePosition(value: Position | Alignment): this {
3942    modifierWithKey(this._modifiersWithKeys, BackgroundImagePositionModifier.identity, BackgroundImagePositionModifier, value);
3943    return this;
3944  }
3945
3946  backgroundImageResizable(value: ResizableOptions): this {
3947    modifierWithKey(this._modifiersWithKeys, BackgroundImageResizableModifier.identity, BackgroundImageResizableModifier, value);
3948    return this;
3949  }
3950
3951  backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): this {
3952    if (isUndefined(value)) {
3953      modifierWithKey(this._modifiersWithKeys, BackgroundBlurStyleModifier.identity,
3954        BackgroundBlurStyleModifier, undefined);
3955      return this;
3956    }
3957    let arkBackgroundBlurStyle = new ArkBackgroundBlurStyle();
3958    arkBackgroundBlurStyle.blurStyle = value;
3959    if (typeof options === 'object') {
3960      arkBackgroundBlurStyle.colorMode = options.colorMode;
3961      arkBackgroundBlurStyle.adaptiveColor = options.adaptiveColor;
3962      arkBackgroundBlurStyle.scale = options.scale;
3963      arkBackgroundBlurStyle.blurOptions = options.blurOptions;
3964      arkBackgroundBlurStyle.policy = options.policy;
3965      arkBackgroundBlurStyle.inactiveColor = options.inactiveColor;
3966      arkBackgroundBlurStyle.type = options.type;
3967    }
3968    modifierWithKey(this._modifiersWithKeys, BackgroundBlurStyleModifier.identity,
3969      BackgroundBlurStyleModifier, arkBackgroundBlurStyle);
3970    return this;
3971  }
3972
3973  foregroundBlurStyle(value: BlurStyle, options?: ForegroundBlurStyleOptions): this {
3974    if (isUndefined(value)) {
3975      modifierWithKey(this._modifiersWithKeys, ForegroundBlurStyleModifier.identity,
3976        ForegroundBlurStyleModifier, undefined);
3977      return this;
3978    }
3979    let arkForegroundBlurStyle = new ArkForegroundBlurStyle();
3980    arkForegroundBlurStyle.blurStyle = value;
3981    if (typeof options === 'object') {
3982      arkForegroundBlurStyle.colorMode = options.colorMode;
3983      arkForegroundBlurStyle.adaptiveColor = options.adaptiveColor;
3984      arkForegroundBlurStyle.scale = options.scale;
3985      arkForegroundBlurStyle.blurOptions = options.blurOptions;
3986    }
3987    modifierWithKey(this._modifiersWithKeys, ForegroundBlurStyleModifier.identity,
3988      ForegroundBlurStyleModifier, arkForegroundBlurStyle);
3989    return this;
3990  }
3991
3992  opacity(value: number | Resource): this {
3993    modifierWithKey(this._modifiersWithKeys, OpacityModifier.identity, OpacityModifier, value);
3994    return this;
3995  }
3996
3997  border(value: BorderOptions): this {
3998    let arkBorder = new ArkBorder();
3999    if (isUndefined(value)) {
4000      arkBorder = undefined;
4001    }
4002
4003    if (!isUndefined(value?.width) && value?.width !== null) {
4004      if (isNumber(value.width) || isString(value.width) || isResource(value.width)) {
4005        arkBorder.arkWidth.left = value.width;
4006        arkBorder.arkWidth.right = value.width;
4007        arkBorder.arkWidth.top = value.width;
4008        arkBorder.arkWidth.bottom = value.width;
4009      } else {
4010        if ((Object.keys(value.width).indexOf('start') >= 0) ||
4011        (Object.keys(value.width).indexOf('end') >= 0)) {
4012          arkBorder.arkWidth.start = (value.width as LocalizedEdgeWidths).start;
4013          arkBorder.arkWidth.end = (value.width as LocalizedEdgeWidths).end;
4014          arkBorder.arkWidth.top = (value.width as LocalizedEdgeWidths).top;
4015          arkBorder.arkWidth.bottom = (value.width as LocalizedEdgeWidths).bottom;
4016        } else {
4017          arkBorder.arkWidth.left = (value.width as EdgeWidths).left;
4018          arkBorder.arkWidth.right = (value.width as EdgeWidths).right;
4019          arkBorder.arkWidth.top = (value.width as EdgeWidths).top;
4020          arkBorder.arkWidth.bottom = (value.width as EdgeWidths).bottom;
4021        }
4022    }
4023  }
4024    if (!isUndefined(value?.color) && value?.color !== null) {
4025      if (isNumber(value.color) || isString(value.color) || isResource(value.color)) {
4026        arkBorder.arkColor.leftColor = value.color;
4027        arkBorder.arkColor.rightColor = value.color;
4028        arkBorder.arkColor.topColor = value.color;
4029        arkBorder.arkColor.bottomColor = value.color;
4030      } else {
4031        if ((Object.keys(value.color).indexOf('start') >= 0) ||
4032          (Object.keys(value.color).indexOf('end') >= 0)) {
4033            arkBorder.arkColor.startColor = (value.color as LocalizedEdgeColors).start;
4034            arkBorder.arkColor.endColor = (value.color as LocalizedEdgeColors).end;
4035            arkBorder.arkColor.topColor = (value.color as LocalizedEdgeColors).top;
4036            arkBorder.arkColor.bottomColor = (value.color as LocalizedEdgeColors).bottom;
4037          } else {
4038            arkBorder.arkColor.leftColor = (value.color as EdgeColors).left;
4039            arkBorder.arkColor.rightColor = (value.color as EdgeColors).right;
4040            arkBorder.arkColor.topColor = (value.color as EdgeColors).top;
4041            arkBorder.arkColor.bottomColor = (value.color as EdgeColors).bottom;
4042          }
4043      }
4044    }
4045    if (!isUndefined(value?.radius) && value?.radius !== null) {
4046      if (isNumber(value.radius) || isString(value.radius) || isResource(value.radius)) {
4047        arkBorder.arkRadius.topLeft = value.radius;
4048        arkBorder.arkRadius.topRight = value.radius;
4049        arkBorder.arkRadius.bottomLeft = value.radius;
4050        arkBorder.arkRadius.bottomRight = value.radius;
4051      } else {
4052        if ((Object.keys(this.value).indexOf('topStart') >= 0) ||
4053          (Object.keys(this.value).indexOf('topEnd') >= 0) ||
4054          (Object.keys(this.value).indexOf('bottomStart') >= 0) ||
4055          (Object.keys(this.value).indexOf('bottomEnd') >= 0)) {
4056          arkBorder.arkRadius.topStart = (value.radius as LocalizedBorderRadius)?.topStart;
4057          arkBorder.arkRadius.topEnd = (value.radius as LocalizedBorderRadius)?.topEnd;
4058          arkBorder.arkRadius.bottomStart = (value.radius as LocalizedBorderRadius)?.bottomStart;
4059          arkBorder.arkRadius.bottomEnd = (value.radius as LocalizedBorderRadius)?.bottomEnd;
4060        } else {
4061          arkBorder.arkRadius.topLeft = (value.radius as BorderRadiuses)?.topLeft;
4062          arkBorder.arkRadius.topRight = (value.radius as BorderRadiuses)?.topRight;
4063          arkBorder.arkRadius.bottomLeft = (value.radius as BorderRadiuses)?.bottomLeft;
4064          arkBorder.arkRadius.bottomRight = (value.radius as BorderRadiuses)?.bottomRight;
4065        }
4066    }
4067  }
4068    if (!isUndefined(value?.style) && value?.style !== null) {
4069      let arkBorderStyle = new ArkBorderStyle();
4070      if (arkBorderStyle.parseBorderStyle(value.style)) {
4071        if (!isUndefined(arkBorderStyle.style)) {
4072          arkBorder.arkStyle.top = arkBorderStyle.style;
4073          arkBorder.arkStyle.left = arkBorderStyle.style;
4074          arkBorder.arkStyle.bottom = arkBorderStyle.style;
4075          arkBorder.arkStyle.right = arkBorderStyle.style;
4076        } else {
4077          arkBorder.arkStyle.top = arkBorderStyle.top;
4078          arkBorder.arkStyle.left = arkBorderStyle.left;
4079          arkBorder.arkStyle.bottom = arkBorderStyle.bottom;
4080          arkBorder.arkStyle.right = arkBorderStyle.right;
4081        }
4082      }
4083    }
4084    if (!isUndefined(value?.dashGap) && value?.dashGap !== null) {
4085      if (isNumber(value.dashGap) || isString(value.dashGap) || isResource(value.dashGap) || isObject(value.dashGap) && isNumber(value.dashGap.value)) {
4086        arkBorder.arkDashGap.left = value.dashGap;
4087        arkBorder.arkDashGap.right = value.dashGap;
4088        arkBorder.arkDashGap.top = value.dashGap;
4089        arkBorder.arkDashGap.bottom = value.dashGap;
4090      } else {
4091        arkBorder.arkDashGap.left = (value.dashGap as EdgeWidths).left;
4092        arkBorder.arkDashGap.right = (value.dashGap as EdgeWidths).right;
4093        arkBorder.arkDashGap.top = (value.dashGap as EdgeWidths).top;
4094        arkBorder.arkDashGap.bottom = (value.dashGap as EdgeWidths).bottom;
4095        arkBorder.arkDashGap.start = (value.dashGap as LocalizedEdgeWidths).start;
4096        arkBorder.arkDashGap.end = (value.dashGap as LocalizedEdgeWidths).end;
4097      }
4098    }
4099    if (!isUndefined(value?.dashWidth) && value?.dashWidth !== null) {
4100      if (isNumber(value.dashWidth) || isString(value.dashWidth) || isResource(value.dashWidth) || isObject(value.dashWidth) && isNumber(value.dashWidth.value)) {
4101        arkBorder.arkDashWidth.left = value.dashWidth;
4102        arkBorder.arkDashWidth.right = value.dashWidth;
4103        arkBorder.arkDashWidth.top = value.dashWidth;
4104        arkBorder.arkDashWidth.bottom = value.dashWidth;
4105      } else {
4106        arkBorder.arkDashWidth.left = (value.dashWidth as EdgeWidths).left;
4107        arkBorder.arkDashWidth.right = (value.dashWidth as EdgeWidths).right;
4108        arkBorder.arkDashWidth.top = (value.dashWidth as EdgeWidths).top;
4109        arkBorder.arkDashWidth.bottom = (value.dashWidth as EdgeWidths).bottom;
4110        arkBorder.arkDashWidth.start = (value.dashWidth as EdgeWidths).start;
4111        arkBorder.arkDashWidth.end = (value.dashWidth as EdgeWidths).end;
4112      }
4113    }
4114    modifierWithKey(this._modifiersWithKeys, BorderModifier.identity, BorderModifier, arkBorder);
4115    return this;
4116  }
4117
4118  borderStyle(value: BorderStyle | EdgeStyles): this {
4119    modifierWithKey(this._modifiersWithKeys, BorderStyleModifier.identity, BorderStyleModifier, value);
4120    return this;
4121  }
4122
4123  borderWidth(value: Length | EdgeWidths): this {
4124    modifierWithKey(this._modifiersWithKeys, BorderWidthModifier.identity, BorderWidthModifier, value);
4125    return this;
4126  }
4127
4128  borderColor(value: ResourceColor | EdgeColors): this {
4129    modifierWithKey(this._modifiersWithKeys, BorderColorModifier.identity, BorderColorModifier, value);
4130    return this;
4131  }
4132
4133  borderRadius(value: Length | BorderRadiuses): this {
4134    modifierWithKey(this._modifiersWithKeys, BorderRadiusModifier.identity, BorderRadiusModifier, value);
4135    return this;
4136  }
4137
4138
4139  borderImage(value: BorderImageOption): this {
4140    modifierWithKey(this._modifiersWithKeys, BorderImageModifier.identity, BorderImageModifier, value);
4141    return this;
4142  }
4143
4144  foregroundColor(value: ResourceColor | ColoringStrategy): this {
4145    modifierWithKey(this._modifiersWithKeys, ForegroundColorModifier.identity, ForegroundColorModifier, value);
4146    return this;
4147  }
4148
4149  onClick(event: (event?: ClickEvent) => void): this {
4150    modifierWithKey(this._modifiersWithKeys, OnClickModifier.identity, OnClickModifier, event);
4151    return this;
4152  }
4153
4154  onHover(event: (isHover?: boolean, event?: HoverEvent) => void): this {
4155    modifierWithKey(this._modifiersWithKeys, OnHoverModifier.identity, OnHoverModifier, event);
4156    return this;
4157  }
4158
4159  onHoverMove(event: (event?: HoverMoveEvent) => void): this {
4160    modifierWithKey(this._modifiersWithKeys, OnHoverMoveModifier.identity, OnHoverMoveModifier, event);
4161    return this;
4162  }
4163
4164  hoverEffect(value: HoverEffect): this {
4165    modifierWithKey(this._modifiersWithKeys, HoverEffectModifier.identity, HoverEffectModifier, value);
4166    return this;
4167  }
4168
4169  onMouse(event: (event?: MouseEvent) => void): this {
4170    modifierWithKey(this._modifiersWithKeys, OnMouseModifier.identity, OnMouseModifier, event);
4171    return this;
4172  }
4173
4174  onAxisEvent(event: (event?: AxisEvent) => void): this {
4175    modifierWithKey(this._modifiersWithKeys, OnAxisEventModifier.identity, OnAxisEventModifier, event);
4176    return this;
4177  }
4178
4179  onTouch(event: (event?: TouchEvent) => void): this {
4180    modifierWithKey(this._modifiersWithKeys, OnTouchModifier.identity, OnTouchModifier, event);
4181    return this;
4182  }
4183
4184  onKeyEvent(event: (event?: KeyEvent) => void): this {
4185    modifierWithKey(this._modifiersWithKeys, OnKeyEventModifier.identity, OnKeyEventModifier, event);
4186    return this;
4187  }
4188
4189  onKeyPreIme(event: Callback<KeyEvent, boolean>): this {
4190    modifierWithKey(this._modifiersWithKeys, OnKeyPreImeModifier.identity, OnKeyPreImeModifier, event);
4191    return this;
4192  }
4193
4194  onKeyEventDispatch(event: Callback<KeyEvent, boolean>): this {
4195    modifierWithKey(this._modifiersWithKeys, OnKeyEventDispatchModifier.identity, OnKeyEventDispatchModifier, event);
4196    return this;
4197  }
4198
4199  onFocusAxisEvent(event: (event?: FocusAxisEvent) => void): this {
4200    modifierWithKey(this._modifiersWithKeys, OnFocusAxisEventModifier.identity, OnFocusAxisEventModifier, event);
4201    return this;
4202  }
4203
4204  focusable(value: boolean): this {
4205    if (typeof value === 'boolean') {
4206      modifierWithKey(this._modifiersWithKeys, FocusableModifier.identity, FocusableModifier, value);
4207    } else {
4208      modifierWithKey(this._modifiersWithKeys, FocusableModifier.identity, FocusableModifier, undefined);
4209    }
4210    return this;
4211  }
4212
4213  tabStop(value: boolean): this {
4214    if (typeof value === 'boolean') {
4215      modifierWithKey(this._modifiersWithKeys, TabStopModifier.identity, TabStopModifier, value);
4216    } else {
4217      modifierWithKey(this._modifiersWithKeys, TabStopModifier.identity, TabStopModifier, undefined);
4218    }
4219    return this;
4220  }
4221
4222  onFocus(event: () => void): this {
4223    modifierWithKey(this._modifiersWithKeys, OnFocusModifier.identity, OnFocusModifier, event);
4224    return this;
4225  }
4226
4227  onBlur(event: () => void): this {
4228    modifierWithKey(this._modifiersWithKeys, OnBlurModifier.identity, OnBlurModifier, event);
4229    return this;
4230  }
4231
4232  tabIndex(index: number): this {
4233    if (typeof index !== 'number') {
4234      modifierWithKey(this._modifiersWithKeys, TabIndexModifier.identity, TabIndexModifier, undefined);
4235    } else {
4236      modifierWithKey(this._modifiersWithKeys, TabIndexModifier.identity, TabIndexModifier, index);
4237    }
4238    return this;
4239  }
4240
4241  defaultFocus(value: boolean): this {
4242    if (typeof value === 'boolean') {
4243      modifierWithKey(this._modifiersWithKeys, DefaultFocusModifier.identity, DefaultFocusModifier, value);
4244    } else {
4245      modifierWithKey(this._modifiersWithKeys, DefaultFocusModifier.identity, DefaultFocusModifier, undefined);
4246    }
4247    return this;
4248  }
4249
4250  groupDefaultFocus(value: boolean): this {
4251    if (typeof value === 'boolean') {
4252      modifierWithKey(this._modifiersWithKeys, GroupDefaultFocusModifier.identity, GroupDefaultFocusModifier, value);
4253    } else {
4254      modifierWithKey(this._modifiersWithKeys, GroupDefaultFocusModifier.identity, GroupDefaultFocusModifier, undefined);
4255    }
4256    return this;
4257  }
4258
4259  focusOnTouch(value: boolean): this {
4260    if (typeof value === 'boolean') {
4261      modifierWithKey(this._modifiersWithKeys, FocusOnTouchModifier.identity, FocusOnTouchModifier, value);
4262    } else {
4263      modifierWithKey(this._modifiersWithKeys, FocusOnTouchModifier.identity, FocusOnTouchModifier, undefined);
4264    }
4265    return this;
4266  }
4267
4268  animation(value: AnimateParam): this {
4269    throw new Error('Method not implemented.');
4270  }
4271
4272  transition(value: TransitionOptions | TransitionEffect): this {
4273    modifierWithKey(this._modifiersWithKeys, TransitionModifier.identity, TransitionModifier, value);
4274    return this;
4275  }
4276
4277  gesture(gesture: GestureType, mask?: GestureMask): this {
4278    throw new Error('Method not implemented.');
4279  }
4280
4281  priorityGesture(gesture: GestureType, mask?: GestureMask): this {
4282    throw new Error('Method not implemented.');
4283  }
4284
4285  parallelGesture(gesture: GestureType, mask?: GestureMask): this {
4286    throw new Error('Method not implemented.');
4287  }
4288
4289  blur(value: number, options?: BlurOptions): this {
4290    let blur: ArkBlurOptions = new ArkBlurOptions();
4291    blur.value = value;
4292    blur.options = options;
4293    modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, blur);
4294    return this;
4295  }
4296
4297  linearGradientBlur(value: number, options: LinearGradientBlurOptions): this {
4298    if (isUndefined(value) || isNull(value) || isUndefined(options) || isNull(options)) {
4299      modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier,
4300        undefined);
4301      return this;
4302    }
4303    let arkLinearGradientBlur = new ArkLinearGradientBlur();
4304    arkLinearGradientBlur.blurRadius = value;
4305    arkLinearGradientBlur.fractionStops = options.fractionStops;
4306    arkLinearGradientBlur.direction = options.direction;
4307    modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier,
4308      arkLinearGradientBlur);
4309    return this;
4310  }
4311
4312  brightness(value: number): this {
4313    if (!isNumber(value)) {
4314      modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, undefined);
4315    } else {
4316      modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, value);
4317    }
4318    return this;
4319  }
4320
4321  contrast(value: number): this {
4322    if (!isNumber(value)) {
4323      modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, undefined);
4324    } else {
4325      modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, value);
4326    }
4327    return this;
4328  }
4329
4330  grayscale(value: number): this {
4331    if (!isNumber(value)) {
4332      modifierWithKey(this._modifiersWithKeys, GrayscaleModifier.identity, GrayscaleModifier, undefined);
4333    } else {
4334      modifierWithKey(this._modifiersWithKeys, GrayscaleModifier.identity, GrayscaleModifier, value);
4335    }
4336    return this;
4337  }
4338
4339  colorBlend(value: Color | string | Resource): this {
4340    modifierWithKey(this._modifiersWithKeys, ColorBlendModifier.identity, ColorBlendModifier, value);
4341    return this;
4342  }
4343
4344  saturate(value: number): this {
4345    if (!isNumber(value)) {
4346      modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, undefined);
4347    } else {
4348      modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, value);
4349    }
4350    return this;
4351  }
4352
4353  sepia(value: number): this {
4354    if (!isNumber(value)) {
4355      modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, undefined);
4356    } else {
4357      modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, value);
4358    }
4359    return this;
4360  }
4361
4362  invert(value: number | InvertOptions): this {
4363    if (!isUndefined(value)) {
4364      modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value);
4365    } else {
4366      modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined);
4367    }
4368    return this;
4369  }
4370
4371  hueRotate(value: number | string): this {
4372    if (!isNumber(value) && !isString(value)) {
4373      modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, undefined);
4374    } else {
4375      modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, value);
4376    }
4377    return this;
4378  }
4379
4380  useEffect(value: boolean, type: EffectType = EffectType.DEFAULT): this {
4381    let useEffectObj = new ArkUseEffect();
4382    useEffectObj.useEffect = value;
4383    useEffectObj.effectType = type;
4384    modifierWithKey(this._modifiersWithKeys, UseEffectModifier.identity, UseEffectModifier, useEffectObj);
4385    return this;
4386  }
4387
4388  backdropBlur(value: number, options?: BlurOptions): this {
4389    let blur: ArkBlurOptions = new ArkBlurOptions();
4390    blur.value = value;
4391    blur.options = options;
4392    modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, blur);
4393    return this;
4394  }
4395
4396  renderGroup(value: boolean): this {
4397    modifierWithKey(this._modifiersWithKeys, RenderGroupModifier.identity, RenderGroupModifier, value);
4398    return this;
4399  }
4400
4401  translate(value: TranslateOptions): this {
4402    modifierWithKey(this._modifiersWithKeys, TranslateModifier.identity, TranslateModifier, value);
4403    return this;
4404  }
4405
4406  scale(value: ScaleOptions): this {
4407    modifierWithKey(this._modifiersWithKeys, ScaleModifier.identity, ScaleModifier, value);
4408    return this;
4409  }
4410  gridSpan(value: number): this {
4411    if (isNumber(value)) {
4412      modifierWithKey(this._modifiersWithKeys, GridSpanModifier.identity, GridSpanModifier, value);
4413    } else {
4414      modifierWithKey(this._modifiersWithKeys, GridSpanModifier.identity, GridSpanModifier, undefined);
4415    }
4416    return this;
4417  }
4418
4419  gridOffset(value: number): this {
4420    if (isNumber(value)) {
4421      modifierWithKey(this._modifiersWithKeys, GridOffsetModifier.identity, GridOffsetModifier, value);
4422    } else {
4423      modifierWithKey(this._modifiersWithKeys, GridOffsetModifier.identity, GridOffsetModifier, undefined);
4424    }
4425    return this;
4426  }
4427
4428  rotate(value: RotateOptions): this {
4429    modifierWithKey(this._modifiersWithKeys, RotateModifier.identity, RotateModifier, value);
4430    return this;
4431  }
4432
4433  transform(value: object): this {
4434    modifierWithKey(this._modifiersWithKeys, TransformModifier.identity, TransformModifier, value);
4435    return this;
4436  }
4437
4438  onAppear(event: () => void): this {
4439    modifierWithKey(this._modifiersWithKeys, OnAppearModifier.identity, OnAppearModifier, event);
4440    return this;
4441  }
4442
4443  onDisAppear(event: () => void): this {
4444    modifierWithKey(this._modifiersWithKeys, OnDisappearModifier.identity, OnDisappearModifier, event);
4445    return this;
4446  }
4447
4448  onAttach(event: () => void): this {
4449    modifierWithKey(this._modifiersWithKeys, OnAttachModifier.identity, OnAttachModifier, event);
4450    return this;
4451  }
4452
4453  onDetach(event: () => void): this {
4454    modifierWithKey(this._modifiersWithKeys, OnDetachModifier.identity, OnDetachModifier, event);
4455    return this;
4456  }
4457  onAreaChange(event: (oldValue: Area, newValue: Area) => void): this {
4458    modifierWithKey(this._modifiersWithKeys, OnAreaChangeModifier.identity, OnAreaChangeModifier, event);
4459    return this;
4460  }
4461
4462  visibility(value: Visibility): this {
4463    modifierWithKey(this._modifiersWithKeys, VisibilityModifier.identity, VisibilityModifier, value);
4464    return this;
4465  }
4466
4467  flexGrow(value: number): this {
4468    modifierWithKey(this._modifiersWithKeys, FlexGrowModifier.identity, FlexGrowModifier, value);
4469    return this;
4470  }
4471
4472  flexShrink(value: number): this {
4473    modifierWithKey(this._modifiersWithKeys, FlexShrinkModifier.identity, FlexShrinkModifier, value);
4474    return this;
4475  }
4476
4477  flexBasis(value: number | string): this {
4478    modifierWithKey(this._modifiersWithKeys, FlexBasisModifier.identity, FlexBasisModifier, value);
4479    return this;
4480  }
4481
4482  alignSelf(value: ItemAlign): this {
4483    modifierWithKey(this._modifiersWithKeys, AlignSelfModifier.identity, AlignSelfModifier, value);
4484    return this;
4485  }
4486
4487  displayPriority(value: number): this {
4488    modifierWithKey(this._modifiersWithKeys, DisplayPriorityModifier.identity, DisplayPriorityModifier, value);
4489    return this;
4490  }
4491
4492  zIndex(value: number): this {
4493    if (value !== null) {
4494      let zIndex = 0;
4495      if (typeof (value) === 'number') {
4496        zIndex = value;
4497      }
4498      modifierWithKey(this._modifiersWithKeys, ZIndexModifier.identity, ZIndexModifier, zIndex);
4499    }
4500    return this;
4501  }
4502
4503  sharedTransition(id: string, options?: sharedTransitionOptions): this {
4504    let arkSharedTransition = new ArkSharedTransition();
4505    if (isString(id)) {
4506      arkSharedTransition.id = id;
4507    }
4508    if (typeof options === 'object') {
4509      arkSharedTransition.options = options;
4510    }
4511    modifierWithKey(
4512      this._modifiersWithKeys, SharedTransitionModifier.identity, SharedTransitionModifier, arkSharedTransition);
4513    return this;
4514  }
4515
4516  direction(value: Direction): this {
4517    modifierWithKey(this._modifiersWithKeys, DirectionModifier.identity, DirectionModifier, value);
4518    return this;
4519  }
4520
4521  align(value: Alignment): this {
4522    if (isNumber(value)) {
4523      modifierWithKey(this._modifiersWithKeys, AlignModifier.identity, AlignModifier, value);
4524    } else {
4525      modifierWithKey(this._modifiersWithKeys, AlignModifier.identity, AlignModifier, undefined);
4526    }
4527    return this;
4528  }
4529
4530  position(value: Position | Edges): this {
4531    if (isObject(value)) {
4532      modifierWithKey(this._modifiersWithKeys, PositionModifier.identity, PositionModifier, value);
4533    } else {
4534      modifierWithKey(this._modifiersWithKeys, PositionModifier.identity, PositionModifier, undefined);
4535    }
4536    return this;
4537  }
4538
4539  markAnchor(value: Position): this {
4540    modifierWithKey(this._modifiersWithKeys, MarkAnchorModifier.identity, MarkAnchorModifier, value);
4541    return this;
4542  }
4543
4544  offset(value: Position | Edges): this {
4545    if (isObject(value)) {
4546      modifierWithKey(this._modifiersWithKeys, OffsetModifier.identity, OffsetModifier, value);
4547    } else {
4548      modifierWithKey(this._modifiersWithKeys, OffsetModifier.identity, OffsetModifier, undefined);
4549    }
4550    return this;
4551  }
4552
4553  enabled(value: boolean): this {
4554    if (typeof value === 'boolean') {
4555      modifierWithKey(this._modifiersWithKeys, EnabledModifier.identity, EnabledModifier, value);
4556    } else {
4557      modifierWithKey(this._modifiersWithKeys, EnabledModifier.identity, EnabledModifier, undefined);
4558    }
4559    return this;
4560  }
4561
4562  useShadowBatching(value: boolean): this {
4563    modifierWithKey(this._modifiersWithKeys, UseShadowBatchingModifier.identity, UseShadowBatchingModifier, value);
4564    return this;
4565  }
4566
4567  monopolizeEvents(value: boolean): this {
4568    modifierWithKey(this._modifiersWithKeys, MonopolizeEventsModifier.identity, MonopolizeEventsModifier, value);
4569    return this;
4570  }
4571
4572  useSizeType(value: {
4573    xs?: number | { span: number; offset: number };
4574    sm?: number | { span: number; offset: number };
4575    md?: number | { span: number; offset: number };
4576    lg?: number | { span: number; offset: number };
4577  }): this {
4578    throw new Error('Method not implemented.');
4579  }
4580
4581  alignRules(value: AlignRuleOption): this {
4582    if (!isObject(value) || JSON.stringify(value) === '{}') {
4583      modifierWithKey(this._modifiersWithKeys, AlignRulesModifier.identity, AlignRulesModifier, undefined);
4584      return this;
4585    }
4586    let keys: string[] = ['left', 'middle', 'right', 'top', 'center', 'bottom'];
4587    let arkValue = new ArkAlignRules();
4588    for (let i = 0; i < keys.length; i++) {
4589      let rule = value[keys[i]];
4590      let alignRule: string = '';
4591      if (isObject(rule)) {
4592        let alignSign = false;
4593        let anchorSign = false;
4594        let align = rule.align;
4595        let anchor = rule.anchor;
4596        if (isString(anchor)) {
4597          anchorSign = true;
4598        }
4599        if (i < DIRECTION_RANGE) {
4600          if (align in HorizontalAlign) {
4601            alignSign = true;
4602          }
4603        } else {
4604          if (align in VerticalAlign) {
4605            alignSign = true;
4606          }
4607        }
4608        if (!alignSign && !anchorSign) {
4609          alignRule += '';
4610        } else if (!anchorSign) {
4611          alignRule += align.toString();
4612          alignRule += '|';
4613          alignRule += '__container__';
4614        } else if (!alignSign) {
4615          alignRule += '2';
4616          alignRule += '|';
4617          alignRule += anchor;
4618        } else {
4619          alignRule += align.toString();
4620          alignRule += '|';
4621          alignRule += anchor;
4622        }
4623      } else {
4624        alignRule += '';
4625      }
4626      switch (keys[i]) {
4627        case 'left':
4628          arkValue.left = alignRule;
4629          break;
4630        case 'middle':
4631          arkValue.middle = alignRule;
4632          break;
4633        case 'right':
4634          arkValue.right = alignRule;
4635          break;
4636        case 'top':
4637          arkValue.top = alignRule;
4638          break;
4639        case 'center':
4640          arkValue.center = alignRule;
4641          break;
4642        case 'bottom':
4643          arkValue.bottom = alignRule;
4644          break;
4645      }
4646    }
4647    modifierWithKey(this._modifiersWithKeys, AlignRulesModifier.identity, AlignRulesModifier, arkValue);
4648    return this;
4649  }
4650
4651  aspectRatio(value: number): this {
4652    modifierWithKey(this._modifiersWithKeys, AspectRatioModifier.identity, AspectRatioModifier, value);
4653    return this;
4654  }
4655
4656  clickEffect(value: ClickEffect | null): this {
4657    modifierWithKey(this._modifiersWithKeys, ClickEffectModifier.identity, ClickEffectModifier, value);
4658    return this;
4659  }
4660
4661  onDragStart(event: (event?: DragEvent, extraParams?: string) => CustomBuilder | DragItemInfo): this {
4662    modifierWithKey(this._modifiersWithKeys, DragStartModifier.identity, DragStartModifier, event);
4663    return this;
4664  }
4665
4666  onDragEnter(event: (event?: DragEvent, extraParams?: string) => void): this {
4667    modifierWithKey(this._modifiersWithKeys, DragEnterModifier.identity, DragEnterModifier, event);
4668    return this;
4669  }
4670
4671  onDragMove(event: (event?: DragEvent, extraParams?: string) => void): this {
4672    modifierWithKey(this._modifiersWithKeys, DragMoveModifier.identity, DragMoveModifier, event);
4673    return this;
4674  }
4675
4676  onDragLeave(event: (event?: DragEvent, extraParams?: string) => void): this {
4677    modifierWithKey(this._modifiersWithKeys, DragLeaveModifier.identity, DragLeaveModifier, event);
4678    return this;
4679  }
4680
4681  onDrop(event: (event?: DragEvent, extraParams?: string) => void): this {
4682    modifierWithKey(this._modifiersWithKeys, DropModifier.identity, DropModifier, event);
4683    return this;
4684  }
4685
4686  onDragEnd(event: (event: DragEvent, extraParams?: string) => void): this {
4687    modifierWithKey(this._modifiersWithKeys, DragEndModifier.identity, DragEndModifier, event);
4688    return this;
4689  }
4690
4691  onPreDrag(event: (preDragStatus: PreDragStatus) => void): this {
4692    throw new Error('Method not implemented.');
4693  }
4694
4695  allowDrop(value: Array<UniformDataType>): this {
4696    modifierWithKey(this._modifiersWithKeys, AllowDropModifier.identity, AllowDropModifier, value);
4697    return this;
4698  }
4699
4700  draggable(value: boolean): this {
4701    if (typeof value === 'boolean') {
4702      modifierWithKey(this._modifiersWithKeys, DraggableModifier.identity, DraggableModifier, value);
4703    } else {
4704      modifierWithKey(this._modifiersWithKeys, DraggableModifier.identity, DraggableModifier, undefined);
4705
4706    }
4707    return this;
4708  }
4709
4710  dragPreview(preview: CustomBuilder | DragItemInfo | string, config: PreviewConfiguration): this {
4711    let arkDragPreview = new ArkDragPreview();
4712    if (typeof config === 'object') {
4713      arkDragPreview.onlyForLifting = config.onlyForLifting;
4714    }
4715    if (typeof preview === 'string') {
4716      arkDragPreview.inspetorId = preview;
4717      modifierWithKey(this._modifiersWithKeys, DragPreviewModifier.identity, DragPreviewModifier, arkDragPreview);
4718    } else if (typeof preview === 'object') {
4719      arkDragPreview.pixelMap = preview.pixelMap;
4720      arkDragPreview.extraInfo = preview.extraInfo;
4721      if (preview.builder) {
4722        throw new Error('Builder is not supported.');
4723      }
4724      modifierWithKey(this._modifiersWithKeys, DragPreviewModifier.identity, DragPreviewModifier, arkDragPreview);
4725    } else if (typeof preview === 'function') {
4726      throw new Error('Method not implemented.');
4727    }
4728    return this;
4729  }
4730
4731  overlay(value: string | CustomBuilder, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): this {
4732    if (typeof value === 'undefined') {
4733      modifierWithKey(this._modifiersWithKeys, OverlayModifier.identity, OverlayModifier, undefined);
4734      return this;
4735    }
4736    let arkOverlay = new ArkOverlay();
4737    if (arkOverlay.splitOverlayValue(value, options)) {
4738      modifierWithKey(this._modifiersWithKeys, OverlayModifier.identity, OverlayModifier, arkOverlay);
4739    } else {
4740      modifierWithKey(this._modifiersWithKeys, OverlayModifier.identity, OverlayModifier, undefined);
4741    }
4742    return this;
4743  }
4744
4745  linearGradient(value: {
4746    angle?: number | string;
4747    direction?: GradientDirection;
4748    colors: Array<any>;
4749    repeating?: boolean;
4750  }): this {
4751    modifierWithKey(this._modifiersWithKeys, LinearGradientModifier.identity, LinearGradientModifier, value);
4752    return this;
4753  }
4754
4755  sweepGradient(value: {
4756    center: Array<any>;
4757    start?: number | string;
4758    end?: number | string;
4759    rotation?: number | string;
4760    colors: Array<any>;
4761    repeating?: boolean;
4762  }): this {
4763    modifierWithKey(this._modifiersWithKeys, SweepGradientModifier.identity, SweepGradientModifier, value);
4764    return this;
4765  }
4766
4767  radialGradient(value: { center: Array<any>; radius: number | string; colors: Array<any>; repeating?: boolean }): this {
4768    modifierWithKey(this._modifiersWithKeys, RadialGradientModifier.identity, RadialGradientModifier, value);
4769    return this;
4770  }
4771
4772  motionPath(value: MotionPathOptions): this {
4773    modifierWithKey(this._modifiersWithKeys, MotionPathModifier.identity, MotionPathModifier, value);
4774    return this;
4775  }
4776
4777  motionBlur(value: MotionBlurOptions): this {
4778    modifierWithKey(this._modifiersWithKeys, MotionBlurModifier.identity, MotionBlurModifier, value);
4779    return this;
4780  }
4781
4782  shadow(value: ShadowOptions | ShadowStyle): this {
4783    modifierWithKey(this._modifiersWithKeys, ShadowModifier.identity, ShadowModifier, value);
4784    return this;
4785  }
4786
4787  mask(value: CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute | ProgressMask): this {
4788    modifierWithKey(this._modifiersWithKeys, MaskModifier.identity, MaskModifier, value);
4789    return this;
4790  }
4791
4792  chainMode(direction: Axis, style: ChainStyle): this {
4793    let arkChainMode = new ArkChainMode();
4794    arkChainMode.direction = direction;
4795    arkChainMode.style = style;
4796    modifierWithKey(this._modifiersWithKeys, ChainModeifier.identity, ChainModeifier, arkChainMode);
4797    return this;
4798  }
4799
4800  key(value: string): this {
4801    if (typeof value === 'string') {
4802      modifierWithKey(this._modifiersWithKeys, KeyModifier.identity, KeyModifier, value);
4803    } else {
4804      modifierWithKey(this._modifiersWithKeys, KeyModifier.identity, KeyModifier, undefined);
4805    }
4806    return this;
4807  }
4808
4809  id(value: string): this {
4810    if (typeof value === 'string') {
4811      modifierWithKey(this._modifiersWithKeys, IdModifier.identity, IdModifier, value);
4812    } else {
4813      modifierWithKey(this._modifiersWithKeys, IdModifier.identity, IdModifier, undefined);
4814    }
4815    return this;
4816  }
4817
4818  geometryTransition(id: string, options?: GeometryTransitionOptions): this {
4819    let arkGeometryTransition = new ArkGeometryTransition();
4820    arkGeometryTransition.id = id;
4821    arkGeometryTransition.options = options;
4822    modifierWithKey(this._modifiersWithKeys, GeometryTransitionModifier.identity, GeometryTransitionModifier, arkGeometryTransition);
4823    return this;
4824  }
4825
4826  bindPopup(show: boolean, popup: PopupOptions | CustomPopupOptions): this {
4827    throw new Error('Method not implemented.');
4828  }
4829
4830  bindTips(message: TipsMessageType, options?: TipsOptions): this {
4831    let arkBindTipsOptions = new ArkBindTipsOptions();
4832    arkBindTipsOptions.message = message;
4833    arkBindTipsOptions.options = options;
4834    modifierWithKey(this._modifiersWithKeys, BindTipsModifier.identity, BindTipsModifier, arkBindTipsOptions);
4835    return this;
4836  }
4837
4838  bindMenu(content: Array<MenuElement> | CustomBuilder, options?: MenuOptions): this {
4839    let arkBindMenu = new ArkBindMenu();
4840    arkBindMenu.content = content;
4841    arkBindMenu.options = options;
4842    modifierWithKey(this._modifiersWithKeys, BindMenuModifier.identity, BindMenuModifier, arkBindMenu);
4843    return this;
4844  }
4845
4846  bindContextMenu(content: CustomBuilder, responseType: ResponseType, options?: ContextMenuOptions): this {
4847    throw new Error('Method not implemented.');
4848  }
4849
4850  bindContentCover(isShow: boolean, builder: CustomBuilder, type?: ModalTransition | ContentCoverOptions): this {
4851    throw new Error('Method not implemented.');
4852  }
4853
4854  blendMode(blendMode: BlendMode, blendApplyType?: BlendApplyType): this {
4855    let arkBlendMode = new ArkBlendMode();
4856    arkBlendMode.blendMode = blendMode;
4857    arkBlendMode.blendApplyType = blendApplyType;
4858    modifierWithKey(this._modifiersWithKeys, BlendModeModifier.identity, BlendModeModifier, arkBlendMode);
4859    return this;
4860  }
4861
4862  advancedBlendMode(blendMode: BlendMode, blendApplyType?: BlendApplyType): this {
4863    let arkBlendMode = new ArkBlendMode();
4864    arkBlendMode.blendMode = blendMode;
4865    arkBlendMode.blendApplyType = blendApplyType;
4866    modifierWithKey(this._modifiersWithKeys, AdvancedBlendModeModifier.identity,
4867      AdvancedBlendModeModifier, arkBlendMode);
4868    return this;
4869  }
4870
4871  clip(value: boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute): this {
4872    modifierWithKey(this._modifiersWithKeys, ClipModifier.identity, ClipModifier, value);
4873    return this;
4874  }
4875
4876  bindSheet(isShow: boolean, builder: CustomBuilder, options?: SheetOptions): this {
4877    throw new Error('Method not implemented.');
4878  }
4879
4880  stateStyles(value: StateStyles): this {
4881    throw new Error('Method not implemented.');
4882  }
4883
4884  restoreId(value: number): this {
4885    if (typeof value !== 'number') {
4886      modifierWithKey(this._modifiersWithKeys, RestoreIdModifier.identity, RestoreIdModifier, undefined);
4887    } else {
4888      modifierWithKey(this._modifiersWithKeys, RestoreIdModifier.identity, RestoreIdModifier, value);
4889    }
4890    return this;
4891  }
4892
4893  onVisibleAreaChange(ratios: Array<number>, event: (isVisible: boolean, currentRatio: number) => void): this {
4894    throw new Error('Method not implemented.');
4895  }
4896
4897  sphericalEffect(value: number): this {
4898    modifierWithKey(this._modifiersWithKeys, SphericalEffectModifier.identity, SphericalEffectModifier, value);
4899    return this;
4900  }
4901
4902  lightUpEffect(value: number): this {
4903    modifierWithKey(this._modifiersWithKeys, LightUpEffectModifier.identity, LightUpEffectModifier, value);
4904    return this;
4905  }
4906
4907  pixelStretchEffect(options: PixelStretchEffectOptions): this {
4908    modifierWithKey(this._modifiersWithKeys, PixelStretchEffectModifier.identity, PixelStretchEffectModifier, options);
4909    return this;
4910  }
4911
4912  keyboardShortcut(value: string | FunctionKey, keys: Array<ModifierKey>, action?: () => void): this {
4913    let keyboardShortCut = new ArkKeyBoardShortCut();
4914    keyboardShortCut.value = value;
4915    keyboardShortCut.keys = keys;
4916    modifierWithKey(this._modifiersWithKeys, KeyBoardShortCutModifier.identity, KeyBoardShortCutModifier, keyboardShortCut);
4917    return this;
4918  }
4919
4920  accessibilityGroup(value: boolean): this {
4921    if (typeof value === 'boolean') {
4922      modifierWithKey(this._modifiersWithKeys, AccessibilityGroupModifier.identity, AccessibilityGroupModifier, value);
4923    } else {
4924      modifierWithKey(this._modifiersWithKeys, AccessibilityGroupModifier.identity, AccessibilityGroupModifier, undefined);
4925
4926    }
4927    return this;
4928  }
4929
4930  accessibilityText(value: string): this {
4931    modifierWithKey(this._modifiersWithKeys, AccessibilityTextModifier.identity, AccessibilityTextModifier, value);
4932    return this;
4933  }
4934
4935  accessibilityDescription(value: string): this {
4936    modifierWithKey(this._modifiersWithKeys, AccessibilityDescriptionModifier.identity, AccessibilityDescriptionModifier, value);
4937    return this;
4938  }
4939
4940  accessibilityLevel(value: string): this {
4941    if (typeof value !== 'string') {
4942      modifierWithKey(this._modifiersWithKeys, AccessibilityLevelModifier.identity, AccessibilityLevelModifier, undefined);
4943    } else {
4944      modifierWithKey(this._modifiersWithKeys, AccessibilityLevelModifier.identity, AccessibilityLevelModifier, value);
4945    }
4946    return this;
4947  }
4948
4949  accessibilityRole(value: AccessibilityRoleType): this {
4950    modifierWithKey(this._modifiersWithKeys, AccessibilityRoleModifier.identity, AccessibilityRoleModifier, value);
4951    return this;
4952  }
4953
4954  onAccessibilityFocus(value: AccessibilityFocusCallback): this {
4955    modifierWithKey(this._modifiersWithKeys, AccessibilityFocusCallbackModifier.identity, AccessibilityFocusCallbackModifier, value);
4956    return this;
4957  }
4958
4959  accessibilityNextFocusId(value: string): this {
4960    if (typeof value === 'string') {
4961      modifierWithKey(this._modifiersWithKeys, AccessibilityNextFocusIdModifier.identity, AccessibilityNextFocusIdModifier, value);
4962    } else {
4963      modifierWithKey(this._modifiersWithKeys, AccessibilityNextFocusIdModifier.identity, AccessibilityNextFocusIdModifier, undefined);
4964    }
4965    return this;
4966  }
4967
4968  accessibilityDefaultFocus(value: boolean): this {
4969    if (typeof value === 'boolean') {
4970      modifierWithKey(this._modifiersWithKeys, AccessibilityDefaultFocusModifier.identity, AccessibilityDefaultFocusModifier, value);
4971    } else {
4972      modifierWithKey(this._modifiersWithKeys, AccessibilityDefaultFocusModifier.identity, AccessibilityDefaultFocusModifier, undefined);
4973    }
4974    return this;
4975  }
4976
4977  accessibilityUseSamePage(value: AccessibilitySamePageMode): this {
4978    modifierWithKey(this._modifiersWithKeys, AccessibilityUseSamePageModifier.identity, AccessibilityUseSamePageModifier, value);
4979    return this;
4980  }
4981
4982  accessibilityScrollTriggerable(value: boolean): this {
4983    if (typeof value === 'boolean') {
4984      modifierWithKey(this._modifiersWithKeys, AccessibilityScrollTriggerableModifier.identity, AccessibilityScrollTriggerableModifier, value);
4985    } else {
4986      modifierWithKey(this._modifiersWithKeys, AccessibilityScrollTriggerableModifier.identity, AccessibilityScrollTriggerableModifier, undefined);
4987    }
4988    return this;
4989  }
4990
4991  obscured(reasons: Array<ObscuredReasons>): this {
4992    modifierWithKey(this._modifiersWithKeys, ObscuredModifier.identity, ObscuredModifier, reasons);
4993    return this;
4994  }
4995
4996  reuseId(id: string): this {
4997    throw new Error('Method not implemented.');
4998  }
4999
5000  renderFit(fitMode: RenderFit): this {
5001    modifierWithKey(this._modifiersWithKeys, RenderFitModifier.identity, RenderFitModifier, fitMode);
5002    return this;
5003  }
5004
5005  attributeModifier(modifier: AttributeModifier<CommonAttribute>): this {
5006    return this;
5007  }
5008
5009  customProperty(key: string, value: object): this {
5010    let returnBool = getUINativeModule().frameNode.setCustomPropertyModiferByKey(this.nativePtr, key, value);
5011    if (!returnBool) {
5012      const property = new ArkCustomProperty();
5013      property.key = key;
5014      property.value = value;
5015      modifierWithKey(this._modifiersWithKeys, CustomPropertyModifier.identity, CustomPropertyModifier, property);
5016      getUINativeModule().frameNode.setRemoveCustomProperties(this.nativePtr);
5017    }
5018    return this;
5019  }
5020
5021  systemBarEffect(): this {
5022    modifierWithKey(this._modifiersWithKeys, SystemBarEffectModifier.identity, SystemBarEffectModifier, null);
5023    return this;
5024  }
5025
5026  focusScopeId(id: string, isGroup?: boolean, arrowStepOut?: boolean): this {
5027    let arkFocusScopeId = new ArkFocusScopeId();
5028    if (isString(id)) {
5029      arkFocusScopeId.id = id;
5030    }
5031    if (typeof isGroup === 'boolean') {
5032      arkFocusScopeId.isGroup = isGroup;
5033    }
5034    if (typeof arrowStepOut === 'boolean') {
5035      arkFocusScopeId.arrowStepOut = arrowStepOut;
5036    }
5037    modifierWithKey(
5038      this._modifiersWithKeys, FocusScopeIdModifier.identity, FocusScopeIdModifier, arkFocusScopeId);
5039    return this;
5040  }
5041
5042  focusScopePriority(scopeId: string, priority?: number): this {
5043    let arkFocusScopePriority = new ArkFocusScopePriority();
5044    if (isString(scopeId)) {
5045      arkFocusScopePriority.scopeId = scopeId;
5046    }
5047    if (typeof priority === 'number') {
5048      arkFocusScopePriority.priority = priority;
5049    }
5050    modifierWithKey(
5051      this._modifiersWithKeys, FocusScopePriorityModifier.identity, FocusScopePriorityModifier, arkFocusScopePriority);
5052    return this;
5053  }
5054  pixelRound(value:PixelRoundPolicy):this {
5055    modifierWithKey(this._modifiersWithKeys, PixelRoundModifier.identity, PixelRoundModifier, value);
5056  }
5057  focusBox(value:FocusBoxStyle):this {
5058    modifierWithKey(this._modifiersWithKeys, FocusBoxModifier.identity, FocusBoxModifier, value);
5059  }
5060  nextFocus(value:FocusMovement):this {
5061    modifierWithKey(this._modifiersWithKeys, NextFocusModifier.identity, NextFocusModifier, value);
5062  }
5063}
5064
5065const isNull = (val: any) => typeof val === 'object' && val === null;
5066const isArray = (val: any) => Array.isArray(val);
5067const isDate = (val: any) => val instanceof Date;
5068const isRegExp = (val: any) => val instanceof RegExp;
5069const isError = (val: any) => val instanceof Error;
5070const isFloat = (val: any) => Number.isFinite(val) && !Number.isInteger(val);
5071const isInteger = (val: any) => Number.isInteger(val);
5072const isNonEmptyMap = (val: any) => val instanceof Map && val.size > 0;
5073const isTruthyString = (val: any) => typeof val === 'string' && val.trim() !== '';
5074
5075class UICommonEvent {
5076  private _nodePtr: Object | null;
5077  private _instanceId: number;
5078  private _clickEvent?: (event: ClickEvent) => void;
5079  private _touchEvent?: (event: TouchEvent) => void;
5080  private _onAppearEvent?: () => void;
5081  private _onDisappearEvent?: () => void;
5082  private _onAttachEvent?: () => void;
5083  private _onDetachEvent?: () => void;
5084  private _onKeyEvent?: (event: KeyEvent) => void;
5085  private _onFocusEvent?: () => void;
5086  private _onBlur?: () => void;
5087  private _onHoverEvent?: (isHover: boolean, event: HoverEvent) => void;
5088  private _onHoverMoveEvent?: (event: HoverEvent) => void;
5089  private _onMouseEvent?: (event: MouseEvent) => void;
5090  private _onSizeChangeEvent?: SizeChangeCallback;
5091  private _onVisibleAreaApproximateChange?: VisibleAreaChangeCallback;
5092
5093  setInstanceId(instanceId: number): void {
5094    this._instanceId = instanceId;
5095  }
5096  setNodePtr(nodePtr: Object | null): void {
5097    this._nodePtr = nodePtr;
5098  }
5099  // the first param is used to indicate frameNode
5100  // the second param is used to indicate the callback
5101  // the third param is used to indicate the instanceid
5102  // other options will be indicated after them
5103  setOnClick(callback: (event: ClickEvent) => void): void {
5104    this._clickEvent = callback;
5105    getUINativeModule().frameNode.setOnClick(this._nodePtr, callback, this._instanceId);
5106  }
5107  setOnTouch(callback: (event: TouchEvent) => void): void {
5108    this._touchEvent = callback;
5109    getUINativeModule().frameNode.setOnTouch(this._nodePtr, callback, this._instanceId);
5110  }
5111  setOnAppear(callback: () => void): void {
5112    this._onAppearEvent = callback;
5113    getUINativeModule().frameNode.setOnAppear(this._nodePtr, callback, this._instanceId);
5114  }
5115  setOnDisappear(callback: () => void): void {
5116    this._onDisappearEvent = callback;
5117    getUINativeModule().frameNode.setOnDisappear(this._nodePtr, callback, this._instanceId);
5118  }
5119  setOnAttach(callback: () => void): void {
5120    this._onAttachEvent = callback;
5121    getUINativeModule().frameNode.setOnAttach(this._nodePtr, callback, this._instanceId);
5122  }
5123  setOnDetach(callback: () => void): void {
5124    this._onDetachEvent = callback;
5125    getUINativeModule().frameNode.setOnDetach(this._nodePtr, callback, this._instanceId);
5126  }
5127  setOnKeyEvent(callback: (event: KeyEvent) => void): void {
5128    this._onKeyEvent = callback;
5129    getUINativeModule().frameNode.setOnKeyEvent(this._nodePtr, callback, this._instanceId);
5130  }
5131  setOnFocus(callback: () => void): void {
5132    this._onFocusEvent = callback;
5133    getUINativeModule().frameNode.setOnFocus(this._nodePtr, callback, this._instanceId);
5134  }
5135  setOnBlur(callback: () => void): void {
5136    this._onBlur = callback;
5137    getUINativeModule().frameNode.setOnBlur(this._nodePtr, callback, this._instanceId);
5138  }
5139  setOnHover(callback: (isHover: boolean, event: HoverEvent) => void): void {
5140    this._onHoverEvent = callback;
5141    getUINativeModule().frameNode.setOnHover(this._nodePtr, callback, this._instanceId);
5142  }
5143  setOnHoverMove(callback: (event: HoverMoveEvent) => void): void {
5144    this._onHoverMoveEvent = callback;
5145    getUINativeModule().frameNode.setOnHoverMove(this._nodePtr, callback, this._instanceId);
5146  }
5147  setOnMouse(callback: (event: MouseEvent) => void): void {
5148    this._onMouseEvent = callback;
5149    getUINativeModule().frameNode.setOnMouse(this._nodePtr, callback, this._instanceId);
5150  }
5151  setOnSizeChange(callback: SizeChangeCallback): void {
5152    this._onSizeChangeEvent = callback;
5153    getUINativeModule().frameNode.setOnSizeChange(this._nodePtr, callback, this._instanceId);
5154  }
5155  setOnVisibleAreaApproximateChange(options: VisibleAreaEventOptions, callback: VisibleAreaChangeCallback): void {
5156    this._onVisibleAreaApproximateChange = callback;
5157    getUINativeModule().frameNode.setOnVisibleAreaApproximateChange(this._nodePtr, callback, this._instanceId, options.ratios, options.expectedUpdateInterval ? options.expectedUpdateInterval : 1000);
5158  }
5159}
5160
5161function attributeModifierFunc<T>(modifier: AttributeModifier<T>,
5162  componentBuilder: (nativePtr: KNode) => ArkComponent,
5163  modifierBuilder: (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => ArkComponent)
5164{
5165  if (modifier === undefined || modifier === null) {
5166    ArkLogConsole.info("custom modifier is undefined");
5167    return;
5168  }
5169  const elmtId = ViewStackProcessor.GetElmtIdToAccountFor();
5170  let nativeNode = getUINativeModule().getFrameNodeById(elmtId);
5171  let component = this.createOrGetNode(elmtId, () => {
5172    return componentBuilder(nativeNode);
5173  });
5174  if (modifier.isAttributeUpdater === true) {
5175    let modifierJS = globalThis.requireNapi('arkui.modifier');
5176    if (modifier.modifierState === modifierJS.AttributeUpdater.StateEnum.INIT) {
5177      modifier.modifierState = modifierJS.AttributeUpdater.StateEnum.UPDATE;
5178      modifier.attribute = modifierBuilder(nativeNode, ModifierType.STATE, modifierJS);
5179      modifierJS.ModifierUtils.applySetOnChange(modifier.attribute);
5180      modifier.initializeModifier(modifier.attribute);
5181      applyUIAttributesInit(modifier, nativeNode, component);
5182      component.applyModifierPatch();
5183    } else {
5184      modifier.attribute.applyStateUpdatePtr(component);
5185      if (modifier.attribute._nativePtrChanged) {
5186        modifier.onComponentChanged(modifier.attribute);
5187      }
5188      modifier.attribute.applyNormalAttribute(component);
5189      applyUIAttributes(modifier, nativeNode, component);
5190      component.applyModifierPatch();
5191    }
5192  } else {
5193    applyUIAttributes(modifier, nativeNode, component);
5194    component.applyModifierPatch();
5195  }
5196}
5197
5198function attributeModifierFuncWithoutStateStyles<T>(modifier: AttributeModifier<T>,
5199  componentBuilder: (nativePtr: KNode) => ArkComponent,
5200  modifierBuilder: (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => ArkComponent)
5201{
5202  if (modifier === undefined || modifier === null) {
5203    ArkLogConsole.info("custom modifier is undefined");
5204    return;
5205  }
5206  const elmtId = ViewStackProcessor.GetElmtIdToAccountFor();
5207  let nativeNode = getUINativeModule().getFrameNodeById(elmtId);
5208  let component = this.createOrGetNode(elmtId, () => {
5209    return componentBuilder(nativeNode);
5210  });
5211  if (modifier.isAttributeUpdater === true) {
5212    let modifierJS = globalThis.requireNapi('arkui.modifier');
5213    if (modifier.modifierState === modifierJS.AttributeUpdater.StateEnum.INIT) {
5214      modifier.modifierState = modifierJS.AttributeUpdater.StateEnum.UPDATE;
5215      modifier.attribute = modifierBuilder(nativeNode, ModifierType.STATE, modifierJS);
5216      modifierJS.ModifierUtils.applySetOnChange(modifier.attribute);
5217      modifier.initializeModifier(modifier.attribute);
5218      component.applyModifierPatch();
5219    } else {
5220      modifier.attribute.applyStateUpdatePtr(component);
5221      modifier.attribute.applyNormalAttribute(component);
5222      if (modifier.applyNormalAttribute) {
5223        modifier.applyNormalAttribute(component);
5224      }
5225      component.applyModifierPatch();
5226    }
5227  } else {
5228    if (modifier.applyNormalAttribute) {
5229      modifier.applyNormalAttribute(component);
5230    }
5231    component.applyModifierPatch();
5232  }
5233}
5234
5235class UIGestureEvent {
5236  private _nodePtr: Object | null;
5237  private _weakNodePtr: JsPointerClass;
5238  private _gestures: GestureHandler[] | undefined;
5239  private _destructorCallback: Callback<number>;
5240  setNodePtr(nodePtr: Object | null): void {
5241    this._nodePtr = nodePtr;
5242  }
5243  setWeakNodePtr(weakNodePtr: JsPointerClass): void {
5244    this._weakNodePtr = weakNodePtr;
5245  }
5246  registerFrameNodeDeletedCallback(nodePtr): void {
5247    this._destructorCallback = (elementId: number): void => {
5248      globalThis.__mapOfModifier__.delete(elementId);
5249    };
5250    getUINativeModule().common.registerFrameNodeDestructorCallback(nodePtr, this._destructorCallback);
5251  }
5252  addGesture(gesture: GestureHandler, priority?: GesturePriority, mask?: GestureMask): void {
5253    if (this._weakNodePtr.invalid()) {
5254      return;
5255    }
5256    if (this._gestures === undefined) {
5257      this._gestures = [gesture];
5258    } else {
5259      this._gestures.push(gesture);
5260    }
5261    switch (gesture.gestureType) {
5262      case CommonGestureType.TAP_GESTURE: {
5263        let tapGesture: TapGestureHandler = gesture as TapGestureHandler;
5264        getUINativeModule().common.addTapGesture(this._nodePtr, priority, mask, tapGesture.gestureTag,
5265          tapGesture.allowedTypes, tapGesture.fingers, tapGesture.count, tapGesture.limitFingerCount, tapGesture.onActionCallback);
5266        break;
5267      }
5268      case CommonGestureType.LONG_PRESS_GESTURE: {
5269        let longPressGesture: LongPressGestureHandler = gesture as LongPressGestureHandler;
5270        getUINativeModule().common.addLongPressGesture(this._nodePtr, priority, mask, longPressGesture.gestureTag,
5271          longPressGesture.allowedTypes, longPressGesture.fingers, longPressGesture.repeat,
5272          longPressGesture.duration, longPressGesture.limitFingerCount,
5273          longPressGesture.onActionCallback, longPressGesture.onActionEndCallback, longPressGesture.onActionCancelCallback);
5274        break;
5275      }
5276      case CommonGestureType.PAN_GESTURE: {
5277        let panGesture: PanGestureHandler = gesture as PanGestureHandler;
5278        getUINativeModule().common.addPanGesture(this._nodePtr, priority, mask, panGesture.gestureTag,
5279          panGesture.allowedTypes, panGesture.fingers, panGesture.direction, panGesture.distance,
5280          panGesture.limitFingerCount, panGesture.onActionStartCallback, panGesture.onActionUpdateCallback,
5281          panGesture.onActionEndCallback, panGesture.onActionCancelCallback);
5282        break;
5283      }
5284      case CommonGestureType.SWIPE_GESTURE: {
5285        let swipeGesture: SwipeGestureHandler = gesture as SwipeGestureHandler;
5286        getUINativeModule().common.addSwipeGesture(this._nodePtr, priority, mask, swipeGesture.gestureTag,
5287          swipeGesture.allowedTypes, swipeGesture.fingers, swipeGesture.direction, swipeGesture.speed,
5288          swipeGesture.limitFingerCount, swipeGesture.onActionCallback);
5289        break;
5290      }
5291      case CommonGestureType.PINCH_GESTURE: {
5292        let pinchGesture: PinchGestureHandler = gesture as PinchGestureHandler;
5293        getUINativeModule().common.addPinchGesture(this._nodePtr, priority, mask, pinchGesture.gestureTag,
5294          pinchGesture.allowedTypes, pinchGesture.fingers, pinchGesture.distance,
5295          pinchGesture.limitFingerCount, pinchGesture.onActionStartCallback,
5296          pinchGesture.onActionUpdateCallback, pinchGesture.onActionEndCallback, pinchGesture.onActionCancelCallback);
5297        break;
5298      }
5299      case CommonGestureType.ROTATION_GESTURE: {
5300        let rotationGesture: RotationGestureHandler = gesture as RotationGestureHandler;
5301        getUINativeModule().common.addRotationGesture(this._nodePtr, priority, mask, rotationGesture.gestureTag,
5302          rotationGesture.allowedTypes, rotationGesture.fingers, rotationGesture.angle,
5303          rotationGesture.limitFingerCount, rotationGesture.onActionStartCallback,
5304          rotationGesture.onActionUpdateCallback, rotationGesture.onActionEndCallback,
5305          rotationGesture.onActionCancelCallback);
5306        break;
5307      }
5308      case CommonGestureType.GESTURE_GROUP: {
5309        let gestureGroup: GestureGroupHandler = gesture as GestureGroupHandler;
5310        let groupPtr = getUINativeModule().common.addGestureGroup(this._nodePtr,
5311          gestureGroup.gestureTag, gestureGroup.onCancelCallback, gestureGroup.mode);
5312        gestureGroup.gestures.forEach((item) => {
5313          addGestureToGroup(this._nodePtr, item, groupPtr);
5314        });
5315        getUINativeModule().common.attachGestureGroup(this._nodePtr, priority, mask, groupPtr);
5316        break;
5317      }
5318      default:
5319        break;
5320    }
5321  }
5322  addParallelGesture(gesture: GestureHandler, mask?: GestureMask): void {
5323    this.addGesture(gesture, GesturePriority.PARALLEL, mask);
5324  }
5325  removeGestureByTag(tag: string): void {
5326    if (this._weakNodePtr.invalid()) {
5327      return;
5328    }
5329    getUINativeModule().common.removeGestureByTag(this._nodePtr, tag);
5330    for (let index = this._gestures.length - 1; index >= 0; index--) {
5331      if (this._gestures[index].gestureTag === tag) {
5332        this._gestures.splice(index, 1);
5333        continue;
5334      }
5335      if (this._gestures[index].gestureType === CommonGestureType.GESTURE_GROUP) {
5336        let gestureGroup: GestureGroupHandler = this._gestures[index] as GestureGroupHandler;
5337        removeGestureByTagInGroup(gestureGroup, tag);
5338      }
5339    }
5340  }
5341  clearGestures(): void {
5342    if (this._weakNodePtr.invalid()) {
5343      return;
5344    }
5345    getUINativeModule().common.clearGestures(this._nodePtr);
5346    this._gestures = [];
5347  }
5348}
5349
5350function removeGestureByTagInGroup(gestureGroup: GestureGroupHandler, tag: string) {
5351  for (let index = gestureGroup.gestures.length - 1; index >= 0; index--) {
5352    if (gestureGroup.gestures[index].gestureTag === tag) {
5353      gestureGroup.gestures.splice(index, 1);
5354      continue;
5355    }
5356    if (gestureGroup.gestures[index].gestureType === CommonGestureType.GESTURE_GROUP) {
5357      removeGestureByTagInGroup(gestureGroup.gestures[index], tag);
5358    }
5359  }
5360}
5361
5362function addGestureToGroup(nodePtr: Object | null, gesture: any, gestureGroupPtr: any) {
5363  switch (gesture.gestureType) {
5364    case CommonGestureType.TAP_GESTURE: {
5365      let tapGesture: TapGestureHandler = gesture as TapGestureHandler;
5366      getUINativeModule().common.addTapGestureToGroup(nodePtr, tapGesture.gestureTag, tapGesture.allowedTypes,
5367        tapGesture.fingers, tapGesture.count, tapGesture.limitFingerCount, tapGesture.onActionCallback,
5368        gestureGroupPtr);
5369      break;
5370    }
5371    case CommonGestureType.LONG_PRESS_GESTURE: {
5372      let longPressGesture: LongPressGestureHandler = gesture as LongPressGestureHandler;
5373      getUINativeModule().common.addLongPressGestureToGroup(nodePtr, longPressGesture.gestureTag, longPressGesture.allowedTypes,
5374        longPressGesture.fingers, longPressGesture.repeat, longPressGesture.duration, longPressGesture.limitFingerCount,
5375        longPressGesture.onActionCallback, longPressGesture.onActionEndCallback, longPressGesture.onActionCancelCallback, gestureGroupPtr);
5376      break;
5377    }
5378    case CommonGestureType.PAN_GESTURE: {
5379      let panGesture: PanGestureHandler = gesture as PanGestureHandler;
5380      getUINativeModule().common.addPanGestureToGroup(nodePtr, panGesture.gestureTag, panGesture.allowedTypes,
5381        panGesture.fingers, panGesture.direction, panGesture.distance, panGesture.limitFingerCount, panGesture.onActionStartCallback,
5382        panGesture.onActionUpdateCallback, panGesture.onActionEndCallback, panGesture.onActionCancelCallback, gestureGroupPtr);
5383      break;
5384    }
5385    case CommonGestureType.SWIPE_GESTURE: {
5386      let swipeGesture: SwipeGestureHandler = gesture as SwipeGestureHandler;
5387      getUINativeModule().common.addSwipeGestureToGroup(nodePtr, swipeGesture.gestureTag, swipeGesture.allowedTypes,
5388        swipeGesture.fingers, swipeGesture.direction, swipeGesture.speed, swipeGesture.limitFingerCount,
5389        swipeGesture.onActionCallback, gestureGroupPtr);
5390      break;
5391    }
5392    case CommonGestureType.PINCH_GESTURE: {
5393      let pinchGesture: PinchGestureHandler = gesture as PinchGestureHandler;
5394      getUINativeModule().common.addPinchGestureToGroup(nodePtr, pinchGesture.gestureTag, pinchGesture.allowedTypes,
5395        pinchGesture.fingers, pinchGesture.distance, pinchGesture.limitFingerCount, pinchGesture.onActionStartCallback,
5396        pinchGesture.onActionUpdateCallback, pinchGesture.onActionEndCallback, pinchGesture.onActionCancelCallback, gestureGroupPtr);
5397      break;
5398    }
5399    case CommonGestureType.ROTATION_GESTURE: {
5400      let rotationGesture: RotationGestureHandler = gesture as RotationGestureHandler;
5401      getUINativeModule().common.addRotationGestureToGroup(nodePtr, rotationGesture.gestureTag, rotationGesture.allowedTypes,
5402        rotationGesture.fingers, rotationGesture.angle, rotationGesture.limitFingerCount,
5403        rotationGesture.onActionStartCallback, rotationGesture.onActionUpdateCallback,
5404        rotationGesture.onActionEndCallback, rotationGesture.onActionCancelCallback, gestureGroupPtr);
5405      break;
5406    }
5407    case CommonGestureType.GESTURE_GROUP: {
5408      let gestureGroup: GestureGroupHandler = gesture as GestureGroupHandler;
5409      let groupPtr = getUINativeModule().common.addGestureGroupToGroup(nodePtr, gestureGroup.gestureTag,
5410        gestureGroup.onCancelCallback, gestureGroup.mode, gestureGroupPtr);
5411      gestureGroup.gestures.forEach((item) => {
5412        addGestureToGroup(nodePtr, item, groupPtr);
5413      });
5414      break;
5415    }
5416    default:
5417      break;
5418  }
5419}
5420
5421function applyGesture(modifier: GestureModifier, component: ArkComponent): void {
5422
5423  if (modifier.applyGesture !== undefined) {
5424    let gestureEvent: UIGestureEvent = component.getOrCreateGestureEvent();
5425    gestureEvent.clearGestures();
5426    modifier.applyGesture(gestureEvent);
5427  }
5428}
5429
5430globalThis.__mapOfModifier__ = new Map();
5431function __gestureModifier__(modifier) {
5432  const elmtId = ViewStackProcessor.GetElmtIdToAccountFor();
5433  let nativeNode = getUINativeModule().getFrameNodeById(elmtId);
5434  if (globalThis.__mapOfModifier__.get(elmtId)) {
5435    let component = globalThis.__mapOfModifier__.get(elmtId);
5436    applyGesture(modifier, component);
5437  } else {
5438    let component = new ArkComponent(nativeNode);
5439    globalThis.__mapOfModifier__.set(elmtId, component);
5440    applyGesture(modifier, component);
5441  }
5442}
5443
5444const __elementIdToCustomProperties__ = new Map();
5445
5446function __setValidCustomProperty__(nodeId: number, key: string, value: Object): void {
5447  if (!__elementIdToCustomProperties__.has(nodeId)) {
5448    __elementIdToCustomProperties__.set(nodeId, new Map());
5449  }
5450
5451  const customProperties = __elementIdToCustomProperties__.get(nodeId);
5452
5453  if (customProperties) {
5454    customProperties.set(key, value);
5455  }
5456}
5457
5458function __removeCustomProperty__(nodeId: number, key: string): boolean {
5459  if (__elementIdToCustomProperties__.has(nodeId)) {
5460    const customProperties = __elementIdToCustomProperties__.get(nodeId);
5461
5462    if (customProperties) {
5463      customProperties.delete(key);
5464      return customProperties.size > 0;
5465    }
5466  }
5467
5468  return false;
5469}
5470
5471function __removeCustomProperties__(nodeId: number): void {
5472  __elementIdToCustomProperties__.delete(nodeId);
5473}
5474
5475function __getCustomProperty__(nodeId: number, key: string): Object | undefined {
5476  if (__elementIdToCustomProperties__.has(nodeId)) {
5477    const customProperties = __elementIdToCustomProperties__.get(nodeId);
5478
5479    if (customProperties) {
5480      return customProperties.get(key);
5481    }
5482  }
5483
5484  return undefined;
5485}
5486
5487function __getCustomPropertyString__(nodeId: number, key: string): string | undefined {
5488  if (__elementIdToCustomProperties__.has(nodeId)) {
5489    const customProperties = __elementIdToCustomProperties__.get(nodeId);
5490
5491    if (customProperties) {
5492      return JSON.stringify(customProperties.get(key));
5493    }
5494  }
5495
5496  return undefined;
5497}
5498
5499function __setCustomProperty__(nodeId: number, key: string, value: Object): boolean {
5500  if (value !== undefined) {
5501    __setValidCustomProperty__(nodeId, key, value);
5502    return true;
5503  } else {
5504    return __removeCustomProperty__(nodeId, key);
5505  }
5506}
5507