framer-motion 6.3.11 → 6.3.12

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.
Files changed (230) hide show
  1. package/dist/cjs/index.js +2 -20
  2. package/dist/es/animation/use-animated-state.mjs +0 -1
  3. package/dist/es/animation/utils/transitions.mjs +0 -2
  4. package/dist/es/context/DeprecatedLayoutGroupContext.mjs +0 -1
  5. package/dist/es/context/LayoutGroupContext.mjs +0 -3
  6. package/dist/es/motion/index.mjs +0 -2
  7. package/dist/es/render/utils/animation.mjs +0 -3
  8. package/dist/es/render/utils/motion-values.mjs +1 -1
  9. package/dist/es/value/index.mjs +1 -4
  10. package/dist/es/value/use-inverted-scale.mjs +0 -1
  11. package/dist/es/value/utils/resolve-motion-value.mjs +0 -2
  12. package/dist/framer-motion.dev.js +2 -20
  13. package/dist/framer-motion.js +1 -1
  14. package/dist/index.d.ts +4118 -0
  15. package/dist/projection.dev.js +2 -9
  16. package/dist/size-rollup-dom-animation.js +1 -1
  17. package/dist/size-rollup-dom-max.js +1 -1
  18. package/dist/three-entry.d.ts +2428 -0
  19. package/package.json +4 -4
  20. package/types/animation/animate.d.ts +0 -54
  21. package/types/animation/animation-controls.d.ts +0 -5
  22. package/types/animation/types.d.ts +0 -79
  23. package/types/animation/use-animated-state.d.ts +0 -6
  24. package/types/animation/use-animation.d.ts +0 -31
  25. package/types/animation/utils/default-transitions.d.ts +0 -19
  26. package/types/animation/utils/easing.d.ts +0 -3
  27. package/types/animation/utils/is-animatable.d.ts +0 -11
  28. package/types/animation/utils/is-animation-controls.d.ts +0 -2
  29. package/types/animation/utils/is-keyframes-target.d.ts +0 -2
  30. package/types/animation/utils/transitions.d.ts +0 -29
  31. package/types/animation/utils/variant-resolvers.d.ts +0 -12
  32. package/types/components/AnimatePresence/PresenceChild.d.ts +0 -12
  33. package/types/components/AnimatePresence/index.d.ts +0 -36
  34. package/types/components/AnimatePresence/types.d.ts +0 -61
  35. package/types/components/AnimatePresence/use-presence.d.ts +0 -52
  36. package/types/components/AnimateSharedLayout.d.ts +0 -2
  37. package/types/components/LayoutGroup/index.d.ts +0 -12
  38. package/types/components/LazyMotion/index.d.ts +0 -38
  39. package/types/components/LazyMotion/types.d.ts +0 -54
  40. package/types/components/MotionConfig/index.d.ts +0 -25
  41. package/types/components/Reorder/Group.d.ts +0 -297
  42. package/types/components/Reorder/Item.d.ts +0 -278
  43. package/types/components/Reorder/index.d.ts +0 -509
  44. package/types/components/Reorder/types.d.ts +0 -10
  45. package/types/components/Reorder/utils/check-reorder.d.ts +0 -2
  46. package/types/context/DeprecatedLayoutGroupContext.d.ts +0 -6
  47. package/types/context/LayoutGroupContext.d.ts +0 -11
  48. package/types/context/LazyContext.d.ts +0 -7
  49. package/types/context/MotionConfigContext.d.ts +0 -36
  50. package/types/context/MotionContext/create.d.ts +0 -3
  51. package/types/context/MotionContext/index.d.ts +0 -9
  52. package/types/context/MotionContext/utils.d.ts +0 -3
  53. package/types/context/PresenceContext.d.ts +0 -17
  54. package/types/context/ReorderContext.d.ts +0 -3
  55. package/types/context/SwitchLayoutGroupContext.d.ts +0 -23
  56. package/types/events/event-info.d.ts +0 -5
  57. package/types/events/types.d.ts +0 -10
  58. package/types/events/use-dom-event.d.ts +0 -24
  59. package/types/events/use-pointer-event.d.ts +0 -4
  60. package/types/events/utils.d.ts +0 -3
  61. package/types/gestures/PanSession.d.ts +0 -127
  62. package/types/gestures/drag/VisualElementDragControls.d.ts +0 -56
  63. package/types/gestures/drag/types.d.ts +0 -294
  64. package/types/gestures/drag/use-drag-controls.d.ts +0 -74
  65. package/types/gestures/drag/use-drag.d.ts +0 -7
  66. package/types/gestures/drag/utils/constraints.d.ts +0 -77
  67. package/types/gestures/drag/utils/lock.d.ts +0 -4
  68. package/types/gestures/types.d.ts +0 -225
  69. package/types/gestures/use-focus-gesture.d.ts +0 -8
  70. package/types/gestures/use-hover-gesture.d.ts +0 -2
  71. package/types/gestures/use-pan-gesture.d.ts +0 -14
  72. package/types/gestures/use-tap-gesture.d.ts +0 -6
  73. package/types/gestures/utils/event-type.d.ts +0 -2
  74. package/types/gestures/utils/is-node-or-child.d.ts +0 -8
  75. package/types/index.d.ts +0 -96
  76. package/types/motion/features/animations.d.ts +0 -2
  77. package/types/motion/features/definitions.d.ts +0 -3
  78. package/types/motion/features/drag.d.ts +0 -2
  79. package/types/motion/features/gestures.d.ts +0 -2
  80. package/types/motion/features/layout/MeasureLayout.d.ts +0 -3
  81. package/types/motion/features/layout/index.d.ts +0 -2
  82. package/types/motion/features/layout/types.d.ts +0 -75
  83. package/types/motion/features/types.d.ts +0 -52
  84. package/types/motion/features/use-features.d.ts +0 -8
  85. package/types/motion/features/use-projection.d.ts +0 -3
  86. package/types/motion/features/viewport/observers.d.ts +0 -3
  87. package/types/motion/features/viewport/types.d.ts +0 -21
  88. package/types/motion/features/viewport/use-viewport.d.ts +0 -2
  89. package/types/motion/index.d.ts +0 -25
  90. package/types/motion/types.d.ts +0 -279
  91. package/types/motion/utils/VisualElementHandler.d.ts +0 -18
  92. package/types/motion/utils/is-forced-motion-value.d.ts +0 -2
  93. package/types/motion/utils/make-renderless-component.d.ts +0 -2
  94. package/types/motion/utils/should-inherit-variant.d.ts +0 -2
  95. package/types/motion/utils/use-motion-ref.d.ts +0 -8
  96. package/types/motion/utils/use-visual-element.d.ts +0 -6
  97. package/types/motion/utils/use-visual-state.d.ts +0 -14
  98. package/types/motion/utils/valid-prop.d.ts +0 -9
  99. package/types/projection/animation/mix-values.d.ts +0 -2
  100. package/types/projection/geometry/conversion.d.ts +0 -14
  101. package/types/projection/geometry/copy.d.ts +0 -13
  102. package/types/projection/geometry/delta-apply.d.ts +0 -37
  103. package/types/projection/geometry/delta-calc.d.ts +0 -10
  104. package/types/projection/geometry/delta-remove.d.ts +0 -20
  105. package/types/projection/geometry/models.d.ts +0 -5
  106. package/types/projection/geometry/types.d.ts +0 -29
  107. package/types/projection/geometry/utils.d.ts +0 -3
  108. package/types/projection/index.d.ts +0 -14
  109. package/types/projection/node/DocumentProjectionNode.d.ts +0 -108
  110. package/types/projection/node/HTMLProjectionNode.d.ts +0 -112
  111. package/types/projection/node/create-projection-node.d.ts +0 -301
  112. package/types/projection/node/group.d.ts +0 -7
  113. package/types/projection/node/id.d.ts +0 -1
  114. package/types/projection/node/types.d.ts +0 -136
  115. package/types/projection/shared/stack.d.ts +0 -17
  116. package/types/projection/styles/scale-border-radius.d.ts +0 -11
  117. package/types/projection/styles/scale-box-shadow.d.ts +0 -2
  118. package/types/projection/styles/scale-correction.d.ts +0 -3
  119. package/types/projection/styles/transform-origin.d.ts +0 -0
  120. package/types/projection/styles/transform.d.ts +0 -4
  121. package/types/projection/styles/types.d.ts +0 -9
  122. package/types/projection/use-instant-layout-transition.d.ts +0 -1
  123. package/types/projection/use-reset-projection.d.ts +0 -1
  124. package/types/projection/utils/each-axis.d.ts +0 -3
  125. package/types/projection/utils/has-transform.d.ts +0 -3
  126. package/types/projection/utils/measure.d.ts +0 -4
  127. package/types/render/dom/create-visual-element.d.ts +0 -2
  128. package/types/render/dom/features-animation.d.ts +0 -5
  129. package/types/render/dom/features-max.d.ts +0 -5
  130. package/types/render/dom/motion-minimal.d.ts +0 -5
  131. package/types/render/dom/motion-proxy.d.ts +0 -30
  132. package/types/render/dom/motion.d.ts +0 -25
  133. package/types/render/dom/types.d.ts +0 -28
  134. package/types/render/dom/use-render.d.ts +0 -4
  135. package/types/render/dom/utils/camel-to-dash.d.ts +0 -4
  136. package/types/render/dom/utils/create-config.d.ts +0 -8
  137. package/types/render/dom/utils/css-variables-conversion.d.ts +0 -22
  138. package/types/render/dom/utils/filter-props.d.ts +0 -4
  139. package/types/render/dom/utils/is-css-variable.d.ts +0 -4
  140. package/types/render/dom/utils/is-svg-component.d.ts +0 -2
  141. package/types/render/dom/utils/parse-dom-variant.d.ts +0 -6
  142. package/types/render/dom/utils/unit-conversion.d.ts +0 -27
  143. package/types/render/dom/value-types/animatable-none.d.ts +0 -1
  144. package/types/render/dom/value-types/defaults.d.ts +0 -9
  145. package/types/render/dom/value-types/dimensions.d.ts +0 -8
  146. package/types/render/dom/value-types/find.d.ts +0 -9
  147. package/types/render/dom/value-types/get-as-type.d.ts +0 -5
  148. package/types/render/dom/value-types/number.d.ts +0 -2
  149. package/types/render/dom/value-types/test.d.ts +0 -5
  150. package/types/render/dom/value-types/type-auto.d.ts +0 -5
  151. package/types/render/dom/value-types/type-int.d.ts +0 -8
  152. package/types/render/dom/value-types/types.d.ts +0 -4
  153. package/types/render/html/config-motion.d.ts +0 -3
  154. package/types/render/html/supported-elements.d.ts +0 -7
  155. package/types/render/html/types.d.ts +0 -61
  156. package/types/render/html/use-props.d.ts +0 -8
  157. package/types/render/html/utils/build-styles.d.ts +0 -5
  158. package/types/render/html/utils/build-transform.d.ts +0 -15
  159. package/types/render/html/utils/create-render-state.d.ts +0 -7
  160. package/types/render/html/utils/render.d.ts +0 -4
  161. package/types/render/html/utils/scrape-motion-values.d.ts +0 -2
  162. package/types/render/html/utils/transform.d.ts +0 -15
  163. package/types/render/html/visual-element.d.ts +0 -6
  164. package/types/render/index.d.ts +0 -2
  165. package/types/render/svg/config-motion.d.ts +0 -3
  166. package/types/render/svg/lowercase-elements.d.ts +0 -5
  167. package/types/render/svg/supported-elements.d.ts +0 -7
  168. package/types/render/svg/types.d.ts +0 -44
  169. package/types/render/svg/use-props.d.ts +0 -7
  170. package/types/render/svg/utils/build-attrs.d.ts +0 -8
  171. package/types/render/svg/utils/camel-case-attrs.d.ts +0 -4
  172. package/types/render/svg/utils/create-render-state.d.ts +0 -2
  173. package/types/render/svg/utils/path.d.ts +0 -9
  174. package/types/render/svg/utils/render.d.ts +0 -4
  175. package/types/render/svg/utils/scrape-motion-values.d.ts +0 -2
  176. package/types/render/svg/utils/transform-origin.d.ts +0 -6
  177. package/types/render/svg/visual-element.d.ts +0 -2
  178. package/types/render/types.d.ts +0 -113
  179. package/types/render/utils/animation-state.d.ts +0 -31
  180. package/types/render/utils/animation.d.ts +0 -21
  181. package/types/render/utils/compare-by-depth.d.ts +0 -5
  182. package/types/render/utils/flat-tree.d.ts +0 -8
  183. package/types/render/utils/is-draggable.d.ts +0 -2
  184. package/types/render/utils/lifecycles.d.ts +0 -114
  185. package/types/render/utils/motion-values.d.ts +0 -3
  186. package/types/render/utils/setters.d.ts +0 -792
  187. package/types/render/utils/types.d.ts +0 -9
  188. package/types/render/utils/variants.d.ts +0 -20
  189. package/types/three-entry.d.ts +0 -19
  190. package/types/types.d.ts +0 -981
  191. package/types/utils/array.d.ts +0 -3
  192. package/types/utils/each-axis.d.ts +0 -1
  193. package/types/utils/is-browser.d.ts +0 -1
  194. package/types/utils/is-numerical-string.d.ts +0 -4
  195. package/types/utils/is-ref-object.d.ts +0 -2
  196. package/types/utils/is-zero-value-string.d.ts +0 -4
  197. package/types/utils/noop.d.ts +0 -1
  198. package/types/utils/process.d.ts +0 -1
  199. package/types/utils/resolve-value.d.ts +0 -3
  200. package/types/utils/shallow-compare.d.ts +0 -1
  201. package/types/utils/subscription-manager.d.ts +0 -9
  202. package/types/utils/time-conversion.d.ts +0 -7
  203. package/types/utils/transform.d.ts +0 -91
  204. package/types/utils/use-animation-frame.d.ts +0 -2
  205. package/types/utils/use-constant.d.ts +0 -10
  206. package/types/utils/use-cycle.d.ts +0 -30
  207. package/types/utils/use-force-update.d.ts +0 -1
  208. package/types/utils/use-id.d.ts +0 -6
  209. package/types/utils/use-instant-transition-state.d.ts +0 -3
  210. package/types/utils/use-instant-transition.d.ts +0 -1
  211. package/types/utils/use-is-mounted.d.ts +0 -2
  212. package/types/utils/use-isomorphic-effect.d.ts +0 -2
  213. package/types/utils/use-reduced-motion.d.ts +0 -28
  214. package/types/utils/use-unmount-effect.d.ts +0 -1
  215. package/types/utils/warn-once.d.ts +0 -2
  216. package/types/value/index.d.ts +0 -260
  217. package/types/value/scroll/use-element-scroll.d.ts +0 -28
  218. package/types/value/scroll/use-viewport-scroll.d.ts +0 -22
  219. package/types/value/scroll/utils.d.ts +0 -19
  220. package/types/value/use-combine-values.d.ts +0 -2
  221. package/types/value/use-inverted-scale.d.ts +0 -28
  222. package/types/value/use-motion-template.d.ts +0 -24
  223. package/types/value/use-motion-value.d.ts +0 -19
  224. package/types/value/use-on-change.d.ts +0 -3
  225. package/types/value/use-spring.d.ts +0 -22
  226. package/types/value/use-time.d.ts +0 -1
  227. package/types/value/use-transform.d.ts +0 -93
  228. package/types/value/use-velocity.d.ts +0 -13
  229. package/types/value/utils/is-motion-value.d.ts +0 -2
  230. package/types/value/utils/resolve-motion-value.d.ts +0 -10
