@mks2508/waapi-animation-primitives 0.1.0 → 0.2.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 +164 -30
- package/dist/index.cjs +49 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +207 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +1308 -401
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +1308 -401
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -63
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,85 +1,1064 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import React from
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import React$1, { ElementType, ReactNode, RefObject } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
4
|
|
|
5
|
+
//#region src/styles/injectStyles.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Inyecta las CSS variables en el documento.
|
|
8
|
+
* Se llama automáticamente al importar el package.
|
|
9
|
+
* Es idempotente - solo inyecta una vez.
|
|
10
|
+
*/
|
|
11
|
+
declare const injectCSSVariables: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Remueve las CSS variables inyectadas.
|
|
14
|
+
* Útil para cleanup en tests o hot reload.
|
|
15
|
+
*/
|
|
16
|
+
declare const removeCSSVariables: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Fuerza la re-inyección de CSS variables.
|
|
19
|
+
* Útil cuando cambian los valores dinámicamente.
|
|
20
|
+
*/
|
|
21
|
+
declare const reinjectCSSVariables: () => void;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/SlidingNumber.d.ts
|
|
4
24
|
interface FormatOptions {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
25
|
+
style?: "decimal" | "currency" | "percent";
|
|
26
|
+
currency?: string;
|
|
27
|
+
locale?: string;
|
|
28
|
+
minimumFractionDigits?: number;
|
|
29
|
+
maximumFractionDigits?: number;
|
|
30
|
+
useGrouping?: boolean;
|
|
11
31
|
}
|
|
12
32
|
interface SlidingNumberProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
declare function SlidingNumber({
|
|
30
|
-
|
|
33
|
+
value: number;
|
|
34
|
+
duration?: number;
|
|
35
|
+
fontSize?: string;
|
|
36
|
+
fontWeight?: string;
|
|
37
|
+
color?: string;
|
|
38
|
+
digitHeight?: number;
|
|
39
|
+
stagger?: number;
|
|
40
|
+
motionBlur?: boolean;
|
|
41
|
+
format?: FormatOptions;
|
|
42
|
+
trend?: -1 | 0 | 1;
|
|
43
|
+
animationConfig?: {
|
|
44
|
+
overshoot?: number;
|
|
45
|
+
mass?: number;
|
|
46
|
+
stiffness?: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
declare function SlidingNumber({
|
|
50
|
+
value,
|
|
51
|
+
duration,
|
|
52
|
+
fontSize,
|
|
53
|
+
fontWeight,
|
|
54
|
+
color,
|
|
55
|
+
digitHeight,
|
|
56
|
+
stagger,
|
|
57
|
+
motionBlur,
|
|
58
|
+
format,
|
|
59
|
+
trend,
|
|
60
|
+
animationConfig
|
|
61
|
+
}: SlidingNumberProps): react_jsx_runtime0.JSX.Element;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/components/SlidingText.d.ts
|
|
31
64
|
interface SlidingTextProps {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
declare const SlidingText: React.FC<SlidingTextProps>;
|
|
48
|
-
|
|
65
|
+
text: string;
|
|
66
|
+
mode?: 'word' | 'character' | 'none';
|
|
67
|
+
direction?: 'vertical' | 'horizontal';
|
|
68
|
+
staggerDelay?: number;
|
|
69
|
+
duration?: number;
|
|
70
|
+
easing?: string;
|
|
71
|
+
blur?: boolean;
|
|
72
|
+
widthAnimation?: boolean;
|
|
73
|
+
initial?: 'initial' | false;
|
|
74
|
+
animate?: 'animate';
|
|
75
|
+
exit?: 'exit';
|
|
76
|
+
onAnimationComplete?: () => void;
|
|
77
|
+
className?: string;
|
|
78
|
+
style?: React$1.CSSProperties;
|
|
79
|
+
}
|
|
80
|
+
declare const SlidingText: React$1.FC<SlidingTextProps>;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/AnimatedTokens.d.ts
|
|
49
83
|
interface Token {
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
id: string;
|
|
85
|
+
text: string;
|
|
52
86
|
}
|
|
53
87
|
interface AnimatedTokensProps {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
declare const AnimatedTokens: React.FC<AnimatedTokensProps>;
|
|
68
|
-
|
|
88
|
+
tokens: Token[];
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
maxVisible?: number;
|
|
91
|
+
textAnimationMode?: 'character' | 'word';
|
|
92
|
+
textDirection?: 'vertical' | 'horizontal';
|
|
93
|
+
textStaggerDelay?: number;
|
|
94
|
+
separator?: string;
|
|
95
|
+
enableWidthAnimation?: boolean;
|
|
96
|
+
className?: string;
|
|
97
|
+
tokenClassName?: string;
|
|
98
|
+
placeholderClassName?: string;
|
|
99
|
+
separatorClassName?: string;
|
|
100
|
+
}
|
|
101
|
+
declare const AnimatedTokens: React$1.FC<AnimatedTokensProps>;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/hooks/useListFormat.d.ts
|
|
104
|
+
type ListFormatType = 'conjunction' | 'disjunction' | 'unit';
|
|
105
|
+
type ListFormatStyle = 'long' | 'short' | 'narrow';
|
|
106
|
+
interface IntlListFormatPart {
|
|
107
|
+
type: 'element' | 'literal';
|
|
108
|
+
value: string;
|
|
109
|
+
}
|
|
110
|
+
interface IntlListFormatOptions {
|
|
111
|
+
type?: ListFormatType;
|
|
112
|
+
style?: ListFormatStyle;
|
|
113
|
+
}
|
|
114
|
+
interface IntlListFormat {
|
|
115
|
+
format(list: string[]): string;
|
|
116
|
+
formatToParts(list: string[]): IntlListFormatPart[];
|
|
117
|
+
}
|
|
118
|
+
interface IntlListFormatConstructor {
|
|
119
|
+
new (locale?: string | string[], options?: IntlListFormatOptions): IntlListFormat;
|
|
120
|
+
}
|
|
121
|
+
declare global {
|
|
122
|
+
namespace Intl {
|
|
123
|
+
const ListFormat: IntlListFormatConstructor;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
interface UseListFormatOptions {
|
|
127
|
+
locale?: string;
|
|
128
|
+
type?: ListFormatType;
|
|
129
|
+
style?: ListFormatStyle;
|
|
130
|
+
separator?: string;
|
|
131
|
+
}
|
|
132
|
+
interface ListPart {
|
|
133
|
+
type: 'element' | 'literal';
|
|
134
|
+
value: string;
|
|
135
|
+
index: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Hook for locale-aware list formatting using Intl.ListFormat
|
|
139
|
+
*
|
|
140
|
+
* Provides parts that can be rendered individually with animations.
|
|
141
|
+
* Uses browser's Intl.ListFormat API for proper locale handling.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```tsx
|
|
145
|
+
* // Automatic locale detection
|
|
146
|
+
* const parts = useListFormat(['Apple', 'Banana', 'Cherry']);
|
|
147
|
+
* // en: [{ type: 'element', value: 'Apple' }, { type: 'literal', value: ', ' }, ...]
|
|
148
|
+
*
|
|
149
|
+
* // Spanish
|
|
150
|
+
* const parts = useListFormat(['Apple', 'Banana', 'Cherry'], { locale: 'es' });
|
|
151
|
+
* // es: [..., { type: 'literal', value: ' y ' }, { type: 'element', value: 'Cherry' }]
|
|
152
|
+
*
|
|
153
|
+
* // Disjunction (or)
|
|
154
|
+
* const parts = useListFormat(['A', 'B', 'C'], { type: 'disjunction' });
|
|
155
|
+
* // en: "A, B, or C"
|
|
156
|
+
*
|
|
157
|
+
* // Manual override
|
|
158
|
+
* const parts = useListFormat(['A', 'B', 'C'], { separator: ' | ' });
|
|
159
|
+
* // "A | B | C"
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
declare function useListFormat(items: string[], options?: UseListFormatOptions): ListPart[];
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/components/AnimatedTokensV2.d.ts
|
|
165
|
+
interface Token$1 {
|
|
166
|
+
id: string;
|
|
167
|
+
text: string;
|
|
168
|
+
}
|
|
169
|
+
interface AnimatedTokensV2Props {
|
|
170
|
+
tokens: Token$1[];
|
|
171
|
+
placeholder?: string;
|
|
172
|
+
maxVisible?: number;
|
|
173
|
+
textAnimationMode?: 'character' | 'word';
|
|
174
|
+
textDirection?: 'vertical' | 'horizontal';
|
|
175
|
+
textStaggerDelay?: number;
|
|
176
|
+
locale?: string;
|
|
177
|
+
listType?: ListFormatType;
|
|
178
|
+
listStyle?: ListFormatStyle;
|
|
179
|
+
separator?: string;
|
|
180
|
+
enableWidthAnimation?: boolean;
|
|
181
|
+
className?: string;
|
|
182
|
+
tokenClassName?: string;
|
|
183
|
+
placeholderClassName?: string;
|
|
184
|
+
separatorClassName?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* AnimatedTokensV2 - Locale-aware animated token list
|
|
188
|
+
*
|
|
189
|
+
* Uses Intl.ListFormat for proper locale-aware separators.
|
|
190
|
+
* Supports conjunction ("and"), disjunction ("or"), and unit (space) types.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* // Automatic locale (browser default)
|
|
195
|
+
* <AnimatedTokensV2 tokens={tags} />
|
|
196
|
+
* // en-US: "Apple, Banana, and Cherry"
|
|
197
|
+
* // es-ES: "Apple, Banana y Cherry"
|
|
198
|
+
*
|
|
199
|
+
* // Specific locale
|
|
200
|
+
* <AnimatedTokensV2 tokens={tags} locale="es" />
|
|
201
|
+
*
|
|
202
|
+
* // Disjunction (or)
|
|
203
|
+
* <AnimatedTokensV2 tokens={tags} listType="disjunction" />
|
|
204
|
+
* // "Apple, Banana, or Cherry"
|
|
205
|
+
*
|
|
206
|
+
* // Manual override
|
|
207
|
+
* <AnimatedTokensV2 tokens={tags} separator=" | " />
|
|
208
|
+
* // "Apple | Banana | Cherry"
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare const AnimatedTokensV2: React.FC<AnimatedTokensV2Props>;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/hooks/useWAAPIAnimations.d.ts
|
|
214
|
+
interface SeparatorState {
|
|
215
|
+
tokenId: string;
|
|
216
|
+
isVisible: boolean;
|
|
217
|
+
isAnimating: boolean;
|
|
218
|
+
animationPhase: 'idle' | 'exit-coordinated' | 'flip-coordinated' | 'completed';
|
|
219
|
+
startTime?: number;
|
|
220
|
+
expectedEndTime?: number;
|
|
221
|
+
}
|
|
69
222
|
interface AnimationConfig {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
223
|
+
onComplete: (id: string) => void;
|
|
224
|
+
exitDuration?: number;
|
|
225
|
+
flipDuration?: number;
|
|
226
|
+
exitEasing?: string;
|
|
227
|
+
flipEasing?: string;
|
|
75
228
|
}
|
|
76
229
|
declare const useWAAPIAnimations: (config: AnimationConfig) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
230
|
+
registerElement: (id: string, el: HTMLElement | null) => void;
|
|
231
|
+
startExit: (id: string, additionalSeparatorIds?: string[]) => Promise<void>;
|
|
232
|
+
isAnimating: (id?: string) => boolean;
|
|
233
|
+
cancelAnimations: (id: string) => void;
|
|
234
|
+
registerSeparator: (tokenId: string, el: HTMLElement | null) => void;
|
|
235
|
+
getSeparatorState: (tokenId: string) => SeparatorState | undefined;
|
|
236
|
+
startSeparatorAnimation: (tokenId: string) => Promise<void>;
|
|
237
|
+
cleanupSeparatorStates: (visibleTokenIds: Set<string>) => void;
|
|
81
238
|
};
|
|
82
|
-
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/contexts/DebugContext.d.ts
|
|
241
|
+
interface TimingData {
|
|
242
|
+
startTime: number;
|
|
243
|
+
endTime?: number;
|
|
244
|
+
expectedDuration: number;
|
|
245
|
+
actualDuration?: number;
|
|
246
|
+
deviation?: number;
|
|
247
|
+
deviationPercent?: number;
|
|
248
|
+
}
|
|
249
|
+
interface StyleData {
|
|
250
|
+
property: string;
|
|
251
|
+
expected: string;
|
|
252
|
+
actual: string;
|
|
253
|
+
matches: boolean;
|
|
254
|
+
}
|
|
255
|
+
interface PositionData {
|
|
256
|
+
element: string;
|
|
257
|
+
x: number;
|
|
258
|
+
y: number;
|
|
259
|
+
width: number;
|
|
260
|
+
height: number;
|
|
261
|
+
delta?: {
|
|
262
|
+
x: number;
|
|
263
|
+
y: number;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
interface AnimationData {
|
|
267
|
+
name: string;
|
|
268
|
+
phase: 'start' | 'running' | 'complete' | 'cancelled';
|
|
269
|
+
progress?: number;
|
|
270
|
+
easing?: string;
|
|
271
|
+
fill?: string;
|
|
272
|
+
}
|
|
273
|
+
type DebugEventType = 'token-add' | 'token-remove' | 'token-reorder' | 'token-exit-start' | 'token-exit-complete' | 'token-dom-remove' | 'overflow-token-remove' | 'flip-animation' | 'flip-animation-complete' | 'flip-all-animations-complete' | 'flip-executing-callback' | 'flip-measure-start' | 'flip-position-measured' | 'flip-invalid-rect' | 'flip-invalid-delta' | 'flip-manual-trigger' | 'flip-capture-positions' | 'flip-position-captured' | 'flip-skipped' | 'waapi-exit-start' | 'waapi-exit-complete' | 'waapi-flip-animation' | 'exit-fade-complete' | 'orchestration-complete' | 'animation-start-detailed' | 'animation-complete-detailed' | 'animation-timing' | 'style-capture' | 'style-mismatch' | 'position-capture' | 'position-delta' | 'choreography-overlap' | 'choreography-sequence' | 'text-enter-start' | 'text-enter-complete' | 'reorder-item-enter' | 'reorder-item-exit' | 'reorder-item-exit-complete' | 'reorder-flip-start' | 'reorder-flip-complete' | 'reorder-flip-before-capture' | 'reorder-flip-after-capture' | 'reorder-flip-after-positions' | 'reorder-flip-after-precaptured' | 'reorder-flip-delta' | 'reorder-flip-reflow-trigger' | 'reorder-flip-skipped' | 'reorder-flip-filter' | 'reorder-stagger-start' | 'reorder-ghost-created' | 'reorder-ghost-removed' | 'reorder-register-element' | 'reorder-animation-start' | 'reorder-animation-complete' | 'reorder-animation-setup' | 'reorder-animation-created' | 'reorder-animation-init' | 'reorder-animation-error' | 'reorder-exit-check' | 'reorder-exit-rejected' | 'reorder-reflow-triggered' | 'reorder-transform-applied' | 'reorder-display-none' | 'reorder-position-absolute' | 'reorder-after-immediate' | 'reorder-exit-cleanup' | 'reorder-await-start' | 'reorder-await-complete' | 'reorder-enter-start' | 'reorder-enter-complete' | 'separator-animation-start' | 'separator-animation-state-only' | 'separator-animation-skipped' | 'separator-flip-start' | 'separator-animation-complete' | 'separator-state-cleanup' | 'test-suite-start' | 'test-suite-complete' | 'test-suite-error' | 'test-suite-stopped' | 'test-start' | 'test-complete' | 'test-error' | 'test-progress' | 'test-flip-capture' | 'test-export' | 'test-manual-remove' | 'triggering-flip-before-absolute' | 'state-change' | 'render' | 'animation-complete-called' | 'scheduling-raf' | 'raf-executed' | 'component-unmounted' | 'token-removing-from-layout' | 'exit-completed-ids-updated' | 'exit-completed-change' | 'registering-callback' | 'callback-fired';
|
|
274
|
+
interface DebugEvent {
|
|
275
|
+
timestamp: number;
|
|
276
|
+
perfNow?: number;
|
|
277
|
+
type: DebugEventType;
|
|
278
|
+
source: string;
|
|
279
|
+
message: string;
|
|
280
|
+
timing?: TimingData;
|
|
281
|
+
styles?: StyleData[];
|
|
282
|
+
position?: PositionData;
|
|
283
|
+
animation?: AnimationData;
|
|
284
|
+
data?: Record<string, unknown>;
|
|
285
|
+
}
|
|
286
|
+
interface DebugContextValue {
|
|
287
|
+
events: DebugEvent[];
|
|
288
|
+
isEnabled: boolean;
|
|
289
|
+
enableDebug: () => void;
|
|
290
|
+
disableDebug: () => void;
|
|
291
|
+
toggleDebug: () => void;
|
|
292
|
+
logEvent: (event: Omit<DebugEvent, 'timestamp' | 'perfNow'>) => void;
|
|
293
|
+
clearEvents: () => void;
|
|
294
|
+
getEventLog: () => string;
|
|
295
|
+
exportToCSV: () => string;
|
|
296
|
+
startCollecting: () => void;
|
|
297
|
+
stopCollecting: () => DebugEvent[];
|
|
298
|
+
isCollecting: boolean;
|
|
299
|
+
flushEvents: () => void;
|
|
300
|
+
}
|
|
301
|
+
declare const useDebug: () => DebugContextValue;
|
|
302
|
+
declare const DebugProvider: React$1.FC<{
|
|
303
|
+
children: React$1.ReactNode;
|
|
304
|
+
}>;
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/utils/choreographyTracker.d.ts
|
|
307
|
+
interface AnimationInfo {
|
|
308
|
+
id: string;
|
|
309
|
+
type: 'exit-fade' | 'exit-collapse' | 'flip' | 'enter' | 'width-collapse' | 'separator-exit';
|
|
310
|
+
elementId: string;
|
|
311
|
+
startTime: number;
|
|
312
|
+
expectedDuration: number;
|
|
313
|
+
endTime?: number;
|
|
314
|
+
actualDuration?: number;
|
|
315
|
+
}
|
|
316
|
+
interface TimelineEvent {
|
|
317
|
+
time: number;
|
|
318
|
+
event: 'animation-start' | 'animation-end' | 'overlap-detected';
|
|
319
|
+
animationId: string;
|
|
320
|
+
type?: string;
|
|
321
|
+
overlappingWith?: string[];
|
|
322
|
+
expectedDuration?: number;
|
|
323
|
+
actualDuration?: number;
|
|
324
|
+
deviation?: number;
|
|
325
|
+
}
|
|
326
|
+
interface OverlapInfo {
|
|
327
|
+
animation1: string;
|
|
328
|
+
animation2: string;
|
|
329
|
+
overlapStart: number;
|
|
330
|
+
overlapDuration: number;
|
|
331
|
+
}
|
|
332
|
+
interface ChoreographySummary {
|
|
333
|
+
totalAnimations: number;
|
|
334
|
+
totalDuration: number;
|
|
335
|
+
overlaps: OverlapInfo[];
|
|
336
|
+
timeline: TimelineEvent[];
|
|
337
|
+
activeAnimations: AnimationInfo[];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* ChoreographyTracker - Singleton for tracking animation choreography
|
|
341
|
+
* Detects overlaps, generates timeline, measures actual vs expected timing
|
|
342
|
+
*/
|
|
343
|
+
declare class ChoreographyTrackerClass {
|
|
344
|
+
private activeAnimations;
|
|
345
|
+
private timeline;
|
|
346
|
+
private completedAnimations;
|
|
347
|
+
private sessionStartTime;
|
|
348
|
+
/**
|
|
349
|
+
* Start a new tracking session (call when debug panel is cleared)
|
|
350
|
+
*/
|
|
351
|
+
startSession(): void;
|
|
352
|
+
/**
|
|
353
|
+
* Get relative time since session start
|
|
354
|
+
*/
|
|
355
|
+
private getRelativeTime;
|
|
356
|
+
/**
|
|
357
|
+
* Start tracking an animation
|
|
358
|
+
*/
|
|
359
|
+
startAnimation(id: string, type: AnimationInfo['type'], elementId: string, expectedDuration: number): void;
|
|
360
|
+
/**
|
|
361
|
+
* End tracking an animation
|
|
362
|
+
*/
|
|
363
|
+
endAnimation(id: string): AnimationInfo | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* Detect which animations are overlapping with the given animation
|
|
366
|
+
*/
|
|
367
|
+
private detectOverlaps;
|
|
368
|
+
/**
|
|
369
|
+
* Get all overlap pairs with duration
|
|
370
|
+
*/
|
|
371
|
+
getOverlaps(): OverlapInfo[];
|
|
372
|
+
/**
|
|
373
|
+
* Get current timeline
|
|
374
|
+
*/
|
|
375
|
+
getTimeline(): TimelineEvent[];
|
|
376
|
+
/**
|
|
377
|
+
* Get active animation count
|
|
378
|
+
*/
|
|
379
|
+
getActiveCount(): number;
|
|
380
|
+
/**
|
|
381
|
+
* Get active animations
|
|
382
|
+
*/
|
|
383
|
+
getActiveAnimations(): AnimationInfo[];
|
|
384
|
+
/**
|
|
385
|
+
* Get completed animations
|
|
386
|
+
*/
|
|
387
|
+
getCompletedAnimations(): AnimationInfo[];
|
|
388
|
+
/**
|
|
389
|
+
* Get full choreography summary
|
|
390
|
+
*/
|
|
391
|
+
getSummary(): ChoreographySummary;
|
|
392
|
+
/**
|
|
393
|
+
* Get timeline for visualization (normalized to 0-100%)
|
|
394
|
+
*/
|
|
395
|
+
getTimelineForVisualization(): Array<{
|
|
396
|
+
id: string;
|
|
397
|
+
type: string;
|
|
398
|
+
elementId: string;
|
|
399
|
+
startPercent: number;
|
|
400
|
+
widthPercent: number;
|
|
401
|
+
duration: number;
|
|
402
|
+
isActive: boolean;
|
|
403
|
+
}>;
|
|
404
|
+
}
|
|
405
|
+
declare const choreographyTracker: ChoreographyTrackerClass;
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/core/types.d.ts
|
|
408
|
+
/**
|
|
409
|
+
* Core types for headless animation primitives
|
|
410
|
+
* Based on WAAPI (Web Animations API) patterns
|
|
411
|
+
*/
|
|
412
|
+
interface FLIPDelta {
|
|
413
|
+
id: string;
|
|
414
|
+
deltaX: number;
|
|
415
|
+
deltaY: number;
|
|
416
|
+
deltaWidth: number;
|
|
417
|
+
deltaHeight: number;
|
|
418
|
+
isSignificant: boolean;
|
|
419
|
+
}
|
|
420
|
+
interface AnimationTiming {
|
|
421
|
+
duration: number;
|
|
422
|
+
delay?: number;
|
|
423
|
+
easing: string;
|
|
424
|
+
fill?: FillMode;
|
|
425
|
+
}
|
|
426
|
+
interface PositionRect {
|
|
427
|
+
x: number;
|
|
428
|
+
y: number;
|
|
429
|
+
width: number;
|
|
430
|
+
height: number;
|
|
431
|
+
}
|
|
432
|
+
interface ElementRegistryAPI {
|
|
433
|
+
register: (id: string, el: HTMLElement | null) => void;
|
|
434
|
+
unregister: (id: string) => void;
|
|
435
|
+
get: (id: string) => HTMLElement | undefined;
|
|
436
|
+
getAll: () => Map<string, HTMLElement>;
|
|
437
|
+
has: (id: string) => boolean;
|
|
438
|
+
clear: () => void;
|
|
439
|
+
size: number;
|
|
440
|
+
}
|
|
441
|
+
interface ElementRegistryCallbacks {
|
|
442
|
+
onRegister?: (id: string, el: HTMLElement) => void;
|
|
443
|
+
onUnregister?: (id: string) => void;
|
|
444
|
+
}
|
|
445
|
+
interface PositionCaptureAPI {
|
|
446
|
+
capture: (excludeIds?: Set<string>) => Map<string, DOMRect>;
|
|
447
|
+
getPosition: (id: string) => DOMRect | undefined;
|
|
448
|
+
calculateDeltas: (before: Map<string, DOMRect>, after: Map<string, DOMRect>) => Map<string, FLIPDelta>;
|
|
449
|
+
getLastCapture: () => Map<string, DOMRect>;
|
|
450
|
+
clear: () => void;
|
|
451
|
+
}
|
|
452
|
+
interface PositionCaptureOptions {
|
|
453
|
+
minDeltaPx?: number;
|
|
454
|
+
}
|
|
455
|
+
interface FLIPAnimationOptions {
|
|
456
|
+
duration?: number;
|
|
457
|
+
easing?: string;
|
|
458
|
+
onStart?: (id: string) => void;
|
|
459
|
+
onComplete?: (id: string) => void;
|
|
460
|
+
}
|
|
461
|
+
interface FLIPAnimationAPI {
|
|
462
|
+
animate: (element: HTMLElement, delta: FLIPDelta, options?: FLIPAnimationOptions) => Animation;
|
|
463
|
+
animateAll: (elements: Map<string, HTMLElement>, deltas: Map<string, FLIPDelta>, options?: FLIPAnimationOptions) => Promise<void>;
|
|
464
|
+
cancel: (id: string) => void;
|
|
465
|
+
cancelAll: () => void;
|
|
466
|
+
isAnimating: (id?: string) => boolean;
|
|
467
|
+
}
|
|
468
|
+
interface ExitOptions {
|
|
469
|
+
duration?: number;
|
|
470
|
+
easing?: string;
|
|
471
|
+
collapseWidth?: boolean;
|
|
472
|
+
additionalIds?: string[];
|
|
473
|
+
onComplete?: () => void;
|
|
474
|
+
}
|
|
475
|
+
interface EnterOptions {
|
|
476
|
+
duration?: number;
|
|
477
|
+
easing?: string;
|
|
478
|
+
stagger?: number;
|
|
479
|
+
onComplete?: () => void;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Controls which elements animate when an item exits
|
|
483
|
+
* - 'all': All remaining elements animate to fill the gap (default)
|
|
484
|
+
* - 'siblings-after': Only elements after the exiting one animate
|
|
485
|
+
* - 'none': No FLIP animation, item exits in-place
|
|
486
|
+
*/
|
|
487
|
+
type FLIPBehavior = 'all' | 'siblings-after' | 'none';
|
|
488
|
+
/**
|
|
489
|
+
* Controls how the exiting element is positioned during exit animation
|
|
490
|
+
* - 'absolute-fixed': Position absolute with fixed coordinates (current default)
|
|
491
|
+
* - 'in-place': Stay in flow, no position change
|
|
492
|
+
* - 'custom': Consumer handles positioning via CSS/callbacks
|
|
493
|
+
*/
|
|
494
|
+
type ExitPositionStrategy = 'absolute-fixed' | 'in-place' | 'custom';
|
|
495
|
+
interface AnimationOrchestratorConfig {
|
|
496
|
+
exitDuration?: number;
|
|
497
|
+
flipDuration?: number;
|
|
498
|
+
enterDuration?: number;
|
|
499
|
+
exitEasing?: string;
|
|
500
|
+
flipEasing?: string;
|
|
501
|
+
enterEasing?: string;
|
|
502
|
+
flipBehavior?: FLIPBehavior;
|
|
503
|
+
exitPositionStrategy?: ExitPositionStrategy;
|
|
504
|
+
minDeltaPx?: number;
|
|
505
|
+
onExitComplete?: (id: string) => void;
|
|
506
|
+
onEnterComplete?: (id: string) => void;
|
|
507
|
+
}
|
|
508
|
+
interface AnimationOrchestratorAPI {
|
|
509
|
+
registry: ElementRegistryAPI;
|
|
510
|
+
positions: PositionCaptureAPI;
|
|
511
|
+
flip: FLIPAnimationAPI;
|
|
512
|
+
registerElement: (id: string, el: HTMLElement | null) => void;
|
|
513
|
+
startExit: (id: string, options?: ExitOptions) => Promise<void>;
|
|
514
|
+
startEnter: (id: string, options?: EnterOptions) => Promise<void>;
|
|
515
|
+
isAnimating: (id?: string) => boolean;
|
|
516
|
+
cancelAnimation: (id: string) => void;
|
|
517
|
+
cancelAllAnimations: () => void;
|
|
518
|
+
capturePositions: (excludeIds?: Set<string>) => Map<string, DOMRect>;
|
|
519
|
+
}
|
|
520
|
+
interface OrchestratorState {
|
|
521
|
+
animatingIds: Set<string>;
|
|
522
|
+
positions: Map<string, DOMRect>;
|
|
523
|
+
activeAnimations: Map<string, Animation[]>;
|
|
524
|
+
}
|
|
525
|
+
type AnimationPhase = 'idle' | 'exit' | 'flip' | 'enter' | 'completed';
|
|
526
|
+
interface AnimationEvent {
|
|
527
|
+
id: string;
|
|
528
|
+
phase: AnimationPhase;
|
|
529
|
+
timestamp: number;
|
|
530
|
+
duration?: number;
|
|
531
|
+
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/core/useElementRegistry.d.ts
|
|
534
|
+
/**
|
|
535
|
+
* Hook for tracking DOM elements by ID
|
|
536
|
+
* Extracted from useWAAPIAnimations element registration logic
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```tsx
|
|
540
|
+
* const registry = useElementRegistry({
|
|
541
|
+
* onRegister: (id) => console.log(`Registered: ${id}`),
|
|
542
|
+
* onUnregister: (id) => console.log(`Unregistered: ${id}`)
|
|
543
|
+
* });
|
|
544
|
+
*
|
|
545
|
+
* // In render:
|
|
546
|
+
* <div ref={el => registry.register('item-1', el)} />
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
declare function useElementRegistry(callbacks?: ElementRegistryCallbacks): ElementRegistryAPI;
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region src/core/usePositionCapture.d.ts
|
|
552
|
+
/**
|
|
553
|
+
* Hook for capturing element positions and calculating FLIP deltas
|
|
554
|
+
* Extracted from useWAAPIAnimations position capture logic
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```tsx
|
|
558
|
+
* const registry = useElementRegistry();
|
|
559
|
+
* const positions = usePositionCapture(registry.getAll);
|
|
560
|
+
*
|
|
561
|
+
* // Before layout change:
|
|
562
|
+
* const before = positions.capture();
|
|
563
|
+
*
|
|
564
|
+
* // After layout change:
|
|
565
|
+
* const after = positions.capture();
|
|
566
|
+
* const deltas = positions.calculateDeltas(before, after);
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
declare function usePositionCapture(getElements: () => Map<string, HTMLElement>, options?: PositionCaptureOptions): PositionCaptureAPI;
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/core/useFLIPAnimation.d.ts
|
|
572
|
+
/**
|
|
573
|
+
* Hook for executing FLIP (First-Last-Invert-Play) animations
|
|
574
|
+
* Extracted from useWAAPIAnimations FLIP logic
|
|
575
|
+
*
|
|
576
|
+
* Uses spring easing for natural motion with slight overshoot
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```tsx
|
|
580
|
+
* const flip = useFLIPAnimation();
|
|
581
|
+
*
|
|
582
|
+
* // After calculating deltas:
|
|
583
|
+
* await flip.animateAll(elements, deltas, {
|
|
584
|
+
* duration: 300,
|
|
585
|
+
* onComplete: (id) => console.log(`${id} completed`)
|
|
586
|
+
* });
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
declare function useFLIPAnimation(): FLIPAnimationAPI;
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/core/useAnimationOrchestrator.d.ts
|
|
592
|
+
/**
|
|
593
|
+
* Main animation orchestrator hook
|
|
594
|
+
* Composes useElementRegistry, usePositionCapture, and useFLIPAnimation
|
|
595
|
+
*
|
|
596
|
+
* Handles the full exit animation sequence:
|
|
597
|
+
* 1. Capture positions of remaining elements
|
|
598
|
+
* 2. Run exit animation (fade + width collapse)
|
|
599
|
+
* 3. Start FLIP animations at 25% of exit (overlap)
|
|
600
|
+
* 4. Cleanup and notify completion
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* ```tsx
|
|
604
|
+
* const orchestrator = useAnimationOrchestrator({
|
|
605
|
+
* onExitComplete: (id) => removeFromList(id)
|
|
606
|
+
* });
|
|
607
|
+
*
|
|
608
|
+
* // Register elements:
|
|
609
|
+
* <div ref={el => orchestrator.registerElement('item-1', el)} />
|
|
610
|
+
*
|
|
611
|
+
* // Trigger exit:
|
|
612
|
+
* await orchestrator.startExit('item-1');
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
declare function useAnimationOrchestrator(config?: AnimationOrchestratorConfig): AnimationOrchestratorAPI;
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/primitives/reorder/types.d.ts
|
|
618
|
+
/**
|
|
619
|
+
* Layout direction for reorder items
|
|
620
|
+
*/
|
|
621
|
+
type ReorderLayout = 'auto' | 'horizontal' | 'vertical' | 'grid';
|
|
622
|
+
/**
|
|
623
|
+
* Stagger configuration
|
|
624
|
+
*/
|
|
625
|
+
type StaggerConfig = number | {
|
|
626
|
+
enter: number;
|
|
627
|
+
exit: number;
|
|
628
|
+
};
|
|
629
|
+
/**
|
|
630
|
+
* Duration configuration
|
|
631
|
+
*/
|
|
632
|
+
type DurationConfig = number | {
|
|
633
|
+
enter: number;
|
|
634
|
+
exit: number;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* Props for Reorder container component
|
|
638
|
+
*/
|
|
639
|
+
interface ReorderProps {
|
|
640
|
+
children: ReactNode;
|
|
641
|
+
autoAnimate?: boolean;
|
|
642
|
+
stagger?: StaggerConfig;
|
|
643
|
+
duration?: DurationConfig;
|
|
644
|
+
layout?: ReorderLayout;
|
|
645
|
+
className?: string;
|
|
646
|
+
flipBehavior?: FLIPBehavior;
|
|
647
|
+
exitPositionStrategy?: ExitPositionStrategy;
|
|
648
|
+
onItemExit?: (id: string) => void;
|
|
649
|
+
onItemEnter?: (id: string) => void;
|
|
650
|
+
/**
|
|
651
|
+
* Callback for drag-and-drop reordering.
|
|
652
|
+
* @future Not yet implemented - planned for future version with @dnd-kit integration.
|
|
653
|
+
*/
|
|
654
|
+
onReorder?: (oldIndex: number, newIndex: number) => void;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* State passed to ReorderItem render props
|
|
658
|
+
*/
|
|
659
|
+
interface ReorderItemState {
|
|
660
|
+
isExiting: boolean;
|
|
661
|
+
isEntering: boolean;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Props for ReorderItem component
|
|
665
|
+
*/
|
|
666
|
+
interface ReorderItemProps {
|
|
667
|
+
children: ReactNode | ((state: ReorderItemState) => ReactNode);
|
|
668
|
+
id: string;
|
|
669
|
+
index?: number;
|
|
670
|
+
animate?: boolean;
|
|
671
|
+
className?: string;
|
|
672
|
+
as?: ElementType;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Return type for useReorder hook
|
|
676
|
+
* Agnostic primitive - separators are consumer responsibility (AnimatedTokensV2)
|
|
677
|
+
*/
|
|
678
|
+
interface UseReorderReturn extends AnimationOrchestratorAPI {
|
|
679
|
+
startItemExit: (id: string) => Promise<void>;
|
|
680
|
+
startItemEnter: (id: string) => Promise<void>;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Configuration for useReorder hook
|
|
684
|
+
*/
|
|
685
|
+
interface UseReorderConfig {
|
|
686
|
+
enterDuration?: number;
|
|
687
|
+
exitDuration?: number;
|
|
688
|
+
flipDuration?: number;
|
|
689
|
+
enterEasing?: string;
|
|
690
|
+
exitEasing?: string;
|
|
691
|
+
flipEasing?: string;
|
|
692
|
+
flipBehavior?: FLIPBehavior;
|
|
693
|
+
exitPositionStrategy?: ExitPositionStrategy;
|
|
694
|
+
onComplete?: (id: string) => void;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Context value for Reorder components
|
|
698
|
+
*/
|
|
699
|
+
interface ReorderContextValue {
|
|
700
|
+
reorder: UseReorderReturn;
|
|
701
|
+
layout: ReorderLayout;
|
|
702
|
+
isExiting: (id: string) => boolean;
|
|
703
|
+
isEntering: (id: string) => boolean;
|
|
704
|
+
exitingIds: string[];
|
|
705
|
+
enteringIds: string[];
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Configuration for useReorderPresence hook
|
|
709
|
+
*/
|
|
710
|
+
interface UseReorderPresenceConfig {
|
|
711
|
+
autoAnimate?: boolean;
|
|
712
|
+
stagger?: StaggerConfig;
|
|
713
|
+
enterDuration?: number;
|
|
714
|
+
exitDuration?: number;
|
|
715
|
+
flipDuration?: number;
|
|
716
|
+
enterEasing?: string;
|
|
717
|
+
exitEasing?: string;
|
|
718
|
+
flipEasing?: string;
|
|
719
|
+
flipBehavior?: FLIPBehavior;
|
|
720
|
+
exitPositionStrategy?: ExitPositionStrategy;
|
|
721
|
+
onItemExit?: (id: string) => void;
|
|
722
|
+
onItemEnter?: (id: string) => void;
|
|
723
|
+
onAnimationComplete?: (id: string) => void;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Return type for useReorderPresence hook
|
|
727
|
+
*/
|
|
728
|
+
interface UseReorderPresenceReturn {
|
|
729
|
+
presentChildren: ReactNode;
|
|
730
|
+
triggerExit: (id: string) => void;
|
|
731
|
+
isExiting: (id: string) => boolean;
|
|
732
|
+
isEntering: (id: string) => boolean;
|
|
733
|
+
exitingIds: string[];
|
|
734
|
+
enteringIds: string[];
|
|
735
|
+
reorder: UseReorderReturn;
|
|
736
|
+
}
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/primitives/reorder/useReorder.d.ts
|
|
739
|
+
/**
|
|
740
|
+
* Hook for managing reorderable lists with FLIP animations.
|
|
741
|
+
*
|
|
742
|
+
* Architecture: Thin wrapper around useAnimationOrchestrator
|
|
743
|
+
* - Delegates all animation logic to orchestrator
|
|
744
|
+
* - Provides stable API surface for Reorder component
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```tsx
|
|
748
|
+
* const reorder = useReorder({
|
|
749
|
+
* onComplete: (id) => removeFromList(id)
|
|
750
|
+
* });
|
|
751
|
+
*
|
|
752
|
+
* // Register elements:
|
|
753
|
+
* <div ref={el => reorder.registerElement('item-1', el)}>
|
|
754
|
+
* Item 1
|
|
755
|
+
* </div>
|
|
756
|
+
*
|
|
757
|
+
* // Trigger exit:
|
|
758
|
+
* await reorder.startItemExit('item-1');
|
|
759
|
+
* ```
|
|
760
|
+
*/
|
|
761
|
+
declare function useReorder(config?: UseReorderConfig): UseReorderReturn;
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region src/primitives/reorder/useReorderPresence.d.ts
|
|
764
|
+
/**
|
|
765
|
+
* Hook for managing presence animations in reorderable lists
|
|
766
|
+
*
|
|
767
|
+
* IMPORTANT: This hook follows the AnimatedTokens pattern where:
|
|
768
|
+
* - Elements stay in DOM until animation completes
|
|
769
|
+
* - Consumer must keep items in their state until onAnimationComplete fires
|
|
770
|
+
* - No "ghost" cloning - animations run on actual DOM elements
|
|
771
|
+
*
|
|
772
|
+
* @example
|
|
773
|
+
* ```tsx
|
|
774
|
+
* const [items, setItems] = useState(INITIAL_ITEMS);
|
|
775
|
+
*
|
|
776
|
+
* const { presentChildren, triggerExit } = useReorderPresence(
|
|
777
|
+
* items.map(item => <div key={item.id}>{item.name}</div>),
|
|
778
|
+
* {
|
|
779
|
+
* onAnimationComplete: (id) => {
|
|
780
|
+
* // Only remove from state AFTER animation completes
|
|
781
|
+
* setItems(prev => prev.filter(item => item.id !== id));
|
|
782
|
+
* }
|
|
783
|
+
* }
|
|
784
|
+
* );
|
|
785
|
+
*
|
|
786
|
+
* const handleDelete = (id: string) => {
|
|
787
|
+
* // DON'T remove from state - just trigger animation
|
|
788
|
+
* triggerExit(id);
|
|
789
|
+
* };
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
declare function useReorderPresence(children: ReactNode, config?: UseReorderPresenceConfig): UseReorderPresenceReturn;
|
|
793
|
+
//#endregion
|
|
794
|
+
//#region src/primitives/reorder/Reorder.d.ts
|
|
795
|
+
/**
|
|
796
|
+
* Agnostic container for reorderable items with FLIP animations.
|
|
797
|
+
*
|
|
798
|
+
* Architecture: CSS + WAAPI (no React state for animation tracking)
|
|
799
|
+
* - CSS handles initial states ([data-reorder-state="entering"] starts hidden)
|
|
800
|
+
* - WAAPI handles all animations
|
|
801
|
+
* - React only manages displayChildren (what's in DOM)
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```tsx
|
|
805
|
+
* <Reorder
|
|
806
|
+
* layout="horizontal"
|
|
807
|
+
* onItemExit={(id) => handleRemove(id)}
|
|
808
|
+
* >
|
|
809
|
+
* {items.map(item => (
|
|
810
|
+
* <div key={item.id}>{item.name}</div>
|
|
811
|
+
* ))}
|
|
812
|
+
* </Reorder>
|
|
813
|
+
* ```
|
|
814
|
+
*/
|
|
815
|
+
declare const ReorderRoot: React$1.ForwardRefExoticComponent<ReorderProps & React$1.RefAttributes<{
|
|
816
|
+
startItemExit: (id: string) => Promise<void>;
|
|
817
|
+
startItemEnter: (id: string) => Promise<void>;
|
|
818
|
+
isAnimating: (id?: string) => boolean;
|
|
819
|
+
}>>;
|
|
820
|
+
//#endregion
|
|
821
|
+
//#region src/primitives/morph/types.d.ts
|
|
822
|
+
/**
|
|
823
|
+
* Available morphing techniques
|
|
824
|
+
*/
|
|
825
|
+
type MorphTechnique = 'flip-clip-path' | 'css-grid' | 'view-transitions';
|
|
826
|
+
/**
|
|
827
|
+
* FLIP + clip-path specific options
|
|
828
|
+
*/
|
|
829
|
+
interface FLIPClipPathOptions {
|
|
830
|
+
duration?: number;
|
|
831
|
+
easing?: string;
|
|
832
|
+
clipPathStart?: string;
|
|
833
|
+
clipPathEnd?: string;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* CSS Grid specific options
|
|
837
|
+
*/
|
|
838
|
+
interface CSSGridMorphOptions {
|
|
839
|
+
duration?: number;
|
|
840
|
+
easing?: string;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* View Transitions API specific options
|
|
844
|
+
*/
|
|
845
|
+
interface ViewTransitionsOptions {
|
|
846
|
+
name?: string;
|
|
847
|
+
types?: string[];
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Configuration for useMorph hook
|
|
851
|
+
*/
|
|
852
|
+
interface UseMorphOptions {
|
|
853
|
+
technique?: MorphTechnique;
|
|
854
|
+
duration?: number;
|
|
855
|
+
easing?: string;
|
|
856
|
+
onMorphStart?: () => void;
|
|
857
|
+
onMorphEnd?: () => void;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* FLIP + clip-path API
|
|
861
|
+
*/
|
|
862
|
+
interface FLIPClipPathAPI {
|
|
863
|
+
isMorphing: boolean;
|
|
864
|
+
morph: (fromElement: HTMLElement, toElement: HTMLElement) => Promise<void>;
|
|
865
|
+
cancel: () => void;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* CSS Grid morph API
|
|
869
|
+
*/
|
|
870
|
+
interface CSSGridMorphAPI {
|
|
871
|
+
isExpanded: boolean;
|
|
872
|
+
expand: () => void;
|
|
873
|
+
collapse: () => void;
|
|
874
|
+
toggle: () => void;
|
|
875
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* View Transitions API
|
|
879
|
+
*/
|
|
880
|
+
interface ViewTransitionsAPI {
|
|
881
|
+
isSupported: boolean;
|
|
882
|
+
startTransition: (callback: () => void | Promise<void>) => Promise<void>;
|
|
883
|
+
setTypes: (types: string[]) => void;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Return type for useMorph hook
|
|
887
|
+
*/
|
|
888
|
+
interface UseMorphReturn {
|
|
889
|
+
isMorphing: boolean;
|
|
890
|
+
technique: MorphTechnique;
|
|
891
|
+
isViewTransitionsSupported: boolean;
|
|
892
|
+
morph: (fromElement: HTMLElement, toElement: HTMLElement) => Promise<void>;
|
|
893
|
+
cancel: () => void;
|
|
894
|
+
flipClipPath: FLIPClipPathAPI;
|
|
895
|
+
cssGrid: CSSGridMorphAPI;
|
|
896
|
+
viewTransitions: ViewTransitionsAPI;
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Props for Morph component
|
|
900
|
+
*/
|
|
901
|
+
interface MorphProps {
|
|
902
|
+
children: ReactNode;
|
|
903
|
+
technique?: MorphTechnique;
|
|
904
|
+
duration?: number;
|
|
905
|
+
easing?: string;
|
|
906
|
+
className?: string;
|
|
907
|
+
onMorphStart?: () => void;
|
|
908
|
+
onMorphEnd?: () => void;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Context value for Morph components
|
|
912
|
+
*/
|
|
913
|
+
interface MorphContextValue {
|
|
914
|
+
morph: UseMorphReturn;
|
|
915
|
+
}
|
|
916
|
+
//#endregion
|
|
917
|
+
//#region src/primitives/morph/MorphContext.d.ts
|
|
918
|
+
/**
|
|
919
|
+
* Context for sharing Morph state between components
|
|
920
|
+
*/
|
|
921
|
+
declare const MorphContext: react0.Context<MorphContextValue | null>;
|
|
922
|
+
/**
|
|
923
|
+
* Hook to access Morph context
|
|
924
|
+
* Must be used within a Morph component
|
|
925
|
+
*
|
|
926
|
+
* @throws Error if used outside Morph component
|
|
927
|
+
*/
|
|
928
|
+
declare function useMorphContext(): MorphContextValue;
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region src/primitives/morph/useMorph.d.ts
|
|
931
|
+
/**
|
|
932
|
+
* Unified hook for morphing animations
|
|
933
|
+
*
|
|
934
|
+
* Provides access to multiple morphing techniques:
|
|
935
|
+
* - FLIP + clip-path (default): Best for element-to-element transitions
|
|
936
|
+
* - CSS Grid: Best for expand/collapse animations
|
|
937
|
+
* - View Transitions: Best for page/route transitions (requires browser support)
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```tsx
|
|
941
|
+
* const morph = useMorph({ technique: 'flip-clip-path' });
|
|
942
|
+
*
|
|
943
|
+
* // Using unified API:
|
|
944
|
+
* await morph.morph(fromElement, toElement);
|
|
945
|
+
*
|
|
946
|
+
* // Or using individual techniques:
|
|
947
|
+
* morph.cssGrid.toggle();
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
declare function useMorph(options?: UseMorphOptions): UseMorphReturn;
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region src/primitives/morph/Morph.d.ts
|
|
953
|
+
/**
|
|
954
|
+
* Container component for morphable elements
|
|
955
|
+
*
|
|
956
|
+
* Provides morphing capabilities to child components through context.
|
|
957
|
+
*
|
|
958
|
+
* @example
|
|
959
|
+
* ```tsx
|
|
960
|
+
* <Morph technique="flip-clip-path" duration={300}>
|
|
961
|
+
* <MorphSource ref={fromRef}>From Content</MorphSource>
|
|
962
|
+
* <MorphTarget ref={toRef}>To Content</MorphTarget>
|
|
963
|
+
* <button onClick={() => morph(fromRef.current, toRef.current)}>
|
|
964
|
+
* Morph
|
|
965
|
+
* </button>
|
|
966
|
+
* </Morph>
|
|
967
|
+
* ```
|
|
968
|
+
*/
|
|
969
|
+
declare function Morph({
|
|
970
|
+
children,
|
|
971
|
+
technique,
|
|
972
|
+
duration,
|
|
973
|
+
easing,
|
|
974
|
+
className,
|
|
975
|
+
onMorphStart,
|
|
976
|
+
onMorphEnd
|
|
977
|
+
}: MorphProps): ReactNode;
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/primitives/morph/techniques/useFLIPClipPath.d.ts
|
|
980
|
+
/**
|
|
981
|
+
* Hook for FLIP + clip-path morphing technique
|
|
982
|
+
*
|
|
983
|
+
* This technique combines:
|
|
984
|
+
* 1. FLIP for position/size transitions
|
|
985
|
+
* 2. clip-path for shape morphing
|
|
986
|
+
* 3. Opacity crossfade for smooth visual transition
|
|
987
|
+
*
|
|
988
|
+
* @example
|
|
989
|
+
* ```tsx
|
|
990
|
+
* const { isMorphing, morph, cancel } = useFLIPClipPath({ duration: 300 });
|
|
991
|
+
*
|
|
992
|
+
* const handleMorph = async () => {
|
|
993
|
+
* await morph(fromRef.current, toRef.current);
|
|
994
|
+
* };
|
|
995
|
+
* ```
|
|
996
|
+
*/
|
|
997
|
+
declare function useFLIPClipPath(options?: FLIPClipPathOptions): FLIPClipPathAPI;
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/primitives/morph/techniques/useCSSGridMorph.d.ts
|
|
1000
|
+
/**
|
|
1001
|
+
* Hook for CSS Grid-based expand/collapse animations
|
|
1002
|
+
*
|
|
1003
|
+
* Uses the grid-template-rows: 0fr/1fr technique for smooth height animations
|
|
1004
|
+
* without needing to know the content height in advance.
|
|
1005
|
+
*
|
|
1006
|
+
* CSS required on container:
|
|
1007
|
+
* ```css
|
|
1008
|
+
* .morph-container {
|
|
1009
|
+
* display: grid;
|
|
1010
|
+
* grid-template-rows: 0fr;
|
|
1011
|
+
* transition: grid-template-rows 300ms ease;
|
|
1012
|
+
* }
|
|
1013
|
+
* .morph-container.expanded {
|
|
1014
|
+
* grid-template-rows: 1fr;
|
|
1015
|
+
* }
|
|
1016
|
+
* .morph-content {
|
|
1017
|
+
* overflow: hidden;
|
|
1018
|
+
* }
|
|
1019
|
+
* ```
|
|
1020
|
+
*
|
|
1021
|
+
* @example
|
|
1022
|
+
* ```tsx
|
|
1023
|
+
* const { isExpanded, toggle, containerRef } = useCSSGridMorph();
|
|
1024
|
+
*
|
|
1025
|
+
* return (
|
|
1026
|
+
* <div ref={containerRef} className={isExpanded ? 'expanded' : ''}>
|
|
1027
|
+
* <div className="morph-content">
|
|
1028
|
+
* Collapsible content
|
|
1029
|
+
* </div>
|
|
1030
|
+
* </div>
|
|
1031
|
+
* );
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
declare function useCSSGridMorph(options?: CSSGridMorphOptions): CSSGridMorphAPI;
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/primitives/morph/techniques/useViewTransitions.d.ts
|
|
1037
|
+
/**
|
|
1038
|
+
* Hook for View Transitions API
|
|
1039
|
+
*
|
|
1040
|
+
* Provides a wrapper around the native View Transitions API
|
|
1041
|
+
* with automatic feature detection and fallback handling.
|
|
1042
|
+
*
|
|
1043
|
+
* Browser support (as of 2025):
|
|
1044
|
+
* - Chrome 111+: ✅
|
|
1045
|
+
* - Firefox 144+: ✅
|
|
1046
|
+
* - Safari latest: ✅
|
|
1047
|
+
*
|
|
1048
|
+
* @example
|
|
1049
|
+
* ```tsx
|
|
1050
|
+
* const { isSupported, startTransition } = useViewTransitions({ name: 'hero' });
|
|
1051
|
+
*
|
|
1052
|
+
* const handleTransition = async () => {
|
|
1053
|
+
* await startTransition(() => {
|
|
1054
|
+
* setActiveImage(nextImage);
|
|
1055
|
+
* });
|
|
1056
|
+
* };
|
|
1057
|
+
* ```
|
|
1058
|
+
*/
|
|
1059
|
+
declare function useViewTransitions(options?: ViewTransitionsOptions): ViewTransitionsAPI;
|
|
1060
|
+
//#endregion
|
|
1061
|
+
//#region src/utils/animationUtils.d.ts
|
|
83
1062
|
/**
|
|
84
1063
|
* Obtiene duración de animación responsiva para el dispositivo actual
|
|
85
1064
|
* @param baseDuration - Duración base en ms
|
|
@@ -93,362 +1072,289 @@ declare const getResponsiveDuration: (baseDuration: number) => number;
|
|
|
93
1072
|
*/
|
|
94
1073
|
declare const getResponsiveStagger: (baseDelay: number) => number;
|
|
95
1074
|
declare const TIMING: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
1075
|
+
readonly ENTER_DURATION: 200;
|
|
1076
|
+
readonly EXIT_DURATION: 180;
|
|
1077
|
+
readonly COLLAPSE_DURATION: 200;
|
|
1078
|
+
readonly FLIP_DURATION: 300;
|
|
1079
|
+
readonly ENTER_STAGGER: 15;
|
|
1080
|
+
readonly EXIT_STAGGER: 0;
|
|
1081
|
+
readonly COLLAPSE_DELAY: 30;
|
|
1082
|
+
readonly FLIP_DELAY_PERCENT: 0.25;
|
|
1083
|
+
readonly MIN_DELTA_PX: 1;
|
|
105
1084
|
};
|
|
106
1085
|
declare const TRANSFORMS: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1086
|
+
readonly OFFSET_Y_ENTER: 8;
|
|
1087
|
+
readonly OFFSET_Y_EXIT: -8;
|
|
1088
|
+
readonly OFFSET_X: 16;
|
|
1089
|
+
readonly SCALE_ENTER: 0.85;
|
|
1090
|
+
readonly SCALE_EXIT: 0.85;
|
|
1091
|
+
readonly ROTATE_EXIT: 0;
|
|
112
1092
|
};
|
|
113
1093
|
declare const EFFECTS: {
|
|
114
|
-
|
|
115
|
-
|
|
1094
|
+
readonly BLUR_ENTER: 4;
|
|
1095
|
+
readonly BLUR_EXIT: 2;
|
|
116
1096
|
};
|
|
117
1097
|
declare const EASINGS: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1098
|
+
readonly MATERIAL_DECELERATE: "cubic-bezier(0, 0, 0.2, 1)";
|
|
1099
|
+
readonly MATERIAL_ACCELERATE: "cubic-bezier(0.4, 0, 1, 1)";
|
|
1100
|
+
readonly MATERIAL_STANDARD: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
1101
|
+
readonly EASE_REORDER: "cubic-bezier(0.215, 0.61, 0.355, 1)";
|
|
1102
|
+
readonly EASE_OUT_CUBIC: "cubic-bezier(0.33, 1, 0.68, 1)";
|
|
1103
|
+
readonly EASE_IN_CUBIC: "cubic-bezier(0.32, 0, 0.67, 0)";
|
|
1104
|
+
readonly EASE_IN_OUT: "cubic-bezier(0.42, 0, 0.58, 1)";
|
|
1105
|
+
readonly EASE_OUT_EXPO: "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
1106
|
+
readonly EASE_FLIP: "cubic-bezier(0.2, 0, 0.2, 1)";
|
|
1107
|
+
readonly SPRING_GENTLE: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
|
|
1108
|
+
readonly SPRING_SNAPPY: "linear(0, 0.006, 0.024 2%, 0.096 4.2%, 0.397 9.3%, 0.861 15.8%, 1.002 18.7%, 1.093 21.4%, 1.143 24%, 1.156, 1.149 28.3%, 1.115 31.5%, 1.022 40%, 0.988 47.1%, 0.984 55.1%, 0.998 72.3%, 1.001 85.4%, 1)";
|
|
125
1109
|
};
|
|
126
1110
|
/**
|
|
127
1111
|
* Configuración de animación responsiva con accessibility
|
|
128
1112
|
*/
|
|
129
1113
|
declare const RESPONSIVE_CONFIGS: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
1114
|
+
readonly tokenEnter: {
|
|
1115
|
+
readonly duration: number;
|
|
1116
|
+
readonly stagger: number;
|
|
1117
|
+
readonly easing: "cubic-bezier(0, 0, 0.2, 1)";
|
|
1118
|
+
readonly blur: 4;
|
|
1119
|
+
readonly offsetY: 8;
|
|
1120
|
+
readonly scale: 0.85;
|
|
1121
|
+
};
|
|
1122
|
+
readonly tokenExit: {
|
|
1123
|
+
readonly duration: number;
|
|
1124
|
+
readonly stagger: number;
|
|
1125
|
+
readonly easing: "cubic-bezier(0.4, 0, 1, 1)";
|
|
1126
|
+
readonly blur: 2;
|
|
1127
|
+
readonly offsetY: -8;
|
|
1128
|
+
readonly scale: 0.85;
|
|
1129
|
+
};
|
|
1130
|
+
readonly collapse: {
|
|
1131
|
+
readonly duration: number;
|
|
1132
|
+
readonly delay: 30;
|
|
1133
|
+
readonly easing: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
1134
|
+
};
|
|
1135
|
+
readonly flip: {
|
|
1136
|
+
readonly duration: number;
|
|
1137
|
+
readonly delayPercent: 0.25;
|
|
1138
|
+
readonly easing: "cubic-bezier(0.215, 0.61, 0.355, 1)";
|
|
1139
|
+
};
|
|
155
1140
|
};
|
|
156
1141
|
declare const ANIMATION_DEFAULTS: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
1142
|
+
DURATION_ENTER: 200;
|
|
1143
|
+
DURATION_EXIT: 180;
|
|
1144
|
+
DURATION_FLIP: 300;
|
|
1145
|
+
STAGGER_DELAY: 15;
|
|
1146
|
+
OFFSET_VERTICAL: 8;
|
|
1147
|
+
OFFSET_HORIZONTAL: 16;
|
|
1148
|
+
BLUR_AMOUNT: 4;
|
|
1149
|
+
EASING_ENTER: "cubic-bezier(0.33, 1, 0.68, 1)";
|
|
1150
|
+
EASING_EXIT: "cubic-bezier(0.32, 0, 0.67, 0)";
|
|
1151
|
+
EASING_FLIP: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
|
|
1152
|
+
SPRING_EASING: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
|
|
168
1153
|
};
|
|
169
1154
|
declare const ANIMATION_CONFIGS: {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
1155
|
+
readonly tokenEnter: {
|
|
1156
|
+
readonly duration: 200;
|
|
1157
|
+
readonly stagger: 15;
|
|
1158
|
+
readonly easing: "cubic-bezier(0, 0, 0.2, 1)";
|
|
1159
|
+
readonly blur: 4;
|
|
1160
|
+
readonly offsetY: 8;
|
|
1161
|
+
readonly scale: 0.85;
|
|
1162
|
+
};
|
|
1163
|
+
readonly tokenExit: {
|
|
1164
|
+
readonly duration: 180;
|
|
1165
|
+
readonly stagger: 0;
|
|
1166
|
+
readonly easing: "cubic-bezier(0.4, 0, 1, 1)";
|
|
1167
|
+
readonly blur: 2;
|
|
1168
|
+
readonly offsetY: -8;
|
|
1169
|
+
readonly scale: 0.85;
|
|
1170
|
+
};
|
|
1171
|
+
readonly collapse: {
|
|
1172
|
+
readonly duration: 200;
|
|
1173
|
+
readonly delay: 30;
|
|
1174
|
+
readonly easing: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
1175
|
+
};
|
|
1176
|
+
readonly flip: {
|
|
1177
|
+
readonly duration: 300;
|
|
1178
|
+
readonly delayPercent: 0.25;
|
|
1179
|
+
readonly easing: "cubic-bezier(0.215, 0.61, 0.355, 1)";
|
|
1180
|
+
};
|
|
195
1181
|
};
|
|
196
1182
|
declare const PRESETS: {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
1183
|
+
newToken: {
|
|
1184
|
+
mode: "character";
|
|
1185
|
+
direction: "vertical";
|
|
1186
|
+
staggerDelay: number;
|
|
1187
|
+
blur: boolean;
|
|
1188
|
+
widthAnimation: boolean;
|
|
1189
|
+
duration: number;
|
|
1190
|
+
initial: "initial";
|
|
1191
|
+
};
|
|
1192
|
+
existingToken: {
|
|
1193
|
+
mode: "none";
|
|
1194
|
+
blur: boolean;
|
|
1195
|
+
widthAnimation: boolean;
|
|
1196
|
+
initial: false;
|
|
1197
|
+
};
|
|
1198
|
+
placeholder: {
|
|
1199
|
+
mode: "word";
|
|
1200
|
+
direction: "vertical";
|
|
1201
|
+
blur: boolean;
|
|
1202
|
+
widthAnimation: boolean;
|
|
1203
|
+
duration: number;
|
|
1204
|
+
};
|
|
1205
|
+
separator: {
|
|
1206
|
+
duration: number;
|
|
1207
|
+
widthAnimation: boolean;
|
|
1208
|
+
};
|
|
223
1209
|
};
|
|
224
|
-
|
|
1210
|
+
//#endregion
|
|
1211
|
+
//#region src/styles/cssTokens.d.ts
|
|
1212
|
+
declare const CSS_VAR_NAMES: {
|
|
1213
|
+
readonly durationEnter: "--waapi-duration-enter";
|
|
1214
|
+
readonly durationExit: "--waapi-duration-exit";
|
|
1215
|
+
readonly durationCollapse: "--waapi-duration-collapse";
|
|
1216
|
+
readonly durationFlip: "--waapi-duration-flip";
|
|
1217
|
+
readonly staggerEnter: "--waapi-stagger-enter";
|
|
1218
|
+
readonly staggerExit: "--waapi-stagger-exit";
|
|
1219
|
+
readonly offsetYEnter: "--waapi-offset-y-enter";
|
|
1220
|
+
readonly offsetYExit: "--waapi-offset-y-exit";
|
|
1221
|
+
readonly offsetX: "--waapi-offset-x";
|
|
1222
|
+
readonly scaleExit: "--waapi-scale-exit";
|
|
1223
|
+
readonly blurEnter: "--waapi-blur-enter";
|
|
1224
|
+
readonly blurExit: "--waapi-blur-exit";
|
|
1225
|
+
readonly easeEnter: "--waapi-ease-enter";
|
|
1226
|
+
readonly easeExit: "--waapi-ease-exit";
|
|
1227
|
+
readonly easeCollapse: "--waapi-ease-collapse";
|
|
1228
|
+
readonly easeFlip: "--waapi-ease-flip";
|
|
1229
|
+
readonly separatorDuration: "--waapi-separator-duration";
|
|
1230
|
+
readonly separatorDelay: "--waapi-separator-delay";
|
|
1231
|
+
readonly separatorEasing: "--waapi-separator-easing";
|
|
1232
|
+
};
|
|
1233
|
+
type CSSVarName = typeof CSS_VAR_NAMES[keyof typeof CSS_VAR_NAMES];
|
|
1234
|
+
declare const CSS_VAR_VALUES: {
|
|
1235
|
+
readonly "--waapi-duration-enter": "200ms";
|
|
1236
|
+
readonly "--waapi-duration-exit": "180ms";
|
|
1237
|
+
readonly "--waapi-duration-collapse": "200ms";
|
|
1238
|
+
readonly "--waapi-duration-flip": "300ms";
|
|
1239
|
+
readonly "--waapi-stagger-enter": "15ms";
|
|
1240
|
+
readonly "--waapi-stagger-exit": "0ms";
|
|
1241
|
+
readonly "--waapi-offset-y-enter": "8px";
|
|
1242
|
+
readonly "--waapi-offset-y-exit": "-8px";
|
|
1243
|
+
readonly "--waapi-offset-x": "16px";
|
|
1244
|
+
readonly "--waapi-scale-exit": "0.85";
|
|
1245
|
+
readonly "--waapi-blur-enter": "4px";
|
|
1246
|
+
readonly "--waapi-blur-exit": "2px";
|
|
1247
|
+
readonly "--waapi-ease-enter": "cubic-bezier(0.33, 1, 0.68, 1)";
|
|
1248
|
+
readonly "--waapi-ease-exit": "cubic-bezier(0.32, 0, 0.67, 0)";
|
|
1249
|
+
readonly "--waapi-ease-collapse": "cubic-bezier(0.42, 0, 0.58, 1)";
|
|
1250
|
+
readonly "--waapi-ease-flip": "cubic-bezier(0.2, 0, 0.2, 1)";
|
|
1251
|
+
readonly "--waapi-separator-duration": "300ms";
|
|
1252
|
+
readonly "--waapi-separator-delay": `${number}ms`;
|
|
1253
|
+
readonly "--waapi-separator-easing": "cubic-bezier(0.2, 0, 0.2, 1)";
|
|
1254
|
+
};
|
|
1255
|
+
declare const cssVar: (name: CSSVarName) => string;
|
|
1256
|
+
declare const animatedTokensBaseStyles: {
|
|
1257
|
+
readonly container: React$1.CSSProperties;
|
|
1258
|
+
readonly placeholder: React$1.CSSProperties;
|
|
1259
|
+
readonly tokenWrapper: React$1.CSSProperties;
|
|
1260
|
+
readonly tokenWrapperExitCompleted: React$1.CSSProperties;
|
|
1261
|
+
readonly separator: React$1.CSSProperties;
|
|
1262
|
+
readonly separatorExitCoordinated: React$1.CSSProperties;
|
|
1263
|
+
readonly separatorExitCompleted: React$1.CSSProperties;
|
|
1264
|
+
readonly overflow: React$1.CSSProperties;
|
|
1265
|
+
};
|
|
1266
|
+
declare const slidingTextBaseStyles: {
|
|
1267
|
+
readonly container: React$1.CSSProperties;
|
|
1268
|
+
readonly content: React$1.CSSProperties;
|
|
1269
|
+
readonly token: React$1.CSSProperties;
|
|
1270
|
+
readonly enterFrom: React$1.CSSProperties;
|
|
1271
|
+
readonly enterTo: React$1.CSSProperties;
|
|
1272
|
+
readonly exitActive: React$1.CSSProperties;
|
|
1273
|
+
readonly verticalEnterFrom: React$1.CSSProperties;
|
|
1274
|
+
readonly verticalExitActive: React$1.CSSProperties;
|
|
1275
|
+
readonly horizontalEnterFrom: React$1.CSSProperties;
|
|
1276
|
+
readonly horizontalExitActive: React$1.CSSProperties;
|
|
1277
|
+
};
|
|
1278
|
+
declare const responsiveOverrides: {
|
|
1279
|
+
readonly mobile: React$1.CSSProperties;
|
|
1280
|
+
readonly smallMobile: React$1.CSSProperties;
|
|
1281
|
+
readonly reducedMotion: React$1.CSSProperties;
|
|
1282
|
+
readonly highContrast: React$1.CSSProperties;
|
|
1283
|
+
};
|
|
1284
|
+
declare const getResponsiveTokenStyles: () => React$1.CSSProperties;
|
|
1285
|
+
declare const generateCSSVariables: () => string;
|
|
1286
|
+
declare const generateResponsiveCSS: () => string;
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region src/styles/slidingText.styles.d.ts
|
|
225
1289
|
declare const slidingTextStyles: {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
1290
|
+
readonly container: React$1.CSSProperties;
|
|
1291
|
+
readonly content: React$1.CSSProperties;
|
|
1292
|
+
readonly token: React$1.CSSProperties;
|
|
1293
|
+
readonly enterFrom: React$1.CSSProperties;
|
|
1294
|
+
readonly enterTo: React$1.CSSProperties;
|
|
1295
|
+
readonly exitActive: React$1.CSSProperties;
|
|
1296
|
+
readonly verticalEnterFrom: React$1.CSSProperties;
|
|
1297
|
+
readonly verticalExitActive: React$1.CSSProperties;
|
|
1298
|
+
readonly horizontalEnterFrom: React$1.CSSProperties;
|
|
1299
|
+
readonly horizontalExitActive: React$1.CSSProperties;
|
|
236
1300
|
};
|
|
237
|
-
declare const getSlidingTextTokenStyle: (state: "enter-from" | "enter-to" | "exit-active", direction: "vertical" | "horizontal") => React.CSSProperties;
|
|
238
|
-
|
|
1301
|
+
declare const getSlidingTextTokenStyle: (state: "enter-from" | "enter-to" | "exit-active", direction: "vertical" | "horizontal") => React$1.CSSProperties;
|
|
1302
|
+
declare const getResponsiveSlidingTextStyle: () => React$1.CSSProperties;
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/styles/animatedTokens.styles.d.ts
|
|
239
1305
|
declare const animatedTokensStyles: {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
readonly overflowExiting: React.CSSProperties;
|
|
1306
|
+
readonly container: React$1.CSSProperties;
|
|
1307
|
+
readonly placeholder: React$1.CSSProperties;
|
|
1308
|
+
readonly tokenWrapper: React$1.CSSProperties;
|
|
1309
|
+
readonly tokenWrapperExitCompleted: React$1.CSSProperties;
|
|
1310
|
+
readonly separator: React$1.CSSProperties;
|
|
1311
|
+
readonly separatorExitCoordinated: React$1.CSSProperties;
|
|
1312
|
+
readonly separatorExitCompleted: React$1.CSSProperties;
|
|
1313
|
+
readonly overflow: React$1.CSSProperties;
|
|
249
1314
|
};
|
|
250
|
-
declare const getResponsiveAnimatedTokensStyle: () => React.CSSProperties;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
startTime: number;
|
|
254
|
-
endTime?: number;
|
|
255
|
-
expectedDuration: number;
|
|
256
|
-
actualDuration?: number;
|
|
257
|
-
deviation?: number;
|
|
258
|
-
deviationPercent?: number;
|
|
259
|
-
}
|
|
260
|
-
interface StyleData {
|
|
261
|
-
property: string;
|
|
262
|
-
expected: string;
|
|
263
|
-
actual: string;
|
|
264
|
-
matches: boolean;
|
|
265
|
-
}
|
|
266
|
-
interface PositionData {
|
|
267
|
-
element: string;
|
|
268
|
-
x: number;
|
|
269
|
-
y: number;
|
|
270
|
-
width: number;
|
|
271
|
-
height: number;
|
|
272
|
-
delta?: {
|
|
273
|
-
x: number;
|
|
274
|
-
y: number;
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
interface AnimationData {
|
|
278
|
-
name: string;
|
|
279
|
-
phase: 'start' | 'running' | 'complete' | 'cancelled';
|
|
280
|
-
progress?: number;
|
|
281
|
-
easing?: string;
|
|
282
|
-
fill?: string;
|
|
283
|
-
}
|
|
284
|
-
type DebugEventType = 'token-add' | 'token-remove' | 'token-reorder' | 'token-exit-start' | 'token-exit-complete' | 'token-dom-remove' | 'overflow-token-remove' | 'flip-animation' | 'flip-animation-complete' | 'flip-all-animations-complete' | 'flip-executing-callback' | 'flip-measure-start' | 'flip-position-measured' | 'flip-invalid-rect' | 'flip-invalid-delta' | 'flip-manual-trigger' | 'flip-capture-positions' | 'flip-position-captured' | 'waapi-exit-start' | 'waapi-exit-complete' | 'waapi-flip-animation' | 'exit-fade-complete' | 'orchestration-complete' | 'animation-start-detailed' | 'animation-complete-detailed' | 'animation-timing' | 'style-capture' | 'style-mismatch' | 'position-capture' | 'position-delta' | 'choreography-overlap' | 'choreography-sequence' | 'text-enter-start' | 'text-enter-complete' | 'triggering-flip-before-absolute' | 'state-change' | 'render' | 'animation-complete-called' | 'scheduling-raf' | 'raf-executed' | 'component-unmounted' | 'token-removing-from-layout' | 'exit-completed-ids-updated' | 'exit-completed-change' | 'registering-callback' | 'callback-fired';
|
|
285
|
-
interface DebugEvent {
|
|
286
|
-
timestamp: number;
|
|
287
|
-
type: DebugEventType;
|
|
288
|
-
source: string;
|
|
289
|
-
message: string;
|
|
290
|
-
timing?: TimingData;
|
|
291
|
-
styles?: StyleData[];
|
|
292
|
-
position?: PositionData;
|
|
293
|
-
animation?: AnimationData;
|
|
294
|
-
data?: Record<string, unknown>;
|
|
295
|
-
}
|
|
296
|
-
interface DebugContextValue {
|
|
297
|
-
events: DebugEvent[];
|
|
298
|
-
isEnabled: boolean;
|
|
299
|
-
enableDebug: () => void;
|
|
300
|
-
disableDebug: () => void;
|
|
301
|
-
toggleDebug: () => void;
|
|
302
|
-
logEvent: (event: Omit<DebugEvent, 'timestamp'>) => void;
|
|
303
|
-
clearEvents: () => void;
|
|
304
|
-
getEventLog: () => string;
|
|
305
|
-
exportToCSV: () => string;
|
|
306
|
-
}
|
|
307
|
-
declare const useDebug: () => DebugContextValue;
|
|
308
|
-
declare const DebugProvider: React.FC<{
|
|
309
|
-
children: React.ReactNode;
|
|
310
|
-
}>;
|
|
311
|
-
|
|
312
|
-
interface AnimationInfo {
|
|
313
|
-
id: string;
|
|
314
|
-
type: 'exit-fade' | 'exit-collapse' | 'flip' | 'enter' | 'width-collapse';
|
|
315
|
-
elementId: string;
|
|
316
|
-
startTime: number;
|
|
317
|
-
expectedDuration: number;
|
|
318
|
-
endTime?: number;
|
|
319
|
-
actualDuration?: number;
|
|
320
|
-
}
|
|
321
|
-
interface TimelineEvent {
|
|
322
|
-
time: number;
|
|
323
|
-
event: 'animation-start' | 'animation-end' | 'overlap-detected';
|
|
324
|
-
animationId: string;
|
|
325
|
-
type?: string;
|
|
326
|
-
overlappingWith?: string[];
|
|
327
|
-
expectedDuration?: number;
|
|
328
|
-
actualDuration?: number;
|
|
329
|
-
deviation?: number;
|
|
330
|
-
}
|
|
331
|
-
interface OverlapInfo {
|
|
332
|
-
animation1: string;
|
|
333
|
-
animation2: string;
|
|
334
|
-
overlapStart: number;
|
|
335
|
-
overlapDuration: number;
|
|
336
|
-
}
|
|
337
|
-
interface ChoreographySummary {
|
|
338
|
-
totalAnimations: number;
|
|
339
|
-
totalDuration: number;
|
|
340
|
-
overlaps: OverlapInfo[];
|
|
341
|
-
timeline: TimelineEvent[];
|
|
342
|
-
activeAnimations: AnimationInfo[];
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* ChoreographyTracker - Singleton for tracking animation choreography
|
|
346
|
-
* Detects overlaps, generates timeline, measures actual vs expected timing
|
|
347
|
-
*/
|
|
348
|
-
declare class ChoreographyTrackerClass {
|
|
349
|
-
private activeAnimations;
|
|
350
|
-
private timeline;
|
|
351
|
-
private completedAnimations;
|
|
352
|
-
private sessionStartTime;
|
|
353
|
-
/**
|
|
354
|
-
* Start a new tracking session (call when debug panel is cleared)
|
|
355
|
-
*/
|
|
356
|
-
startSession(): void;
|
|
357
|
-
/**
|
|
358
|
-
* Get relative time since session start
|
|
359
|
-
*/
|
|
360
|
-
private getRelativeTime;
|
|
361
|
-
/**
|
|
362
|
-
* Start tracking an animation
|
|
363
|
-
*/
|
|
364
|
-
startAnimation(id: string, type: AnimationInfo['type'], elementId: string, expectedDuration: number): void;
|
|
365
|
-
/**
|
|
366
|
-
* End tracking an animation
|
|
367
|
-
*/
|
|
368
|
-
endAnimation(id: string): AnimationInfo | undefined;
|
|
369
|
-
/**
|
|
370
|
-
* Detect which animations are overlapping with the given animation
|
|
371
|
-
*/
|
|
372
|
-
private detectOverlaps;
|
|
373
|
-
/**
|
|
374
|
-
* Get all overlap pairs with duration
|
|
375
|
-
*/
|
|
376
|
-
getOverlaps(): OverlapInfo[];
|
|
377
|
-
/**
|
|
378
|
-
* Get current timeline
|
|
379
|
-
*/
|
|
380
|
-
getTimeline(): TimelineEvent[];
|
|
381
|
-
/**
|
|
382
|
-
* Get active animation count
|
|
383
|
-
*/
|
|
384
|
-
getActiveCount(): number;
|
|
385
|
-
/**
|
|
386
|
-
* Get active animations
|
|
387
|
-
*/
|
|
388
|
-
getActiveAnimations(): AnimationInfo[];
|
|
389
|
-
/**
|
|
390
|
-
* Get completed animations
|
|
391
|
-
*/
|
|
392
|
-
getCompletedAnimations(): AnimationInfo[];
|
|
393
|
-
/**
|
|
394
|
-
* Get full choreography summary
|
|
395
|
-
*/
|
|
396
|
-
getSummary(): ChoreographySummary;
|
|
397
|
-
/**
|
|
398
|
-
* Get timeline for visualization (normalized to 0-100%)
|
|
399
|
-
*/
|
|
400
|
-
getTimelineForVisualization(): Array<{
|
|
401
|
-
id: string;
|
|
402
|
-
type: string;
|
|
403
|
-
elementId: string;
|
|
404
|
-
startPercent: number;
|
|
405
|
-
widthPercent: number;
|
|
406
|
-
duration: number;
|
|
407
|
-
isActive: boolean;
|
|
408
|
-
}>;
|
|
409
|
-
}
|
|
410
|
-
declare const choreographyTracker: ChoreographyTrackerClass;
|
|
411
|
-
|
|
1315
|
+
declare const getResponsiveAnimatedTokensStyle: () => React$1.CSSProperties;
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region src/utils/debugCapture.d.ts
|
|
412
1318
|
interface StyleCapture {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
1319
|
+
opacity: string;
|
|
1320
|
+
transform: string;
|
|
1321
|
+
filter: string;
|
|
1322
|
+
width: string;
|
|
1323
|
+
height: string;
|
|
1324
|
+
marginRight: string;
|
|
1325
|
+
marginLeft: string;
|
|
1326
|
+
position: string;
|
|
1327
|
+
visibility: string;
|
|
1328
|
+
pointerEvents: string;
|
|
423
1329
|
}
|
|
424
1330
|
interface PositionCapture {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
1331
|
+
x: number;
|
|
1332
|
+
y: number;
|
|
1333
|
+
width: number;
|
|
1334
|
+
height: number;
|
|
1335
|
+
top: number;
|
|
1336
|
+
left: number;
|
|
1337
|
+
right: number;
|
|
1338
|
+
bottom: number;
|
|
433
1339
|
}
|
|
434
1340
|
interface StyleComparison {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
1341
|
+
property: string;
|
|
1342
|
+
expected: string;
|
|
1343
|
+
actual: string;
|
|
1344
|
+
matches: boolean;
|
|
439
1345
|
}
|
|
440
1346
|
interface TimingResult {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1347
|
+
startTime: number;
|
|
1348
|
+
endTime: number;
|
|
1349
|
+
expectedDuration: number;
|
|
1350
|
+
actualDuration: number;
|
|
1351
|
+
deviation: number;
|
|
1352
|
+
deviationPercent: number;
|
|
447
1353
|
}
|
|
448
1354
|
interface AnimationTimer {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
1355
|
+
start: number;
|
|
1356
|
+
expectedDuration: number;
|
|
1357
|
+
end: () => TimingResult;
|
|
452
1358
|
}
|
|
453
1359
|
/**
|
|
454
1360
|
* Capture relevant computed styles from an element
|
|
@@ -471,10 +1377,10 @@ declare function capturePositionForLog(el: HTMLElement): Record<string, number>;
|
|
|
471
1377
|
* Calculate delta between two positions
|
|
472
1378
|
*/
|
|
473
1379
|
declare function calculatePositionDelta(before: PositionCapture, after: PositionCapture): {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
1380
|
+
deltaX: number;
|
|
1381
|
+
deltaY: number;
|
|
1382
|
+
deltaWidth: number;
|
|
1383
|
+
deltaHeight: number;
|
|
478
1384
|
};
|
|
479
1385
|
/**
|
|
480
1386
|
* Compare expected styles vs actual computed styles
|
|
@@ -498,5 +1404,6 @@ declare function captureAnimationInfo(animation: Animation): Record<string, unkn
|
|
|
498
1404
|
* Capture all active animations on an element
|
|
499
1405
|
*/
|
|
500
1406
|
declare function captureElementAnimations(el: HTMLElement): Record<string, unknown>[];
|
|
501
|
-
|
|
502
|
-
export { ANIMATION_CONFIGS, ANIMATION_DEFAULTS, AnimatedTokens, type AnimatedTokensProps, type
|
|
1407
|
+
//#endregion
|
|
1408
|
+
export { ANIMATION_CONFIGS, ANIMATION_DEFAULTS, AnimatedTokens, type AnimatedTokensProps, AnimatedTokensV2, AnimatedTokensV2 as TextFlow, type AnimatedTokensV2Props, type AnimatedTokensV2Props as TextFlowProps, type AnimationData, AnimationEvent, AnimationOrchestratorAPI, AnimationOrchestratorConfig, AnimationPhase, type AnimationTimer, AnimationTiming, type CSSGridMorphAPI, type CSSGridMorphOptions, CSS_VAR_NAMES, CSS_VAR_VALUES, type DebugEvent, type DebugEventType, DebugProvider, type DurationConfig, EASINGS, EFFECTS, ElementRegistryAPI, ElementRegistryCallbacks, EnterOptions, ExitOptions, ExitPositionStrategy, FLIPAnimationAPI, FLIPAnimationOptions, FLIPBehavior, type FLIPClipPathAPI, type FLIPClipPathOptions, FLIPDelta, type FormatOptions, type ListFormatStyle, type ListFormatType, type ListPart, Morph, MorphContext, type MorphContextValue, type MorphProps, type MorphTechnique, OrchestratorState, PRESETS, type PositionCapture, PositionCaptureAPI, PositionCaptureOptions, type PositionData, PositionRect, RESPONSIVE_CONFIGS, ReorderRoot as Reorder, type ReorderContextValue, type ReorderItemProps, type ReorderItemState, type ReorderLayout, type ReorderProps, SlidingNumber, type SlidingNumberProps, SlidingText, type SlidingTextProps, type StaggerConfig, type StyleCapture, type StyleComparison, type StyleData, TIMING, TRANSFORMS, type TimingData, type TimingResult, type Token, type UseListFormatOptions, type UseMorphOptions, type UseMorphReturn, type UseReorderConfig, type UseReorderPresenceConfig, type UseReorderPresenceReturn, type UseReorderReturn, type ViewTransitionsAPI, type ViewTransitionsOptions, animatedTokensBaseStyles, animatedTokensStyles, calculatePositionDelta, captureAnimationInfo, captureComputedStyles, captureElementAnimations, capturePosition, capturePositionForLog, captureStylesForLog, choreographyTracker, compareStyles, createAnimationTimer, cssVar, formatTimingResult, generateCSSVariables, generateResponsiveCSS, getResponsiveAnimatedTokensStyle, getResponsiveDuration, getResponsiveSlidingTextStyle, getResponsiveStagger, getResponsiveTokenStyles, getSlidingTextTokenStyle, injectCSSVariables, reinjectCSSVariables, removeCSSVariables, responsiveOverrides, slidingTextBaseStyles, slidingTextStyles, useAnimationOrchestrator, useCSSGridMorph, useDebug, useElementRegistry, useFLIPAnimation, useFLIPClipPath, useListFormat, useMorph, useMorphContext, usePositionCapture, useReorder, useReorderPresence, useViewTransitions, useWAAPIAnimations };
|
|
1409
|
+
//# sourceMappingURL=index.d.ts.map
|