@umituz/react-native-design-system 2.6.47 → 2.6.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/atoms/skeleton/AtomicSkeleton.tsx +16 -62
- package/src/index.ts +0 -32
- package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +101 -180
- package/src/molecules/bottom-sheet/components/SafeBottomSheetModalProvider.tsx +8 -14
- package/src/molecules/index.ts +0 -6
- package/src/molecules/animation/core/AnimationCore.ts +0 -29
- package/src/molecules/animation/domain/entities/Animation.ts +0 -81
- package/src/molecules/animation/domain/entities/Fireworks.ts +0 -44
- package/src/molecules/animation/domain/entities/Theme.ts +0 -76
- package/src/molecules/animation/index.ts +0 -146
- package/src/molecules/animation/infrastructure/services/AnimationConfigService.ts +0 -35
- package/src/molecules/animation/infrastructure/services/SpringAnimationConfigService.ts +0 -67
- package/src/molecules/animation/infrastructure/services/TimingAnimationConfigService.ts +0 -57
- package/src/molecules/animation/infrastructure/services/__tests__/SpringAnimationConfigService.test.ts +0 -114
- package/src/molecules/animation/infrastructure/services/__tests__/TimingAnimationConfigService.test.ts +0 -105
- package/src/molecules/animation/presentation/components/Fireworks.tsx +0 -127
- package/src/molecules/animation/presentation/components/__tests__/Fireworks.test.tsx +0 -185
- package/src/molecules/animation/presentation/hooks/__tests__/useAnimation.integration.test.ts +0 -210
- package/src/molecules/animation/presentation/hooks/__tests__/useFireworks.test.ts +0 -242
- package/src/molecules/animation/presentation/hooks/__tests__/useGesture.test.ts +0 -108
- package/src/molecules/animation/presentation/hooks/__tests__/useSpringAnimation.test.ts +0 -127
- package/src/molecules/animation/presentation/hooks/__tests__/useTimingAnimation.test.ts +0 -172
- package/src/molecules/animation/presentation/hooks/__tests__/useTransformAnimation.test.ts +0 -133
- package/src/molecules/animation/presentation/hooks/useAnimation.ts +0 -77
- package/src/molecules/animation/presentation/hooks/useFireworks.ts +0 -144
- package/src/molecules/animation/presentation/hooks/useGesture.ts +0 -57
- package/src/molecules/animation/presentation/hooks/useGestureCreators.ts +0 -163
- package/src/molecules/animation/presentation/hooks/useGestureState.ts +0 -53
- package/src/molecules/animation/presentation/hooks/useIconAnimations.ts +0 -120
- package/src/molecules/animation/presentation/hooks/useModalAnimations.ts +0 -124
- package/src/molecules/animation/presentation/hooks/useReanimatedReady.ts +0 -60
- package/src/molecules/animation/presentation/hooks/useSpringAnimation.ts +0 -69
- package/src/molecules/animation/presentation/hooks/useTimingAnimation.ts +0 -111
- package/src/molecules/animation/presentation/hooks/useTransformAnimation.ts +0 -57
- package/src/molecules/animation/presentation/providers/AnimationThemeProvider.tsx +0 -60
- package/src/molecules/animation/presentation/providers/__tests__/AnimationThemeProvider.test.tsx +0 -165
- package/src/molecules/celebration/domain/entities/CelebrationConfig.ts +0 -17
- package/src/molecules/celebration/domain/entities/FireworksConfig.ts +0 -32
- package/src/molecules/celebration/index.ts +0 -93
- package/src/molecules/celebration/infrastructure/services/FireworksConfigService.ts +0 -49
- package/src/molecules/celebration/presentation/components/CelebrationFireworksOverlay.tsx +0 -33
- package/src/molecules/celebration/presentation/components/CelebrationModal.tsx +0 -81
- package/src/molecules/celebration/presentation/components/CelebrationModalContent.tsx +0 -88
- package/src/molecules/celebration/presentation/hooks/useCelebrationModalAnimation.ts +0 -49
- package/src/molecules/celebration/presentation/hooks/useCelebrationState.ts +0 -45
- package/src/molecules/celebration/presentation/styles/CelebrationModalStyles.ts +0 -65
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Theme System for Animation Package
|
|
3
|
-
*
|
|
4
|
-
* Provides theme-aware animation configurations.
|
|
5
|
-
* Consumers can provide their own theme or use defaults.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface AnimationTheme {
|
|
9
|
-
colors: {
|
|
10
|
-
primary: string;
|
|
11
|
-
secondary: string;
|
|
12
|
-
success: string;
|
|
13
|
-
warning: string;
|
|
14
|
-
error: string;
|
|
15
|
-
info: string;
|
|
16
|
-
};
|
|
17
|
-
spacing: {
|
|
18
|
-
xs: number;
|
|
19
|
-
sm: number;
|
|
20
|
-
md: number;
|
|
21
|
-
lg: number;
|
|
22
|
-
xl: number;
|
|
23
|
-
};
|
|
24
|
-
borderRadius: {
|
|
25
|
-
sm: number;
|
|
26
|
-
md: number;
|
|
27
|
-
lg: number;
|
|
28
|
-
full: number;
|
|
29
|
-
};
|
|
30
|
-
opacity: {
|
|
31
|
-
transparent: number;
|
|
32
|
-
light: number;
|
|
33
|
-
medium: number;
|
|
34
|
-
heavy: number;
|
|
35
|
-
opaque: number;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const DEFAULT_ANIMATION_THEME: AnimationTheme = {
|
|
40
|
-
colors: {
|
|
41
|
-
primary: '#007AFF',
|
|
42
|
-
secondary: '#5856D6',
|
|
43
|
-
success: '#34C759',
|
|
44
|
-
warning: '#FF9500',
|
|
45
|
-
error: '#FF3B30',
|
|
46
|
-
info: '#5AC8FA',
|
|
47
|
-
},
|
|
48
|
-
spacing: {
|
|
49
|
-
xs: 4,
|
|
50
|
-
sm: 8,
|
|
51
|
-
md: 16,
|
|
52
|
-
lg: 24,
|
|
53
|
-
xl: 32,
|
|
54
|
-
},
|
|
55
|
-
borderRadius: {
|
|
56
|
-
sm: 4,
|
|
57
|
-
md: 8,
|
|
58
|
-
lg: 12,
|
|
59
|
-
full: 9999,
|
|
60
|
-
},
|
|
61
|
-
opacity: {
|
|
62
|
-
transparent: 0,
|
|
63
|
-
light: 0.25,
|
|
64
|
-
medium: 0.5,
|
|
65
|
-
heavy: 0.75,
|
|
66
|
-
opaque: 1,
|
|
67
|
-
},
|
|
68
|
-
} as const;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Theme context for React components
|
|
72
|
-
*/
|
|
73
|
-
export interface ThemeContext {
|
|
74
|
-
theme: AnimationTheme;
|
|
75
|
-
setTheme: (theme: Partial<AnimationTheme>) => void;
|
|
76
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Native Animation - Barrel Export
|
|
3
|
-
*
|
|
4
|
-
* Universal animation system for React Native with react-native-reanimated.
|
|
5
|
-
* Provides declarative animations, gesture handling, and preset configurations.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Declarative animations (fade, slide, scale, bounce, shake)
|
|
9
|
-
* - Spring physics animations
|
|
10
|
-
* - Gesture handling (tap, pan, pinch, long press)
|
|
11
|
-
* - Preset animation configs
|
|
12
|
-
* - TypeScript type safety
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
*
|
|
16
|
-
* Animation Example:
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { useAnimation, Animated } from '@umituz/react-native-animation';
|
|
19
|
-
*
|
|
20
|
-
* const MyComponent = () => {
|
|
21
|
-
* const { fadeIn, animatedStyle } = useAnimation();
|
|
22
|
-
*
|
|
23
|
-
* useEffect(() => {
|
|
24
|
-
* fadeIn();
|
|
25
|
-
* }, []);
|
|
26
|
-
*
|
|
27
|
-
* return <Animated.View style={animatedStyle}>...</Animated.View>;
|
|
28
|
-
* };
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* Gesture Example:
|
|
32
|
-
* ```typescript
|
|
33
|
-
* import { useGesture, Animated } from '@umituz/react-native-animation';
|
|
34
|
-
*
|
|
35
|
-
* const MyComponent = () => {
|
|
36
|
-
* const { createPanGesture, animatedStyle, GestureDetector } = useGesture();
|
|
37
|
-
*
|
|
38
|
-
* const panGesture = createPanGesture({
|
|
39
|
-
* onEnd: (x, y) => console.log('Dragged to:', x, y),
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* return (
|
|
43
|
-
* <GestureDetector gesture={panGesture}>
|
|
44
|
-
* <Animated.View style={animatedStyle}>...</Animated.View>
|
|
45
|
-
* </GestureDetector>
|
|
46
|
-
* );
|
|
47
|
-
* };
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* Technical:
|
|
51
|
-
* - Uses react-native-reanimated v3 for animations
|
|
52
|
-
* - Uses react-native-gesture-handler for gestures
|
|
53
|
-
* - Zero backend dependencies
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
// =============================================================================
|
|
57
|
-
// CORE LAYER - Animation Primitives
|
|
58
|
-
// =============================================================================
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
Animated,
|
|
62
|
-
useSharedValue,
|
|
63
|
-
useAnimatedStyle,
|
|
64
|
-
withTiming,
|
|
65
|
-
withSpring,
|
|
66
|
-
withSequence,
|
|
67
|
-
withRepeat,
|
|
68
|
-
runOnJS,
|
|
69
|
-
cancelAnimation,
|
|
70
|
-
Easing,
|
|
71
|
-
} from './core/AnimationCore';
|
|
72
|
-
|
|
73
|
-
export type {
|
|
74
|
-
SharedValue,
|
|
75
|
-
WithTimingConfig,
|
|
76
|
-
WithSpringConfig,
|
|
77
|
-
} from './core/AnimationCore';
|
|
78
|
-
|
|
79
|
-
// =============================================================================
|
|
80
|
-
// DOMAIN LAYER - Entities
|
|
81
|
-
// =============================================================================
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
AnimationPreset,
|
|
85
|
-
GestureType,
|
|
86
|
-
AnimationEasing,
|
|
87
|
-
ANIMATION_CONSTANTS,
|
|
88
|
-
} from './domain/entities/Animation';
|
|
89
|
-
export type {
|
|
90
|
-
AnimationTimingConfig,
|
|
91
|
-
AnimationSpringConfig,
|
|
92
|
-
} from './domain/entities/Animation';
|
|
93
|
-
|
|
94
|
-
// Infrastructure Layer - Services
|
|
95
|
-
export { AnimationConfigService } from './infrastructure/services/AnimationConfigService';
|
|
96
|
-
export { TimingAnimationConfigService } from './infrastructure/services/TimingAnimationConfigService';
|
|
97
|
-
export { SpringAnimationConfigService } from './infrastructure/services/SpringAnimationConfigService';
|
|
98
|
-
|
|
99
|
-
// Presentation Layer - Hooks
|
|
100
|
-
export { useAnimation } from './presentation/hooks/useAnimation';
|
|
101
|
-
export {
|
|
102
|
-
useGesture,
|
|
103
|
-
type TapGestureOptions,
|
|
104
|
-
type PanGestureOptions,
|
|
105
|
-
type PinchGestureOptions,
|
|
106
|
-
} from './presentation/hooks/useGesture';
|
|
107
|
-
export { useReanimatedReady } from './presentation/hooks/useReanimatedReady';
|
|
108
|
-
export { useFireworks } from './presentation/hooks/useFireworks';
|
|
109
|
-
export {
|
|
110
|
-
useOverlayAnimations,
|
|
111
|
-
useModalAnimations, // Legacy
|
|
112
|
-
type OverlayAnimationConfig,
|
|
113
|
-
type UseOverlayAnimationsReturn,
|
|
114
|
-
type ModalAnimationConfig, // Legacy
|
|
115
|
-
type UseModalAnimationsReturn, // Legacy
|
|
116
|
-
} from './presentation/hooks/useModalAnimations';
|
|
117
|
-
export {
|
|
118
|
-
useElementAnimations,
|
|
119
|
-
useIconAnimations, // Legacy
|
|
120
|
-
type ElementAnimationConfig,
|
|
121
|
-
type UseElementAnimationsReturn,
|
|
122
|
-
type IconAnimationConfig, // Legacy
|
|
123
|
-
type UseIconAnimationsReturn, // Legacy
|
|
124
|
-
} from './presentation/hooks/useIconAnimations';
|
|
125
|
-
|
|
126
|
-
// Presentation Layer - Components
|
|
127
|
-
export { Fireworks } from './presentation/components/Fireworks';
|
|
128
|
-
export type { FireworksProps } from './presentation/components/Fireworks';
|
|
129
|
-
|
|
130
|
-
// Domain Layer - Fireworks
|
|
131
|
-
export type {
|
|
132
|
-
ParticleConfig,
|
|
133
|
-
FireworksConfig,
|
|
134
|
-
} from './domain/entities/Fireworks';
|
|
135
|
-
export { FIREWORKS_CONSTANTS } from './domain/entities/Fireworks';
|
|
136
|
-
|
|
137
|
-
// Domain Layer - Theme
|
|
138
|
-
export type {
|
|
139
|
-
AnimationTheme,
|
|
140
|
-
ThemeContext,
|
|
141
|
-
} from './domain/entities/Theme';
|
|
142
|
-
export { DEFAULT_ANIMATION_THEME } from './domain/entities/Theme';
|
|
143
|
-
|
|
144
|
-
// Presentation Layer - Providers
|
|
145
|
-
export { AnimationThemeProvider, useAnimationTheme } from './presentation/providers/AnimationThemeProvider';
|
|
146
|
-
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animation Config Service (Legacy)
|
|
3
|
-
*
|
|
4
|
-
* Legacy service for backward compatibility.
|
|
5
|
-
* New implementations should use TimingAnimationConfigService and SpringAnimationConfigService.
|
|
6
|
-
* @deprecated Use TimingAnimationConfigService and SpringAnimationConfigService instead
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
AnimationTimingConfig,
|
|
11
|
-
AnimationSpringConfig,
|
|
12
|
-
} from '../../domain/entities/Animation';
|
|
13
|
-
import { AnimationPreset } from '../../domain/entities/Animation';
|
|
14
|
-
import { TimingAnimationConfigService } from './TimingAnimationConfigService';
|
|
15
|
-
import { SpringAnimationConfigService } from './SpringAnimationConfigService';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use TimingAnimationConfigService and SpringAnimationConfigService instead
|
|
19
|
-
*/
|
|
20
|
-
export class AnimationConfigService {
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use TimingAnimationConfigService.getTimingConfig instead
|
|
23
|
-
*/
|
|
24
|
-
static getTimingConfig(preset: AnimationPreset): AnimationTimingConfig {
|
|
25
|
-
return TimingAnimationConfigService.getTimingConfig(preset);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use SpringAnimationConfigService.getSpringConfig instead
|
|
30
|
-
*/
|
|
31
|
-
static getSpringConfig(preset: AnimationPreset): AnimationSpringConfig {
|
|
32
|
-
return SpringAnimationConfigService.getSpringConfig(preset);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spring Animation Config Service
|
|
3
|
-
*
|
|
4
|
-
* Infrastructure service for spring animation configurations.
|
|
5
|
-
* Separates spring configuration logic from domain entities.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { AnimationSpringConfig } from '../../domain/entities/Animation';
|
|
9
|
-
import {
|
|
10
|
-
AnimationPreset,
|
|
11
|
-
ANIMATION_CONSTANTS,
|
|
12
|
-
} from '../../domain/entities/Animation';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Service for providing spring animation configurations
|
|
16
|
-
*/
|
|
17
|
-
export class SpringAnimationConfigService {
|
|
18
|
-
/**
|
|
19
|
-
* Get preset spring config
|
|
20
|
-
*/
|
|
21
|
-
static getSpringConfig(preset: AnimationPreset): AnimationSpringConfig {
|
|
22
|
-
const configs: Record<AnimationPreset, AnimationSpringConfig> = {
|
|
23
|
-
[AnimationPreset.FADE_IN]: {
|
|
24
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
25
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
26
|
-
},
|
|
27
|
-
[AnimationPreset.FADE_OUT]: {
|
|
28
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
29
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
30
|
-
},
|
|
31
|
-
[AnimationPreset.SLIDE_IN_UP]: {
|
|
32
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
33
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
34
|
-
},
|
|
35
|
-
[AnimationPreset.SLIDE_IN_DOWN]: {
|
|
36
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
37
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
38
|
-
},
|
|
39
|
-
[AnimationPreset.SLIDE_IN_LEFT]: {
|
|
40
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
41
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
42
|
-
},
|
|
43
|
-
[AnimationPreset.SLIDE_IN_RIGHT]: {
|
|
44
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
45
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
46
|
-
},
|
|
47
|
-
[AnimationPreset.SCALE_IN]: {
|
|
48
|
-
damping: 15,
|
|
49
|
-
stiffness: 150,
|
|
50
|
-
},
|
|
51
|
-
[AnimationPreset.SCALE_OUT]: {
|
|
52
|
-
damping: 15,
|
|
53
|
-
stiffness: 150,
|
|
54
|
-
},
|
|
55
|
-
[AnimationPreset.BOUNCE]: {
|
|
56
|
-
damping: 5,
|
|
57
|
-
stiffness: 120,
|
|
58
|
-
},
|
|
59
|
-
[AnimationPreset.SHAKE]: {
|
|
60
|
-
damping: 8,
|
|
61
|
-
stiffness: 200,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return configs[preset];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Timing Animation Config Service
|
|
3
|
-
*
|
|
4
|
-
* Infrastructure service for timing animation configurations.
|
|
5
|
-
* Separates timing configuration logic from domain entities.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { AnimationTimingConfig } from '../../domain/entities/Animation';
|
|
9
|
-
import {
|
|
10
|
-
AnimationPreset,
|
|
11
|
-
ANIMATION_CONSTANTS,
|
|
12
|
-
} from '../../domain/entities/Animation';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Service for providing timing animation configurations
|
|
16
|
-
*/
|
|
17
|
-
export class TimingAnimationConfigService {
|
|
18
|
-
/**
|
|
19
|
-
* Get preset timing config
|
|
20
|
-
*/
|
|
21
|
-
static getTimingConfig(preset: AnimationPreset): AnimationTimingConfig {
|
|
22
|
-
const configs: Record<AnimationPreset, AnimationTimingConfig> = {
|
|
23
|
-
[AnimationPreset.FADE_IN]: {
|
|
24
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
25
|
-
},
|
|
26
|
-
[AnimationPreset.FADE_OUT]: {
|
|
27
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
28
|
-
},
|
|
29
|
-
[AnimationPreset.SLIDE_IN_UP]: {
|
|
30
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
31
|
-
},
|
|
32
|
-
[AnimationPreset.SLIDE_IN_DOWN]: {
|
|
33
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
34
|
-
},
|
|
35
|
-
[AnimationPreset.SLIDE_IN_LEFT]: {
|
|
36
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
37
|
-
},
|
|
38
|
-
[AnimationPreset.SLIDE_IN_RIGHT]: {
|
|
39
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
40
|
-
},
|
|
41
|
-
[AnimationPreset.SCALE_IN]: {
|
|
42
|
-
duration: ANIMATION_CONSTANTS.DURATION.FAST,
|
|
43
|
-
},
|
|
44
|
-
[AnimationPreset.SCALE_OUT]: {
|
|
45
|
-
duration: ANIMATION_CONSTANTS.DURATION.FAST,
|
|
46
|
-
},
|
|
47
|
-
[AnimationPreset.BOUNCE]: {
|
|
48
|
-
duration: ANIMATION_CONSTANTS.DURATION.SLOW,
|
|
49
|
-
},
|
|
50
|
-
[AnimationPreset.SHAKE]: {
|
|
51
|
-
duration: ANIMATION_CONSTANTS.DURATION.FAST,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return configs[preset];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SpringAnimationConfigService Tests
|
|
3
|
-
*
|
|
4
|
-
* Unit tests for spring animation configuration service.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { SpringAnimationConfigService } from '../SpringAnimationConfigService';
|
|
8
|
-
import { AnimationPreset, ANIMATION_CONSTANTS } from '../../../domain/entities/Animation';
|
|
9
|
-
|
|
10
|
-
describe('SpringAnimationConfigService', () => {
|
|
11
|
-
describe('getSpringConfig', () => {
|
|
12
|
-
it('should return config for FADE_IN preset', () => {
|
|
13
|
-
const config = SpringAnimationConfigService.getSpringConfig(AnimationPreset.FADE_IN);
|
|
14
|
-
|
|
15
|
-
expect(config).toEqual({
|
|
16
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
17
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should return config for FADE_OUT preset', () => {
|
|
22
|
-
const config = SpringAnimationConfigService.getSpringConfig(AnimationPreset.FADE_OUT);
|
|
23
|
-
|
|
24
|
-
expect(config).toEqual({
|
|
25
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
26
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should return config for SCALE_IN preset', () => {
|
|
31
|
-
const config = SpringAnimationConfigService.getSpringConfig(AnimationPreset.SCALE_IN);
|
|
32
|
-
|
|
33
|
-
expect(config).toEqual({
|
|
34
|
-
damping: 15,
|
|
35
|
-
stiffness: 150,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should return config for SCALE_OUT preset', () => {
|
|
40
|
-
const config = SpringAnimationConfigService.getSpringConfig(AnimationPreset.SCALE_OUT);
|
|
41
|
-
|
|
42
|
-
expect(config).toEqual({
|
|
43
|
-
damping: 15,
|
|
44
|
-
stiffness: 150,
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should return config for BOUNCE preset', () => {
|
|
49
|
-
const config = SpringAnimationConfigService.getSpringConfig(AnimationPreset.BOUNCE);
|
|
50
|
-
|
|
51
|
-
expect(config).toEqual({
|
|
52
|
-
damping: 5,
|
|
53
|
-
stiffness: 120,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should return config for SHAKE preset', () => {
|
|
58
|
-
const config = SpringAnimationConfigService.getSpringConfig(AnimationPreset.SHAKE);
|
|
59
|
-
|
|
60
|
-
expect(config).toEqual({
|
|
61
|
-
damping: 8,
|
|
62
|
-
stiffness: 200,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should return default spring config for slide presets', () => {
|
|
67
|
-
const slidePresets = [
|
|
68
|
-
AnimationPreset.SLIDE_IN_UP,
|
|
69
|
-
AnimationPreset.SLIDE_IN_DOWN,
|
|
70
|
-
AnimationPreset.SLIDE_IN_LEFT,
|
|
71
|
-
AnimationPreset.SLIDE_IN_RIGHT,
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
slidePresets.forEach(preset => {
|
|
75
|
-
const config = SpringAnimationConfigService.getSpringConfig(preset);
|
|
76
|
-
|
|
77
|
-
expect(config).toEqual({
|
|
78
|
-
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
79
|
-
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should handle all animation presets', () => {
|
|
85
|
-
const presets = Object.values(AnimationPreset);
|
|
86
|
-
|
|
87
|
-
presets.forEach(preset => {
|
|
88
|
-
const config = SpringAnimationConfigService.getSpringConfig(preset);
|
|
89
|
-
|
|
90
|
-
expect(config).toBeDefined();
|
|
91
|
-
expect(config).toHaveProperty('damping');
|
|
92
|
-
expect(config).toHaveProperty('stiffness');
|
|
93
|
-
expect(typeof config.damping).toBe('number');
|
|
94
|
-
expect(typeof config.stiffness).toBe('number');
|
|
95
|
-
expect(config.damping).toBeGreaterThan(0);
|
|
96
|
-
expect(config.stiffness).toBeGreaterThan(0);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('should have appropriate values for different animation types', () => {
|
|
101
|
-
const bounceConfig = SpringAnimationConfigService.getSpringConfig(AnimationPreset.BOUNCE);
|
|
102
|
-
const shakeConfig = SpringAnimationConfigService.getSpringConfig(AnimationPreset.SHAKE);
|
|
103
|
-
const scaleConfig = SpringAnimationConfigService.getSpringConfig(AnimationPreset.SCALE_IN);
|
|
104
|
-
|
|
105
|
-
// Bounce should be more bouncy (lower damping, moderate stiffness)
|
|
106
|
-
expect(bounceConfig.damping).toBeLessThan(scaleConfig.damping);
|
|
107
|
-
expect(bounceConfig.stiffness).toBeLessThan(scaleConfig.stiffness);
|
|
108
|
-
|
|
109
|
-
// Shake should be quick and responsive (higher damping and stiffness)
|
|
110
|
-
expect(shakeConfig.damping).toBeGreaterThan(bounceConfig.damping);
|
|
111
|
-
expect(shakeConfig.stiffness).toBeGreaterThan(scaleConfig.stiffness);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TimingAnimationConfigService Tests
|
|
3
|
-
*
|
|
4
|
-
* Unit tests for timing animation configuration service.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { TimingAnimationConfigService } from '../TimingAnimationConfigService';
|
|
8
|
-
import { AnimationPreset, ANIMATION_CONSTANTS } from '../../../domain/entities/Animation';
|
|
9
|
-
|
|
10
|
-
describe('TimingAnimationConfigService', () => {
|
|
11
|
-
describe('getTimingConfig', () => {
|
|
12
|
-
it('should return config for FADE_IN preset', () => {
|
|
13
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.FADE_IN);
|
|
14
|
-
|
|
15
|
-
expect(config).toEqual({
|
|
16
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should return config for FADE_OUT preset', () => {
|
|
21
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.FADE_OUT);
|
|
22
|
-
|
|
23
|
-
expect(config).toEqual({
|
|
24
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should return config for SLIDE_IN_UP preset', () => {
|
|
29
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SLIDE_IN_UP);
|
|
30
|
-
|
|
31
|
-
expect(config).toEqual({
|
|
32
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should return config for SLIDE_IN_DOWN preset', () => {
|
|
37
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SLIDE_IN_DOWN);
|
|
38
|
-
|
|
39
|
-
expect(config).toEqual({
|
|
40
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should return config for SLIDE_IN_LEFT preset', () => {
|
|
45
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SLIDE_IN_LEFT);
|
|
46
|
-
|
|
47
|
-
expect(config).toEqual({
|
|
48
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should return config for SLIDE_IN_RIGHT preset', () => {
|
|
53
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SLIDE_IN_RIGHT);
|
|
54
|
-
|
|
55
|
-
expect(config).toEqual({
|
|
56
|
-
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should return config for SCALE_IN preset', () => {
|
|
61
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SCALE_IN);
|
|
62
|
-
|
|
63
|
-
expect(config).toEqual({
|
|
64
|
-
duration: ANIMATION_CONSTANTS.DURATION.FAST,
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should return config for SCALE_OUT preset', () => {
|
|
69
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SCALE_OUT);
|
|
70
|
-
|
|
71
|
-
expect(config).toEqual({
|
|
72
|
-
duration: ANIMATION_CONSTANTS.DURATION.FAST,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should return config for BOUNCE preset', () => {
|
|
77
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.BOUNCE);
|
|
78
|
-
|
|
79
|
-
expect(config).toEqual({
|
|
80
|
-
duration: ANIMATION_CONSTANTS.DURATION.SLOW,
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should return config for SHAKE preset', () => {
|
|
85
|
-
const config = TimingAnimationConfigService.getTimingConfig(AnimationPreset.SHAKE);
|
|
86
|
-
|
|
87
|
-
expect(config).toEqual({
|
|
88
|
-
duration: ANIMATION_CONSTANTS.DURATION.FAST,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should handle all animation presets', () => {
|
|
93
|
-
const presets = Object.values(AnimationPreset);
|
|
94
|
-
|
|
95
|
-
presets.forEach(preset => {
|
|
96
|
-
const config = TimingAnimationConfigService.getTimingConfig(preset);
|
|
97
|
-
|
|
98
|
-
expect(config).toBeDefined();
|
|
99
|
-
expect(config).toHaveProperty('duration');
|
|
100
|
-
expect(typeof config.duration).toBe('number');
|
|
101
|
-
expect(config.duration).toBeGreaterThan(0);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|