@enact-ui/animate 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/api-schema.json +206 -0
- package/dist/components/CountUp.d.ts +84 -0
- package/dist/components/CountUp.d.ts.map +1 -0
- package/dist/components/CountUp.js +68 -0
- package/dist/components/CountUp.js.map +1 -0
- package/dist/components/MotionDiv.d.ts +159 -0
- package/dist/components/MotionDiv.d.ts.map +1 -0
- package/dist/components/MotionDiv.js +162 -0
- package/dist/components/MotionDiv.js.map +1 -0
- package/dist/components/StaggerContainer.d.ts +136 -0
- package/dist/components/StaggerContainer.d.ts.map +1 -0
- package/dist/components/StaggerContainer.js +166 -0
- package/dist/components/StaggerContainer.js.map +1 -0
- package/dist/hooks/use-component-animation.d.ts +156 -0
- package/dist/hooks/use-component-animation.d.ts.map +1 -0
- package/dist/hooks/use-component-animation.js +231 -0
- package/dist/hooks/use-component-animation.js.map +1 -0
- package/dist/hooks/use-count-up.d.ts +111 -0
- package/dist/hooks/use-count-up.d.ts.map +1 -0
- package/dist/hooks/use-count-up.js +246 -0
- package/dist/hooks/use-count-up.js.map +1 -0
- package/dist/hooks/use-draw-path.d.ts +96 -0
- package/dist/hooks/use-draw-path.d.ts.map +1 -0
- package/dist/hooks/use-draw-path.js +227 -0
- package/dist/hooks/use-draw-path.js.map +1 -0
- package/dist/hooks/use-motion-preset.d.ts.map +1 -1
- package/dist/hooks/use-motion-preset.js +17 -16
- package/dist/hooks/use-motion-preset.js.map +1 -1
- package/dist/hooks/use-stagger.d.ts +174 -0
- package/dist/hooks/use-stagger.d.ts.map +1 -0
- package/dist/hooks/use-stagger.js +256 -0
- package/dist/hooks/use-stagger.js.map +1 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2442 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2335 -25
- package/dist/index.mjs.map +1 -1
- package/dist/presets/component-presets.d.ts +246 -0
- package/dist/presets/component-presets.d.ts.map +1 -0
- package/dist/presets/component-presets.js +472 -0
- package/dist/presets/component-presets.js.map +1 -0
- package/dist/presets/micro-interactions.d.ts +451 -0
- package/dist/presets/micro-interactions.d.ts.map +1 -0
- package/dist/presets/micro-interactions.js +856 -0
- package/dist/presets/micro-interactions.js.map +1 -0
- package/dist/presets/motion-presets.d.ts.map +1 -1
- package/dist/presets/motion-presets.js +0 -1
- package/dist/presets/motion-presets.js.map +1 -1
- package/dist/presets/motion-styles.d.ts +186 -0
- package/dist/presets/motion-styles.d.ts.map +1 -0
- package/dist/presets/motion-styles.js +204 -0
- package/dist/presets/motion-styles.js.map +1 -0
- package/dist/presets/stagger-presets.d.ts +378 -0
- package/dist/presets/stagger-presets.d.ts.map +1 -0
- package/dist/presets/stagger-presets.js +582 -0
- package/dist/presets/stagger-presets.js.map +1 -0
- package/dist/showcase/motion-presets.demo.d.ts +25 -0
- package/dist/showcase/motion-presets.demo.d.ts.map +1 -0
- package/dist/showcase/motion-presets.demo.js +96 -0
- package/dist/showcase/motion-presets.demo.js.map +1 -0
- package/dist/showcase/motion-presets.story.d.ts +37 -0
- package/dist/showcase/motion-presets.story.d.ts.map +1 -0
- package/dist/showcase/motion-presets.story.js +151 -0
- package/dist/showcase/motion-presets.story.js.map +1 -0
- package/dist/utils/easing.d.ts +294 -0
- package/dist/utils/easing.d.ts.map +1 -0
- package/dist/utils/easing.js +265 -0
- package/dist/utils/easing.js.map +1 -0
- package/dist/utils/reduced-motion.d.ts +322 -0
- package/dist/utils/reduced-motion.d.ts.map +1 -0
- package/dist/utils/reduced-motion.js +362 -0
- package/dist/utils/reduced-motion.js.map +1 -0
- package/dist/utils/select-preset.d.ts +186 -0
- package/dist/utils/select-preset.d.ts.map +1 -0
- package/dist/utils/select-preset.js +320 -0
- package/dist/utils/select-preset.js.map +1 -0
- package/dist/utils/spring-configs.d.ts +187 -0
- package/dist/utils/spring-configs.d.ts.map +1 -0
- package/dist/utils/spring-configs.js +169 -0
- package/dist/utils/spring-configs.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// Copyright (c) 2026 Amsterdam Data Labs
|
|
2
|
+
"use client";
|
|
3
|
+
/**
|
|
4
|
+
* useStagger Hook
|
|
5
|
+
*
|
|
6
|
+
* Hook for creating staggered animations for lists and grids.
|
|
7
|
+
* Provides both container and item animation configurations.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import { useMemo } from "react";
|
|
12
|
+
import { getMotionStyle, msToSeconds } from "../presets/motion-styles";
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// Delay Calculation Functions
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Calculates stagger delay based on direction pattern.
|
|
18
|
+
*/
|
|
19
|
+
function calculateDelay(index, total, direction, baseDelay) {
|
|
20
|
+
switch (direction) {
|
|
21
|
+
case "forward":
|
|
22
|
+
return index * baseDelay;
|
|
23
|
+
case "reverse":
|
|
24
|
+
return (total - 1 - index) * baseDelay;
|
|
25
|
+
case "center": {
|
|
26
|
+
const center = (total - 1) / 2;
|
|
27
|
+
const distanceFromCenter = Math.abs(index - center);
|
|
28
|
+
return distanceFromCenter * baseDelay;
|
|
29
|
+
}
|
|
30
|
+
case "edges": {
|
|
31
|
+
const center = (total - 1) / 2;
|
|
32
|
+
const distanceFromCenter = Math.abs(index - center);
|
|
33
|
+
const maxDistance = center;
|
|
34
|
+
return (maxDistance - distanceFromCenter) * baseDelay;
|
|
35
|
+
}
|
|
36
|
+
case "random":
|
|
37
|
+
return Math.random() * total * baseDelay * 0.5;
|
|
38
|
+
default:
|
|
39
|
+
return index * baseDelay;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// Main Hook
|
|
44
|
+
// =============================================================================
|
|
45
|
+
/**
|
|
46
|
+
* Hook for creating staggered animations.
|
|
47
|
+
*
|
|
48
|
+
* Creates container and item variants for Motion library that orchestrate
|
|
49
|
+
* staggered entrance animations for lists and grids.
|
|
50
|
+
*
|
|
51
|
+
* @param style - The motion style to apply
|
|
52
|
+
* @param options - Stagger configuration options
|
|
53
|
+
* @returns Stagger animation configuration
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { motion } from "motion/react";
|
|
58
|
+
* import { useStagger } from "@enact-ui/animate";
|
|
59
|
+
*
|
|
60
|
+
* function AnimatedList({ items }) {
|
|
61
|
+
* const { containerProps, getItemProps } = useStagger("standard");
|
|
62
|
+
*
|
|
63
|
+
* return (
|
|
64
|
+
* <motion.ul {...containerProps}>
|
|
65
|
+
* {items.map((item, index) => (
|
|
66
|
+
* <motion.li key={item.id} {...getItemProps(index)}>
|
|
67
|
+
* {item.content}
|
|
68
|
+
* </motion.li>
|
|
69
|
+
* ))}
|
|
70
|
+
* </motion.ul>
|
|
71
|
+
* );
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Center-out stagger pattern
|
|
78
|
+
* const { containerProps, getItemProps } = useStagger("bold", {
|
|
79
|
+
* direction: "center",
|
|
80
|
+
* totalItems: items.length,
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* // Custom delay function for grid layouts
|
|
87
|
+
* const { containerProps, getItemProps } = useStagger("playful", {
|
|
88
|
+
* getDelay: (index, total) => {
|
|
89
|
+
* const row = Math.floor(index / columns);
|
|
90
|
+
* const col = index % columns;
|
|
91
|
+
* return (row + col) * 50; // Diagonal wave
|
|
92
|
+
* },
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export function useStagger(style = "standard", options = {}) {
|
|
97
|
+
const { direction = "forward", totalItems = 10, delayMultiplier, maxDelay = 1000, useSpring = true, getDelay: customGetDelay } = options;
|
|
98
|
+
const styleConfig = getMotionStyle(style);
|
|
99
|
+
const baseDelay = delayMultiplier ?? styleConfig.staggerDelay;
|
|
100
|
+
const result = useMemo(() => {
|
|
101
|
+
// Calculate the delay for each item
|
|
102
|
+
const getDelayForIndex = (index) => {
|
|
103
|
+
if (customGetDelay) {
|
|
104
|
+
return Math.min(customGetDelay(index, totalItems), maxDelay);
|
|
105
|
+
}
|
|
106
|
+
return Math.min(calculateDelay(index, totalItems, direction, baseDelay), maxDelay);
|
|
107
|
+
};
|
|
108
|
+
// Container variants
|
|
109
|
+
const containerVariants = {
|
|
110
|
+
hidden: { opacity: 0 },
|
|
111
|
+
visible: {
|
|
112
|
+
opacity: 1,
|
|
113
|
+
transition: {
|
|
114
|
+
staggerChildren: msToSeconds(baseDelay),
|
|
115
|
+
delayChildren: 0,
|
|
116
|
+
when: "beforeChildren",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
// Item variants with spring or tween
|
|
121
|
+
const itemTransition = useSpring
|
|
122
|
+
? {
|
|
123
|
+
type: "spring",
|
|
124
|
+
stiffness: styleConfig.spring.stiffness,
|
|
125
|
+
damping: styleConfig.spring.damping,
|
|
126
|
+
mass: styleConfig.spring.mass,
|
|
127
|
+
}
|
|
128
|
+
: {
|
|
129
|
+
type: "tween",
|
|
130
|
+
duration: msToSeconds(styleConfig.duration.normal),
|
|
131
|
+
ease: [0.25, 0.1, 0.25, 1],
|
|
132
|
+
};
|
|
133
|
+
const itemVariants = {
|
|
134
|
+
hidden: {
|
|
135
|
+
opacity: 0,
|
|
136
|
+
y: 20,
|
|
137
|
+
},
|
|
138
|
+
visible: (custom) => ({
|
|
139
|
+
opacity: 1,
|
|
140
|
+
y: 0,
|
|
141
|
+
transition: {
|
|
142
|
+
...itemTransition,
|
|
143
|
+
delay: msToSeconds(getDelayForIndex(custom)),
|
|
144
|
+
},
|
|
145
|
+
}),
|
|
146
|
+
};
|
|
147
|
+
// Container props
|
|
148
|
+
const containerProps = {
|
|
149
|
+
initial: "hidden",
|
|
150
|
+
animate: "visible",
|
|
151
|
+
exit: "hidden",
|
|
152
|
+
variants: containerVariants,
|
|
153
|
+
};
|
|
154
|
+
// Item props factory
|
|
155
|
+
const getItemProps = (index) => ({
|
|
156
|
+
variants: itemVariants,
|
|
157
|
+
custom: index,
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
containerVariants,
|
|
161
|
+
itemVariants,
|
|
162
|
+
containerProps,
|
|
163
|
+
getItemProps,
|
|
164
|
+
};
|
|
165
|
+
}, [direction, totalItems, baseDelay, maxDelay, useSpring, customGetDelay, styleConfig]);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
// =============================================================================
|
|
169
|
+
// Preset Stagger Patterns
|
|
170
|
+
// =============================================================================
|
|
171
|
+
/**
|
|
172
|
+
* Creates a grid stagger pattern (diagonal wave).
|
|
173
|
+
*
|
|
174
|
+
* @param columns - Number of columns in the grid
|
|
175
|
+
* @param baseDelay - Base delay between items in ms
|
|
176
|
+
* @returns Delay function for useStagger
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```tsx
|
|
180
|
+
* const { containerProps, getItemProps } = useStagger("standard", {
|
|
181
|
+
* getDelay: gridStagger(4, 50),
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export function gridStagger(columns, baseDelay = 50) {
|
|
186
|
+
return (index) => {
|
|
187
|
+
const row = Math.floor(index / columns);
|
|
188
|
+
const col = index % columns;
|
|
189
|
+
return (row + col) * baseDelay;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Creates a wave stagger pattern (sine-based).
|
|
194
|
+
*
|
|
195
|
+
* @param amplitude - Wave amplitude (higher = more variation)
|
|
196
|
+
* @param frequency - Wave frequency
|
|
197
|
+
* @param baseDelay - Base delay in ms
|
|
198
|
+
* @returns Delay function for useStagger
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```tsx
|
|
202
|
+
* const { containerProps, getItemProps } = useStagger("playful", {
|
|
203
|
+
* getDelay: waveStagger(100, 0.5, 30),
|
|
204
|
+
* });
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export function waveStagger(amplitude = 100, frequency = 0.5, baseDelay = 30) {
|
|
208
|
+
return (index) => {
|
|
209
|
+
const wave = Math.sin(index * frequency) * amplitude;
|
|
210
|
+
return index * baseDelay + Math.abs(wave);
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Creates a cascade stagger pattern (accelerating).
|
|
215
|
+
*
|
|
216
|
+
* Items start slow and speed up as the animation progresses.
|
|
217
|
+
*
|
|
218
|
+
* @param baseDelay - Base delay in ms
|
|
219
|
+
* @param acceleration - Acceleration factor (0-1)
|
|
220
|
+
* @returns Delay function for useStagger
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```tsx
|
|
224
|
+
* const { containerProps, getItemProps } = useStagger("bold", {
|
|
225
|
+
* getDelay: cascadeStagger(80, 0.8),
|
|
226
|
+
* });
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export function cascadeStagger(baseDelay = 80, acceleration = 0.8) {
|
|
230
|
+
return (index) => {
|
|
231
|
+
const factor = acceleration ** index;
|
|
232
|
+
return baseDelay * (1 - factor) * (1 / (1 - acceleration));
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Creates an explode stagger pattern (from center outward, fast).
|
|
237
|
+
*
|
|
238
|
+
* @param baseDelay - Base delay in ms
|
|
239
|
+
* @returns Delay function for useStagger
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```tsx
|
|
243
|
+
* const { containerProps, getItemProps } = useStagger("playful", {
|
|
244
|
+
* direction: "center",
|
|
245
|
+
* getDelay: explodeStagger(20),
|
|
246
|
+
* });
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
export function explodeStagger(baseDelay = 20) {
|
|
250
|
+
return (index, total) => {
|
|
251
|
+
const center = (total - 1) / 2;
|
|
252
|
+
const distance = Math.abs(index - center);
|
|
253
|
+
return distance * baseDelay;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=use-stagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stagger.js","sourceRoot":"","sources":["../../src/hooks/use-stagger.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,YAAY,CAAC;AAEb;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAoB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAoEzF,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF;;GAEG;AACH,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa,EAAE,SAA2B,EAAE,SAAiB;IAChG,QAAQ,SAAS,EAAE,CAAC;QAChB,KAAK,SAAS;YACV,OAAO,KAAK,GAAG,SAAS,CAAC;QAE7B,KAAK,SAAS;YACV,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,SAAS,CAAC;QAE3C,KAAK,QAAQ,CAAC,CAAC,CAAC;YACZ,MAAM,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;YACpD,OAAO,kBAAkB,GAAG,SAAS,CAAC;QAC1C,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC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Y,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAC,YAAoB,EAAE;IACjD,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;QAC1C,OAAO,QAAQ,GAAG,SAAS,CAAC;IAChC,CAAC,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,26 @@
|
|
|
2
2
|
* @enact-ui/animate
|
|
3
3
|
*
|
|
4
4
|
* Animation utilities and motion presets for ENACT UI.
|
|
5
|
-
*
|
|
5
|
+
* Provides a comprehensive motion preset system for AI-driven UI generation
|
|
6
|
+
* with professional, accessible animations.
|
|
6
7
|
*
|
|
7
8
|
* @packageDocumentation
|
|
8
9
|
*/
|
|
10
|
+
export { CountUp, type CountUpProps } from "./components/CountUp";
|
|
11
|
+
export { createAccessibleMotionProps, createMotionProps, MotionDiv, type MotionDivProps, } from "./components/MotionDiv";
|
|
12
|
+
export { StaggerContainer, type StaggerContainerProps, withStagger, } from "./components/StaggerContainer";
|
|
13
|
+
export { type ComponentAnimationResult, type UseComponentAnimationOptions, useAnimationVariants, useComponentAnimation, useDelayedAnimation, useReducedMotion, } from "./hooks/use-component-animation";
|
|
14
|
+
export { type CountUpEasing, type UseCountUpOptions, type UseCountUpResult, useCountUp, } from "./hooks/use-count-up";
|
|
15
|
+
export { type DrawPathEasing, type UseDrawPathOptions, type UseDrawPathResult, useDrawPath, } from "./hooks/use-draw-path";
|
|
9
16
|
export { type ComputedPathsMotion, type ComputedRaysMotion, useMotionPreset, } from "./hooks/use-motion-preset";
|
|
17
|
+
export { cascadeStagger, explodeStagger, gridStagger, type StaggerDirection, type StaggerOptions, type StaggerResult, useStagger, waveStagger, } from "./hooks/use-stagger";
|
|
18
|
+
export { type AnimationVariants, type ComponentAnimationProps, type ComponentPreset, type ComponentPresetName, componentPresets, expand, fadeIn, fadeOut, flip, getComponentPreset, getPresetsByContext, getPresetsByUseCase, type PresetContext, type PresetMetadata, type PresetOptions, type PresetUseCase, rotate, scale, slideDown, slideLeft, slideRight, slideUp, slideUpScale, zoomIn, zoomOut, } from "./presets/component-presets";
|
|
19
|
+
export { badgePop, buttonPress, cardHover, checkmarkDraw, findPresetsForUseCase, getMicroInteraction, getMicroInteractionNames, glowPulse, heartbeat, iconSpin, type MicroInteractionPreset, type MicroInteractionProps, microInteractions, progressFill, pulse, rubberBand, scale as scaleMicro, shake, shimmer, successFlash, wiggle, } from "./presets/micro-interactions";
|
|
10
20
|
export { type AmbientPathsConfig, ambientPaths, applyMotionPreset, type ComponentType, getPreset, type LightRaysConfig, lightRays, type MotionPreset, type PresetConfig, } from "./presets/motion-presets";
|
|
21
|
+
export { boldStyle, type DurationConfig, type EasingConfig, getDuration, getMotionStyle, getSpringConfig, type MotionStyle, type MotionStyleConfig, motionStyles, msToSeconds, playfulStyle, type SpringConfig, standardStyle, subtleStyle, } from "./presets/motion-styles";
|
|
22
|
+
export { type ContainerVariants, calculateStaggerDelays, getStaggerPreset, type ItemVariants, type StaggerPreset, type StaggerPresetType, staggerCascade, staggerCenter, staggerGrid, staggerPresets, staggerRandom, staggerReverse, staggerSequential, staggerWave, } from "./presets/stagger-presets";
|
|
23
|
+
export { type CubicBezier, createTween, createTweenFromParams, type DurationPresetName, durations, type EasingPresetName, easeIn, easeInOut, easeInOutCubic, easeInOutQuint, easeOut, easeOutBack, easeOutExpo, easeOutQuart, easingPresets, linear, type TweenParams, type TweenPresetName, type TweenTransition, tweenPresets, } from "./utils/easing";
|
|
24
|
+
export { checkReducedMotion, createReducedMotionProps, getReducedMotionVariant, INSTANT_TRANSITION, type MotionProps, type MotionTransition, type MotionVariant, REDUCED_MOTION_QUERY, type ReducedMotionOptions, } from "./utils/reduced-motion";
|
|
25
|
+
export { getAllContexts, getAllPresetNames, getAllUseCases, getDefaultPreset, getPresetMetadata, getRecommendations, type PresetRecommendation, type SelectionCriteria, type SelectionResult, selectPreset, suggestAnimations, } from "./utils/select-preset";
|
|
26
|
+
export { createSpring, createSpringFromParams, type SpringParams, type SpringPresetName, type SpringTransition, springBouncy, springGentle, springPresets, springSnappy, springStiff, } from "./utils/spring-configs";
|
|
11
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACH,2BAA2B,EAC3B,iBAAiB,EACjB,SAAS,EACT,KAAK,cAAc,GACtB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EACH,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,WAAW,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,UAAU,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,WAAW,GACd,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,eAAe,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAA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