package/types/types.d.ts DELETED
@@ -1,981 +0,0 @@
1
- import { CSSProperties, SVGAttributes } from "react";
2
- import { TransformProperties, CustomStyles, SVGPathProperties } from "./motion/types";
3
- /**
4
- * @public
5
- */
6
- export declare type ResolvedKeyframesTarget = [null, ...number[]] | number[] | [null, ...string[]] | string[];
7
- /**
8
- * @public
9
- */
10
- export declare type KeyframesTarget = ResolvedKeyframesTarget | [null, ...CustomValueType[]] | CustomValueType[];
11
- /**
12
- * @public
13
- */
14
- export declare type ResolvedSingleTarget = string | number;
15
- /**
16
- * @public
17
- */
18
- export declare type SingleTarget = ResolvedSingleTarget | CustomValueType;
19
- /**
20
- * @public
21
- */
22
- export declare type ResolvedValueTarget = ResolvedSingleTarget | ResolvedKeyframesTarget;
23
- /**
24
- * @public
25
- */
26
- export declare type ValueTarget = SingleTarget | KeyframesTarget;
27
- /**
28
- * @public
29
- */
30
- export declare type Props = {
31
- [key: string]: any;
32
- };
33
- /**
34
- * A function that accepts a progress value between `0` and `1` and returns a
35
- * new one.
36
- *
37
- * ```jsx
38
- * <motion.div
39
- * animate={{ opacity: 0 }}
40
- * transition={{
41
- * duration: 1,
42
- * ease: progress => progress * progress
43
- * }}
44
- * />
45
- * ```
46
- *
47
- * @public
48
- */
49
- export declare type EasingFunction = (v: number) => number;
50
- /**
51
- * The easing function to use. Set as one of:
52
- *
53
- * - The name of an in-built easing function.
54
- * - An array of four numbers to define a cubic bezier curve.
55
- * - An easing function, that accepts and returns a progress value between `0` and `1`.
56
- *
57
- * @public
58
- */
59
- export declare type Easing = [number, number, number, number] | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate" | EasingFunction;
60
- /**
61
- * Options for orchestrating the timing of animations.
62
- *
63
- * @public
64
- */
65
- export interface Orchestration {
66
- /**
67
- * Delay the animation by this duration (in seconds). Defaults to `0`.
68
- *
69
- * @remarks
70
- * ```javascript
71
- * const transition = {
72
- * delay: 0.2
73
- * }
74
- * ```
75
- *
76
- * @public
77
- */
78
- delay?: number;
79
- /**
80
- * Describes the relationship between the transition and its children. Set
81
- * to `false` by default.
82
- *
83
- * @remarks
84
- * When using variants, the transition can be scheduled in relation to its
85
- * children with either `"beforeChildren"` to finish this transition before
86
- * starting children transitions, `"afterChildren"` to finish children
87
- * transitions before starting this transition.
88
- *
89
- * ```jsx
90
- * const list = {
91
- * hidden: {
92
- * opacity: 0,
93
- * transition: { when: "afterChildren" }
94
- * }
95
- * }
96
- *
97
- * const item = {
98
- * hidden: {
99
- * opacity: 0,
100
- * transition: { duration: 2 }
101
- * }
102
- * }
103
- *
104
- * return (
105
- * <motion.ul variants={list} animate="hidden">
106
- * <motion.li variants={item} />
107
- * <motion.li variants={item} />
108
- * </motion.ul>
109
- * )
110
- * ```
111
- *
112
- * @public
113
- */
114
- when?: false | "beforeChildren" | "afterChildren" | string;
115
- /**
116
- * When using variants, children animations will start after this duration
117
- * (in seconds). You can add the `transition` property to both the `Frame` and the `variant` directly. Adding it to the `variant` generally offers more flexibility, as it allows you to customize the delay per visual state.
118
- *
119
- * ```jsx
120
- * const container = {
121
- * hidden: { opacity: 0 },
122
- * show: {
123
- * opacity: 1,
124
- * transition: {
125
- * delayChildren: 0.5
126
- * }
127
- * }
128
- * }
129
- *
130
- * const item = {
131
- * hidden: { opacity: 0 },
132
- * show: { opacity: 1 }
133
- * }
134
- *
135
- * return (
136
- * <motion.ul
137
- * variants={container}
138
- * initial="hidden"
139
- * animate="show"
140
- * >
141
- * <motion.li variants={item} />
142
- * <motion.li variants={item} />
143
- * </motion.ul>
144
- * )
145
- * ```
146
- *
147
- * @public
148
- */
149
- delayChildren?: number;
150
- /**
151
- * When using variants, animations of child components can be staggered by this
152
- * duration (in seconds).
153
- *
154
- * For instance, if `staggerChildren` is `0.01`, the first child will be
155
- * delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
156
- * on.
157
- *
158
- * The calculated stagger delay will be added to `delayChildren`.
159
- *
160
- * ```jsx
161
- * const container = {
162
- * hidden: { opacity: 0 },
163
- * show: {
164
- * opacity: 1,
165
- * transition: {
166
- * staggerChildren: 0.5
167
- * }
168
- * }
169
- * }
170
- *
171
- * const item = {
172
- * hidden: { opacity: 0 },
173
- * show: { opacity: 1 }
174
- * }
175
- *
176
- * return (
177
- * <motion.ol
178
- * variants={container}
179
- * initial="hidden"
180
- * animate="show"
181
- * >
182
- * <motion.li variants={item} />
183
- * <motion.li variants={item} />
184
- * </motion.ol>
185
- * )
186
- * ```
187
- *
188
- * @public
189
- */
190
- staggerChildren?: number;
191
- /**
192
- * The direction in which to stagger children.
193
- *
194
- * A value of `1` staggers from the first to the last while `-1`
195
- * staggers from the last to the first.
196
- *
197
- * ```jsx
198
- * const container = {
199
- * hidden: { opacity: 0 },
200
- * show: {
201
- * opacity: 1,
202
- * transition: {
203
- * delayChildren: 0.5,
204
- * staggerDirection: -1
205
- * }
206
- * }
207
- * }
208
- *
209
- * const item = {
210
- * hidden: { opacity: 0 },
211
- * show: { opacity: 1 }
212
- * }
213
- *
214
- * return (
215
- * <motion.ul
216
- * variants={container}
217
- * initial="hidden"
218
- * animate="show"
219
- * >
220
- * <motion.li variants={item} size={50} />
221
- * <motion.li variants={item} size={50} />
222
- * </motion.ul>
223
- * )
224
- * ```
225
- *
226
- * @public
227
- */
228
- staggerDirection?: number;
229
- }
230
- export interface Repeat {
231
- /**
232
- * The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
233
- *
234
- * Without setting `repeatType`, this will loop the animation.
235
- *
236
- * ```jsx
237
- * <motion.div
238
- * animate={{ rotate: 180 }}
239
- * transition={{ repeat: Infinity, duration: 2 }}
240
- * />
241
- * ```
242
- *
243
- * @public
244
- */
245
- repeat?: number;
246
- /**
247
- * How to repeat the animation. This can be either:
248
- *
249
- * "loop": Repeats the animation from the start
250
- *
251
- * "reverse": Alternates between forward and backwards playback
252
- *
253
- * "mirror": Switches `from` and `to` alternately
254
- *
255
- * ```jsx
256
- * <motion.div
257
- * animate={{ rotate: 180 }}
258
- * transition={{
259
- * repeat: 1,
260
- * repeatType: "reverse",
261
- * duration: 2
262
- * }}
263
- * />
264
- * ```
265
- *
266
- * @public
267
- */
268
- repeatType?: "loop" | "reverse" | "mirror";
269
- /**
270
- * When repeating an animation, `repeatDelay` will set the
271
- * duration of the time to wait, in seconds, between each repetition.
272
- *
273
- * ```jsx
274
- * <motion.div
275
- * animate={{ rotate: 180 }}
276
- * transition={{ repeat: Infinity, repeatDelay: 1 }}
277
- * />
278
- * ```
279
- *
280
- * @public
281
- */
282
- repeatDelay?: number;
283
- }
284
- /**
285
- * An animation that animates between two or more values over a specific duration of time.
286
- * This is the default animation for non-physical values like `color` and `opacity`.
287
- *
288
- * @public
289
- */
290
- export interface Tween extends Repeat {
291
- /**
292
- * Set `type` to `"tween"` to use a duration-based tween animation.
293
- * If any non-orchestration `transition` values are set without a `type` property,
294
- * this is used as the default animation.
295
- *
296
- * ```jsx
297
- * <motion.path
298
- * animate={{ pathLength: 1 }}
299
- * transition={{ duration: 2, type: "tween" }}
300
- * />
301
- * ```
302
- *
303
- * @public
304
- */
305
- type?: "tween";
306
- /**
307
- * The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
308
- *
309
- * ```jsx
310
- * const variants = {
311
- * visible: {
312
- * opacity: 1,
313
- * transition: { duration: 2 }
314
- * }
315
- * }
316
- * ```
317
- *
318
- * @public
319
- */
320
- duration?: number;
321
- /**
322
- * The easing function to use. Set as one of the below.
323
- *
324
- * - The name of an existing easing function.
325
- *
326
- * - An array of four numbers to define a cubic bezier curve.
327
- *
328
- * - An easing function, that accepts and returns a value `0-1`.
329
- *
330
- * If the animating value is set as an array of multiple values for a keyframes
331
- * animation, `ease` can be set as an array of easing functions to set different easings between
332
- * each of those values.
333
- *
334
- *
335
- * ```jsx
336
- * <motion.div
337
- * animate={{ opacity: 0 }}
338
- * transition={{ ease: [0.17, 0.67, 0.83, 0.67] }}
339
- * />
340
- * ```
341
- *
342
- * @public
343
- */
344
- ease?: Easing | Easing[];
345
- /**
346
- * The duration of time already elapsed in the animation. Set to `0` by
347
- * default.
348
- *
349
- * @internal
350
- */
351
- elapsed?: number;
352
- /**
353
- * When animating keyframes, `times` can be used to determine where in the animation each keyframe is reached.
354
- * Each value in `times` is a value between `0` and `1`, representing `duration`.
355
- *
356
- * There must be the same number of `times` as there are keyframes.
357
- * Defaults to an array of evenly-spread durations.
358
- *
359
- * ```jsx
360
- * <motion.div
361
- * animate={{ scale: [0, 1, 0.5, 1] }}
362
- * transition={{ times: [0, 0.1, 0.9, 1] }}
363
- * />
364
- * ```
365
- *
366
- * @public
367
- */
368
- times?: number[];
369
- /**
370
- * When animating keyframes, `easings` can be used to define easing functions between each keyframe. This array should be one item fewer than the number of keyframes, as these easings apply to the transitions between the keyframes.
371
- *
372
- * ```jsx
373
- * <motion.div
374
- * animate={{ backgroundColor: ["#0f0", "#00f", "#f00"] }}
375
- * transition={{ easings: ["easeIn", "easeOut"] }}
376
- * />
377
- * ```
378
- *
379
- * @public
380
- */
381
- easings?: Easing[];
382
- /**
383
- * The value to animate from.
384
- * By default, this is the current state of the animating value.
385
- *
386
- * ```jsx
387
- * <motion.div
388
- * animate={{ rotate: 180 }}
389
- * transition={{ from: 90, duration: 2 }}
390
- * />
391
- * ```
392
- *
393
- * @public
394
- */
395
- from?: number | string;
396
- /**
397
- * @internal
398
- */
399
- to?: number | string | ValueTarget;
400
- /**
401
- * @internal
402
- */
403
- velocity?: number;
404
- /**
405
- * @internal
406
- */
407
- delay?: number;
408
- }
409
- /**
410
- * An animation that simulates spring physics for realistic motion.
411
- * This is the default animation for physical values like `x`, `y`, `scale` and `rotate`.
412
- *
413
- * @public
414
- */
415
- export interface Spring extends Repeat {
416
- /**
417
- * Set `type` to `"spring"` to animate using spring physics for natural
418
- * movement. Type is set to `"spring"` by default.
419
- *
420
- * ```jsx
421
- * <motion.div
422
- * animate={{ rotate: 180 }}
423
- * transition={{ type: 'spring' }}
424
- * />
425
- * ```
426
- *
427
- * @public
428
- */
429
- type: "spring";
430
- /**
431
- * Stiffness of the spring. Higher values will create more sudden movement.
432
- * Set to `100` by default.
433
- *
434
- * ```jsx
435
- * <motion.section
436
- * animate={{ rotate: 180 }}
437
- * transition={{ type: 'spring', stiffness: 50 }}
438
- * />
439
- * ```
440
- *
441
- * @public
442
- */
443
- stiffness?: number;
444
- /**
445
- * Strength of opposing force. If set to 0, spring will oscillate
446
- * indefinitely. Set to `10` by default.
447
- *
448
- * ```jsx
449
- * <motion.a
450
- * animate={{ rotate: 180 }}
451
- * transition={{ type: 'spring', damping: 300 }}
452
- * />
453
- * ```
454
- *
455
- * @public
456
- */
457
- damping?: number;
458
- /**
459
- * Mass of the moving object. Higher values will result in more lethargic
460
- * movement. Set to `1` by default.
461
- *
462
- * ```jsx
463
- * <motion.feTurbulence
464
- * animate={{ baseFrequency: 0.5 } as any}
465
- * transition={{ type: "spring", mass: 0.5 }}
466
- * />
467
- * ```
468
- *
469
- * @public
470
- */
471
- mass?: number;
472
- /**
473
- * The duration of the animation, defined in seconds. Spring animations can be a maximum of 10 seconds.
474
- *
475
- * If `bounce` is set, this defaults to `0.8`.
476
- *
477
- * Note: `duration` and `bounce` will be overridden if `stiffness`, `damping` or `mass` are set.
478
- *
479
- * ```jsx
480
- * <motion.div
481
- * animate={{ x: 100 }}
482
- * transition={{ type: "spring", duration: 0.8 }}
483
- * />
484
- * ```
485
- *
486
- * @public
487
- */
488
- duration?: number;
489
- /**
490
- * `bounce` determines the "bounciness" of a spring animation.
491
- *
492
- * `0` is no bounce, and `1` is extremely bouncy.
493
- *
494
- * If `duration` is set, this defaults to `0.25`.
495
- *
496
- * Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
497
- *
498
- * ```jsx
499
- * <motion.div
500
- * animate={{ x: 100 }}
501
- * transition={{ type: "spring", bounce: 0.25 }}
502
- * />
503
- * ```
504
- *
505
- * @public
506
- */
507
- bounce?: number;
508
- /**
509
- * End animation if absolute speed (in units per second) drops below this
510
- * value and delta is smaller than `restDelta`. Set to `0.01` by default.
511
- *
512
- * ```jsx
513
- * <motion.div
514
- * animate={{ rotate: 180 }}
515
- * transition={{ type: 'spring', restSpeed: 0.5 }}
516
- * />
517
- * ```
518
- *
519
- * @public
520
- */
521
- restSpeed?: number;
522
- /**
523
- * End animation if distance is below this value and speed is below
524
- * `restSpeed`. When animation ends, spring gets “snapped” to. Set to
525
- * `0.01` by default.
526
- *
527
- * ```jsx
528
- * <motion.div
529
- * animate={{ rotate: 180 }}
530
- * transition={{ type: 'spring', restDelta: 0.5 }}
531
- * />
532
- * ```
533
- *
534
- * @public
535
- */
536
- restDelta?: number;
537
- /**
538
- * The value to animate from.
539
- * By default, this is the initial state of the animating value.
540
- *
541
- * ```jsx
542
- * <motion.div
543
- * animate={{ rotate: 180 }}
544
- * transition={{ type: 'spring', from: 90 }}
545
- * />
546
- * ```
547
- *
548
- * @public
549
- */
550
- from?: number | string;
551
- /**
552
- * @internal
553
- */
554
- to?: number | string | ValueTarget;
555
- /**
556
- * The initial velocity of the spring. By default this is the current velocity of the component.
557
- *
558
- * ```jsx
559
- * <motion.div
560
- * animate={{ rotate: 180 }}
561
- * transition={{ type: 'spring', velocity: 2 }}
562
- * />
563
- * ```
564
- *
565
- * @public
566
- */
567
- velocity?: number;
568
- /**
569
- * @internal
570
- */
571
- delay?: number;
572
- }
573
- /**
574
- * An animation that decelerates a value based on its initial velocity,
575
- * usually used to implement inertial scrolling.
576
- *
577
- * Optionally, `min` and `max` boundaries can be defined, and inertia
578
- * will snap to these with a spring animation.
579
- *
580
- * This animation will automatically precalculate a target value,
581
- * which can be modified with the `modifyTarget` property.
582
- *
583
- * This allows you to add snap-to-grid or similar functionality.
584
- *
585
- * Inertia is also the animation used for `dragTransition`, and can be configured via that prop.
586
- *
587
- * @public
588
- */
589
- export interface Inertia {
590
- /**
591
- * Set `type` to animate using the inertia animation. Set to `"tween"` by
592
- * default. This can be used for natural deceleration, like momentum scrolling.
593
- *
594
- * ```jsx
595
- * <motion.div
596
- * animate={{ rotate: 180 }}
597
- * transition={{ type: "inertia", velocity: 50 }}
598
- * />
599
- * ```
600
- *
601
- * @public
602
- */
603
- type: "inertia";
604
- /**
605
- * A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
606
- *
607
- * ```jsx
608
- * <motion.div
609
- * drag
610
- * dragTransition={{
611
- * power: 0,
612
- * // Snap calculated target to nearest 50 pixels
613
- * modifyTarget: target => Math.round(target / 50) * 50
614
- * }}
615
- * />
616
- * ```
617
- *
618
- * @public
619
- */
620
- modifyTarget?(v: number): number;
621
- /**
622
- * If `min` or `max` is set, this affects the stiffness of the bounce
623
- * spring. Higher values will create more sudden movement. Set to `500` by
624
- * default.
625
- *
626
- * ```jsx
627
- * <motion.div
628
- * drag
629
- * dragTransition={{
630
- * min: 0,
631
- * max: 100,
632
- * bounceStiffness: 100
633
- * }}
634
- * />
635
- * ```
636
- *
637
- * @public
638
- */
639
- bounceStiffness?: number;
640
- /**
641
- * If `min` or `max` is set, this affects the damping of the bounce spring.
642
- * If set to `0`, spring will oscillate indefinitely. Set to `10` by
643
- * default.
644
- *
645
- * ```jsx
646
- * <motion.div
647
- * drag
648
- * dragTransition={{
649
- * min: 0,
650
- * max: 100,
651
- * bounceDamping: 8
652
- * }}
653
- * />
654
- * ```
655
- *
656
- * @public
657
- */
658
- bounceDamping?: number;
659
- /**
660
- * A higher power value equals a further target. Set to `0.8` by default.
661
- *
662
- * ```jsx
663
- * <motion.div
664
- * drag
665
- * dragTransition={{ power: 0.2 }}
666
- * />
667
- * ```
668
- *
669
- * @public
670
- */
671
- power?: number;
672
- /**
673
- * Adjusting the time constant will change the duration of the
674
- * deceleration, thereby affecting its feel. Set to `700` by default.
675
- *
676
- * ```jsx
677
- * <motion.div
678
- * drag
679
- * dragTransition={{ timeConstant: 200 }}
680
- * />
681
- * ```
682
- *
683
- * @public
684
- */
685
- timeConstant?: number;
686
- /**
687
- * End the animation if the distance to the animation target is below this value, and the absolute speed is below `restSpeed`.
688
- * When the animation ends, the value gets snapped to the animation target. Set to `0.01` by default.
689
- * Generally the default values provide smooth animation endings, only in rare cases should you need to customize these.
690
- *
691
- * ```jsx
692
- * <motion.div
693
- * drag
694
- * dragTransition={{ restDelta: 10 }}
695
- * />
696
- * ```
697
- *
698
- * @public
699
- */
700
- restDelta?: number;
701
- /**
702
- * Minimum constraint. If set, the value will "bump" against this value (or immediately spring to it if the animation starts as less than this value).
703
- *
704
- * ```jsx
705
- * <motion.div
706
- * drag
707
- * dragTransition={{ min: 0, max: 100 }}
708
- * />
709
- * ```
710
- *
711
- * @public
712
- */
713
- min?: number;
714
- /**
715
- * Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
716
- *
717
- * ```jsx
718
- * <motion.div
719
- * drag
720
- * dragTransition={{ min: 0, max: 100 }}
721
- * />
722
- * ```
723
- *
724
- * @public
725
- */
726
- max?: number;
727
- /**
728
- * The value to animate from. By default, this is the current state of the animating value.
729
- *
730
- * ```jsx
731
- * <Frame
732
- * drag
733
- * dragTransition={{ from: 50 }}
734
- * />
735
- * ```
736
- *
737
- * @public
738
- */
739
- from?: number | string;
740
- /**
741
- * The initial velocity of the animation.
742
- * By default this is the current velocity of the component.
743
- *
744
- * ```jsx
745
- * <motion.div
746
- * animate={{ rotate: 180 }}
747
- * transition={{ type: 'inertia', velocity: 200 }}
748
- * />
749
- * ```
750
- *
751
- * @public
752
- */
753
- velocity?: number;
754
- /**
755
- * @internal
756
- */
757
- delay?: number;
758
- }
759
- /**
760
- * Keyframes tweens between multiple `values`.
761
- *
762
- * These tweens can be arranged using the `duration`, `easings`, and `times` properties.
763
- *
764
- * @internalremarks
765
- * We could possibly make the `type` property redundant, if not for all animations
766
- * then for this one quite easily.
767
- *
768
- * @internal
769
- */
770
- export interface Keyframes {
771
- /**
772
- * Set `type` to `"keyframes"` to animate using the keyframes animation.
773
- * Set to `"tween"` by default. This can be used to animate between a series of values.
774
- *
775
- * @public
776
- */
777
- type: "keyframes";
778
- /**
779
- * An array of values to animate between.
780
- *
781
- * @internal
782
- */
783
- values: KeyframesTarget;
784
- /**
785
- * An array of numbers between 0 and 1, where `1` represents the `total` duration.
786
- *
787
- * Each value represents at which point during the animation each item in the animation target should be hit, so the array should be the same length as `values`.
788
- *
789
- * Defaults to an array of evenly-spread durations.
790
- *
791
- * @public
792
- */
793
- times?: number[];
794
- /**
795
- * An array of easing functions for each generated tween, or a single easing function applied to all tweens.
796
- *
797
- * This array should be one item less than `values`, as these easings apply to the transitions *between* the `values`.
798
- *
799
- * ```jsx
800
- * const transition = {
801
- * backgroundColor: {
802
- * type: 'keyframes',
803
- * easings: ['circIn', 'circOut']
804
- * }
805
- * }
806
- * ```
807
- *
808
- * @public
809
- */
810
- ease?: Easing | Easing[];
811
- /**
812
- * Popmotion's easing prop to define individual easings. `ease` will be mapped to this prop in keyframes animations.
813
- *
814
- * @internal
815
- */
816
- easings?: Easing | Easing[];
817
- /**
818
- * @internal
819
- */
820
- elapsed?: number;
821
- /**
822
- * The total duration of the animation. Set to `0.3` by default.
823
- *
824
- * ```jsx
825
- * const transition = {
826
- * type: "keyframes",
827
- * duration: 2
828
- * }
829
- *
830
- * <Frame
831
- * animate={{ opacity: 0 }}
832
- * transition={transition}
833
- * />
834
- * ```
835
- *
836
- * @public
837
- */
838
- duration?: number;
839
- /**
840
- * @public
841
- */
842
- repeatDelay?: number;
843
- /**
844
- * @internal
845
- */
846
- from?: number | string;
847
- /**
848
- * @internal
849
- */
850
- to?: number | string | ValueTarget;
851
- /**
852
- * @internal
853
- */
854
- velocity?: number;
855
- /**
856
- * @internal
857
- */
858
- delay?: number;
859
- }
860
- /**
861
- * @internal
862
- */
863
- export interface Just {
864
- type: "just";
865
- to?: number | string | ValueTarget;
866
- from?: number | string;
867
- delay?: number;
868
- velocity?: number;
869
- }
870
- /**
871
- * @public
872
- */
873
- export interface None {
874
- /**
875
- * Set `type` to `false` for an instant transition.
876
- *
877
- * @public
878
- */
879
- type: false;
880
- /**
881
- * @internal
882
- */
883
- from?: number | string;
884
- /**
885
- * @internal
886
- */
887
- delay?: number;
888
- /**
889
- * @internal
890
- */
891
- velocity?: number;
892
- }
893
- /**
894
- * @public
895
- */
896
- export declare type PopmotionTransitionProps = Tween | Spring | Keyframes | Inertia | Just;
897
- /**
898
- * @public
899
- */
900
- export declare type PermissiveTransitionDefinition = {
901
- [key: string]: any;
902
- };
903
- /**
904
- * @public
905
- */
906
- export declare type TransitionDefinition = Tween | Spring | Keyframes | Inertia | Just | None | PermissiveTransitionDefinition;
907
- export declare type TransitionMap = Orchestration & {
908
- [key: string]: TransitionDefinition;
909
- };
910
- /**
911
- * Transition props
912
- *
913
- * @public
914
- */
915
- export declare type Transition = (Orchestration & Repeat & TransitionDefinition) | (Orchestration & Repeat & TransitionMap);
916
- export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
917
- declare type CSSPropertiesWithoutTransitionOrSingleTransforms = Omit<CSSProperties, "transition" | "rotate" | "scale" | "perspective">;
918
- declare type TargetProperties = CSSPropertiesWithoutTransitionOrSingleTransforms & SVGAttributes<SVGElement> & TransformProperties & CustomStyles & SVGPathProperties;
919
- /**
920
- * @public
921
- */
922
- export declare type MakeCustomValueType<T> = {
923
- [K in keyof T]: T[K] | CustomValueType;
924
- };
925
- /**
926
- * @public
927
- */
928
- export declare type Target = MakeCustomValueType<TargetProperties>;
929
- /**
930
- * @public
931
- */
932
- export declare type MakeKeyframes<T> = {
933
- [K in keyof T]: T[K] | T[K][] | [null, ...T[K][]];
934
- };
935
- /**
936
- * @public
937
- */
938
- export declare type TargetWithKeyframes = MakeKeyframes<Target>;
939
- /**
940
- * An object that specifies values to animate to. Each value may be set either as
941
- * a single value, or an array of values.
942
- *
943
- * It may also option contain these properties:
944
- *
945
- * - `transition`: Specifies transitions for all or individual values.
946
- * - `transitionEnd`: Specifies values to set when the animation finishes.
947
- *
948
- * ```jsx
949
- * const target = {
950
- * x: "0%",
951
- * opacity: 0,
952
- * transition: { duration: 1 },
953
- * transitionEnd: { display: "none" }
954
- * }
955
- * ```
956
- *
957
- * @public
958
- */
959
- export declare type TargetAndTransition = TargetWithKeyframes & {
960
- transition?: Transition;
961
- transitionEnd?: Target;
962
- };
963
- export declare type TargetResolver = (custom: any, current: Target, velocity: Target) => TargetAndTransition | string;
964
- /**
965
- * @public
966
- */
967
- export declare type Variant = TargetAndTransition | TargetResolver;
968
- /**
969
- * @public
970
- */
971
- export declare type Variants = {
972
- [key: string]: Variant;
973
- };
974
- /**
975
- * @public
976
- */
977
- export interface CustomValueType {
978
- mix: (from: any, to: any) => (p: number) => number | string;
979
- toValue: () => number | string;
980
- }
981
- export {};