@hua-labs/motion-core 2.2.2 → 2.3.0
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/README.md +28 -111
- package/dist/index.d.mts +669 -131
- package/dist/index.mjs +2307 -712
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/dist/index.d.ts +0 -1089
- package/dist/index.js +0 -4248
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
DELETED
|
@@ -1,1089 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, RefObject } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* HUA Motion Core - 의존성 제로 모션 엔진
|
|
6
|
-
*
|
|
7
|
-
* 순수 JavaScript로 구현된 고성능 모션 엔진
|
|
8
|
-
* GPU 가속, 레이어 분리, 성능 최적화 포함
|
|
9
|
-
*/
|
|
10
|
-
interface MotionFrame {
|
|
11
|
-
progress: number;
|
|
12
|
-
properties: {
|
|
13
|
-
opacity?: number;
|
|
14
|
-
transform?: string;
|
|
15
|
-
scale?: number;
|
|
16
|
-
translateX?: number;
|
|
17
|
-
translateY?: number;
|
|
18
|
-
rotate?: number;
|
|
19
|
-
rotateX?: number;
|
|
20
|
-
rotateY?: number;
|
|
21
|
-
rotateZ?: number;
|
|
22
|
-
skewX?: number;
|
|
23
|
-
skewY?: number;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
interface MotionOptions {
|
|
27
|
-
duration: number;
|
|
28
|
-
easing: (t: number) => number;
|
|
29
|
-
delay?: number;
|
|
30
|
-
direction?: 'forward' | 'reverse' | 'alternate';
|
|
31
|
-
iterations?: number;
|
|
32
|
-
fill?: 'none' | 'forwards' | 'backwards' | 'both';
|
|
33
|
-
onStart?: () => void;
|
|
34
|
-
onUpdate?: (progress: number) => void;
|
|
35
|
-
onComplete?: () => void;
|
|
36
|
-
onCancel?: () => void;
|
|
37
|
-
}
|
|
38
|
-
interface Motion {
|
|
39
|
-
id: string;
|
|
40
|
-
element: HTMLElement;
|
|
41
|
-
isRunning: boolean;
|
|
42
|
-
isPaused: boolean;
|
|
43
|
-
currentProgress: number;
|
|
44
|
-
startTime: number;
|
|
45
|
-
pauseTime: number;
|
|
46
|
-
options: MotionOptions;
|
|
47
|
-
}
|
|
48
|
-
declare class MotionEngine {
|
|
49
|
-
private motions;
|
|
50
|
-
private isRunning;
|
|
51
|
-
private animationFrameId;
|
|
52
|
-
/**
|
|
53
|
-
* 모션 시작
|
|
54
|
-
*/
|
|
55
|
-
motion(element: HTMLElement, motionFrames: MotionFrame[], options: MotionOptions): Promise<string>;
|
|
56
|
-
/**
|
|
57
|
-
* 모션 중지
|
|
58
|
-
*/
|
|
59
|
-
stop(motionId: string): void;
|
|
60
|
-
/**
|
|
61
|
-
* 모션 일시정지
|
|
62
|
-
*/
|
|
63
|
-
pause(motionId: string): void;
|
|
64
|
-
/**
|
|
65
|
-
* 모션 재개
|
|
66
|
-
*/
|
|
67
|
-
resume(motionId: string): void;
|
|
68
|
-
/**
|
|
69
|
-
* 모든 모션 중지
|
|
70
|
-
*/
|
|
71
|
-
stopAll(): void;
|
|
72
|
-
/**
|
|
73
|
-
* 모션 상태 확인
|
|
74
|
-
*/
|
|
75
|
-
getMotion(motionId: string): Motion | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* 실행 중인 모션 수
|
|
78
|
-
*/
|
|
79
|
-
getActiveMotionCount(): number;
|
|
80
|
-
/**
|
|
81
|
-
* 애니메이션 루프 시작
|
|
82
|
-
*/
|
|
83
|
-
private startAnimationLoop;
|
|
84
|
-
/**
|
|
85
|
-
* 애니메이션 루프 중지
|
|
86
|
-
*/
|
|
87
|
-
private stopAnimationLoop;
|
|
88
|
-
/**
|
|
89
|
-
* 메인 애니메이션 루프
|
|
90
|
-
*/
|
|
91
|
-
private animate;
|
|
92
|
-
/**
|
|
93
|
-
* 모션 프레임 적용
|
|
94
|
-
*/
|
|
95
|
-
private applyMotionFrame;
|
|
96
|
-
/**
|
|
97
|
-
* GPU 가속 활성화
|
|
98
|
-
*/
|
|
99
|
-
private enableGPUAcceleration;
|
|
100
|
-
/**
|
|
101
|
-
* 레이어 분리
|
|
102
|
-
*/
|
|
103
|
-
private createLayer;
|
|
104
|
-
/**
|
|
105
|
-
* 고유 모션 ID 생성
|
|
106
|
-
*/
|
|
107
|
-
private generateMotionId;
|
|
108
|
-
/**
|
|
109
|
-
* 정리
|
|
110
|
-
*/
|
|
111
|
-
destroy(): void;
|
|
112
|
-
}
|
|
113
|
-
declare const motionEngine: MotionEngine;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* HUA Motion Core - 전환 효과 시스템
|
|
117
|
-
*
|
|
118
|
-
* CSS Motion API를 활용한 고성능 전환 효과들
|
|
119
|
-
* GPU 가속 및 레이어 분리 최적화 포함
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
type TransitionType = 'fade' | 'slide' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'scale' | 'flip' | 'morph' | 'cube' | 'zoom';
|
|
123
|
-
interface TransitionOptions extends Omit<MotionOptions, 'easing'> {
|
|
124
|
-
type: TransitionType;
|
|
125
|
-
easing?: (t: number) => number;
|
|
126
|
-
distance?: number;
|
|
127
|
-
scale?: number;
|
|
128
|
-
perspective?: number;
|
|
129
|
-
onTransitionStart?: () => void;
|
|
130
|
-
onTransitionComplete?: () => void;
|
|
131
|
-
}
|
|
132
|
-
declare class TransitionEffects {
|
|
133
|
-
private static instance;
|
|
134
|
-
private activeTransitions;
|
|
135
|
-
static getInstance(): TransitionEffects;
|
|
136
|
-
/**
|
|
137
|
-
* 페이드 인/아웃 전환
|
|
138
|
-
*/
|
|
139
|
-
fade(element: HTMLElement, options: Omit<TransitionOptions, 'type'>): Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* 슬라이드 전환
|
|
142
|
-
*/
|
|
143
|
-
slide(element: HTMLElement, options: Omit<TransitionOptions, 'type'>): Promise<void>;
|
|
144
|
-
/**
|
|
145
|
-
* 스케일 전환
|
|
146
|
-
*/
|
|
147
|
-
scale(element: HTMLElement, options: Omit<TransitionOptions, 'type'>): Promise<void>;
|
|
148
|
-
/**
|
|
149
|
-
* 플립 전환 (3D 회전)
|
|
150
|
-
*/
|
|
151
|
-
flip(element: HTMLElement, options: Omit<TransitionOptions, 'type'>): Promise<void>;
|
|
152
|
-
/**
|
|
153
|
-
* 큐브 전환 (3D 큐브 회전)
|
|
154
|
-
*/
|
|
155
|
-
cube(element: HTMLElement, options: Omit<TransitionOptions, 'type'>): Promise<void>;
|
|
156
|
-
/**
|
|
157
|
-
* 모프 전환 (복합 변형)
|
|
158
|
-
*/
|
|
159
|
-
morph(element: HTMLElement, options: Omit<TransitionOptions, 'type'>): Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* 전환 중지
|
|
162
|
-
*/
|
|
163
|
-
stopTransition(transitionId: string): void;
|
|
164
|
-
/**
|
|
165
|
-
* 모든 전환 중지
|
|
166
|
-
*/
|
|
167
|
-
stopAllTransitions(): void;
|
|
168
|
-
/**
|
|
169
|
-
* 활성 전환 수 확인
|
|
170
|
-
*/
|
|
171
|
-
getActiveTransitionCount(): number;
|
|
172
|
-
/**
|
|
173
|
-
* GPU 가속 활성화
|
|
174
|
-
*/
|
|
175
|
-
private enableGPUAcceleration;
|
|
176
|
-
/**
|
|
177
|
-
* 기본 이징 함수
|
|
178
|
-
*/
|
|
179
|
-
private getDefaultEasing;
|
|
180
|
-
/**
|
|
181
|
-
* 고유 전환 ID 생성
|
|
182
|
-
*/
|
|
183
|
-
private generateTransitionId;
|
|
184
|
-
/**
|
|
185
|
-
* 정리
|
|
186
|
-
*/
|
|
187
|
-
destroy(): void;
|
|
188
|
-
}
|
|
189
|
-
declare const transitionEffects: TransitionEffects;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* HUA Motion Core - 성능 최적화 시스템
|
|
193
|
-
*
|
|
194
|
-
* GPU 가속, 레이어 관리, 메모리 최적화를 위한 유틸리티들
|
|
195
|
-
* 브라우저별 최적화 전략 포함
|
|
196
|
-
*/
|
|
197
|
-
interface PerformanceOptimizerMetrics {
|
|
198
|
-
fps: number;
|
|
199
|
-
memoryUsage?: number;
|
|
200
|
-
gpuTime?: number;
|
|
201
|
-
cpuTime?: number;
|
|
202
|
-
layerCount: number;
|
|
203
|
-
activeMotions: number;
|
|
204
|
-
}
|
|
205
|
-
interface OptimizationConfig {
|
|
206
|
-
enableGPUAcceleration: boolean;
|
|
207
|
-
enableLayerSeparation: boolean;
|
|
208
|
-
enableMemoryOptimization: boolean;
|
|
209
|
-
targetFPS: number;
|
|
210
|
-
maxLayerCount: number;
|
|
211
|
-
memoryThreshold: number;
|
|
212
|
-
}
|
|
213
|
-
declare class PerformanceOptimizer {
|
|
214
|
-
private static instance;
|
|
215
|
-
private config;
|
|
216
|
-
private performanceObserver;
|
|
217
|
-
private metrics;
|
|
218
|
-
private layerRegistry;
|
|
219
|
-
private isMonitoring;
|
|
220
|
-
constructor();
|
|
221
|
-
static getInstance(): PerformanceOptimizer;
|
|
222
|
-
/**
|
|
223
|
-
* 성능 모니터링 초기화
|
|
224
|
-
*/
|
|
225
|
-
private initializePerformanceMonitoring;
|
|
226
|
-
/**
|
|
227
|
-
* 성능 메트릭 업데이트
|
|
228
|
-
*/
|
|
229
|
-
private updatePerformanceMetrics;
|
|
230
|
-
/**
|
|
231
|
-
* FPS 계산
|
|
232
|
-
*/
|
|
233
|
-
private calculateFPS;
|
|
234
|
-
/**
|
|
235
|
-
* GPU 가속 활성화
|
|
236
|
-
*/
|
|
237
|
-
enableGPUAcceleration(element: HTMLElement): void;
|
|
238
|
-
/**
|
|
239
|
-
* 레이어 분리 및 최적화
|
|
240
|
-
*/
|
|
241
|
-
createOptimizedLayer(element: HTMLElement): void;
|
|
242
|
-
/**
|
|
243
|
-
* 레이어 등록
|
|
244
|
-
*/
|
|
245
|
-
private registerLayer;
|
|
246
|
-
/**
|
|
247
|
-
* 레이어 제거
|
|
248
|
-
*/
|
|
249
|
-
removeLayer(element: HTMLElement): void;
|
|
250
|
-
/**
|
|
251
|
-
* 레이어 수 제한 체크
|
|
252
|
-
*/
|
|
253
|
-
private checkLayerLimit;
|
|
254
|
-
/**
|
|
255
|
-
* 오래된 레이어 정리
|
|
256
|
-
*/
|
|
257
|
-
private cleanupOldLayers;
|
|
258
|
-
/**
|
|
259
|
-
* 메모리 사용량 체크
|
|
260
|
-
*/
|
|
261
|
-
private checkMemoryUsage;
|
|
262
|
-
/**
|
|
263
|
-
* 메모리 정리
|
|
264
|
-
*/
|
|
265
|
-
private cleanupMemory;
|
|
266
|
-
/**
|
|
267
|
-
* 성능 최적화 설정 업데이트
|
|
268
|
-
*/
|
|
269
|
-
updateConfig(newConfig: Partial<OptimizationConfig>): void;
|
|
270
|
-
/**
|
|
271
|
-
* 모든 GPU 가속 비활성화
|
|
272
|
-
*/
|
|
273
|
-
private disableAllGPUAcceleration;
|
|
274
|
-
/**
|
|
275
|
-
* 모든 레이어 비활성화
|
|
276
|
-
*/
|
|
277
|
-
private disableAllLayers;
|
|
278
|
-
/**
|
|
279
|
-
* 성능 메트릭 가져오기
|
|
280
|
-
*/
|
|
281
|
-
getMetrics(): PerformanceOptimizerMetrics;
|
|
282
|
-
/**
|
|
283
|
-
* 성능 모니터링 시작
|
|
284
|
-
*/
|
|
285
|
-
startMonitoring(): void;
|
|
286
|
-
/**
|
|
287
|
-
* 성능 모니터링 중지
|
|
288
|
-
*/
|
|
289
|
-
stopMonitoring(): void;
|
|
290
|
-
/**
|
|
291
|
-
* 메트릭 업데이트
|
|
292
|
-
*/
|
|
293
|
-
private updateMetrics;
|
|
294
|
-
/**
|
|
295
|
-
* 성능 리포트 생성
|
|
296
|
-
*/
|
|
297
|
-
generateReport(): string;
|
|
298
|
-
/**
|
|
299
|
-
* 바이트 단위 포맷팅
|
|
300
|
-
*/
|
|
301
|
-
private formatBytes;
|
|
302
|
-
/**
|
|
303
|
-
* 성능 최적화 권장사항
|
|
304
|
-
*/
|
|
305
|
-
getOptimizationRecommendations(): string[];
|
|
306
|
-
/**
|
|
307
|
-
* 정리
|
|
308
|
-
*/
|
|
309
|
-
destroy(): void;
|
|
310
|
-
private lastFrameTime?;
|
|
311
|
-
private monitoringInterval?;
|
|
312
|
-
}
|
|
313
|
-
declare const performanceOptimizer: PerformanceOptimizer;
|
|
314
|
-
|
|
315
|
-
type MotionElement = HTMLDivElement | HTMLSpanElement | HTMLButtonElement | HTMLHeadingElement | HTMLParagraphElement | HTMLImageElement;
|
|
316
|
-
type MotionStyle = CSSProperties & {
|
|
317
|
-
'--motion-delay'?: string;
|
|
318
|
-
'--motion-duration'?: string;
|
|
319
|
-
'--motion-easing'?: string;
|
|
320
|
-
'--motion-progress'?: string;
|
|
321
|
-
};
|
|
322
|
-
interface BaseMotionOptions {
|
|
323
|
-
/** 모션 시작 지연 시간 (ms) */
|
|
324
|
-
delay?: number;
|
|
325
|
-
/** 모션 지속 시간 (ms) */
|
|
326
|
-
duration?: number;
|
|
327
|
-
/** Intersection Observer 임계값 (0-1) */
|
|
328
|
-
threshold?: number;
|
|
329
|
-
/** 한 번만 트리거할지 여부 */
|
|
330
|
-
triggerOnce?: boolean;
|
|
331
|
-
/** 이징 함수명 */
|
|
332
|
-
easing?: string;
|
|
333
|
-
/** 자동 시작 여부 */
|
|
334
|
-
autoStart?: boolean;
|
|
335
|
-
/** 모션 완료 시 콜백 */
|
|
336
|
-
onComplete?: () => void;
|
|
337
|
-
/** 모션 시작 시 콜백 */
|
|
338
|
-
onStart?: () => void;
|
|
339
|
-
/** 모션 중단 시 콜백 */
|
|
340
|
-
onStop?: () => void;
|
|
341
|
-
/** 모션 리셋 시 콜백 */
|
|
342
|
-
onReset?: () => void;
|
|
343
|
-
}
|
|
344
|
-
interface BaseMotionReturn<T extends MotionElement = HTMLDivElement> {
|
|
345
|
-
/** DOM 요소 참조 (React 19 호환) */
|
|
346
|
-
ref: React.RefObject<T | null>;
|
|
347
|
-
/** 요소가 화면에 보이는지 여부 */
|
|
348
|
-
isVisible: boolean;
|
|
349
|
-
/** 모션이 진행 중인지 여부 */
|
|
350
|
-
isAnimating: boolean;
|
|
351
|
-
/** 적용할 CSS 스타일 (React 19 호환) - useFadeIn 등에서는 항상 반환됨 */
|
|
352
|
-
style: MotionStyle;
|
|
353
|
-
/** 적용할 CSS 클래스명 */
|
|
354
|
-
className?: string;
|
|
355
|
-
/** 모션 진행률 (0-1) - useFadeIn 등에서는 항상 반환됨 */
|
|
356
|
-
progress: number;
|
|
357
|
-
/** 모션 시작 함수 - useFadeIn 등에서는 항상 반환됨 */
|
|
358
|
-
start: () => void;
|
|
359
|
-
/** 모션 리셋 함수 - useFadeIn 등에서는 항상 반환됨 */
|
|
360
|
-
reset: () => void;
|
|
361
|
-
/** 모션 중단 함수 - useFadeIn 등에서는 항상 반환됨 */
|
|
362
|
-
stop: () => void;
|
|
363
|
-
/** 모션 일시정지 함수 - 일부 훅에서만 제공 */
|
|
364
|
-
pause?: () => void;
|
|
365
|
-
/** 모션 재개 함수 - 일부 훅에서만 제공 */
|
|
366
|
-
resume?: () => void;
|
|
367
|
-
}
|
|
368
|
-
interface InteractionReturn<T extends MotionElement = HTMLDivElement> extends BaseMotionReturn<T> {
|
|
369
|
-
/** 가시성 토글 함수 */
|
|
370
|
-
toggle?: () => void;
|
|
371
|
-
/** 표시 함수 */
|
|
372
|
-
show?: () => void;
|
|
373
|
-
/** 숨김 함수 */
|
|
374
|
-
hide?: () => void;
|
|
375
|
-
}
|
|
376
|
-
interface FadeInOptions extends BaseMotionOptions {
|
|
377
|
-
/** 초기 투명도 */
|
|
378
|
-
initialOpacity?: number;
|
|
379
|
-
/** 목표 투명도 */
|
|
380
|
-
targetOpacity?: number;
|
|
381
|
-
}
|
|
382
|
-
interface SlideOptions extends BaseMotionOptions {
|
|
383
|
-
/** 슬라이드 방향 */
|
|
384
|
-
direction?: 'up' | 'down' | 'left' | 'right';
|
|
385
|
-
/** 슬라이드 거리 (px) */
|
|
386
|
-
distance?: number;
|
|
387
|
-
}
|
|
388
|
-
interface ScaleOptions extends BaseMotionOptions {
|
|
389
|
-
/** 초기 스케일 */
|
|
390
|
-
initialScale?: number;
|
|
391
|
-
/** 목표 스케일 */
|
|
392
|
-
targetScale?: number;
|
|
393
|
-
}
|
|
394
|
-
interface BounceOptions extends BaseMotionOptions {
|
|
395
|
-
/** 바운스 강도 */
|
|
396
|
-
intensity?: number;
|
|
397
|
-
/** 바운스 횟수 */
|
|
398
|
-
bounces?: number;
|
|
399
|
-
}
|
|
400
|
-
interface PulseOptions extends BaseMotionOptions {
|
|
401
|
-
/** 펄스 강도 */
|
|
402
|
-
intensity?: number;
|
|
403
|
-
/** 반복 횟수 (-1 = 무한) */
|
|
404
|
-
repeatCount?: number;
|
|
405
|
-
/** 반복 간격 (ms) */
|
|
406
|
-
repeatDelay?: number;
|
|
407
|
-
}
|
|
408
|
-
interface SpringOptions extends BaseMotionOptions {
|
|
409
|
-
/** 스프링 질량 */
|
|
410
|
-
mass?: number;
|
|
411
|
-
/** 스프링 강성 */
|
|
412
|
-
stiffness?: number;
|
|
413
|
-
/** 스프링 감쇠 */
|
|
414
|
-
damping?: number;
|
|
415
|
-
/** 정지 임계값 */
|
|
416
|
-
restDelta?: number;
|
|
417
|
-
/** 정지 속도 */
|
|
418
|
-
restSpeed?: number;
|
|
419
|
-
}
|
|
420
|
-
interface GestureOptions$1 extends BaseMotionOptions {
|
|
421
|
-
/** 호버 제스처 활성화 */
|
|
422
|
-
hover?: boolean;
|
|
423
|
-
/** 드래그 제스처 활성화 */
|
|
424
|
-
drag?: boolean;
|
|
425
|
-
/** 핀치 제스처 활성화 */
|
|
426
|
-
pinch?: boolean;
|
|
427
|
-
/** 스와이프 제스처 활성화 */
|
|
428
|
-
swipe?: boolean;
|
|
429
|
-
/** 틸트 제스처 활성화 */
|
|
430
|
-
tilt?: boolean;
|
|
431
|
-
}
|
|
432
|
-
type MotionDirection$1 = 'up' | 'down' | 'left' | 'right';
|
|
433
|
-
type MotionEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'bounce' | 'elastic';
|
|
434
|
-
type MotionTrigger = 'scroll' | 'click' | 'hover' | 'focus' | 'auto';
|
|
435
|
-
type MotionCallback = () => void;
|
|
436
|
-
type MotionProgressCallback = (progress: number) => void;
|
|
437
|
-
type MotionStateCallback<T extends MotionElement = HTMLDivElement> = (state: BaseMotionReturn<T>) => void;
|
|
438
|
-
interface PerformanceMetrics {
|
|
439
|
-
/** 모션 시작 시간 */
|
|
440
|
-
startTime: number;
|
|
441
|
-
/** 모션 종료 시간 */
|
|
442
|
-
endTime?: number;
|
|
443
|
-
/** 총 지속 시간 */
|
|
444
|
-
duration: number;
|
|
445
|
-
/** FPS */
|
|
446
|
-
fps: number;
|
|
447
|
-
/** 메모리 사용량 */
|
|
448
|
-
memoryUsage?: number;
|
|
449
|
-
}
|
|
450
|
-
interface MotionConfig {
|
|
451
|
-
/** 성능 모니터링 활성화 */
|
|
452
|
-
enablePerformanceMonitoring?: boolean;
|
|
453
|
-
/** 디버그 모드 활성화 */
|
|
454
|
-
debug?: boolean;
|
|
455
|
-
/** 로그 레벨 */
|
|
456
|
-
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
457
|
-
}
|
|
458
|
-
interface InViewOptions {
|
|
459
|
-
/** Intersection Observer 임계값 */
|
|
460
|
-
threshold?: number | number[];
|
|
461
|
-
/** 루트 마진 */
|
|
462
|
-
rootMargin?: string;
|
|
463
|
-
/** 한 번만 트리거할지 여부 */
|
|
464
|
-
triggerOnce?: boolean;
|
|
465
|
-
/** 초기 가시성 상태 */
|
|
466
|
-
initialInView?: boolean;
|
|
467
|
-
}
|
|
468
|
-
interface InViewReturn<T extends HTMLElement = HTMLDivElement> {
|
|
469
|
-
/** DOM 요소 참조 */
|
|
470
|
-
ref: RefObject<T | null>;
|
|
471
|
-
/** 요소가 화면에 보이는지 여부 */
|
|
472
|
-
inView: boolean;
|
|
473
|
-
/** IntersectionObserver 엔트리 */
|
|
474
|
-
entry: IntersectionObserverEntry | null;
|
|
475
|
-
}
|
|
476
|
-
interface MouseOptions {
|
|
477
|
-
/** 타겟 요소 참조 */
|
|
478
|
-
targetRef?: RefObject<HTMLElement | null>;
|
|
479
|
-
/** 스로틀 시간 (ms) */
|
|
480
|
-
throttle?: number;
|
|
481
|
-
}
|
|
482
|
-
interface MouseReturn {
|
|
483
|
-
/** 마우스 X 좌표 (viewport 기준) */
|
|
484
|
-
x: number;
|
|
485
|
-
/** 마우스 Y 좌표 (viewport 기준) */
|
|
486
|
-
y: number;
|
|
487
|
-
/** 요소 내 상대 X 좌표 (0-1) */
|
|
488
|
-
elementX: number;
|
|
489
|
-
/** 요소 내 상대 Y 좌표 (0-1) */
|
|
490
|
-
elementY: number;
|
|
491
|
-
/** 마우스가 타겟 위에 있는지 여부 */
|
|
492
|
-
isOver: boolean;
|
|
493
|
-
}
|
|
494
|
-
interface ReducedMotionReturn {
|
|
495
|
-
/** 사용자가 모션 감소를 선호하는지 여부 */
|
|
496
|
-
prefersReducedMotion: boolean;
|
|
497
|
-
}
|
|
498
|
-
interface WindowSizeOptions {
|
|
499
|
-
/** 디바운스 시간 (ms) */
|
|
500
|
-
debounce?: number;
|
|
501
|
-
/** 초기 너비 */
|
|
502
|
-
initialWidth?: number;
|
|
503
|
-
/** 초기 높이 */
|
|
504
|
-
initialHeight?: number;
|
|
505
|
-
}
|
|
506
|
-
interface WindowSizeReturn {
|
|
507
|
-
/** 윈도우 너비 */
|
|
508
|
-
width: number;
|
|
509
|
-
/** 윈도우 높이 */
|
|
510
|
-
height: number;
|
|
511
|
-
/** 마운트 여부 (SSR 대응) */
|
|
512
|
-
isMounted: boolean;
|
|
513
|
-
}
|
|
514
|
-
type ScrollRevealMotionType = 'fadeIn' | 'slideUp' | 'slideLeft' | 'slideRight' | 'scaleIn' | 'bounceIn';
|
|
515
|
-
interface ScrollRevealOptions extends BaseMotionOptions {
|
|
516
|
-
/** 루트 마진 */
|
|
517
|
-
rootMargin?: string;
|
|
518
|
-
/** 모션 타입 */
|
|
519
|
-
motionType?: ScrollRevealMotionType;
|
|
520
|
-
}
|
|
521
|
-
interface GradientOptions extends BaseMotionOptions {
|
|
522
|
-
/** 그라디언트 색상 배열 */
|
|
523
|
-
colors?: string[];
|
|
524
|
-
/** 그라디언트 방향 */
|
|
525
|
-
direction?: 'horizontal' | 'vertical' | 'diagonal';
|
|
526
|
-
/** 그라디언트 크기 (%) */
|
|
527
|
-
size?: number;
|
|
528
|
-
}
|
|
529
|
-
interface ToggleMotionOptions extends BaseMotionOptions {
|
|
530
|
-
}
|
|
531
|
-
interface RepeatOptions extends BaseMotionOptions {
|
|
532
|
-
/** 반복 효과 타입 */
|
|
533
|
-
type?: 'pulse' | 'bounce' | 'wave' | 'fade';
|
|
534
|
-
/** 효과 강도 */
|
|
535
|
-
intensity?: number;
|
|
536
|
-
}
|
|
537
|
-
interface HoverMotionOptions extends BaseMotionOptions {
|
|
538
|
-
/** 호버 시 스케일 */
|
|
539
|
-
hoverScale?: number;
|
|
540
|
-
/** 호버 시 Y 오프셋 (px) */
|
|
541
|
-
hoverY?: number;
|
|
542
|
-
/** 호버 시 투명도 */
|
|
543
|
-
hoverOpacity?: number;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
type PageType = 'home' | 'dashboard' | 'product' | 'blog';
|
|
547
|
-
type MotionType$1 = 'hero' | 'title' | 'button' | 'card' | 'text' | 'image';
|
|
548
|
-
type EntranceType = 'fadeIn' | 'slideUp' | 'slideLeft' | 'slideRight' | 'scaleIn' | 'bounceIn';
|
|
549
|
-
interface PageMotionElement {
|
|
550
|
-
type: MotionType$1;
|
|
551
|
-
entrance?: EntranceType;
|
|
552
|
-
hover?: boolean;
|
|
553
|
-
click?: boolean;
|
|
554
|
-
delay?: number;
|
|
555
|
-
duration?: number;
|
|
556
|
-
threshold?: number;
|
|
557
|
-
}
|
|
558
|
-
interface PageMotionsConfig {
|
|
559
|
-
[elementId: string]: PageMotionElement;
|
|
560
|
-
}
|
|
561
|
-
interface MotionState$1 {
|
|
562
|
-
internalVisibility: boolean;
|
|
563
|
-
triggeredVisibility: boolean;
|
|
564
|
-
finalVisibility: boolean;
|
|
565
|
-
opacity: number;
|
|
566
|
-
translateY: number;
|
|
567
|
-
translateX: number;
|
|
568
|
-
scale: number;
|
|
569
|
-
rotation: number;
|
|
570
|
-
isHovered: boolean;
|
|
571
|
-
isClicked: boolean;
|
|
572
|
-
isAnimating: boolean;
|
|
573
|
-
}
|
|
574
|
-
interface PageMotionRef<T extends HTMLElement = HTMLElement> {
|
|
575
|
-
ref: React.RefObject<T | null>;
|
|
576
|
-
style: React.CSSProperties;
|
|
577
|
-
isVisible: boolean;
|
|
578
|
-
isHovered: boolean;
|
|
579
|
-
isClicked: boolean;
|
|
580
|
-
}
|
|
581
|
-
interface MotionPreset {
|
|
582
|
-
entrance: EntranceType;
|
|
583
|
-
delay: number;
|
|
584
|
-
duration: number;
|
|
585
|
-
hover: boolean;
|
|
586
|
-
click: boolean;
|
|
587
|
-
}
|
|
588
|
-
interface PresetConfig {
|
|
589
|
-
[key: string]: MotionPreset;
|
|
590
|
-
}
|
|
591
|
-
interface SpringConfig {
|
|
592
|
-
mass?: number;
|
|
593
|
-
stiffness?: number;
|
|
594
|
-
damping?: number;
|
|
595
|
-
restDelta?: number;
|
|
596
|
-
restSpeed?: number;
|
|
597
|
-
}
|
|
598
|
-
interface GestureConfig {
|
|
599
|
-
hover?: boolean;
|
|
600
|
-
drag?: boolean;
|
|
601
|
-
pinch?: boolean;
|
|
602
|
-
swipe?: boolean;
|
|
603
|
-
tilt?: boolean;
|
|
604
|
-
}
|
|
605
|
-
interface OrchestrationConfig {
|
|
606
|
-
sequence?: 'sequential' | 'parallel' | 'stagger';
|
|
607
|
-
staggerDelay?: number;
|
|
608
|
-
staggerDuration?: number;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* 1단계 API: 프리셋 기반 페이지 모션 (기존 방식)
|
|
613
|
-
*
|
|
614
|
-
* 사용법:
|
|
615
|
-
* ```typescript
|
|
616
|
-
* const motions = useSimplePageMotion('home')
|
|
617
|
-
* ```
|
|
618
|
-
*
|
|
619
|
-
* 지원하는 페이지 타입:
|
|
620
|
-
* - 'home': 홈페이지
|
|
621
|
-
* - 'dashboard': 대시보드
|
|
622
|
-
* - 'product': 제품 페이지
|
|
623
|
-
* - 'blog': 블로그
|
|
624
|
-
*/
|
|
625
|
-
declare function useSimplePageMotion(pageType: PageType): Record<string, PageMotionRef<HTMLElement>>;
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* 2단계 API: 페이지 레벨 모션 관리 (상태 관리자 버전)
|
|
629
|
-
*
|
|
630
|
-
* 사용법:
|
|
631
|
-
* ```typescript
|
|
632
|
-
* const motions = usePageMotions({
|
|
633
|
-
* hero: { type: 'hero' },
|
|
634
|
-
* title: { type: 'title' },
|
|
635
|
-
* button: { type: 'button', hover: true, click: true }
|
|
636
|
-
* })
|
|
637
|
-
* ```
|
|
638
|
-
*/
|
|
639
|
-
declare function usePageMotions(config: PageMotionsConfig): {
|
|
640
|
-
reset: () => void;
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
type MotionType = 'fadeIn' | 'slideUp' | 'slideLeft' | 'slideRight' | 'scaleIn' | 'bounceIn';
|
|
644
|
-
type ElementType = 'hero' | 'title' | 'button' | 'card' | 'text' | 'image';
|
|
645
|
-
interface SmartMotionOptions {
|
|
646
|
-
type?: ElementType;
|
|
647
|
-
entrance?: MotionType;
|
|
648
|
-
hover?: boolean;
|
|
649
|
-
click?: boolean;
|
|
650
|
-
delay?: number;
|
|
651
|
-
duration?: number;
|
|
652
|
-
threshold?: number;
|
|
653
|
-
autoLanguageSync?: boolean;
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* 3단계 API: 개별 요소 모션
|
|
657
|
-
*
|
|
658
|
-
* 사용법:
|
|
659
|
-
* ```typescript
|
|
660
|
-
* const heroRef = useSmartMotion({ type: 'hero' })
|
|
661
|
-
* const titleRef = useSmartMotion({ type: 'title' })
|
|
662
|
-
* const buttonRef = useSmartMotion({ type: 'button' })
|
|
663
|
-
* ```
|
|
664
|
-
*/
|
|
665
|
-
declare function useSmartMotion<T extends HTMLElement = HTMLDivElement>(options?: SmartMotionOptions): {
|
|
666
|
-
ref: React.RefObject<T | null>;
|
|
667
|
-
style: React.CSSProperties;
|
|
668
|
-
isVisible: boolean;
|
|
669
|
-
isHovered: boolean;
|
|
670
|
-
isClicked: boolean;
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* @hua-labs/motion-core - useUnifiedMotion
|
|
675
|
-
*
|
|
676
|
-
* 통합 Motion Hook - 단일 타입으로 여러 모션 효과 중 하나를 선택
|
|
677
|
-
* 내부에서 선택된 type에 맞는 로직만 실행 (6개 훅 동시 호출 제거)
|
|
678
|
-
*/
|
|
679
|
-
|
|
680
|
-
interface UseUnifiedMotionOptions extends Omit<BaseMotionOptions, 'autoStart'> {
|
|
681
|
-
/** Motion type to use */
|
|
682
|
-
type: EntranceType;
|
|
683
|
-
/** Auto start animation @default true */
|
|
684
|
-
autoStart?: boolean;
|
|
685
|
-
/** Slide distance (px) for slide types @default 50 */
|
|
686
|
-
distance?: number;
|
|
687
|
-
}
|
|
688
|
-
declare function useUnifiedMotion<T extends MotionElement = HTMLDivElement>(options: UseUnifiedMotionOptions): BaseMotionReturn<T>;
|
|
689
|
-
|
|
690
|
-
declare function useFadeIn<T extends MotionElement = HTMLDivElement>(options?: FadeInOptions): BaseMotionReturn<T>;
|
|
691
|
-
|
|
692
|
-
declare function useSlideUp<T extends MotionElement = HTMLDivElement>(options?: SlideOptions): BaseMotionReturn<T>;
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* useSlideLeft - 오른쪽에서 왼쪽으로 슬라이드하며 나타나는 애니메이션 훅
|
|
696
|
-
*
|
|
697
|
-
* useSlideUp의 wrapper로, direction: 'left'를 기본값으로 사용합니다.
|
|
698
|
-
* IntersectionObserver를 통해 뷰포트 진입 시 자동으로 애니메이션이 시작됩니다.
|
|
699
|
-
*
|
|
700
|
-
* @example
|
|
701
|
-
* ```tsx
|
|
702
|
-
* const slideLeft = useSlideLeft({ duration: 700, distance: 50 });
|
|
703
|
-
*
|
|
704
|
-
* return (
|
|
705
|
-
* <div ref={slideLeft.ref} style={slideLeft.style}>
|
|
706
|
-
* Content slides in from right
|
|
707
|
-
* </div>
|
|
708
|
-
* );
|
|
709
|
-
* ```
|
|
710
|
-
*/
|
|
711
|
-
declare function useSlideLeft<T extends MotionElement = HTMLDivElement>(options?: Omit<SlideOptions, 'direction'>): BaseMotionReturn<T>;
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* useSlideRight - 왼쪽에서 오른쪽으로 슬라이드하며 나타나는 애니메이션 훅
|
|
715
|
-
*
|
|
716
|
-
* useSlideUp의 wrapper로, direction: 'right'를 기본값으로 사용합니다.
|
|
717
|
-
* IntersectionObserver를 통해 뷰포트 진입 시 자동으로 애니메이션이 시작됩니다.
|
|
718
|
-
*
|
|
719
|
-
* @example
|
|
720
|
-
* ```tsx
|
|
721
|
-
* const slideRight = useSlideRight({ duration: 700, distance: 50 });
|
|
722
|
-
*
|
|
723
|
-
* return (
|
|
724
|
-
* <div ref={slideRight.ref} style={slideRight.style}>
|
|
725
|
-
* Content slides in from left
|
|
726
|
-
* </div>
|
|
727
|
-
* );
|
|
728
|
-
* ```
|
|
729
|
-
*/
|
|
730
|
-
declare function useSlideRight<T extends MotionElement = HTMLDivElement>(options?: Omit<SlideOptions, 'direction'>): BaseMotionReturn<T>;
|
|
731
|
-
|
|
732
|
-
declare function useScaleIn<T extends MotionElement = HTMLDivElement>(options?: ScaleOptions): BaseMotionReturn<T>;
|
|
733
|
-
|
|
734
|
-
declare function useBounceIn<T extends MotionElement = HTMLDivElement>(options?: BounceOptions): BaseMotionReturn<T>;
|
|
735
|
-
|
|
736
|
-
declare function usePulse<T extends MotionElement = HTMLDivElement>(options?: PulseOptions): BaseMotionReturn<T>;
|
|
737
|
-
|
|
738
|
-
interface SpringMotionOptions extends SpringOptions {
|
|
739
|
-
/** 시작 값 */
|
|
740
|
-
from: number;
|
|
741
|
-
/** 목표 값 */
|
|
742
|
-
to: number;
|
|
743
|
-
/** 활성화 여부 */
|
|
744
|
-
enabled?: boolean;
|
|
745
|
-
}
|
|
746
|
-
declare function useSpringMotion<T extends MotionElement = HTMLDivElement>(options: SpringMotionOptions): BaseMotionReturn<T> & {
|
|
747
|
-
value: number;
|
|
748
|
-
velocity: number;
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
declare function useGradient<T extends MotionElement = HTMLDivElement>(options?: GradientOptions): BaseMotionReturn<T>;
|
|
752
|
-
|
|
753
|
-
declare function useHoverMotion<T extends MotionElement = HTMLDivElement>(options?: HoverMotionOptions): BaseMotionReturn<T> & {
|
|
754
|
-
isHovered: boolean;
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
interface ClickToggleOptions {
|
|
758
|
-
initialState?: boolean;
|
|
759
|
-
toggleOnClick?: boolean;
|
|
760
|
-
toggleOnDoubleClick?: boolean;
|
|
761
|
-
toggleOnRightClick?: boolean;
|
|
762
|
-
toggleOnEnter?: boolean;
|
|
763
|
-
toggleOnSpace?: boolean;
|
|
764
|
-
autoReset?: boolean;
|
|
765
|
-
resetDelay?: number;
|
|
766
|
-
preventDefault?: boolean;
|
|
767
|
-
stopPropagation?: boolean;
|
|
768
|
-
showOnMount?: boolean;
|
|
769
|
-
}
|
|
770
|
-
interface ClickToggleReturn {
|
|
771
|
-
isActive: boolean;
|
|
772
|
-
mounted: boolean;
|
|
773
|
-
toggle: () => void;
|
|
774
|
-
activate: () => void;
|
|
775
|
-
deactivate: () => void;
|
|
776
|
-
reset: () => void;
|
|
777
|
-
clickHandlers: {
|
|
778
|
-
onClick?: (event: React.MouseEvent) => void;
|
|
779
|
-
onDoubleClick?: (event: React.MouseEvent) => void;
|
|
780
|
-
onContextMenu?: (event: React.MouseEvent) => void;
|
|
781
|
-
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
declare function useClickToggle(options?: ClickToggleOptions): ClickToggleReturn;
|
|
785
|
-
|
|
786
|
-
interface FocusToggleOptions {
|
|
787
|
-
initialState?: boolean;
|
|
788
|
-
toggleOnFocus?: boolean;
|
|
789
|
-
toggleOnBlur?: boolean;
|
|
790
|
-
toggleOnFocusIn?: boolean;
|
|
791
|
-
toggleOnFocusOut?: boolean;
|
|
792
|
-
autoReset?: boolean;
|
|
793
|
-
resetDelay?: number;
|
|
794
|
-
preventDefault?: boolean;
|
|
795
|
-
stopPropagation?: boolean;
|
|
796
|
-
showOnMount?: boolean;
|
|
797
|
-
}
|
|
798
|
-
interface FocusToggleReturn {
|
|
799
|
-
isActive: boolean;
|
|
800
|
-
mounted: boolean;
|
|
801
|
-
toggle: () => void;
|
|
802
|
-
activate: () => void;
|
|
803
|
-
deactivate: () => void;
|
|
804
|
-
reset: () => void;
|
|
805
|
-
focusHandlers: {
|
|
806
|
-
onFocus?: (event: React.FocusEvent) => void;
|
|
807
|
-
onBlur?: (event: React.FocusEvent) => void;
|
|
808
|
-
onFocusIn?: (event: React.FocusEvent) => void;
|
|
809
|
-
onFocusOut?: (event: React.FocusEvent) => void;
|
|
810
|
-
};
|
|
811
|
-
ref: React.RefObject<HTMLElement | null>;
|
|
812
|
-
}
|
|
813
|
-
declare function useFocusToggle(options?: FocusToggleOptions): FocusToggleReturn;
|
|
814
|
-
|
|
815
|
-
declare function useScrollReveal<T extends MotionElement = HTMLDivElement>(options?: ScrollRevealOptions): BaseMotionReturn<T>;
|
|
816
|
-
|
|
817
|
-
interface ScrollProgressOptions {
|
|
818
|
-
target?: number;
|
|
819
|
-
offset?: number;
|
|
820
|
-
showOnMount?: boolean;
|
|
821
|
-
}
|
|
822
|
-
declare function useScrollProgress(options?: ScrollProgressOptions): {
|
|
823
|
-
progress: number;
|
|
824
|
-
mounted: boolean;
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
type MotionState = 'idle' | 'playing' | 'paused' | 'completed' | 'error';
|
|
828
|
-
type MotionDirection = 'forward' | 'reverse' | 'alternate';
|
|
829
|
-
interface MotionStateOptions {
|
|
830
|
-
initialState?: MotionState;
|
|
831
|
-
autoStart?: boolean;
|
|
832
|
-
loop?: boolean;
|
|
833
|
-
direction?: MotionDirection;
|
|
834
|
-
duration?: number;
|
|
835
|
-
delay?: number;
|
|
836
|
-
showOnMount?: boolean;
|
|
837
|
-
}
|
|
838
|
-
interface MotionStateReturn {
|
|
839
|
-
state: MotionState;
|
|
840
|
-
direction: MotionDirection;
|
|
841
|
-
progress: number;
|
|
842
|
-
elapsed: number;
|
|
843
|
-
remaining: number;
|
|
844
|
-
mounted: boolean;
|
|
845
|
-
play: () => void;
|
|
846
|
-
pause: () => void;
|
|
847
|
-
stop: () => void;
|
|
848
|
-
reset: () => void;
|
|
849
|
-
reverse: () => void;
|
|
850
|
-
seek: (progress: number) => void;
|
|
851
|
-
setState: (newState: MotionState) => void;
|
|
852
|
-
}
|
|
853
|
-
declare function useMotionState(options?: MotionStateOptions): MotionStateReturn;
|
|
854
|
-
|
|
855
|
-
declare function useRepeat<T extends MotionElement = HTMLDivElement>(options?: RepeatOptions): BaseMotionReturn<T> & {
|
|
856
|
-
isAnimating: boolean;
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
declare function useToggleMotion<T extends MotionElement = HTMLDivElement>(options?: ToggleMotionOptions): InteractionReturn<T>;
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* useSlideDown - 아래에서 위로 슬라이드하며 나타나는 애니메이션 훅
|
|
863
|
-
*
|
|
864
|
-
* useSlideUp의 wrapper로, direction: 'down'을 기본값으로 사용합니다.
|
|
865
|
-
* IntersectionObserver를 통해 뷰포트 진입 시 자동으로 애니메이션이 시작됩니다.
|
|
866
|
-
*
|
|
867
|
-
* @example
|
|
868
|
-
* ```tsx
|
|
869
|
-
* const slideDown = useSlideDown({ duration: 700, distance: 50 });
|
|
870
|
-
*
|
|
871
|
-
* return (
|
|
872
|
-
* <div ref={slideDown.ref} style={slideDown.style}>
|
|
873
|
-
* Content slides down into view
|
|
874
|
-
* </div>
|
|
875
|
-
* );
|
|
876
|
-
* ```
|
|
877
|
-
*/
|
|
878
|
-
declare function useSlideDown<T extends MotionElement = HTMLDivElement>(options?: Omit<SlideOptions, 'direction'>): BaseMotionReturn<T>;
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* useInView - 요소의 뷰포트 가시성 감지 훅
|
|
882
|
-
* Viewport visibility detection hook
|
|
883
|
-
*
|
|
884
|
-
* @description
|
|
885
|
-
* Intersection Observer를 사용하여 요소가 뷰포트에 보이는지 감지.
|
|
886
|
-
* 스크롤 애니메이션, 레이지 로딩 등에 활용.
|
|
887
|
-
* Detects whether an element is visible in the viewport using Intersection Observer.
|
|
888
|
-
* Useful for scroll animations, lazy loading, etc.
|
|
889
|
-
*
|
|
890
|
-
* @example
|
|
891
|
-
* ```tsx
|
|
892
|
-
* const { ref, inView } = useInView({ threshold: 0.5, triggerOnce: true })
|
|
893
|
-
*
|
|
894
|
-
* return (
|
|
895
|
-
* <div ref={ref} style={{ opacity: inView ? 1 : 0 }}>
|
|
896
|
-
* {inView ? 'Visible!' : 'Not visible'}
|
|
897
|
-
* </div>
|
|
898
|
-
* )
|
|
899
|
-
* ```
|
|
900
|
-
*/
|
|
901
|
-
declare function useInView<T extends HTMLElement = HTMLDivElement>(options?: InViewOptions): InViewReturn<T>;
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* useMouse - 마우스 위치 추적 훅
|
|
905
|
-
* Mouse position tracking hook
|
|
906
|
-
*
|
|
907
|
-
* @description
|
|
908
|
-
* 마우스 위치를 실시간으로 추적. 커서 따라다니는 효과,
|
|
909
|
-
* 마우스 기반 인터랙션 등에 활용.
|
|
910
|
-
* Tracks mouse position in real-time. Useful for cursor-following effects
|
|
911
|
-
* and mouse-based interactions.
|
|
912
|
-
*
|
|
913
|
-
* @example
|
|
914
|
-
* ```tsx
|
|
915
|
-
* const { x, y, elementX, elementY } = useMouse()
|
|
916
|
-
*
|
|
917
|
-
* return (
|
|
918
|
-
* <div style={{
|
|
919
|
-
* '--mouse-x': elementX,
|
|
920
|
-
* '--mouse-y': elementY
|
|
921
|
-
* }}>
|
|
922
|
-
* Mouse: {x}, {y}
|
|
923
|
-
* </div>
|
|
924
|
-
* )
|
|
925
|
-
* ```
|
|
926
|
-
*/
|
|
927
|
-
declare function useMouse(options?: MouseOptions): MouseReturn;
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* useReducedMotion - 모션 감소 설정 감지 훅
|
|
931
|
-
* Reduced motion preference detection hook
|
|
932
|
-
*
|
|
933
|
-
* @description
|
|
934
|
-
* 사용자의 prefers-reduced-motion 설정을 감지.
|
|
935
|
-
* 접근성을 위해 모션을 줄이거나 비활성화할 때 사용.
|
|
936
|
-
* Detects user's prefers-reduced-motion setting.
|
|
937
|
-
* Used to reduce or disable motion for accessibility.
|
|
938
|
-
*
|
|
939
|
-
* @example
|
|
940
|
-
* ```tsx
|
|
941
|
-
* const { prefersReducedMotion } = useReducedMotion()
|
|
942
|
-
*
|
|
943
|
-
* return (
|
|
944
|
-
* <motion.div
|
|
945
|
-
* animate={prefersReducedMotion ? {} : { scale: [1, 1.1, 1] }}
|
|
946
|
-
* transition={{ duration: prefersReducedMotion ? 0 : 0.3 }}
|
|
947
|
-
* >
|
|
948
|
-
* Accessible Motion
|
|
949
|
-
* </motion.div>
|
|
950
|
-
* )
|
|
951
|
-
* ```
|
|
952
|
-
*/
|
|
953
|
-
declare function useReducedMotion(): ReducedMotionReturn;
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* useWindowSize - 윈도우 크기 추적 훅
|
|
957
|
-
* Window size tracking hook
|
|
958
|
-
*
|
|
959
|
-
* @description
|
|
960
|
-
* 브라우저 윈도우 크기 변경을 감지.
|
|
961
|
-
* 반응형 레이아웃, 리사이즈 기반 애니메이션 등에 활용.
|
|
962
|
-
* Detects browser window size changes.
|
|
963
|
-
* Useful for responsive layouts and resize-based animations.
|
|
964
|
-
*
|
|
965
|
-
* @example
|
|
966
|
-
* ```tsx
|
|
967
|
-
* const { width, height, isMounted } = useWindowSize({ debounce: 100 })
|
|
968
|
-
*
|
|
969
|
-
* return (
|
|
970
|
-
* <div>
|
|
971
|
-
* {isMounted ? `${width} x ${height}` : 'Loading...'}
|
|
972
|
-
* </div>
|
|
973
|
-
* )
|
|
974
|
-
* ```
|
|
975
|
-
*/
|
|
976
|
-
declare function useWindowSize(options?: WindowSizeOptions): WindowSizeReturn;
|
|
977
|
-
|
|
978
|
-
interface GestureOptions {
|
|
979
|
-
enabled?: boolean;
|
|
980
|
-
threshold?: number;
|
|
981
|
-
timeout?: number;
|
|
982
|
-
swipeThreshold?: number;
|
|
983
|
-
swipeVelocity?: number;
|
|
984
|
-
swipeDirections?: ('up' | 'down' | 'left' | 'right')[];
|
|
985
|
-
pinchThreshold?: number;
|
|
986
|
-
minScale?: number;
|
|
987
|
-
maxScale?: number;
|
|
988
|
-
rotateThreshold?: number;
|
|
989
|
-
panThreshold?: number;
|
|
990
|
-
onSwipe?: (direction: 'up' | 'down' | 'left' | 'right', distance: number, velocity: number) => void;
|
|
991
|
-
onPinch?: (scale: number, delta: number) => void;
|
|
992
|
-
onRotate?: (angle: number, delta: number) => void;
|
|
993
|
-
onPan?: (deltaX: number, deltaY: number, totalX: number, totalY: number) => void;
|
|
994
|
-
onTap?: (x: number, y: number) => void;
|
|
995
|
-
onDoubleTap?: (x: number, y: number) => void;
|
|
996
|
-
onLongPress?: (x: number, y: number) => void;
|
|
997
|
-
onStart?: (x: number, y: number) => void;
|
|
998
|
-
onMove?: (x: number, y: number) => void;
|
|
999
|
-
onEnd?: (x: number, y: number) => void;
|
|
1000
|
-
}
|
|
1001
|
-
interface GestureReturn {
|
|
1002
|
-
isActive: boolean;
|
|
1003
|
-
gesture: string | null;
|
|
1004
|
-
scale: number;
|
|
1005
|
-
rotation: number;
|
|
1006
|
-
deltaX: number;
|
|
1007
|
-
deltaY: number;
|
|
1008
|
-
distance: number;
|
|
1009
|
-
velocity: number;
|
|
1010
|
-
start: () => void;
|
|
1011
|
-
stop: () => void;
|
|
1012
|
-
reset: () => void;
|
|
1013
|
-
onTouchStart: (e: React.TouchEvent | TouchEvent) => void;
|
|
1014
|
-
onTouchMove: (e: React.TouchEvent | TouchEvent) => void;
|
|
1015
|
-
onTouchEnd: (e: React.TouchEvent | TouchEvent) => void;
|
|
1016
|
-
onMouseDown: (e: React.MouseEvent | MouseEvent) => void;
|
|
1017
|
-
onMouseMove: (e: React.MouseEvent | MouseEvent) => void;
|
|
1018
|
-
onMouseUp: (e: React.MouseEvent | MouseEvent) => void;
|
|
1019
|
-
}
|
|
1020
|
-
declare function useGesture(options?: GestureOptions): GestureReturn;
|
|
1021
|
-
|
|
1022
|
-
interface GestureMotionOptions {
|
|
1023
|
-
gestureType: 'hover' | 'drag' | 'pinch' | 'swipe' | 'tilt';
|
|
1024
|
-
duration?: number;
|
|
1025
|
-
easing?: string;
|
|
1026
|
-
sensitivity?: number;
|
|
1027
|
-
enabled?: boolean;
|
|
1028
|
-
onGestureStart?: () => void;
|
|
1029
|
-
onGestureEnd?: () => void;
|
|
1030
|
-
}
|
|
1031
|
-
interface GestureState {
|
|
1032
|
-
isActive: boolean;
|
|
1033
|
-
x: number;
|
|
1034
|
-
y: number;
|
|
1035
|
-
deltaX: number;
|
|
1036
|
-
deltaY: number;
|
|
1037
|
-
scale: number;
|
|
1038
|
-
rotation: number;
|
|
1039
|
-
}
|
|
1040
|
-
declare function useGestureMotion(options: GestureMotionOptions): {
|
|
1041
|
-
ref: react.RefObject<HTMLElement | null>;
|
|
1042
|
-
gestureState: GestureState;
|
|
1043
|
-
motionStyle: react.CSSProperties;
|
|
1044
|
-
isActive: boolean;
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
declare const MOTION_PRESETS: PresetConfig;
|
|
1048
|
-
declare const PAGE_MOTIONS: Record<PageType, PageMotionsConfig>;
|
|
1049
|
-
/**
|
|
1050
|
-
* 프리셋과 커스텀 설정을 병합
|
|
1051
|
-
*/
|
|
1052
|
-
declare function mergeWithPreset(preset: MotionPreset, custom?: Partial<MotionPreset>): MotionPreset;
|
|
1053
|
-
/**
|
|
1054
|
-
* 페이지 타입으로 프리셋 가져오기
|
|
1055
|
-
*/
|
|
1056
|
-
declare function getPagePreset(pageType: PageType): PageMotionsConfig;
|
|
1057
|
-
/**
|
|
1058
|
-
* 모션 타입으로 기본 프리셋 가져오기
|
|
1059
|
-
*/
|
|
1060
|
-
declare function getMotionPreset(type: string): MotionPreset;
|
|
1061
|
-
|
|
1062
|
-
type EasingFunction = (t: number) => number;
|
|
1063
|
-
declare const linear: EasingFunction;
|
|
1064
|
-
declare const easeIn: EasingFunction;
|
|
1065
|
-
declare const easeOut: EasingFunction;
|
|
1066
|
-
declare const easeInOut: EasingFunction;
|
|
1067
|
-
declare const easeInQuad: EasingFunction;
|
|
1068
|
-
declare const easeOutQuad: EasingFunction;
|
|
1069
|
-
declare const easeInOutQuad: EasingFunction;
|
|
1070
|
-
type EasingType = 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeInQuart' | 'easeOutQuart' | 'easeInOutQuart' | 'easeInQuint' | 'easeOutQuint' | 'easeInOutQuint' | 'easeInSine' | 'easeOutSine' | 'easeInOutSine' | 'easeInExpo' | 'easeOutExpo' | 'easeInOutExpo' | 'easeInCirc' | 'easeOutCirc' | 'easeInOutCirc' | 'easeInBounce' | 'easeOutBounce' | 'easeInOutBounce' | 'easeInBack' | 'easeOutBack' | 'easeInOutBack' | 'easeInElastic' | 'easeOutElastic' | 'easeInOutElastic' | 'pulse' | 'pulseSmooth' | 'skeletonWave' | 'blink';
|
|
1071
|
-
declare function isValidEasing(easingName: string): boolean;
|
|
1072
|
-
declare function getEasing(easingName: unknown): EasingFunction;
|
|
1073
|
-
declare function applyEasing(t: number, easingName: string | EasingFunction): number;
|
|
1074
|
-
declare function safeApplyEasing(t: number, easingName: unknown): number;
|
|
1075
|
-
declare function getAvailableEasings(): string[];
|
|
1076
|
-
declare function isEasingFunction(value: any): value is EasingFunction;
|
|
1077
|
-
declare const easingPresets: {
|
|
1078
|
-
readonly default: "easeOut";
|
|
1079
|
-
readonly smooth: "easeInOutCubic";
|
|
1080
|
-
readonly fast: "easeOutQuad";
|
|
1081
|
-
readonly slow: "easeInOutSine";
|
|
1082
|
-
readonly bouncy: "easeOutBounce";
|
|
1083
|
-
readonly elastic: "easeOutElastic";
|
|
1084
|
-
readonly fade: "easeInOut";
|
|
1085
|
-
readonly scale: "easeOutBack";
|
|
1086
|
-
};
|
|
1087
|
-
declare function getPresetEasing(preset: keyof typeof easingPresets): EasingFunction;
|
|
1088
|
-
|
|
1089
|
-
export { type BaseMotionOptions, type BaseMotionReturn, type BounceOptions, type EasingFunction, type EasingType, type EntranceType, type FadeInOptions, type GestureConfig, type GestureOptions$1 as GestureOptions, type GradientOptions, type HoverMotionOptions, type InViewOptions, type InViewReturn, type InteractionReturn, MOTION_PRESETS, type Motion, type MotionCallback, type MotionConfig, type MotionDirection$1 as MotionDirection, type MotionEasing, type MotionElement, MotionEngine, type MotionFrame, type MotionOptions, type MotionPreset, type MotionProgressCallback, type MotionState$1 as MotionState, type MotionStateCallback, type MotionTrigger, type MotionType$1 as MotionType, type MouseOptions, type MouseReturn, type OptimizationConfig, type OrchestrationConfig, PAGE_MOTIONS, type PageMotionElement, type PageMotionRef, type PageMotionsConfig, type PageType, type PerformanceMetrics, PerformanceOptimizer, type PerformanceOptimizerMetrics, type PresetConfig, type PulseOptions, type ReducedMotionReturn, type RepeatOptions, type ScaleOptions, type ScrollRevealMotionType, type ScrollRevealOptions, type SlideOptions, type SpringConfig, type SpringOptions, type ToggleMotionOptions, TransitionEffects, type TransitionOptions, type TransitionType, type UseUnifiedMotionOptions, type WindowSizeOptions, type WindowSizeReturn, applyEasing, easeIn, easeInOut, easeInOutQuad, easeInQuad, easeOut, easeOutQuad, easingPresets, getAvailableEasings, getEasing, getMotionPreset, getPagePreset, getPresetEasing, isEasingFunction, isValidEasing, linear, mergeWithPreset, motionEngine, performanceOptimizer, safeApplyEasing, transitionEffects, useBounceIn, useClickToggle, useFadeIn, useFocusToggle, useGesture, useGestureMotion, useGradient, useHoverMotion, useInView, useMotionState, useMouse, usePageMotions, usePulse, useReducedMotion, useRepeat, useScaleIn, useScrollProgress, useScrollReveal, useSimplePageMotion, useSlideDown, useSlideLeft, useSlideRight, useSlideUp, useSmartMotion, useSpringMotion, useToggleMotion, useUnifiedMotion, useWindowSize };
|