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