import { ContainerRef } from '@cleartrip/ct-design-container'; import { AnimatedStyleWithController, IAnimatedRef, IAnimationOptions } from '../type'; import { IAnimatedStyleClass } from './IAnimatedStyleClass'; class AnimatedStyle implements IAnimatedStyleClass { private animatedStyle: IAnimationOptions | AnimatedStyleWithController[]; private elementRef?: React.RefObject | null; constructor( animatedStyle?: IAnimationOptions | AnimatedStyleWithController[], elementRef?: React.RefObject | null, ) { this.animatedStyle = animatedStyle ?? {}; this.elementRef = elementRef ?? null; } getNativeAnimatedSequenceStyles(): AnimatedStyleWithController[] { return this.animatedStyle as AnimatedStyleWithController[]; } getNativeAnimatedStyle(): IAnimationOptions | null { if (this.getNativeIsSequence()) return null; return this.animatedStyle as IAnimationOptions; } getNativeElementRef(): React.RefObject | null { return this.elementRef as React.RefObject | null; } getNativeIsSequence(): boolean { return Array.isArray(this.animatedStyle); } setNativeElementRef(callback: React.RefObject | null): void { this.elementRef = callback; } // Platform-agnostic methods (delegate to native implementations) getAnimatedStyle(): IAnimationOptions | null { return this.getNativeAnimatedStyle(); } getAnimatedSequenceStyles(): AnimatedStyleWithController[] { return this.getNativeAnimatedSequenceStyles(); } getIsSequence(): boolean { return this.getNativeIsSequence(); } getWebAnimatedStyle(): IAnimationOptions | null { // No Operation return null; } setWebElementRef(_: React.MutableRefObject | null): void { // No Operation } getWebClassNamesRef(): React.RefObject | null { // No Operation return null; } setWebClassNamesRef(_: React.RefObject): void { // No Operation } getWebIsSequence(): boolean { // No Operation return false; } getWebIsSpring(): boolean { // No Operation return false; } getWebAnimatedSequenceStyles(): AnimatedStyleWithController[] { // No Operation return []; } getWebSpringRef(): React.RefObject | null { // No Operation return null; } } export default AnimatedStyle;