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