• 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' />
17class ArkSwiperComponent extends ArkComponent implements SwiperAttribute {
18  constructor(nativePtr: KNode) {
19    super(nativePtr);
20  }
21  index(value: number): this {
22    modifierWithKey(this._modifiersWithKeys, SwiperIndexModifier.identity, SwiperIndexModifier, value);
23    return this;
24  }
25  autoPlay(value: boolean): this {
26    modifierWithKey(this._modifiersWithKeys, SwiperAutoPlayModifier.identity, SwiperAutoPlayModifier, value);
27    return this;
28  }
29  interval(value: number): this {
30    modifierWithKey(this._modifiersWithKeys, SwiperIntervalModifier.identity, SwiperIntervalModifier, value);
31    return this;
32  }
33
34  indicator(value: boolean | DotIndicator | DigitIndicator): this {
35    modifierWithKey(this._modifiersWithKeys, SwiperIndicatorModifier.identity, SwiperIndicatorModifier, value);
36    return this;
37  }
38
39  displayArrow(value: boolean | ArrowStyle, isHoverShow?: boolean | undefined): this {
40    let arkDisplayArrow = new ArkDisplayArrow();
41    arkDisplayArrow.value = value;
42    arkDisplayArrow.isHoverShow = isHoverShow;
43    modifierWithKey(
44      this._modifiersWithKeys,
45      SwiperDisplayArrowModifier.identity,
46      SwiperDisplayArrowModifier,
47      arkDisplayArrow
48    );
49    return this;
50  }
51  loop(value: boolean): this {
52    modifierWithKey(this._modifiersWithKeys, SwiperLoopModifier.identity, SwiperLoopModifier, value);
53    return this;
54  }
55  duration(value: number): this {
56    modifierWithKey(this._modifiersWithKeys, SwiperDurationModifier.identity, SwiperDurationModifier, value);
57    return this;
58  }
59  vertical(value: boolean): this {
60    modifierWithKey(this._modifiersWithKeys, SwiperVerticalModifier.identity, SwiperVerticalModifier, value);
61    return this;
62  }
63  itemSpace(value: string | number): this {
64    modifierWithKey(this._modifiersWithKeys, SwiperItemSpaceModifier.identity, SwiperItemSpaceModifier, value);
65    return this;
66  }
67  displayMode(value: SwiperDisplayMode): this {
68    modifierWithKey(this._modifiersWithKeys, SwiperDisplayModeModifier.identity, SwiperDisplayModeModifier, value);
69    return this;
70  }
71  cachedCount(value: number): this {
72    modifierWithKey(this._modifiersWithKeys, SwiperCachedCountModifier.identity, SwiperCachedCountModifier, value);
73    return this;
74  }
75  displayCount(value: string | number | SwiperAutoFill): this {
76    modifierWithKey(this._modifiersWithKeys, SwiperDisplayCountModifier.identity, SwiperDisplayCountModifier, value);
77    return this;
78  }
79  effectMode(value: EdgeEffect): this {
80    modifierWithKey(this._modifiersWithKeys, SwiperEffectModeModifier.identity, SwiperEffectModeModifier, value);
81    return this;
82  }
83  disableSwipe(value: boolean): this {
84    modifierWithKey(this._modifiersWithKeys, SwiperDisableSwipeModifier.identity, SwiperDisableSwipeModifier, value);
85    return this;
86  }
87
88  curve(value: string | Curve | ICurve): this {
89    modifierWithKey(this._modifiersWithKeys, SwiperCurveModifier.identity, SwiperCurveModifier, value);
90    return this;
91  }
92  onChange(event: (index: number) => void): this {
93    throw new Error('Method not implemented.');
94  }
95  indicatorStyle(value?: IndicatorStyle | undefined): this {
96    throw new Error('Method not implemented.');
97  }
98  prevMargin(value: Length): this {
99    modifierWithKey(this._modifiersWithKeys, SwiperPrevMarginModifier.identity, SwiperPrevMarginModifier, value);
100    return this;
101  }
102  nextMargin(value: Length): this {
103    modifierWithKey(this._modifiersWithKeys, SwiperNextMarginModifier.identity, SwiperNextMarginModifier, value);
104    return this;
105  }
106  enabled(value: boolean): this {
107    modifierWithKey(this._modifiersWithKeys, SwiperEnabledModifier.identity, SwiperEnabledModifier, value);
108    return this;
109  }
110  onAnimationStart(event: (index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => void): this {
111    throw new Error('Method not implemented.');
112  }
113  onAnimationEnd(event: (index: number, extraInfo: SwiperAnimationEvent) => void): this {
114    throw new Error('Method not implemented.');
115  }
116  onGestureSwipe(event: (index: number, extraInfo: SwiperAnimationEvent) => void): this {
117    throw new Error('Method not implemented.');
118  }
119  nestedScroll(value: SwiperNestedScrollMode): this {
120    throw new Error('Method not implemented.');
121  }
122}
123class SwiperNextMarginModifier extends ModifierWithKey<Length> {
124  static identity: Symbol = Symbol('swiperNextMargin');
125  applyPeer(node: KNode, reset: boolean): void {
126    if (reset) {
127      getUINativeModule().swiper.resetSwiperNextMargin(node);
128    } else {
129      getUINativeModule().swiper.setSwiperNextMargin(node, this.value);
130    }
131  }
132  checkObjectDiff(): boolean {
133    return !isBaseOrResourceEqual(this.stageValue, this.value);
134  }
135}
136class SwiperPrevMarginModifier extends ModifierWithKey<Length> {
137  static identity: Symbol = Symbol('swiperPrevMargin');
138  applyPeer(node: KNode, reset: boolean): void {
139    if (reset) {
140      getUINativeModule().swiper.resetSwiperPrevMargin(node);
141    } else {
142      getUINativeModule().swiper.setSwiperPrevMargin(node, this.value);
143    }
144  }
145  checkObjectDiff(): boolean {
146    return !isBaseOrResourceEqual(this.stageValue, this.value);
147  }
148}
149
150class SwiperDisplayCountModifier extends ModifierWithKey<string | number | SwiperAutoFill> {
151  static identity: Symbol = Symbol('swiperDisplayCount');
152  applyPeer(node: KNode, reset: boolean): void {
153    if (reset) {
154      getUINativeModule().swiper.resetSwiperDisplayCount(node);
155    } else {
156      if (isNull(this.value) || isUndefined(this.value)) {
157        getUINativeModule().swiper.resetSwiperDisplayCount(node);
158      } else if (typeof this.value === 'object') {
159        let minSize = (this.value as SwiperAutoFill).minSize.toString();
160        getUINativeModule().swiper.setSwiperDisplayCount(node, minSize, typeof this.value);
161      } else {
162        getUINativeModule().swiper.setSwiperDisplayCount(node, this.value, typeof this.value);
163      }
164    }
165  }
166  checkObjectDiff(): boolean {
167    if (typeof this.stageValue !== typeof this.value) {
168      return true;
169    } else if (typeof this.stageValue === 'object' && typeof this.stageValue === 'object') {
170      return (this.stageValue as SwiperAutoFill).minSize !== (this.value as SwiperAutoFill).minSize;
171    } else {
172      return !isBaseOrResourceEqual(this.stageValue, this.value);
173    }
174  }
175}
176
177class SwiperDisplayArrowModifier extends ModifierWithKey<ArkDisplayArrow> {
178  static identity: Symbol = Symbol('swiperDisplayArrow');
179  applyPeer(node: KNode, reset: boolean): void {
180    if (reset) {
181      getUINativeModule().swiper.resetSwiperDisplayArrow(node);
182    } else {
183      if (!isNull(this.value.value) && !isUndefined(this.value.value) && typeof this.value === 'object') {
184        let displayArrowValue = 3;
185        let showBackground;
186        let isSidebarMiddle;
187        let backgroundSize;
188        let backgroundColor;
189        let arrowSize;
190        let arrowColor;
191        if (typeof this.value.value === 'boolean') {
192          if (this.value.value) {
193            displayArrowValue = 1;
194          } else {
195            displayArrowValue = 0;
196          }
197        } else if (typeof this.value.value === 'object') {
198          displayArrowValue = 2;
199          showBackground = this.value.value.showBackground;
200          isSidebarMiddle = this.value.value.isSidebarMiddle;
201          backgroundSize = this.value.value.backgroundSize;
202          backgroundColor = this.value.value.backgroundColor;
203          arrowSize = this.value.value.arrowSize;
204          arrowColor = this.value.value.arrowColor;
205        }
206        let isHoverShow;
207        if (typeof this.value.isHoverShow === 'boolean') {
208          isHoverShow = this.value.isHoverShow;
209        }
210        getUINativeModule().swiper.setSwiperDisplayArrow(
211          node,
212          displayArrowValue,
213          showBackground,
214          isSidebarMiddle,
215          backgroundSize,
216          backgroundColor,
217          arrowSize,
218          arrowColor,
219          isHoverShow
220        );
221      } else {
222        getUINativeModule().swiper.resetSwiperDisplayArrow(node);
223      }
224    }
225  }
226  checkObjectDiff(): boolean {
227    if (
228      this.stageValue.isHoverShow !== this.value.isHoverShow ||
229      typeof this.stageValue.value !== typeof this.value.value
230    ) {
231      return true;
232    }
233    if (
234      typeof this.stageValue.value === 'boolean' &&
235      typeof this.value.value === 'boolean' &&
236      this.stageValue.value !== this.value.value
237    ) {
238      return true;
239    } else if (typeof this.stageValue.value === 'object' && typeof this.value.value === 'object') {
240      return (
241        !isBaseOrResourceEqual(
242          (this.stageValue.value as ArrowStyle).showBackground,
243          (this.value.value as ArrowStyle).showBackground
244        ) ||
245        !isBaseOrResourceEqual(
246          (this.stageValue.value as ArrowStyle).isSidebarMiddle,
247          (this.value.value as ArrowStyle).isSidebarMiddle
248        ) ||
249        !isBaseOrResourceEqual(
250          (this.stageValue.value as ArrowStyle).backgroundSize,
251          (this.value.value as ArrowStyle).backgroundSize
252        ) ||
253        !isBaseOrResourceEqual(
254          (this.stageValue.value as ArrowStyle).backgroundColor,
255          (this.value.value as ArrowStyle).backgroundColor
256        ) ||
257        !isBaseOrResourceEqual(
258          (this.stageValue.value as ArrowStyle).arrowSize,
259          (this.value.value as ArrowStyle).arrowSize
260        ) ||
261        !isBaseOrResourceEqual(
262          (this.stageValue.value as ArrowStyle).arrowColor,
263          (this.value.value as ArrowStyle).arrowColor
264        )
265      );
266    } else {
267      return true;
268    }
269  }
270}
271
272class SwiperIndicatorModifier extends ModifierWithKey<boolean | DotIndicator | DigitIndicator> {
273  static identity: Symbol = Symbol('swiperIndicator');
274  applyPeer(node: KNode, reset: boolean): void {
275    if (reset) {
276      getUINativeModule().swiper.resetSwiperIndicator(node);
277    } else {
278      let left;
279      let top;
280      let right;
281      let bottom;
282      let itemWidth;
283      let itemHeight;
284      let selectedItemWidth;
285      let selectedItemHeight;
286      let mask;
287      let color;
288      let selectedColor;
289      let fontColor;
290      let selectedFontColor;
291      let digitFontSize;
292      let digitFontWeight;
293      let selectedDigitFontSize;
294      let selectedDigitFontWeight;
295      if (typeof this.value === 'boolean') {
296        getUINativeModule().swiper.setSwiperIndicator(node, 'boolean', this.value);
297      } else if (typeof this.value === 'object' && (this.value as ArkDotIndicator).type === 'DotIndicator') {
298        left = (this.value as ArkDotIndicator).leftValue;
299        top = (this.value as ArkDotIndicator).topValue;
300        right = (this.value as ArkDotIndicator).rightValue;
301        bottom = (this.value as ArkDotIndicator).bottomValue;
302        itemWidth = (this.value as ArkDotIndicator).itemWidthValue;
303        itemHeight = (this.value as ArkDotIndicator).itemHeightValue;
304        selectedItemWidth = (this.value as ArkDotIndicator).selectedItemWidthValue;
305        selectedItemHeight = (this.value as ArkDotIndicator).selectedItemHeightValue;
306        mask = (this.value as ArkDotIndicator).maskValue;
307        color = (this.value as ArkDotIndicator).colorValue;
308        selectedColor = (this.value as ArkDotIndicator).selectedColorValue;
309        getUINativeModule().swiper.setSwiperIndicator(
310          node,
311          'ArkDotIndicator',
312          itemWidth,
313          itemHeight,
314          selectedItemWidth,
315          selectedItemHeight,
316          mask,
317          color,
318          selectedColor,
319          left,
320          top,
321          right,
322          bottom
323        );
324      } else if (typeof this.value === 'object' && (this.value as ArkDigitIndicator).type === 'DigitIndicator') {
325        left = (this.value as ArkDigitIndicator).leftValue;
326        top = (this.value as ArkDigitIndicator).topValue;
327        right = (this.value as ArkDigitIndicator).rightValue;
328        bottom = (this.value as ArkDigitIndicator).bottomValue;
329        fontColor = (this.value as ArkDigitIndicator).fontColorValue;
330        selectedFontColor = (this.value as ArkDigitIndicator).selectedFontColorValue;
331        let arkDigitFont = new ArkDigitFont();
332        if (typeof (this.value as ArkDigitIndicator).digitFontValue === 'object') {
333          digitFontSize = ((this.value as ArkDigitIndicator).digitFontValue as Font).size;
334          digitFontWeight = arkDigitFont.parseFontWeight(
335            ((this.value as ArkDigitIndicator).digitFontValue as Font).weight
336          );
337        }
338        if (typeof (this.value as ArkDigitIndicator).selectedDigitFontValue === 'object') {
339          selectedDigitFontSize = ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).size;
340          selectedDigitFontWeight = arkDigitFont.parseFontWeight(
341            ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).weight
342          );
343        }
344        getUINativeModule().swiper.setSwiperIndicator(
345          node,
346          'ArkDigitIndicator',
347          fontColor,
348          selectedFontColor,
349          digitFontSize,
350          digitFontWeight,
351          selectedDigitFontSize,
352          selectedDigitFontWeight,
353          left,
354          top,
355          right,
356          bottom
357        );
358      } else {
359        getUINativeModule().swiper.setSwiperIndicator(node, 'boolean', true);
360      }
361    }
362  }
363  checkObjectDiff(): boolean {
364    if (typeof this.stageValue !== typeof this.value) {
365      return true;
366    }
367    if (typeof this.stageValue === 'boolean' && typeof this.value === 'boolean') {
368      return this.stageValue !== this.value;
369    }
370    if (this.stageValue instanceof ArkDotIndicator && this.value instanceof ArkDotIndicator) {
371      return (
372        !isBaseOrResourceEqual(
373          (this.stageValue as ArkDotIndicator).itemWidthValue,
374          (this.value as ArkDotIndicator).itemWidthValue
375        ) ||
376        !isBaseOrResourceEqual(
377          (this.stageValue as ArkDotIndicator).itemHeightValue,
378          (this.value as ArkDotIndicator).itemHeightValue
379        ) ||
380        !isBaseOrResourceEqual(
381          (this.stageValue as ArkDotIndicator).selectedItemWidthValue,
382          (this.value as ArkDotIndicator).selectedItemWidthValue
383        ) ||
384        !isBaseOrResourceEqual(
385          (this.stageValue as ArkDotIndicator).selectedItemHeightValue,
386          (this.value as ArkDotIndicator).selectedItemHeightValue
387        ) ||
388        !isBaseOrResourceEqual(
389          (this.stageValue as ArkDotIndicator).maskValue,
390          (this.value as ArkDotIndicator).maskValue
391        ) ||
392        !isBaseOrResourceEqual(
393          (this.stageValue as ArkDotIndicator).colorValue,
394          (this.value as ArkDotIndicator).colorValue
395        ) ||
396        !isBaseOrResourceEqual(
397          (this.stageValue as ArkDotIndicator).selectedColorValue,
398          (this.value as ArkDotIndicator).selectedColorValue
399        )
400      );
401    } else if (this.stageValue instanceof ArkDigitIndicator && this.value instanceof ArkDigitIndicator) {
402      return (
403        !isBaseOrResourceEqual(
404          (this.stageValue as ArkDigitIndicator).fontColorValue,
405          (this.value as ArkDigitIndicator).fontColorValue
406        ) ||
407        !isBaseOrResourceEqual(
408          (this.stageValue as ArkDigitIndicator).selectedFontColorValue,
409          (this.value as ArkDigitIndicator).selectedFontColorValue
410        ) ||
411        !isBaseOrResourceEqual(
412          ((this.stageValue as ArkDigitIndicator).digitFontValue as Font).size,
413          ((this.value as ArkDigitIndicator).digitFontValue as Font).size
414        ) ||
415        !isBaseOrResourceEqual(
416          ((this.stageValue as ArkDigitIndicator).digitFontValue as Font).weight,
417          ((this.value as ArkDigitIndicator).digitFontValue as Font).weight
418        ) ||
419        !isBaseOrResourceEqual(
420          ((this.stageValue as ArkDigitIndicator).selectedDigitFontValue as Font).size,
421          ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).size
422        ) ||
423        !isBaseOrResourceEqual(
424          ((this.stageValue as ArkDigitIndicator).selectedDigitFontValue as Font).weight,
425          ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).weight
426        )
427      );
428    } else {
429      return true;
430    }
431  }
432}
433
434class SwiperCurveModifier extends ModifierWithKey<string | Curve | ICurve> {
435  static identity: Symbol = Symbol('swiperCurve');
436  applyPeer(node: KNode, reset: boolean): void {
437    if (reset) {
438      getUINativeModule().swiper.resetSwiperCurve(node);
439    } else {
440      const curveMap = {
441        [0]: 'linear',
442        [1]: 'ease',
443        [2]: 'ease-in',
444        [3]: 'ease-out',
445        [4]: 'ease-in-out',
446        [5]: 'fast-out-slow-in',
447        [6]: 'linear-out-slow-in',
448        [7]: 'fast-out-linear-in',
449        [8]: 'extreme-deceleration',
450        [9]: 'sharp',
451        [10]: 'rhythm',
452        [11]: 'smooth',
453        [12]: 'friction'
454      };
455      if (typeof this.value === 'number') {
456        if (this.value in curveMap) {
457          this.value = curveMap[this.value];
458        } else {
459          this.value = this.value.toString();
460        }
461      }
462      getUINativeModule().swiper.setSwiperCurve(node, this.value);
463    }
464  }
465  checkObjectDiff(): boolean {
466    return !isBaseOrResourceEqual(this.stageValue, this.value);
467  }
468}
469class SwiperDisableSwipeModifier extends ModifierWithKey<boolean> {
470  static identity: Symbol = Symbol('swiperDisableSwipe');
471  applyPeer(node: KNode, reset: boolean): void {
472    if (reset) {
473      getUINativeModule().swiper.resetSwiperDisableSwipe(node);
474    } else {
475      getUINativeModule().swiper.setSwiperDisableSwipe(node, this.value);
476    }
477  }
478  checkObjectDiff(): boolean {
479    return !isBaseOrResourceEqual(this.stageValue, this.value);
480  }
481}
482class SwiperEffectModeModifier extends ModifierWithKey<EdgeEffect> {
483  static identity: Symbol = Symbol('swiperEffectMode');
484  applyPeer(node: KNode, reset: boolean): void {
485    if (reset) {
486      getUINativeModule().swiper.resetSwiperEffectMode(node);
487    } else {
488      getUINativeModule().swiper.setSwiperEffectMode(node, this.value);
489    }
490  }
491  checkObjectDiff(): boolean {
492    return !isBaseOrResourceEqual(this.stageValue, this.value);
493  }
494}
495class SwiperCachedCountModifier extends ModifierWithKey<number> {
496  static identity: Symbol = Symbol('swiperCachedCount');
497  applyPeer(node: KNode, reset: boolean): void {
498    if (reset) {
499      getUINativeModule().swiper.resetSwiperCachedCount(node);
500    } else {
501      getUINativeModule().swiper.setSwiperCachedCount(node, this.value);
502    }
503  }
504  checkObjectDiff(): boolean {
505    return !isBaseOrResourceEqual(this.stageValue, this.value);
506  }
507}
508class SwiperDisplayModeModifier extends ModifierWithKey<number> {
509  static identity: Symbol = Symbol('swiperDisplayMode');
510  applyPeer(node: KNode, reset: boolean): void {
511    if (reset) {
512      getUINativeModule().swiper.resetSwiperDisplayMode(node);
513    } else {
514      getUINativeModule().swiper.setSwiperDisplayMode(node, this.value);
515    }
516  }
517  checkObjectDiff(): boolean {
518    return !isBaseOrResourceEqual(this.stageValue, this.value);
519  }
520}
521class SwiperItemSpaceModifier extends ModifierWithKey<string | number> {
522  static identity: Symbol = Symbol('swiperItemSpace');
523  applyPeer(node: KNode, reset: boolean): void {
524    if (reset) {
525      getUINativeModule().swiper.resetSwiperItemSpace(node);
526    } else {
527      getUINativeModule().swiper.setSwiperItemSpace(node, this.value);
528    }
529  }
530  checkObjectDiff(): boolean {
531    return !isBaseOrResourceEqual(this.stageValue, this.value);
532  }
533}
534class SwiperVerticalModifier extends ModifierWithKey<boolean> {
535  static identity: Symbol = Symbol('swiperVertical');
536  applyPeer(node: KNode, reset: boolean): void {
537    if (reset) {
538      getUINativeModule().swiper.resetSwiperVertical(node);
539    } else {
540      getUINativeModule().swiper.setSwiperVertical(node, this.value);
541    }
542  }
543  checkObjectDiff(): boolean {
544    return !isBaseOrResourceEqual(this.stageValue, this.value);
545  }
546}
547class SwiperLoopModifier extends ModifierWithKey<boolean> {
548  static identity: Symbol = Symbol('swiperLoop');
549  applyPeer(node: KNode, reset: boolean): void {
550    if (reset) {
551      getUINativeModule().swiper.resetSwiperLoop(node);
552    } else {
553      getUINativeModule().swiper.setSwiperLoop(node, this.value);
554    }
555  }
556  checkObjectDiff(): boolean {
557    return !isBaseOrResourceEqual(this.stageValue, this.value);
558  }
559}
560class SwiperIntervalModifier extends ModifierWithKey<number> {
561  static identity: Symbol = Symbol('swiperInterval');
562  applyPeer(node: KNode, reset: boolean): void {
563    if (reset) {
564      getUINativeModule().swiper.resetSwiperInterval(node);
565    } else {
566      getUINativeModule().swiper.setSwiperInterval(node, this.value);
567    }
568  }
569  checkObjectDiff(): boolean {
570    return !isBaseOrResourceEqual(this.stageValue, this.value);
571  }
572}
573class SwiperAutoPlayModifier extends ModifierWithKey<boolean> {
574  static identity: Symbol = Symbol('swiperAutoPlay');
575  applyPeer(node: KNode, reset: boolean): void {
576    if (reset) {
577      getUINativeModule().swiper.resetSwiperAutoPlay(node);
578    } else {
579      getUINativeModule().swiper.setSwiperAutoPlay(node, this.value);
580    }
581  }
582  checkObjectDiff(): boolean {
583    return !isBaseOrResourceEqual(this.stageValue, this.value);
584  }
585}
586class SwiperIndexModifier extends ModifierWithKey<number> {
587  static identity: Symbol = Symbol('swiperIndex');
588  applyPeer(node: KNode, reset: boolean): void {
589    if (reset) {
590      getUINativeModule().swiper.resetSwiperIndex(node);
591    } else {
592      getUINativeModule().swiper.setSwiperIndex(node, this.value);
593    }
594  }
595  checkObjectDiff(): boolean {
596    return !isBaseOrResourceEqual(this.stageValue, this.value);
597  }
598}
599class SwiperDurationModifier extends ModifierWithKey<number> {
600  static identity: Symbol = Symbol('swiperDuration');
601  applyPeer(node: KNode, reset: boolean): void {
602    if (reset) {
603      getUINativeModule().swiper.resetSwiperDuration(node);
604    } else {
605      getUINativeModule().swiper.setSwiperDuration(node, this.value);
606    }
607  }
608  checkObjectDiff(): boolean {
609    return !isBaseOrResourceEqual(this.stageValue, this.value);
610  }
611}
612
613class SwiperEnabledModifier extends ModifierWithKey<boolean> {
614  constructor(value: boolean) {
615    super(value);
616  }
617  static identity: Symbol = Symbol('swiperenabled');
618  applyPeer(node: KNode, reset: boolean): void {
619    if (reset) {
620      getUINativeModule().swiper.resetSwiperEnabled(node);
621
622    } else {
623      getUINativeModule().swiper.setSwiperEnabled(node, this.value);
624    }
625  }
626}
627
628// @ts-ignore
629globalThis.Swiper.attributeModifier = function (modifier) {
630  const elmtId = ViewStackProcessor.GetElmtIdToAccountFor();
631  let nativeNode = getUINativeModule().getFrameNodeById(elmtId);
632  let component = this.createOrGetNode(elmtId, () => {
633    return new ArkSwiperComponent(nativeNode);
634  });
635  applyUIAttributes(modifier, nativeNode, component);
636  component.applyModifierPatch();
637};
638