react-ui-animate 5.3.1 → 5.4.0-next.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 +12 -706
- package/dist/index.d.ts +60 -9
- package/dist/index.mjs +4041 -1
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,10 @@ interface LoopOptions {
|
|
|
55
55
|
iterations?: number;
|
|
56
56
|
animation?: Descriptor;
|
|
57
57
|
}
|
|
58
|
+
interface StaggerOptions {
|
|
59
|
+
each?: number;
|
|
60
|
+
delay?: number;
|
|
61
|
+
}
|
|
58
62
|
type DriverType = 'spring' | 'timing' | 'decay' | 'delay' | 'sequence' | 'loop';
|
|
59
63
|
interface Descriptor {
|
|
60
64
|
type: DriverType;
|
|
@@ -100,6 +104,19 @@ interface UseInViewOptions extends IntersectionObserverInit {
|
|
|
100
104
|
}
|
|
101
105
|
declare function useInView(ref: RefObject<Element>, options?: UseInViewOptions): boolean;
|
|
102
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Transition config for `layout` / `layoutId`. Prefer the same descriptor
|
|
109
|
+
* helpers used everywhere else in the library — options-only form, since
|
|
110
|
+
* FLIP always settles at identity and there is no target value to declare:
|
|
111
|
+
*
|
|
112
|
+
* layoutOptions={withSpring({ stiffness: 400, damping: 32 })}
|
|
113
|
+
* layoutOptions={withTiming({ duration: 300 })}
|
|
114
|
+
*
|
|
115
|
+
* Raw `SpringOptions` remain supported for backwards compatibility and are
|
|
116
|
+
* treated as an implicit spring.
|
|
117
|
+
*/
|
|
118
|
+
type LayoutOptions = Descriptor | SpringOptions$1;
|
|
119
|
+
|
|
103
120
|
type AnimateValueCompatible = AnimateValue<number> | AnimateValue<string> | AnimateValue<number | string>;
|
|
104
121
|
type CSSPropertiesWithoutTransforms = Omit<CSSProperties, (typeof transformKeys)[number]>;
|
|
105
122
|
type AnimateStyle = {
|
|
@@ -116,7 +133,7 @@ type AnimateSVGAttributes<T> = {
|
|
|
116
133
|
type AnimateProp = {
|
|
117
134
|
[K in keyof AnimateStyle]?: Descriptor | Primitive;
|
|
118
135
|
};
|
|
119
|
-
type AnimateAttributes<T extends EventTarget> = Omit<AnimateHTMLAttributes<T> & AnimateSVGAttributes<T>, 'style' | 'animate' | 'exit' | 'hover' | 'press' | 'focus' | 'view' | 'viewOptions'> & {
|
|
136
|
+
type AnimateAttributes<T extends EventTarget> = Omit<AnimateHTMLAttributes<T> & AnimateSVGAttributes<T>, 'style' | 'animate' | 'exit' | 'hover' | 'press' | 'focus' | 'view' | 'viewOptions' | 'layout' | 'layoutOptions' | 'layoutId'> & {
|
|
120
137
|
style?: AnimateStyle;
|
|
121
138
|
/**
|
|
122
139
|
* Declarative animations to run when the component mounts or updates.
|
|
@@ -146,9 +163,40 @@ type AnimateAttributes<T extends EventTarget> = Omit<AnimateHTMLAttributes<T> &
|
|
|
146
163
|
* Options for the IntersectionObserver used by view animations.
|
|
147
164
|
*/
|
|
148
165
|
viewOptions?: UseInViewOptions;
|
|
166
|
+
/**
|
|
167
|
+
* When true, automatically animates position and size changes caused by
|
|
168
|
+
* layout shifts (reordering, resizing, insertion/removal of siblings, etc.)
|
|
169
|
+
* using a FLIP-style transform animation. Composes with any other transform
|
|
170
|
+
* already applied to the element (via `style`, `animate`, `hover`, `press`,
|
|
171
|
+
* or `view`) instead of overwriting it.
|
|
172
|
+
*/
|
|
173
|
+
layout?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Transition used by `layout` / `layoutId`. Same descriptor helpers as
|
|
176
|
+
* `animate` / `hover` / etc., in options-only form (no target — FLIP
|
|
177
|
+
* always settles at identity):
|
|
178
|
+
*
|
|
179
|
+
* layoutOptions={withSpring({ stiffness: 400, damping: 32 })}
|
|
180
|
+
* layoutOptions={withTiming({ duration: 300 })}
|
|
181
|
+
*
|
|
182
|
+
* Raw spring option objects are still accepted for backwards compatibility.
|
|
183
|
+
*/
|
|
184
|
+
layoutOptions?: LayoutOptions;
|
|
185
|
+
/**
|
|
186
|
+
* Identifies this element as part of a shared layout transition. When an
|
|
187
|
+
* element carrying a given `layoutId` unmounts (or moves elsewhere) and a
|
|
188
|
+
* different element mounts with the same `layoutId`, the new element
|
|
189
|
+
* automatically plays a FLIP-style transform animation from the previous
|
|
190
|
+
* element's last known position/size to its own — useful for tab
|
|
191
|
+
* indicators, expanding cards, and other "morph between elements"
|
|
192
|
+
* patterns. Uses `layoutOptions` for the transition (spring or timing).
|
|
193
|
+
* Note: `layoutId`s are tracked in a single global registry, so keep them
|
|
194
|
+
* unique per active transition group.
|
|
195
|
+
*/
|
|
196
|
+
layoutId?: string;
|
|
149
197
|
};
|
|
150
198
|
|
|
151
|
-
declare function makeAnimated<Tag extends keyof JSX.IntrinsicElements>(tag: Tag): react.ForwardRefExoticComponent<Omit<AnimateHTMLAttributes<HTMLElement> & AnimateSVGAttributes<HTMLElement>, "style" | "animate" | "exit" | "hover" | "press" | "focus" | "view" | "viewOptions"> & {
|
|
199
|
+
declare function makeAnimated<Tag extends keyof JSX.IntrinsicElements>(tag: Tag): react.ForwardRefExoticComponent<Omit<AnimateHTMLAttributes<HTMLElement> & AnimateSVGAttributes<HTMLElement>, "style" | "animate" | "exit" | "hover" | "press" | "focus" | "view" | "viewOptions" | "layout" | "layoutOptions" | "layoutId"> & {
|
|
152
200
|
style?: AnimateStyle;
|
|
153
201
|
animate?: AnimateProp;
|
|
154
202
|
exit?: AnimateProp;
|
|
@@ -157,6 +205,9 @@ declare function makeAnimated<Tag extends keyof JSX.IntrinsicElements>(tag: Tag)
|
|
|
157
205
|
focus?: AnimateProp;
|
|
158
206
|
view?: AnimateProp;
|
|
159
207
|
viewOptions?: UseInViewOptions;
|
|
208
|
+
layout?: boolean;
|
|
209
|
+
layoutOptions?: LayoutOptions;
|
|
210
|
+
layoutId?: string;
|
|
160
211
|
} & react.RefAttributes<HTMLElement>>;
|
|
161
212
|
|
|
162
213
|
declare const animate: { [K in keyof JSX.IntrinsicElements]: ReturnType<typeof makeAnimated<K>>; };
|
|
@@ -274,11 +325,14 @@ declare function combine<T extends any[], U>(inputs: {
|
|
|
274
325
|
|
|
275
326
|
declare function to(input: number, inRange: number[], outRange: (number | string)[], config?: ExtrapolateConfig): number | string;
|
|
276
327
|
|
|
277
|
-
declare
|
|
278
|
-
declare
|
|
328
|
+
declare function withSpring(opts: SpringOptions$1 & Callbacks): Descriptor;
|
|
329
|
+
declare function withSpring(to: Descriptor['to'], opts?: SpringOptions$1 & Callbacks): Descriptor;
|
|
330
|
+
declare function withTiming(opts: TimingOptions$1 & Callbacks): Descriptor;
|
|
331
|
+
declare function withTiming(to: Descriptor['to'], opts?: TimingOptions$1 & Callbacks): Descriptor;
|
|
279
332
|
declare const withDecay: (velocity: number, opts?: DecayOptions$1 & Callbacks) => Descriptor;
|
|
280
333
|
declare const withDelay: (ms: number) => Descriptor;
|
|
281
334
|
declare const withSequence: (animations: Descriptor[], opts?: Omit<Callbacks, "onChange">) => Descriptor;
|
|
335
|
+
declare const withStagger: (index: number, descriptor: Descriptor, opts?: StaggerOptions) => Descriptor;
|
|
282
336
|
declare const withLoop: (animation: Descriptor, iterations?: number, opts?: Omit<Callbacks, "onChange">) => Descriptor;
|
|
283
337
|
|
|
284
338
|
type Widen<T> = T extends number ? number : T extends string ? string : T;
|
|
@@ -356,9 +410,6 @@ declare function useIsPresent(): boolean;
|
|
|
356
410
|
*/
|
|
357
411
|
declare function Presence({ children, initial, onExitComplete, mode, }: PresenceProps): ReactElement;
|
|
358
412
|
|
|
359
|
-
/**
|
|
360
|
-
* Animation Recipes - Pre-built, tested animations for common use cases
|
|
361
|
-
*/
|
|
362
413
|
declare const fadeIn: AnimateProp;
|
|
363
414
|
declare const fadeOut: AnimateProp;
|
|
364
415
|
declare const fadeInUp: AnimateProp;
|
|
@@ -584,5 +635,5 @@ declare function rubberClamp(value: number, lowerbound: number, upperbound: numb
|
|
|
584
635
|
declare function snapTo(value: number, velocity: number, snapPoints: Array<number>): number;
|
|
585
636
|
declare function move(array: Array<any>, moveIndex: number, toIndex: number): any[];
|
|
586
637
|
|
|
587
|
-
export { AnimateValue, Easing, Presence, PresenceContext, animate, bounceIn, bounceOut, clamp, combine, decay, delay, exitFade, exitScale, exitSlideDown, exitSlideUp, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, flipX, flipY, hoverGlow, hoverLift, hoverScale, isAnimateValue, loop, makeAnimated, move, parallel, pressDown, pressScale, recipes, rotateIn, rotateOut, rubberClamp, scaleDown, scaleFadeIn, scaleFadeOut, scaleIn, scaleOut, scaleUp, sequence, slideFadeIn, slideFadeOut, slideInDown, slideInLeft, slideInRight, slideInUp, slideOutDown, slideOutLeft, slideOutRight, slideOutUp, snapTo, spin, spring, timing, to, useDrag, useInView, useIsPresent, useMove, useOutsideClick, usePresence, useRecognizer, useScroll, useScrollProgress, useValue, useWheel, withDecay, withDelay, withLoop, withSequence, withSpring, withTiming, zoomIn, zoomOut };
|
|
588
|
-
export type { AnimateAttributes, AnimateController, AnimateHTMLAttributes, AnimateHooks, AnimateProp, AnimateSVGAttributes, AnimateStyle, Callbacks, Controls, DecayOptions$1 as DecayOptions, DelayOptions, Descriptor, DragConfig, DragEvent, DriverType, ExtrapolateConfig, ExtrapolateType, LoopOptions, MoveEvent, PresenceContextValue, PresenceProps, Primitive, ScrollEvent, SequenceOptions, SpringOptions$1 as SpringOptions, TimingOptions$1 as TimingOptions, UseInViewOptions, UseScrollProgressOptions, WheelEvent };
|
|
638
|
+
export { AnimateValue, Easing, Presence, PresenceContext, animate, bounceIn, bounceOut, clamp, combine, decay, delay, exitFade, exitScale, exitSlideDown, exitSlideUp, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, flipX, flipY, hoverGlow, hoverLift, hoverScale, isAnimateValue, loop, makeAnimated, move, parallel, pressDown, pressScale, recipes, rotateIn, rotateOut, rubberClamp, scaleDown, scaleFadeIn, scaleFadeOut, scaleIn, scaleOut, scaleUp, sequence, slideFadeIn, slideFadeOut, slideInDown, slideInLeft, slideInRight, slideInUp, slideOutDown, slideOutLeft, slideOutRight, slideOutUp, snapTo, spin, spring, timing, to, useDrag, useInView, useIsPresent, useMove, useOutsideClick, usePresence, useRecognizer, useScroll, useScrollProgress, useValue, useWheel, withDecay, withDelay, withLoop, withSequence, withSpring, withStagger, withTiming, zoomIn, zoomOut };
|
|
639
|
+
export type { AnimateAttributes, AnimateController, AnimateHTMLAttributes, AnimateHooks, AnimateProp, AnimateSVGAttributes, AnimateStyle, Callbacks, Controls, DecayOptions$1 as DecayOptions, DelayOptions, Descriptor, DragConfig, DragEvent, DriverType, ExtrapolateConfig, ExtrapolateType, LayoutOptions, LoopOptions, MoveEvent, PresenceContextValue, PresenceProps, Primitive, ScrollEvent, SequenceOptions, SpringOptions$1 as SpringOptions, StaggerOptions, TimingOptions$1 as TimingOptions, UseInViewOptions, UseScrollProgressOptions, WheelEvent };
|