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
@@ -0,0 +1,2428 @@
1
+ /// <reference types="react" />
2
+ import * as React from 'react';
3
+ import { RefObject, CSSProperties, SVGAttributes, useEffect } from 'react';
4
+
5
+ /**
6
+ * `MotionValue` is used to track the state and velocity of motion values.
7
+ *
8
+ * @public
9
+ */
10
+ declare class MotionValue<V = any> {
11
+ /**
12
+ * This will be replaced by the build step with the latest version number.
13
+ * When MotionValues are provided to motion components, warn if versions are mixed.
14
+ */
15
+ version: string;
16
+ clearListeners(): void;
17
+ /**
18
+ * Sets the state of the `MotionValue`.
19
+ *
20
+ * @remarks
21
+ *
22
+ * ```jsx
23
+ * const x = useMotionValue(0)
24
+ * x.set(10)
25
+ * ```
26
+ *
27
+ * @param latest - Latest value to set.
28
+ * @param render - Whether to notify render subscribers. Defaults to `true`
29
+ *
30
+ * @public
31
+ */
32
+ set(v: V, render?: boolean): void;
33
+ updateAndNotify: (v: V, render?: boolean) => void;
34
+ /**
35
+ * Returns the latest state of `MotionValue`
36
+ *
37
+ * @returns - The latest state of `MotionValue`
38
+ *
39
+ * @public
40
+ */
41
+ get(): V;
42
+ /**
43
+ * @public
44
+ */
45
+ getPrevious(): V;
46
+ /**
47
+ * Returns the latest velocity of `MotionValue`
48
+ *
49
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
50
+ *
51
+ * @public
52
+ */
53
+ getVelocity(): number;
54
+ hasAnimated: boolean;
55
+ /**
56
+ * Stop the currently active animation.
57
+ *
58
+ * @public
59
+ */
60
+ stop(): void;
61
+ /**
62
+ * Returns `true` if this value is currently animating.
63
+ *
64
+ * @public
65
+ */
66
+ isAnimating(): boolean;
67
+ private clearAnimation;
68
+ /**
69
+ * Destroy and clean up subscribers to this `MotionValue`.
70
+ *
71
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
72
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
73
+ * created a `MotionValue` via the `motionValue` function.
74
+ *
75
+ * @public
76
+ */
77
+ destroy(): void;
78
+ }
79
+
80
+ /**
81
+ * @public
82
+ */
83
+ declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
84
+ /**
85
+ * @public
86
+ */
87
+ interface AnimationControls {
88
+ /**
89
+ * Starts an animation on all linked components.
90
+ *
91
+ * @remarks
92
+ *
93
+ * ```jsx
94
+ * controls.start("variantLabel")
95
+ * controls.start({
96
+ * x: 0,
97
+ * transition: { duration: 1 }
98
+ * })
99
+ * ```
100
+ *
101
+ * @param definition - Properties or variant label to animate to
102
+ * @param transition - Optional `transtion` to apply to a variant
103
+ * @returns - A `Promise` that resolves when all animations have completed.
104
+ *
105
+ * @public
106
+ */
107
+ start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
108
+ /**
109
+ * Stops animations on all linked components.
110
+ *
111
+ * ```jsx
112
+ * controls.stop()
113
+ * ```
114
+ *
115
+ * @public
116
+ */
117
+ stop(): void;
118
+ mount(): () => void;
119
+ }
120
+
121
+ interface Point {
122
+ x: number;
123
+ y: number;
124
+ }
125
+ interface Axis {
126
+ min: number;
127
+ max: number;
128
+ }
129
+ interface Box {
130
+ x: Axis;
131
+ y: Axis;
132
+ }
133
+ interface BoundingBox {
134
+ top: number;
135
+ right: number;
136
+ bottom: number;
137
+ left: number;
138
+ }
139
+ interface AxisDelta {
140
+ translate: number;
141
+ scale: number;
142
+ origin: number;
143
+ originPoint: number;
144
+ }
145
+ interface Delta {
146
+ x: AxisDelta;
147
+ y: AxisDelta;
148
+ }
149
+ declare type TransformPoint = (point: Point) => Point;
150
+
151
+ /**
152
+ * Passed in to pan event handlers like `onPan` the `PanInfo` object contains
153
+ * information about the current state of the tap gesture such as its
154
+ * `point`, `delta`, `offset` and `velocity`.
155
+ *
156
+ * ```jsx
157
+ * <motion.div onPan={(event, info) => {
158
+ * console.log(info.point.x, info.point.y)
159
+ * }} />
160
+ * ```
161
+ *
162
+ * @public
163
+ */
164
+ interface PanInfo {
165
+ /**
166
+ * Contains `x` and `y` values for the current pan position relative
167
+ * to the device or page.
168
+ *
169
+ * ```jsx
170
+ * function onPan(event, info) {
171
+ * console.log(info.point.x, info.point.y)
172
+ * }
173
+ *
174
+ * <motion.div onPan={onPan} />
175
+ * ```
176
+ *
177
+ * @public
178
+ */
179
+ point: Point;
180
+ /**
181
+ * Contains `x` and `y` values for the distance moved since
182
+ * the last event.
183
+ *
184
+ * ```jsx
185
+ * function onPan(event, info) {
186
+ * console.log(info.delta.x, info.delta.y)
187
+ * }
188
+ *
189
+ * <motion.div onPan={onPan} />
190
+ * ```
191
+ *
192
+ * @public
193
+ */
194
+ delta: Point;
195
+ /**
196
+ * Contains `x` and `y` values for the distance moved from
197
+ * the first pan event.
198
+ *
199
+ * ```jsx
200
+ * function onPan(event, info) {
201
+ * console.log(info.offset.x, info.offset.y)
202
+ * }
203
+ *
204
+ * <motion.div onPan={onPan} />
205
+ * ```
206
+ *
207
+ * @public
208
+ */
209
+ offset: Point;
210
+ /**
211
+ * Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
212
+ *
213
+ * ```jsx
214
+ * function onPan(event, info) {
215
+ * console.log(info.velocity.x, info.velocity.y)
216
+ * }
217
+ *
218
+ * <motion.div onPan={onPan} />
219
+ * ```
220
+ *
221
+ * @public
222
+ */
223
+ velocity: Point;
224
+ }
225
+
226
+ interface DragControlOptions {
227
+ snapToCursor?: boolean;
228
+ cursorProgress?: Point;
229
+ }
230
+
231
+ /**
232
+ * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.
233
+ *
234
+ * ```jsx
235
+ * const dragControls = useDragControls()
236
+ *
237
+ * function startDrag(event) {
238
+ * dragControls.start(event, { snapToCursor: true })
239
+ * }
240
+ *
241
+ * return (
242
+ * <>
243
+ * <div onPointerDown={startDrag} />
244
+ * <motion.div drag="x" dragControls={dragControls} />
245
+ * </>
246
+ * )
247
+ * ```
248
+ *
249
+ * @public
250
+ */
251
+ declare class DragControls {
252
+ private componentControls;
253
+ /**
254
+ * Start a drag gesture on every `motion` component that has this set of drag controls
255
+ * passed into it via the `dragControls` prop.
256
+ *
257
+ * ```jsx
258
+ * dragControls.start(e, {
259
+ * snapToCursor: true
260
+ * })
261
+ * ```
262
+ *
263
+ * @param event - PointerEvent
264
+ * @param options - Options
265
+ *
266
+ * @public
267
+ */
268
+ start(event: React.MouseEvent | React.TouchEvent | React.PointerEvent | MouseEvent | TouchEvent | PointerEvent, options?: DragControlOptions): void;
269
+ }
270
+
271
+ declare type DragElastic = boolean | number | Partial<BoundingBox>;
272
+ /**
273
+ * @public
274
+ */
275
+ interface DragHandlers {
276
+ /**
277
+ * Callback function that fires when dragging starts.
278
+ *
279
+ * ```jsx
280
+ * <motion.div
281
+ * drag
282
+ * onDragStart={
283
+ * (event, info) => console.log(info.point.x, info.point.y)
284
+ * }
285
+ * />
286
+ * ```
287
+ *
288
+ * @public
289
+ */
290
+ onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
291
+ /**
292
+ * Callback function that fires when dragging ends.
293
+ *
294
+ * ```jsx
295
+ * <motion.div
296
+ * drag
297
+ * onDragEnd={
298
+ * (event, info) => console.log(info.point.x, info.point.y)
299
+ * }
300
+ * />
301
+ * ```
302
+ *
303
+ * @public
304
+ */
305
+ onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
306
+ /**
307
+ * Callback function that fires when the component is dragged.
308
+ *
309
+ * ```jsx
310
+ * <motion.div
311
+ * drag
312
+ * onDrag={
313
+ * (event, info) => console.log(info.point.x, info.point.y)
314
+ * }
315
+ * />
316
+ * ```
317
+ *
318
+ * @public
319
+ */
320
+ onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
321
+ /**
322
+ * Callback function that fires a drag direction is determined.
323
+ *
324
+ * ```jsx
325
+ * <motion.div
326
+ * drag
327
+ * dragDirectionLock
328
+ * onDirectionLock={axis => console.log(axis)}
329
+ * />
330
+ * ```
331
+ *
332
+ * @public
333
+ */
334
+ onDirectionLock?(axis: "x" | "y"): void;
335
+ /**
336
+ * Callback function that fires when drag momentum/bounce transition finishes.
337
+ *
338
+ * ```jsx
339
+ * <motion.div
340
+ * drag
341
+ * onDragTransitionEnd={() => console.log('Drag transition complete')}
342
+ * />
343
+ * ```
344
+ *
345
+ * @public
346
+ */
347
+ onDragTransitionEnd?(): void;
348
+ }
349
+ /**
350
+ * @public
351
+ */
352
+ declare type InertiaOptions = Partial<Omit<Inertia, "velocity" | "type">>;
353
+ /**
354
+ * @public
355
+ */
356
+ interface DraggableProps extends DragHandlers {
357
+ /**
358
+ * Enable dragging for this element. Set to `false` by default.
359
+ * Set `true` to drag in both directions.
360
+ * Set `"x"` or `"y"` to only drag in a specific direction.
361
+ *
362
+ * ```jsx
363
+ * <motion.div drag="x" />
364
+ * ```
365
+ */
366
+ drag?: boolean | "x" | "y";
367
+ /**
368
+ * Properties or variant label to animate to while the drag gesture is recognised.
369
+ *
370
+ * ```jsx
371
+ * <motion.div whileDrag={{ scale: 1.2 }} />
372
+ * ```
373
+ */
374
+ whileDrag?: VariantLabels | TargetAndTransition;
375
+ /**
376
+ * If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
377
+ *
378
+ * ```jsx
379
+ * <motion.div drag dragDirectionLock />
380
+ * ```
381
+ */
382
+ dragDirectionLock?: boolean;
383
+ /**
384
+ * Allows drag gesture propagation to child components. Set to `false` by
385
+ * default.
386
+ *
387
+ * ```jsx
388
+ * <motion.div drag="x" dragPropagation />
389
+ * ```
390
+ */
391
+ dragPropagation?: boolean;
392
+ /**
393
+ * Applies constraints on the permitted draggable area.
394
+ *
395
+ * It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
396
+ * This will define a distance the named edge of the draggable component.
397
+ *
398
+ * Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
399
+ * This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
400
+ * of the component you want to use as constraints.
401
+ *
402
+ * ```jsx
403
+ * // In pixels
404
+ * <motion.div
405
+ * drag="x"
406
+ * dragConstraints={{ left: 0, right: 300 }}
407
+ * />
408
+ *
409
+ * // As a ref to another component
410
+ * const MyComponent = () => {
411
+ * const constraintsRef = useRef(null)
412
+ *
413
+ * return (
414
+ * <motion.div ref={constraintsRef}>
415
+ * <motion.div drag dragConstraints={constraintsRef} />
416
+ * </motion.div>
417
+ * )
418
+ * }
419
+ * ```
420
+ */
421
+ dragConstraints?: false | Partial<BoundingBox> | RefObject<Element>;
422
+ /**
423
+ * The degree of movement allowed outside constraints. 0 = no movement, 1 =
424
+ * full movement.
425
+ *
426
+ * Set to `0.5` by default. Can also be set as `false` to disable movement.
427
+ *
428
+ * By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
429
+ * per constraint. Any missing values will be set to `0`.
430
+ *
431
+ * ```jsx
432
+ * <motion.div
433
+ * drag
434
+ * dragConstraints={{ left: 0, right: 300 }}
435
+ * dragElastic={0.2}
436
+ * />
437
+ * ```
438
+ */
439
+ dragElastic?: DragElastic;
440
+ /**
441
+ * Apply momentum from the pan gesture to the component when dragging
442
+ * finishes. Set to `true` by default.
443
+ *
444
+ * ```jsx
445
+ * <motion.div
446
+ * drag
447
+ * dragConstraints={{ left: 0, right: 300 }}
448
+ * dragMomentum={false}
449
+ * />
450
+ * ```
451
+ */
452
+ dragMomentum?: boolean;
453
+ /**
454
+ * Allows you to change dragging inertia parameters.
455
+ * When releasing a draggable Frame, an animation with type `inertia` starts. The animation is based on your dragging velocity. This property allows you to customize it.
456
+ * See {@link https://framer.com/api/animation/#inertia | Inertia} for all properties you can use.
457
+ *
458
+ * ```jsx
459
+ * <motion.div
460
+ * drag
461
+ * dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
462
+ * />
463
+ * ```
464
+ */
465
+ dragTransition?: InertiaOptions;
466
+ /**
467
+ * Usually, dragging is initiated by pressing down on a component and moving it. For some
468
+ * use-cases, for instance clicking at an arbitrary point on a video scrubber, we
469
+ * might want to initiate dragging from a different component than the draggable one.
470
+ *
471
+ * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
472
+ * the draggable component's `dragControls` prop. It exposes a `start` method
473
+ * that can start dragging from pointer events on other components.
474
+ *
475
+ * ```jsx
476
+ * const dragControls = useDragControls()
477
+ *
478
+ * function startDrag(event) {
479
+ * dragControls.start(event, { snapToCursor: true })
480
+ * }
481
+ *
482
+ * return (
483
+ * <>
484
+ * <div onPointerDown={startDrag} />
485
+ * <motion.div drag="x" dragControls={dragControls} />
486
+ * </>
487
+ * )
488
+ * ```
489
+ */
490
+ dragControls?: DragControls;
491
+ /**
492
+ * If true, element will snap back to its origin when dragging ends.
493
+ *
494
+ * Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
495
+ * with `dragElastic={1}`, but when used together `dragConstraints` can define
496
+ * a wider draggable area and `dragSnapToOrigin` will ensure the element
497
+ * animates back to its origin on release.
498
+ */
499
+ dragSnapToOrigin?: boolean;
500
+ /**
501
+ * By default, if `drag` is defined on a component then an event listener will be attached
502
+ * to automatically initiate dragging when a user presses down on it.
503
+ *
504
+ * By setting `dragListener` to `false`, this event listener will not be created.
505
+ *
506
+ * ```jsx
507
+ * const dragControls = useDragControls()
508
+ *
509
+ * function startDrag(event) {
510
+ * dragControls.start(event, { snapToCursor: true })
511
+ * }
512
+ *
513
+ * return (
514
+ * <>
515
+ * <div onPointerDown={startDrag} />
516
+ * <motion.div
517
+ * drag="x"
518
+ * dragControls={dragControls}
519
+ * dragListener={false}
520
+ * />
521
+ * </>
522
+ * )
523
+ * ```
524
+ */
525
+ dragListener?: boolean;
526
+ /**
527
+ * If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
528
+ *
529
+ * @public
530
+ */
531
+ onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
532
+ /**
533
+ * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
534
+ * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
535
+ * This allows you to manually control how updates from a drag gesture on an element is applied.
536
+ *
537
+ * @public
538
+ */
539
+ _dragX?: MotionValue<number>;
540
+ /**
541
+ * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
542
+ * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
543
+ * This allows you to manually control how updates from a drag gesture on an element is applied.
544
+ *
545
+ * @public
546
+ */
547
+ _dragY?: MotionValue<number>;
548
+ }
549
+
550
+ /**
551
+ * @public
552
+ */
553
+ interface LayoutProps {
554
+ /**
555
+ * If `true`, this component will automatically animate to its new position when
556
+ * its layout changes.
557
+ *
558
+ * ```jsx
559
+ * <motion.div layout />
560
+ * ```
561
+ *
562
+ * This will perform a layout animation using performant transforms. Part of this technique
563
+ * involved animating an element's scale. This can introduce visual distortions on children,
564
+ * `boxShadow` and `borderRadius`.
565
+ *
566
+ * To correct distortion on immediate children, add `layout` to those too.
567
+ *
568
+ * `boxShadow` and `borderRadius` will automatically be corrected if they are already being
569
+ * animated on this component. Otherwise, set them directly via the `initial` prop.
570
+ *
571
+ * If `layout` is set to `"position"`, the size of the component will change instantly and
572
+ * only its position will animate. If `layout` is set to `"size"`, the position of the
573
+ * component will change instantly but its size will animate.
574
+ *
575
+ * If `layout` is set to `"size"`, the position of the component will change instantly and
576
+ * only its size will animate.
577
+ *
578
+ * @public
579
+ */
580
+ layout?: boolean | "position" | "size";
581
+ /**
582
+ * Enable shared layout transitions between different components with the same `layoutId`.
583
+ *
584
+ * When a component with a layoutId is removed from the React tree, and then
585
+ * added elsewhere, it will visually animate from the previous component's bounding box
586
+ * and its latest animated values.
587
+ *
588
+ * ```jsx
589
+ * {items.map(item => (
590
+ * <motion.li layout>
591
+ * {item.name}
592
+ * {item.isSelected && <motion.div layoutId="underline" />}
593
+ * </motion.li>
594
+ * ))}
595
+ * ```
596
+ *
597
+ * If the previous component remains in the tree it will crossfade with the new component.
598
+ *
599
+ * @public
600
+ */
601
+ layoutId?: string;
602
+ /**
603
+ * A callback that will fire when a layout animation on this component starts.
604
+ *
605
+ * @public
606
+ */
607
+ onLayoutAnimationStart?(): void;
608
+ /**
609
+ * A callback that will fire when a layout animation on this component completes.
610
+ *
611
+ * @public
612
+ */
613
+ onLayoutAnimationComplete?(): void;
614
+ /**
615
+ * @public
616
+ */
617
+ layoutDependency?: any;
618
+ /**
619
+ * Wether a projection node should measure its scroll when it or its descendants update their layout.
620
+ *
621
+ * @public
622
+ */
623
+ layoutScroll?: boolean;
624
+ }
625
+
626
+ declare enum AnimationType {
627
+ Animate = "animate",
628
+ Hover = "whileHover",
629
+ Tap = "whileTap",
630
+ Drag = "whileDrag",
631
+ Focus = "whileFocus",
632
+ InView = "whileInView",
633
+ Exit = "exit"
634
+ }
635
+
636
+ declare type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
637
+ declare type AnimationOptions = {
638
+ delay?: number;
639
+ transitionOverride?: Transition;
640
+ custom?: any;
641
+ type?: AnimationType;
642
+ };
643
+
644
+ declare type LayoutMeasureListener = (layout: Box, prevLayout?: Box) => void;
645
+ declare type BeforeLayoutMeasureListener = () => void;
646
+ declare type LayoutUpdateListener = (layout: Axis, prevLayout: Axis) => void;
647
+ declare type UpdateListener = (latest: ResolvedValues) => void;
648
+ declare type AnimationStartListener = (definition: AnimationDefinition) => void;
649
+ declare type AnimationCompleteListener = (definition: AnimationDefinition) => void;
650
+ declare type LayoutAnimationStartListener = () => void;
651
+ declare type LayoutAnimationCompleteListener = () => void;
652
+ declare type SetAxisTargetListener = () => void;
653
+ declare type RenderListener = () => void;
654
+ interface LayoutLifecycles {
655
+ onBeforeLayoutMeasure?(box: Box): void;
656
+ onLayoutMeasure?(box: Box, prevBox: Box): void;
657
+ }
658
+ interface AnimationLifecycles {
659
+ /**
660
+ * Callback with latest motion values, fired max once per frame.
661
+ *
662
+ * ```jsx
663
+ * function onUpdate(latest) {
664
+ * console.log(latest.x, latest.opacity)
665
+ * }
666
+ *
667
+ * <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
668
+ * ```
669
+ */
670
+ onUpdate?(latest: ResolvedValues): void;
671
+ /**
672
+ * Callback when animation defined in `animate` begins.
673
+ *
674
+ * The provided callback will be called with the triggering animation definition.
675
+ * If this is a variant, it'll be the variant name, and if a target object
676
+ * then it'll be the target object.
677
+ *
678
+ * This way, it's possible to figure out which animation has started.
679
+ *
680
+ * ```jsx
681
+ * function onStart() {
682
+ * console.log("Animation started")
683
+ * }
684
+ *
685
+ * <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
686
+ * ```
687
+ */
688
+ onAnimationStart?(definition: AnimationDefinition): void;
689
+ /**
690
+ * Callback when animation defined in `animate` is complete.
691
+ *
692
+ * The provided callback will be called with the triggering animation definition.
693
+ * If this is a variant, it'll be the variant name, and if a target object
694
+ * then it'll be the target object.
695
+ *
696
+ * This way, it's possible to figure out which animation has completed.
697
+ *
698
+ * ```jsx
699
+ * function onComplete() {
700
+ * console.log("Animation completed")
701
+ * }
702
+ *
703
+ * <motion.div
704
+ * animate={{ x: 100 }}
705
+ * onAnimationComplete={definition => {
706
+ * console.log('Completed animating', definition)
707
+ * }}
708
+ * />
709
+ * ```
710
+ */
711
+ onAnimationComplete?(definition: AnimationDefinition): void;
712
+ }
713
+ declare type VisualElementLifecycles = LayoutLifecycles & AnimationLifecycles;
714
+ interface LifecycleManager {
715
+ onLayoutMeasure: (callback: LayoutMeasureListener) => () => void;
716
+ notifyLayoutMeasure: LayoutMeasureListener;
717
+ onBeforeLayoutMeasure: (callback: BeforeLayoutMeasureListener) => () => void;
718
+ notifyBeforeLayoutMeasure: BeforeLayoutMeasureListener;
719
+ onLayoutUpdate: (callback: LayoutUpdateListener) => () => void;
720
+ notifyLayoutUpdate: LayoutUpdateListener;
721
+ onUpdate: (callback: UpdateListener) => () => void;
722
+ notifyUpdate: UpdateListener;
723
+ onAnimationStart: (callback: AnimationStartListener) => () => void;
724
+ notifyAnimationStart: AnimationStartListener;
725
+ onAnimationComplete: (callback: AnimationCompleteListener) => () => void;
726
+ notifyAnimationComplete: AnimationCompleteListener;
727
+ onLayoutAnimationStart: (callback: LayoutAnimationStartListener) => () => void;
728
+ notifyLayoutAnimationStart: LayoutAnimationStartListener;
729
+ onLayoutAnimationComplete: (callback: LayoutAnimationCompleteListener) => () => void;
730
+ notifyLayoutAnimationComplete: LayoutAnimationCompleteListener;
731
+ onSetAxisTarget: (callback: SetAxisTargetListener) => () => void;
732
+ notifySetAxisTarget: SetAxisTargetListener;
733
+ onRender: (callback: RenderListener) => () => void;
734
+ notifyRender: RenderListener;
735
+ onUnmount: (callback: () => void) => () => void;
736
+ notifyUnmount: () => void;
737
+ clearAllListeners: () => void;
738
+ updatePropListeners: (props: MotionProps) => void;
739
+ }
740
+
741
+ /** @public */
742
+ interface EventInfo {
743
+ point: Point;
744
+ }
745
+
746
+ /**
747
+ * @public
748
+ */
749
+ interface FocusHandlers {
750
+ /**
751
+ * Properties or variant label to animate to while the focus gesture is recognised.
752
+ *
753
+ * ```jsx
754
+ * <motion.input whileFocus={{ scale: 1.2 }} />
755
+ * ```
756
+ */
757
+ whileFocus?: VariantLabels | TargetAndTransition;
758
+ }
759
+ /**
760
+ * Passed in to tap event handlers like `onTap` the `TapInfo` object contains
761
+ * information about the tap gesture such as it‘s location.
762
+ *
763
+ * ```jsx
764
+ * function onTap(event, info) {
765
+ * console.log(info.point.x, info.point.y)
766
+ * }
767
+ *
768
+ * <motion.div onTap={onTap} />
769
+ * ```
770
+ *
771
+ * @public
772
+ */
773
+ interface TapInfo {
774
+ /**
775
+ * Contains `x` and `y` values for the tap gesture relative to the
776
+ * device or page.
777
+ *
778
+ * ```jsx
779
+ * function onTapStart(event, info) {
780
+ * console.log(info.point.x, info.point.y)
781
+ * }
782
+ *
783
+ * <motion.div onTapStart={onTapStart} />
784
+ * ```
785
+ *
786
+ * @public
787
+ */
788
+ point: Point;
789
+ }
790
+ /**
791
+ * @public
792
+ */
793
+ interface TapHandlers {
794
+ /**
795
+ * Callback when the tap gesture successfully ends on this element.
796
+ *
797
+ * ```jsx
798
+ * function onTap(event, info) {
799
+ * console.log(info.point.x, info.point.y)
800
+ * }
801
+ *
802
+ * <motion.div onTap={onTap} />
803
+ * ```
804
+ *
805
+ * @param event - The originating pointer event.
806
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
807
+ */
808
+ onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
809
+ /**
810
+ * Callback when the tap gesture starts on this element.
811
+ *
812
+ * ```jsx
813
+ * function onTapStart(event, info) {
814
+ * console.log(info.point.x, info.point.y)
815
+ * }
816
+ *
817
+ * <motion.div onTapStart={onTapStart} />
818
+ * ```
819
+ *
820
+ * @param event - The originating pointer event.
821
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
822
+ */
823
+ onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
824
+ /**
825
+ * Callback when the tap gesture ends outside this element.
826
+ *
827
+ * ```jsx
828
+ * function onTapCancel(event, info) {
829
+ * console.log(info.point.x, info.point.y)
830
+ * }
831
+ *
832
+ * <motion.div onTapCancel={onTapCancel} />
833
+ * ```
834
+ *
835
+ * @param event - The originating pointer event.
836
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
837
+ */
838
+ onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
839
+ /**
840
+ * Properties or variant label to animate to while the component is pressed.
841
+ *
842
+ * ```jsx
843
+ * <motion.div whileTap={{ scale: 0.8 }} />
844
+ * ```
845
+ */
846
+ whileTap?: VariantLabels | TargetAndTransition;
847
+ }
848
+ /**
849
+ * @public
850
+ */
851
+ interface PanHandlers {
852
+ /**
853
+ * Callback function that fires when the pan gesture is recognised on this element.
854
+ *
855
+ * **Note:** For pan gestures to work correctly with touch input, the element needs
856
+ * touch scrolling to be disabled on either x/y or both axis with the
857
+ * [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
858
+ *
859
+ * ```jsx
860
+ * function onPan(event, info) {
861
+ * console.log(info.point.x, info.point.y)
862
+ * }
863
+ *
864
+ * <motion.div onPan={onPan} />
865
+ * ```
866
+ *
867
+ * @param event - The originating pointer event.
868
+ * @param info - A {@link PanInfo} object containing `x` and `y` values for:
869
+ *
870
+ * - `point`: Relative to the device or page.
871
+ * - `delta`: Distance moved since the last event.
872
+ * - `offset`: Offset from the original pan event.
873
+ * - `velocity`: Current velocity of the pointer.
874
+ */
875
+ onPan?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
876
+ /**
877
+ * Callback function that fires when the pan gesture begins on this element.
878
+ *
879
+ * ```jsx
880
+ * function onPanStart(event, info) {
881
+ * console.log(info.point.x, info.point.y)
882
+ * }
883
+ *
884
+ * <motion.div onPanStart={onPanStart} />
885
+ * ```
886
+ *
887
+ * @param event - The originating pointer event.
888
+ * @param info - A {@link PanInfo} object containing `x`/`y` values for:
889
+ *
890
+ * - `point`: Relative to the device or page.
891
+ * - `delta`: Distance moved since the last event.
892
+ * - `offset`: Offset from the original pan event.
893
+ * - `velocity`: Current velocity of the pointer.
894
+ */
895
+ onPanStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
896
+ /**
897
+ * Callback function that fires when we begin detecting a pan gesture. This
898
+ * is analogous to `onMouseStart` or `onTouchStart`.
899
+ *
900
+ * ```jsx
901
+ * function onPanSessionStart(event, info) {
902
+ * console.log(info.point.x, info.point.y)
903
+ * }
904
+ *
905
+ * <motion.div onPanSessionStart={onPanSessionStart} />
906
+ * ```
907
+ *
908
+ * @param event - The originating pointer event.
909
+ * @param info - An {@link EventInfo} object containing `x`/`y` values for:
910
+ *
911
+ * - `point`: Relative to the device or page.
912
+ */
913
+ onPanSessionStart?(event: MouseEvent | TouchEvent | PointerEvent, info: EventInfo): void;
914
+ /**
915
+ * Callback function that fires when the pan gesture ends on this element.
916
+ *
917
+ * ```jsx
918
+ * function onPanEnd(event, info) {
919
+ * console.log(info.point.x, info.point.y)
920
+ * }
921
+ *
922
+ * <motion.div onPanEnd={onPanEnd} />
923
+ * ```
924
+ *
925
+ * @param event - The originating pointer event.
926
+ * @param info - A {@link PanInfo} object containing `x`/`y` values for:
927
+ *
928
+ * - `point`: Relative to the device or page.
929
+ * - `delta`: Distance moved since the last event.
930
+ * - `offset`: Offset from the original pan event.
931
+ * - `velocity`: Current velocity of the pointer.
932
+ */
933
+ onPanEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
934
+ }
935
+ /**
936
+ * @public
937
+ */
938
+ interface HoverHandlers {
939
+ /**
940
+ * Properties or variant label to animate to while the hover gesture is recognised.
941
+ *
942
+ * ```jsx
943
+ * <motion.div whileHover={{ scale: 1.2 }} />
944
+ * ```
945
+ */
946
+ whileHover?: VariantLabels | TargetAndTransition;
947
+ /**
948
+ * Callback function that fires when pointer starts hovering over the component.
949
+ *
950
+ * ```jsx
951
+ * <motion.div onHoverStart={() => console.log('Hover starts')} />
952
+ * ```
953
+ */
954
+ onHoverStart?(event: MouseEvent, info: EventInfo): void;
955
+ /**
956
+ * Callback function that fires when pointer stops hovering over the component.
957
+ *
958
+ * ```jsx
959
+ * <motion.div onHoverEnd={() => console.log("Hover ends")} />
960
+ * ```
961
+ */
962
+ onHoverEnd?(event: MouseEvent, info: EventInfo): void;
963
+ }
964
+
965
+ declare type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
966
+ interface ViewportOptions {
967
+ root?: RefObject<Element>;
968
+ once?: boolean;
969
+ margin?: string;
970
+ amount?: "some" | "all" | number;
971
+ fallback?: boolean;
972
+ }
973
+ interface ViewportProps {
974
+ whileInView?: VariantLabels | TargetAndTransition;
975
+ onViewportEnter?: ViewportEventHandler;
976
+ onViewportLeave?: ViewportEventHandler;
977
+ viewport?: ViewportOptions;
978
+ }
979
+
980
+ /**
981
+ * Either a string, or array of strings, that reference variants defined via the `variants` prop.
982
+ * @public
983
+ */
984
+ declare type VariantLabels = string | string[];
985
+ interface TransformProperties {
986
+ x?: string | number;
987
+ y?: string | number;
988
+ z?: string | number;
989
+ translateX?: string | number;
990
+ translateY?: string | number;
991
+ translateZ?: string | number;
992
+ rotate?: string | number;
993
+ rotateX?: string | number;
994
+ rotateY?: string | number;
995
+ rotateZ?: string | number;
996
+ scale?: string | number;
997
+ scaleX?: string | number;
998
+ scaleY?: string | number;
999
+ scaleZ?: string | number;
1000
+ skew?: string | number;
1001
+ skewX?: string | number;
1002
+ skewY?: string | number;
1003
+ originX?: string | number;
1004
+ originY?: string | number;
1005
+ originZ?: string | number;
1006
+ perspective?: string | number;
1007
+ transformPerspective?: string | number;
1008
+ }
1009
+ /**
1010
+ * @public
1011
+ */
1012
+ interface SVGPathProperties {
1013
+ pathLength?: number;
1014
+ pathOffset?: number;
1015
+ pathSpacing?: number;
1016
+ }
1017
+ interface CustomStyles {
1018
+ /**
1019
+ * Framer Library custom prop types. These are not actually supported in Motion - preferably
1020
+ * we'd have a way of external consumers injecting supported styles into this library.
1021
+ */
1022
+ size?: string | number;
1023
+ radius?: string | number;
1024
+ shadow?: string;
1025
+ image?: string;
1026
+ }
1027
+ declare type MakeMotion<T> = MakeCustomValueType<{
1028
+ [K in keyof T]: T[K] | MotionValue<number> | MotionValue<string> | MotionValue<any>;
1029
+ }>;
1030
+ declare type MotionCSS = MakeMotion<Omit$1<CSSProperties, "rotate" | "scale" | "perspective">>;
1031
+ /**
1032
+ * @public
1033
+ */
1034
+ declare type MotionTransform = MakeMotion<TransformProperties>;
1035
+ /**
1036
+ * @public
1037
+ */
1038
+ declare type MotionStyle = MotionCSS & MotionTransform & MakeMotion<SVGPathProperties> & MakeCustomValueType<CustomStyles>;
1039
+ /**
1040
+ * @public
1041
+ */
1042
+ interface AnimationProps {
1043
+ /**
1044
+ * Properties, variant label or array of variant labels to start in.
1045
+ *
1046
+ * Set to `false` to initialise with the values in `animate` (disabling the mount animation)
1047
+ *
1048
+ * ```jsx
1049
+ * // As values
1050
+ * <motion.div initial={{ opacity: 1 }} />
1051
+ *
1052
+ * // As variant
1053
+ * <motion.div initial="visible" variants={variants} />
1054
+ *
1055
+ * // Multiple variants
1056
+ * <motion.div initial={["visible", "active"]} variants={variants} />
1057
+ *
1058
+ * // As false (disable mount animation)
1059
+ * <motion.div initial={false} animate={{ opacity: 0 }} />
1060
+ * ```
1061
+ */
1062
+ initial?: boolean | Target | VariantLabels;
1063
+ /**
1064
+ * Values to animate to, variant label(s), or `AnimationControls`.
1065
+ *
1066
+ * ```jsx
1067
+ * // As values
1068
+ * <motion.div animate={{ opacity: 1 }} />
1069
+ *
1070
+ * // As variant
1071
+ * <motion.div animate="visible" variants={variants} />
1072
+ *
1073
+ * // Multiple variants
1074
+ * <motion.div animate={["visible", "active"]} variants={variants} />
1075
+ *
1076
+ * // AnimationControls
1077
+ * <motion.div animate={animation} />
1078
+ * ```
1079
+ */
1080
+ animate?: AnimationControls | TargetAndTransition | VariantLabels | boolean;
1081
+ /**
1082
+ * A target to animate to when this component is removed from the tree.
1083
+ *
1084
+ * This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
1085
+ *
1086
+ * This limitation exists because React doesn't allow components to defer unmounting until after
1087
+ * an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
1088
+ *
1089
+ * ```jsx
1090
+ * import { AnimatePresence, motion } from 'framer-motion'
1091
+ *
1092
+ * export const MyComponent = ({ isVisible }) => {
1093
+ * return (
1094
+ * <AnimatePresence>
1095
+ * {isVisible && (
1096
+ * <motion.div
1097
+ * initial={{ opacity: 0 }}
1098
+ * animate={{ opacity: 1 }}
1099
+ * exit={{ opacity: 0 }}
1100
+ * />
1101
+ * )}
1102
+ * </AnimatePresence>
1103
+ * )
1104
+ * }
1105
+ * ```
1106
+ */
1107
+ exit?: TargetAndTransition | VariantLabels;
1108
+ /**
1109
+ * Variants allow you to define animation states and organise them by name. They allow
1110
+ * you to control animations throughout a component tree by switching a single `animate` prop.
1111
+ *
1112
+ * Using `transition` options like `delayChildren` and `staggerChildren`, you can orchestrate
1113
+ * when children animations play relative to their parent.
1114
+
1115
+ *
1116
+ * After passing variants to one or more `motion` component's `variants` prop, these variants
1117
+ * can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
1118
+ *
1119
+ * ```jsx
1120
+ * const variants = {
1121
+ * active: {
1122
+ * backgroundColor: "#f00"
1123
+ * },
1124
+ * inactive: {
1125
+ * backgroundColor: "#fff",
1126
+ * transition: { duration: 2 }
1127
+ * }
1128
+ * }
1129
+ *
1130
+ * <motion.div variants={variants} animate="active" />
1131
+ * ```
1132
+ */
1133
+ variants?: Variants;
1134
+ /**
1135
+ * Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
1136
+ * ```jsx
1137
+ * const spring = {
1138
+ * type: "spring",
1139
+ * damping: 10,
1140
+ * stiffness: 100
1141
+ * }
1142
+ *
1143
+ * <motion.div transition={spring} animate={{ scale: 1.2 }} />
1144
+ * ```
1145
+ */
1146
+ transition?: Transition;
1147
+ }
1148
+ /**
1149
+ * @public
1150
+ */
1151
+ interface MotionAdvancedProps {
1152
+ /**
1153
+ * Custom data to use to resolve dynamic variants differently for each animating component.
1154
+ *
1155
+ * ```jsx
1156
+ * const variants = {
1157
+ * visible: (custom) => ({
1158
+ * opacity: 1,
1159
+ * transition: { delay: custom * 0.2 }
1160
+ * })
1161
+ * }
1162
+ *
1163
+ * <motion.div custom={0} animate="visible" variants={variants} />
1164
+ * <motion.div custom={1} animate="visible" variants={variants} />
1165
+ * <motion.div custom={2} animate="visible" variants={variants} />
1166
+ * ```
1167
+ *
1168
+ * @public
1169
+ */
1170
+ custom?: any;
1171
+ /**
1172
+ * @public
1173
+ * Set to `false` to prevent inheriting variant changes from its parent.
1174
+ */
1175
+ inherit?: boolean;
1176
+ }
1177
+ /**
1178
+ * Props for `motion` components.
1179
+ *
1180
+ * @public
1181
+ */
1182
+ interface MotionProps extends AnimationProps, VisualElementLifecycles, PanHandlers, TapHandlers, HoverHandlers, FocusHandlers, ViewportProps, DraggableProps, LayoutProps, MotionAdvancedProps {
1183
+ /**
1184
+ *
1185
+ * The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values.
1186
+ *
1187
+ * ```jsx
1188
+ * export const MyComponent = () => {
1189
+ * const x = useMotionValue(0)
1190
+ *
1191
+ * return <motion.div style={{ x, opacity: 1, scale: 0.5 }} />
1192
+ * }
1193
+ * ```
1194
+ */
1195
+ style?: MotionStyle;
1196
+ /**
1197
+ * By default, Framer Motion generates a `transform` property with a sensible transform order. `transformTemplate`
1198
+ * can be used to create a different order, or to append/preprend the automatically generated `transform` property.
1199
+ *
1200
+ * ```jsx
1201
+ * <motion.div
1202
+ * style={{ x: 0, rotate: 180 }}
1203
+ * transformTemplate={
1204
+ * ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
1205
+ * }
1206
+ * />
1207
+ * ```
1208
+ *
1209
+ * @param transform - The latest animated transform props.
1210
+ * @param generatedTransform - The transform string as automatically generated by Framer Motion
1211
+ *
1212
+ * @public
1213
+ */
1214
+ transformTemplate?(transform: TransformProperties, generatedTransform: string): string;
1215
+ }
1216
+
1217
+ /**
1218
+ * @public
1219
+ */
1220
+ declare type ResolvedKeyframesTarget = [null, ...number[]] | number[] | [null, ...string[]] | string[];
1221
+ /**
1222
+ * @public
1223
+ */
1224
+ declare type ResolvedSingleTarget = string | number;
1225
+ /**
1226
+ * @public
1227
+ */
1228
+ declare type ResolvedValueTarget = ResolvedSingleTarget | ResolvedKeyframesTarget;
1229
+ /**
1230
+ * A function that accepts a progress value between `0` and `1` and returns a
1231
+ * new one.
1232
+ *
1233
+ * ```jsx
1234
+ * <motion.div
1235
+ * animate={{ opacity: 0 }}
1236
+ * transition={{
1237
+ * duration: 1,
1238
+ * ease: progress => progress * progress
1239
+ * }}
1240
+ * />
1241
+ * ```
1242
+ *
1243
+ * @public
1244
+ */
1245
+ declare type EasingFunction = (v: number) => number;
1246
+ /**
1247
+ * The easing function to use. Set as one of:
1248
+ *
1249
+ * - The name of an in-built easing function.
1250
+ * - An array of four numbers to define a cubic bezier curve.
1251
+ * - An easing function, that accepts and returns a progress value between `0` and `1`.
1252
+ *
1253
+ * @public
1254
+ */
1255
+ declare type Easing = [number, number, number, number] | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate" | EasingFunction;
1256
+ /**
1257
+ * Options for orchestrating the timing of animations.
1258
+ *
1259
+ * @public
1260
+ */
1261
+ interface Orchestration {
1262
+ /**
1263
+ * Delay the animation by this duration (in seconds). Defaults to `0`.
1264
+ *
1265
+ * @remarks
1266
+ * ```javascript
1267
+ * const transition = {
1268
+ * delay: 0.2
1269
+ * }
1270
+ * ```
1271
+ *
1272
+ * @public
1273
+ */
1274
+ delay?: number;
1275
+ /**
1276
+ * Describes the relationship between the transition and its children. Set
1277
+ * to `false` by default.
1278
+ *
1279
+ * @remarks
1280
+ * When using variants, the transition can be scheduled in relation to its
1281
+ * children with either `"beforeChildren"` to finish this transition before
1282
+ * starting children transitions, `"afterChildren"` to finish children
1283
+ * transitions before starting this transition.
1284
+ *
1285
+ * ```jsx
1286
+ * const list = {
1287
+ * hidden: {
1288
+ * opacity: 0,
1289
+ * transition: { when: "afterChildren" }
1290
+ * }
1291
+ * }
1292
+ *
1293
+ * const item = {
1294
+ * hidden: {
1295
+ * opacity: 0,
1296
+ * transition: { duration: 2 }
1297
+ * }
1298
+ * }
1299
+ *
1300
+ * return (
1301
+ * <motion.ul variants={list} animate="hidden">
1302
+ * <motion.li variants={item} />
1303
+ * <motion.li variants={item} />
1304
+ * </motion.ul>
1305
+ * )
1306
+ * ```
1307
+ *
1308
+ * @public
1309
+ */
1310
+ when?: false | "beforeChildren" | "afterChildren" | string;
1311
+ /**
1312
+ * When using variants, children animations will start after this duration
1313
+ * (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.
1314
+ *
1315
+ * ```jsx
1316
+ * const container = {
1317
+ * hidden: { opacity: 0 },
1318
+ * show: {
1319
+ * opacity: 1,
1320
+ * transition: {
1321
+ * delayChildren: 0.5
1322
+ * }
1323
+ * }
1324
+ * }
1325
+ *
1326
+ * const item = {
1327
+ * hidden: { opacity: 0 },
1328
+ * show: { opacity: 1 }
1329
+ * }
1330
+ *
1331
+ * return (
1332
+ * <motion.ul
1333
+ * variants={container}
1334
+ * initial="hidden"
1335
+ * animate="show"
1336
+ * >
1337
+ * <motion.li variants={item} />
1338
+ * <motion.li variants={item} />
1339
+ * </motion.ul>
1340
+ * )
1341
+ * ```
1342
+ *
1343
+ * @public
1344
+ */
1345
+ delayChildren?: number;
1346
+ /**
1347
+ * When using variants, animations of child components can be staggered by this
1348
+ * duration (in seconds).
1349
+ *
1350
+ * For instance, if `staggerChildren` is `0.01`, the first child will be
1351
+ * delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
1352
+ * on.
1353
+ *
1354
+ * The calculated stagger delay will be added to `delayChildren`.
1355
+ *
1356
+ * ```jsx
1357
+ * const container = {
1358
+ * hidden: { opacity: 0 },
1359
+ * show: {
1360
+ * opacity: 1,
1361
+ * transition: {
1362
+ * staggerChildren: 0.5
1363
+ * }
1364
+ * }
1365
+ * }
1366
+ *
1367
+ * const item = {
1368
+ * hidden: { opacity: 0 },
1369
+ * show: { opacity: 1 }
1370
+ * }
1371
+ *
1372
+ * return (
1373
+ * <motion.ol
1374
+ * variants={container}
1375
+ * initial="hidden"
1376
+ * animate="show"
1377
+ * >
1378
+ * <motion.li variants={item} />
1379
+ * <motion.li variants={item} />
1380
+ * </motion.ol>
1381
+ * )
1382
+ * ```
1383
+ *
1384
+ * @public
1385
+ */
1386
+ staggerChildren?: number;
1387
+ /**
1388
+ * The direction in which to stagger children.
1389
+ *
1390
+ * A value of `1` staggers from the first to the last while `-1`
1391
+ * staggers from the last to the first.
1392
+ *
1393
+ * ```jsx
1394
+ * const container = {
1395
+ * hidden: { opacity: 0 },
1396
+ * show: {
1397
+ * opacity: 1,
1398
+ * transition: {
1399
+ * delayChildren: 0.5,
1400
+ * staggerDirection: -1
1401
+ * }
1402
+ * }
1403
+ * }
1404
+ *
1405
+ * const item = {
1406
+ * hidden: { opacity: 0 },
1407
+ * show: { opacity: 1 }
1408
+ * }
1409
+ *
1410
+ * return (
1411
+ * <motion.ul
1412
+ * variants={container}
1413
+ * initial="hidden"
1414
+ * animate="show"
1415
+ * >
1416
+ * <motion.li variants={item} size={50} />
1417
+ * <motion.li variants={item} size={50} />
1418
+ * </motion.ul>
1419
+ * )
1420
+ * ```
1421
+ *
1422
+ * @public
1423
+ */
1424
+ staggerDirection?: number;
1425
+ }
1426
+ interface Repeat {
1427
+ /**
1428
+ * The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
1429
+ *
1430
+ * Without setting `repeatType`, this will loop the animation.
1431
+ *
1432
+ * ```jsx
1433
+ * <motion.div
1434
+ * animate={{ rotate: 180 }}
1435
+ * transition={{ repeat: Infinity, duration: 2 }}
1436
+ * />
1437
+ * ```
1438
+ *
1439
+ * @public
1440
+ */
1441
+ repeat?: number;
1442
+ /**
1443
+ * How to repeat the animation. This can be either:
1444
+ *
1445
+ * "loop": Repeats the animation from the start
1446
+ *
1447
+ * "reverse": Alternates between forward and backwards playback
1448
+ *
1449
+ * "mirror": Switches `from` and `to` alternately
1450
+ *
1451
+ * ```jsx
1452
+ * <motion.div
1453
+ * animate={{ rotate: 180 }}
1454
+ * transition={{
1455
+ * repeat: 1,
1456
+ * repeatType: "reverse",
1457
+ * duration: 2
1458
+ * }}
1459
+ * />
1460
+ * ```
1461
+ *
1462
+ * @public
1463
+ */
1464
+ repeatType?: "loop" | "reverse" | "mirror";
1465
+ /**
1466
+ * When repeating an animation, `repeatDelay` will set the
1467
+ * duration of the time to wait, in seconds, between each repetition.
1468
+ *
1469
+ * ```jsx
1470
+ * <motion.div
1471
+ * animate={{ rotate: 180 }}
1472
+ * transition={{ repeat: Infinity, repeatDelay: 1 }}
1473
+ * />
1474
+ * ```
1475
+ *
1476
+ * @public
1477
+ */
1478
+ repeatDelay?: number;
1479
+ }
1480
+ /**
1481
+ * An animation that animates between two or more values over a specific duration of time.
1482
+ * This is the default animation for non-physical values like `color` and `opacity`.
1483
+ *
1484
+ * @public
1485
+ */
1486
+ interface Tween extends Repeat {
1487
+ /**
1488
+ * Set `type` to `"tween"` to use a duration-based tween animation.
1489
+ * If any non-orchestration `transition` values are set without a `type` property,
1490
+ * this is used as the default animation.
1491
+ *
1492
+ * ```jsx
1493
+ * <motion.path
1494
+ * animate={{ pathLength: 1 }}
1495
+ * transition={{ duration: 2, type: "tween" }}
1496
+ * />
1497
+ * ```
1498
+ *
1499
+ * @public
1500
+ */
1501
+ type?: "tween";
1502
+ /**
1503
+ * The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
1504
+ *
1505
+ * ```jsx
1506
+ * const variants = {
1507
+ * visible: {
1508
+ * opacity: 1,
1509
+ * transition: { duration: 2 }
1510
+ * }
1511
+ * }
1512
+ * ```
1513
+ *
1514
+ * @public
1515
+ */
1516
+ duration?: number;
1517
+ /**
1518
+ * The easing function to use. Set as one of the below.
1519
+ *
1520
+ * - The name of an existing easing function.
1521
+ *
1522
+ * - An array of four numbers to define a cubic bezier curve.
1523
+ *
1524
+ * - An easing function, that accepts and returns a value `0-1`.
1525
+ *
1526
+ * If the animating value is set as an array of multiple values for a keyframes
1527
+ * animation, `ease` can be set as an array of easing functions to set different easings between
1528
+ * each of those values.
1529
+ *
1530
+ *
1531
+ * ```jsx
1532
+ * <motion.div
1533
+ * animate={{ opacity: 0 }}
1534
+ * transition={{ ease: [0.17, 0.67, 0.83, 0.67] }}
1535
+ * />
1536
+ * ```
1537
+ *
1538
+ * @public
1539
+ */
1540
+ ease?: Easing | Easing[];
1541
+ /**
1542
+ * When animating keyframes, `times` can be used to determine where in the animation each keyframe is reached.
1543
+ * Each value in `times` is a value between `0` and `1`, representing `duration`.
1544
+ *
1545
+ * There must be the same number of `times` as there are keyframes.
1546
+ * Defaults to an array of evenly-spread durations.
1547
+ *
1548
+ * ```jsx
1549
+ * <motion.div
1550
+ * animate={{ scale: [0, 1, 0.5, 1] }}
1551
+ * transition={{ times: [0, 0.1, 0.9, 1] }}
1552
+ * />
1553
+ * ```
1554
+ *
1555
+ * @public
1556
+ */
1557
+ times?: number[];
1558
+ /**
1559
+ * 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.
1560
+ *
1561
+ * ```jsx
1562
+ * <motion.div
1563
+ * animate={{ backgroundColor: ["#0f0", "#00f", "#f00"] }}
1564
+ * transition={{ easings: ["easeIn", "easeOut"] }}
1565
+ * />
1566
+ * ```
1567
+ *
1568
+ * @public
1569
+ */
1570
+ easings?: Easing[];
1571
+ /**
1572
+ * The value to animate from.
1573
+ * By default, this is the current state of the animating value.
1574
+ *
1575
+ * ```jsx
1576
+ * <motion.div
1577
+ * animate={{ rotate: 180 }}
1578
+ * transition={{ from: 90, duration: 2 }}
1579
+ * />
1580
+ * ```
1581
+ *
1582
+ * @public
1583
+ */
1584
+ from?: number | string;
1585
+ }
1586
+ /**
1587
+ * An animation that simulates spring physics for realistic motion.
1588
+ * This is the default animation for physical values like `x`, `y`, `scale` and `rotate`.
1589
+ *
1590
+ * @public
1591
+ */
1592
+ interface Spring extends Repeat {
1593
+ /**
1594
+ * Set `type` to `"spring"` to animate using spring physics for natural
1595
+ * movement. Type is set to `"spring"` by default.
1596
+ *
1597
+ * ```jsx
1598
+ * <motion.div
1599
+ * animate={{ rotate: 180 }}
1600
+ * transition={{ type: 'spring' }}
1601
+ * />
1602
+ * ```
1603
+ *
1604
+ * @public
1605
+ */
1606
+ type: "spring";
1607
+ /**
1608
+ * Stiffness of the spring. Higher values will create more sudden movement.
1609
+ * Set to `100` by default.
1610
+ *
1611
+ * ```jsx
1612
+ * <motion.section
1613
+ * animate={{ rotate: 180 }}
1614
+ * transition={{ type: 'spring', stiffness: 50 }}
1615
+ * />
1616
+ * ```
1617
+ *
1618
+ * @public
1619
+ */
1620
+ stiffness?: number;
1621
+ /**
1622
+ * Strength of opposing force. If set to 0, spring will oscillate
1623
+ * indefinitely. Set to `10` by default.
1624
+ *
1625
+ * ```jsx
1626
+ * <motion.a
1627
+ * animate={{ rotate: 180 }}
1628
+ * transition={{ type: 'spring', damping: 300 }}
1629
+ * />
1630
+ * ```
1631
+ *
1632
+ * @public
1633
+ */
1634
+ damping?: number;
1635
+ /**
1636
+ * Mass of the moving object. Higher values will result in more lethargic
1637
+ * movement. Set to `1` by default.
1638
+ *
1639
+ * ```jsx
1640
+ * <motion.feTurbulence
1641
+ * animate={{ baseFrequency: 0.5 } as any}
1642
+ * transition={{ type: "spring", mass: 0.5 }}
1643
+ * />
1644
+ * ```
1645
+ *
1646
+ * @public
1647
+ */
1648
+ mass?: number;
1649
+ /**
1650
+ * The duration of the animation, defined in seconds. Spring animations can be a maximum of 10 seconds.
1651
+ *
1652
+ * If `bounce` is set, this defaults to `0.8`.
1653
+ *
1654
+ * Note: `duration` and `bounce` will be overridden if `stiffness`, `damping` or `mass` are set.
1655
+ *
1656
+ * ```jsx
1657
+ * <motion.div
1658
+ * animate={{ x: 100 }}
1659
+ * transition={{ type: "spring", duration: 0.8 }}
1660
+ * />
1661
+ * ```
1662
+ *
1663
+ * @public
1664
+ */
1665
+ duration?: number;
1666
+ /**
1667
+ * `bounce` determines the "bounciness" of a spring animation.
1668
+ *
1669
+ * `0` is no bounce, and `1` is extremely bouncy.
1670
+ *
1671
+ * If `duration` is set, this defaults to `0.25`.
1672
+ *
1673
+ * Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
1674
+ *
1675
+ * ```jsx
1676
+ * <motion.div
1677
+ * animate={{ x: 100 }}
1678
+ * transition={{ type: "spring", bounce: 0.25 }}
1679
+ * />
1680
+ * ```
1681
+ *
1682
+ * @public
1683
+ */
1684
+ bounce?: number;
1685
+ /**
1686
+ * End animation if absolute speed (in units per second) drops below this
1687
+ * value and delta is smaller than `restDelta`. Set to `0.01` by default.
1688
+ *
1689
+ * ```jsx
1690
+ * <motion.div
1691
+ * animate={{ rotate: 180 }}
1692
+ * transition={{ type: 'spring', restSpeed: 0.5 }}
1693
+ * />
1694
+ * ```
1695
+ *
1696
+ * @public
1697
+ */
1698
+ restSpeed?: number;
1699
+ /**
1700
+ * End animation if distance is below this value and speed is below
1701
+ * `restSpeed`. When animation ends, spring gets “snapped” to. Set to
1702
+ * `0.01` by default.
1703
+ *
1704
+ * ```jsx
1705
+ * <motion.div
1706
+ * animate={{ rotate: 180 }}
1707
+ * transition={{ type: 'spring', restDelta: 0.5 }}
1708
+ * />
1709
+ * ```
1710
+ *
1711
+ * @public
1712
+ */
1713
+ restDelta?: number;
1714
+ /**
1715
+ * The value to animate from.
1716
+ * By default, this is the initial state of the animating value.
1717
+ *
1718
+ * ```jsx
1719
+ * <motion.div
1720
+ * animate={{ rotate: 180 }}
1721
+ * transition={{ type: 'spring', from: 90 }}
1722
+ * />
1723
+ * ```
1724
+ *
1725
+ * @public
1726
+ */
1727
+ from?: number | string;
1728
+ /**
1729
+ * The initial velocity of the spring. By default this is the current velocity of the component.
1730
+ *
1731
+ * ```jsx
1732
+ * <motion.div
1733
+ * animate={{ rotate: 180 }}
1734
+ * transition={{ type: 'spring', velocity: 2 }}
1735
+ * />
1736
+ * ```
1737
+ *
1738
+ * @public
1739
+ */
1740
+ velocity?: number;
1741
+ }
1742
+ /**
1743
+ * An animation that decelerates a value based on its initial velocity,
1744
+ * usually used to implement inertial scrolling.
1745
+ *
1746
+ * Optionally, `min` and `max` boundaries can be defined, and inertia
1747
+ * will snap to these with a spring animation.
1748
+ *
1749
+ * This animation will automatically precalculate a target value,
1750
+ * which can be modified with the `modifyTarget` property.
1751
+ *
1752
+ * This allows you to add snap-to-grid or similar functionality.
1753
+ *
1754
+ * Inertia is also the animation used for `dragTransition`, and can be configured via that prop.
1755
+ *
1756
+ * @public
1757
+ */
1758
+ interface Inertia {
1759
+ /**
1760
+ * Set `type` to animate using the inertia animation. Set to `"tween"` by
1761
+ * default. This can be used for natural deceleration, like momentum scrolling.
1762
+ *
1763
+ * ```jsx
1764
+ * <motion.div
1765
+ * animate={{ rotate: 180 }}
1766
+ * transition={{ type: "inertia", velocity: 50 }}
1767
+ * />
1768
+ * ```
1769
+ *
1770
+ * @public
1771
+ */
1772
+ type: "inertia";
1773
+ /**
1774
+ * A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
1775
+ *
1776
+ * ```jsx
1777
+ * <motion.div
1778
+ * drag
1779
+ * dragTransition={{
1780
+ * power: 0,
1781
+ * // Snap calculated target to nearest 50 pixels
1782
+ * modifyTarget: target => Math.round(target / 50) * 50
1783
+ * }}
1784
+ * />
1785
+ * ```
1786
+ *
1787
+ * @public
1788
+ */
1789
+ modifyTarget?(v: number): number;
1790
+ /**
1791
+ * If `min` or `max` is set, this affects the stiffness of the bounce
1792
+ * spring. Higher values will create more sudden movement. Set to `500` by
1793
+ * default.
1794
+ *
1795
+ * ```jsx
1796
+ * <motion.div
1797
+ * drag
1798
+ * dragTransition={{
1799
+ * min: 0,
1800
+ * max: 100,
1801
+ * bounceStiffness: 100
1802
+ * }}
1803
+ * />
1804
+ * ```
1805
+ *
1806
+ * @public
1807
+ */
1808
+ bounceStiffness?: number;
1809
+ /**
1810
+ * If `min` or `max` is set, this affects the damping of the bounce spring.
1811
+ * If set to `0`, spring will oscillate indefinitely. Set to `10` by
1812
+ * default.
1813
+ *
1814
+ * ```jsx
1815
+ * <motion.div
1816
+ * drag
1817
+ * dragTransition={{
1818
+ * min: 0,
1819
+ * max: 100,
1820
+ * bounceDamping: 8
1821
+ * }}
1822
+ * />
1823
+ * ```
1824
+ *
1825
+ * @public
1826
+ */
1827
+ bounceDamping?: number;
1828
+ /**
1829
+ * A higher power value equals a further target. Set to `0.8` by default.
1830
+ *
1831
+ * ```jsx
1832
+ * <motion.div
1833
+ * drag
1834
+ * dragTransition={{ power: 0.2 }}
1835
+ * />
1836
+ * ```
1837
+ *
1838
+ * @public
1839
+ */
1840
+ power?: number;
1841
+ /**
1842
+ * Adjusting the time constant will change the duration of the
1843
+ * deceleration, thereby affecting its feel. Set to `700` by default.
1844
+ *
1845
+ * ```jsx
1846
+ * <motion.div
1847
+ * drag
1848
+ * dragTransition={{ timeConstant: 200 }}
1849
+ * />
1850
+ * ```
1851
+ *
1852
+ * @public
1853
+ */
1854
+ timeConstant?: number;
1855
+ /**
1856
+ * End the animation if the distance to the animation target is below this value, and the absolute speed is below `restSpeed`.
1857
+ * When the animation ends, the value gets snapped to the animation target. Set to `0.01` by default.
1858
+ * Generally the default values provide smooth animation endings, only in rare cases should you need to customize these.
1859
+ *
1860
+ * ```jsx
1861
+ * <motion.div
1862
+ * drag
1863
+ * dragTransition={{ restDelta: 10 }}
1864
+ * />
1865
+ * ```
1866
+ *
1867
+ * @public
1868
+ */
1869
+ restDelta?: number;
1870
+ /**
1871
+ * 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).
1872
+ *
1873
+ * ```jsx
1874
+ * <motion.div
1875
+ * drag
1876
+ * dragTransition={{ min: 0, max: 100 }}
1877
+ * />
1878
+ * ```
1879
+ *
1880
+ * @public
1881
+ */
1882
+ min?: number;
1883
+ /**
1884
+ * Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
1885
+ *
1886
+ * ```jsx
1887
+ * <motion.div
1888
+ * drag
1889
+ * dragTransition={{ min: 0, max: 100 }}
1890
+ * />
1891
+ * ```
1892
+ *
1893
+ * @public
1894
+ */
1895
+ max?: number;
1896
+ /**
1897
+ * The value to animate from. By default, this is the current state of the animating value.
1898
+ *
1899
+ * ```jsx
1900
+ * <Frame
1901
+ * drag
1902
+ * dragTransition={{ from: 50 }}
1903
+ * />
1904
+ * ```
1905
+ *
1906
+ * @public
1907
+ */
1908
+ from?: number | string;
1909
+ /**
1910
+ * The initial velocity of the animation.
1911
+ * By default this is the current velocity of the component.
1912
+ *
1913
+ * ```jsx
1914
+ * <motion.div
1915
+ * animate={{ rotate: 180 }}
1916
+ * transition={{ type: 'inertia', velocity: 200 }}
1917
+ * />
1918
+ * ```
1919
+ *
1920
+ * @public
1921
+ */
1922
+ velocity?: number;
1923
+ }
1924
+ /**
1925
+ * Keyframes tweens between multiple `values`.
1926
+ *
1927
+ * These tweens can be arranged using the `duration`, `easings`, and `times` properties.
1928
+ */
1929
+ interface Keyframes {
1930
+ /**
1931
+ * Set `type` to `"keyframes"` to animate using the keyframes animation.
1932
+ * Set to `"tween"` by default. This can be used to animate between a series of values.
1933
+ *
1934
+ * @public
1935
+ */
1936
+ type: "keyframes";
1937
+ /**
1938
+ * An array of numbers between 0 and 1, where `1` represents the `total` duration.
1939
+ *
1940
+ * 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`.
1941
+ *
1942
+ * Defaults to an array of evenly-spread durations.
1943
+ *
1944
+ * @public
1945
+ */
1946
+ times?: number[];
1947
+ /**
1948
+ * An array of easing functions for each generated tween, or a single easing function applied to all tweens.
1949
+ *
1950
+ * This array should be one item less than `values`, as these easings apply to the transitions *between* the `values`.
1951
+ *
1952
+ * ```jsx
1953
+ * const transition = {
1954
+ * backgroundColor: {
1955
+ * type: 'keyframes',
1956
+ * easings: ['circIn', 'circOut']
1957
+ * }
1958
+ * }
1959
+ * ```
1960
+ *
1961
+ * @public
1962
+ */
1963
+ ease?: Easing | Easing[];
1964
+ /**
1965
+ * The total duration of the animation. Set to `0.3` by default.
1966
+ *
1967
+ * ```jsx
1968
+ * const transition = {
1969
+ * type: "keyframes",
1970
+ * duration: 2
1971
+ * }
1972
+ *
1973
+ * <Frame
1974
+ * animate={{ opacity: 0 }}
1975
+ * transition={transition}
1976
+ * />
1977
+ * ```
1978
+ *
1979
+ * @public
1980
+ */
1981
+ duration?: number;
1982
+ /**
1983
+ * @public
1984
+ */
1985
+ repeatDelay?: number;
1986
+ }
1987
+ /**
1988
+ * @public
1989
+ */
1990
+ interface Just {
1991
+ /**
1992
+ * @public
1993
+ */
1994
+ type: "just";
1995
+ }
1996
+ /**
1997
+ * @public
1998
+ */
1999
+ interface None {
2000
+ /**
2001
+ * Set `type` to `false` for an instant transition.
2002
+ *
2003
+ * @public
2004
+ */
2005
+ type: false;
2006
+ }
2007
+ /**
2008
+ * @public
2009
+ */
2010
+ declare type PermissiveTransitionDefinition = {
2011
+ [key: string]: any;
2012
+ };
2013
+ /**
2014
+ * @public
2015
+ */
2016
+ declare type TransitionDefinition = Tween | Spring | Keyframes | Inertia | Just | None | PermissiveTransitionDefinition;
2017
+ declare type TransitionMap = Orchestration & {
2018
+ [key: string]: TransitionDefinition;
2019
+ };
2020
+ /**
2021
+ * Transition props
2022
+ *
2023
+ * @public
2024
+ */
2025
+ declare type Transition = (Orchestration & Repeat & TransitionDefinition) | (Orchestration & Repeat & TransitionMap);
2026
+ declare type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
2027
+ declare type CSSPropertiesWithoutTransitionOrSingleTransforms = Omit$1<CSSProperties, "transition" | "rotate" | "scale" | "perspective">;
2028
+ declare type TargetProperties = CSSPropertiesWithoutTransitionOrSingleTransforms & SVGAttributes<SVGElement> & TransformProperties & CustomStyles & SVGPathProperties;
2029
+ /**
2030
+ * @public
2031
+ */
2032
+ declare type MakeCustomValueType<T> = {
2033
+ [K in keyof T]: T[K] | CustomValueType;
2034
+ };
2035
+ /**
2036
+ * @public
2037
+ */
2038
+ declare type Target = MakeCustomValueType<TargetProperties>;
2039
+ /**
2040
+ * @public
2041
+ */
2042
+ declare type MakeKeyframes<T> = {
2043
+ [K in keyof T]: T[K] | T[K][] | [null, ...T[K][]];
2044
+ };
2045
+ /**
2046
+ * @public
2047
+ */
2048
+ declare type TargetWithKeyframes = MakeKeyframes<Target>;
2049
+ /**
2050
+ * An object that specifies values to animate to. Each value may be set either as
2051
+ * a single value, or an array of values.
2052
+ *
2053
+ * It may also option contain these properties:
2054
+ *
2055
+ * - `transition`: Specifies transitions for all or individual values.
2056
+ * - `transitionEnd`: Specifies values to set when the animation finishes.
2057
+ *
2058
+ * ```jsx
2059
+ * const target = {
2060
+ * x: "0%",
2061
+ * opacity: 0,
2062
+ * transition: { duration: 1 },
2063
+ * transitionEnd: { display: "none" }
2064
+ * }
2065
+ * ```
2066
+ *
2067
+ * @public
2068
+ */
2069
+ declare type TargetAndTransition = TargetWithKeyframes & {
2070
+ transition?: Transition;
2071
+ transitionEnd?: Target;
2072
+ };
2073
+ declare type TargetResolver = (custom: any, current: Target, velocity: Target) => TargetAndTransition | string;
2074
+ /**
2075
+ * @public
2076
+ */
2077
+ declare type Variant = TargetAndTransition | TargetResolver;
2078
+ /**
2079
+ * @public
2080
+ */
2081
+ declare type Variants = {
2082
+ [key: string]: Variant;
2083
+ };
2084
+ /**
2085
+ * @public
2086
+ */
2087
+ interface CustomValueType {
2088
+ mix: (from: any, to: any) => (p: number) => number | string;
2089
+ toValue: () => number | string;
2090
+ }
2091
+
2092
+ /**
2093
+ * Start animation on a MotionValue. This function is an interface between
2094
+ * Framer Motion and Popmotion
2095
+ */
2096
+ declare function startAnimation(key: string, value: MotionValue, target: ResolvedValueTarget, transition?: Transition): Promise<void>;
2097
+
2098
+ interface VisualState<Instance, RenderState> {
2099
+ renderState: RenderState;
2100
+ latestValues: ResolvedValues;
2101
+ mount?: (instance: Instance) => void;
2102
+ }
2103
+ declare type UseVisualState<Instance, RenderState> = (props: MotionProps, isStatic: boolean) => VisualState<Instance, RenderState>;
2104
+ interface UseVisualStateConfig<Instance, RenderState> {
2105
+ scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps;
2106
+ createRenderState: () => RenderState;
2107
+ onMount?: (props: MotionProps, instance: Instance, visualState: VisualState<Instance, RenderState>) => void;
2108
+ }
2109
+ declare const makeUseVisualState: <I, RS>(config: UseVisualStateConfig<I, RS>) => UseVisualState<I, RS>;
2110
+
2111
+ interface AnimationState {
2112
+ animateChanges: (options?: AnimationOptions, type?: AnimationType) => Promise<any>;
2113
+ setActive: (type: AnimationType, isActive: boolean, options?: AnimationOptions) => Promise<any>;
2114
+ setAnimateFunction: (fn: any) => void;
2115
+ isAnimated(key: string): boolean;
2116
+ getState: () => {
2117
+ [key: string]: AnimationTypeState;
2118
+ };
2119
+ }
2120
+ interface AnimationTypeState {
2121
+ isActive: boolean;
2122
+ protectedKeys: {
2123
+ [key: string]: true;
2124
+ };
2125
+ needsAnimating: {
2126
+ [key: string]: boolean;
2127
+ };
2128
+ prevResolvedValues: {
2129
+ [key: string]: any;
2130
+ };
2131
+ prevProp?: VariantLabels | TargetAndTransition;
2132
+ }
2133
+
2134
+ declare class NodeStack {
2135
+ lead?: IProjectionNode;
2136
+ prevLead?: IProjectionNode;
2137
+ members: IProjectionNode[];
2138
+ add(node: IProjectionNode): void;
2139
+ remove(node: IProjectionNode): void;
2140
+ relegate(node: IProjectionNode): boolean;
2141
+ promote(node: IProjectionNode, preserveFollowOpacity?: boolean): void;
2142
+ exitAnimationComplete(): void;
2143
+ scheduleRender(): void;
2144
+ /**
2145
+ * Clear any leads that have been removed this render to prevent them from being
2146
+ * used in future animations and to prevent memory leaks
2147
+ */
2148
+ removeLeadSnapshot(): void;
2149
+ }
2150
+
2151
+ /**
2152
+ * @public
2153
+ */
2154
+ interface AnimationPlaybackControls {
2155
+ stop: () => void;
2156
+ isAnimating: () => boolean;
2157
+ }
2158
+
2159
+ interface WithDepth {
2160
+ depth: number;
2161
+ }
2162
+
2163
+ declare class FlatTree {
2164
+ private children;
2165
+ private isDirty;
2166
+ add(child: WithDepth): void;
2167
+ remove(child: WithDepth): void;
2168
+ forEach(callback: (child: WithDepth) => void): void;
2169
+ }
2170
+
2171
+ declare type InitialPromotionConfig = {
2172
+ /**
2173
+ * The initial transition to use when the elements in this group mount (and automatically promoted).
2174
+ * Subsequent updates should provide a transition in the promote method.
2175
+ */
2176
+ transition?: Transition;
2177
+ /**
2178
+ * If the follow tree should preserve its opacity when the lead is promoted on mount
2179
+ */
2180
+ shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean;
2181
+ };
2182
+
2183
+ interface Snapshot {
2184
+ measured: Box;
2185
+ layout: Box;
2186
+ latestValues: ResolvedValues;
2187
+ isShared?: boolean;
2188
+ }
2189
+ interface Layout {
2190
+ measured: Box;
2191
+ actual: Box;
2192
+ }
2193
+ declare type LayoutEvents = "willUpdate" | "didUpdate" | "beforeMeasure" | "measure" | "projectionUpdate" | "animationStart" | "animationComplete";
2194
+ interface IProjectionNode<I = unknown> {
2195
+ id: number | undefined;
2196
+ parent?: IProjectionNode;
2197
+ relativeParent?: IProjectionNode;
2198
+ root?: IProjectionNode;
2199
+ children: Set<IProjectionNode>;
2200
+ path: IProjectionNode[];
2201
+ nodes?: FlatTree;
2202
+ depth: number;
2203
+ instance: I;
2204
+ mount: (node: I, isLayoutDirty?: boolean) => void;
2205
+ unmount: () => void;
2206
+ options: ProjectionNodeOptions;
2207
+ setOptions(options: ProjectionNodeOptions): void;
2208
+ layout?: Layout;
2209
+ snapshot?: Snapshot;
2210
+ target?: Box;
2211
+ relativeTarget?: Box;
2212
+ targetDelta?: Delta;
2213
+ targetWithTransforms?: Box;
2214
+ scroll?: Point;
2215
+ treeScale?: Point;
2216
+ projectionDelta?: Delta;
2217
+ latestValues: ResolvedValues;
2218
+ isLayoutDirty: boolean;
2219
+ shouldResetTransform: boolean;
2220
+ prevTransformTemplateValue: string | undefined;
2221
+ isUpdateBlocked(): boolean;
2222
+ updateManuallyBlocked: boolean;
2223
+ updateBlockedByResize: boolean;
2224
+ blockUpdate(): void;
2225
+ unblockUpdate(): void;
2226
+ isUpdating: boolean;
2227
+ needsReset: boolean;
2228
+ startUpdate(): void;
2229
+ willUpdate(notifyListeners?: boolean): void;
2230
+ didUpdate(): void;
2231
+ measure(): Box;
2232
+ updateLayout(): void;
2233
+ updateSnapshot(): void;
2234
+ clearSnapshot(): void;
2235
+ updateScroll(): void;
2236
+ scheduleUpdateProjection(): void;
2237
+ scheduleCheckAfterUnmount(): void;
2238
+ checkUpdateFailed(): void;
2239
+ potentialNodes: Map<number, IProjectionNode>;
2240
+ sharedNodes: Map<string, NodeStack>;
2241
+ registerPotentialNode(id: number, node: IProjectionNode): void;
2242
+ registerSharedNode(id: string, node: IProjectionNode): void;
2243
+ getStack(): NodeStack | undefined;
2244
+ isVisible: boolean;
2245
+ hide(): void;
2246
+ show(): void;
2247
+ scheduleRender(notifyAll?: boolean): void;
2248
+ getClosestProjectingParent(): IProjectionNode | undefined;
2249
+ setTargetDelta(delta: Delta): void;
2250
+ resetTransform(): void;
2251
+ resetRotation(): void;
2252
+ applyTransform(box: Box, transformOnly?: boolean): Box;
2253
+ resolveTargetDelta(): void;
2254
+ calcProjection(): void;
2255
+ getProjectionStyles(styles?: MotionStyle): MotionStyle | undefined;
2256
+ clearMeasurements(): void;
2257
+ resetTree(): void;
2258
+ animationValues?: ResolvedValues;
2259
+ currentAnimation?: AnimationPlaybackControls;
2260
+ isTreeAnimating?: boolean;
2261
+ isAnimationBlocked?: boolean;
2262
+ isTreeAnimationBlocked: () => boolean;
2263
+ setAnimationOrigin(delta: Delta): void;
2264
+ startAnimation(transition: Transition): void;
2265
+ finishAnimation(): void;
2266
+ isLead(): boolean;
2267
+ promote(options?: {
2268
+ needsReset?: boolean;
2269
+ transition?: Transition;
2270
+ preserveFollowOpacity?: boolean;
2271
+ }): void;
2272
+ relegate(): boolean;
2273
+ resumeFrom?: IProjectionNode;
2274
+ resumingFrom?: IProjectionNode;
2275
+ isPresent?: boolean;
2276
+ addEventListener(name: LayoutEvents, handler: any): VoidFunction;
2277
+ notifyListeners(name: LayoutEvents, ...args: any): void;
2278
+ hasListeners(name: LayoutEvents): boolean;
2279
+ preserveOpacity?: boolean;
2280
+ }
2281
+ interface ProjectionNodeOptions {
2282
+ animate?: boolean;
2283
+ layoutScroll?: boolean;
2284
+ alwaysMeasureLayout?: boolean;
2285
+ scheduleRender?: VoidFunction;
2286
+ onExitComplete?: VoidFunction;
2287
+ animationType?: "size" | "position" | "both";
2288
+ layoutId?: string;
2289
+ layout?: boolean | string;
2290
+ visualElement?: VisualElement;
2291
+ crossfade?: boolean;
2292
+ transition?: Transition;
2293
+ initialPromotionConfig?: InitialPromotionConfig;
2294
+ }
2295
+
2296
+ declare function filterProps(props: MotionProps, isDom: boolean, forwardMotionProps: boolean): {};
2297
+
2298
+ interface VisualElement<Instance = any, RenderState = any> extends LifecycleManager {
2299
+ treeType: string;
2300
+ depth: number;
2301
+ parent?: VisualElement;
2302
+ children: Set<VisualElement>;
2303
+ variantChildren?: Set<VisualElement>;
2304
+ current: Instance | null;
2305
+ manuallyAnimateOnMount: boolean;
2306
+ blockInitialAnimation?: boolean;
2307
+ presenceId: number | undefined;
2308
+ isMounted(): boolean;
2309
+ mount(instance: Instance): void;
2310
+ unmount(): void;
2311
+ isStatic?: boolean;
2312
+ getInstance(): Instance | null;
2313
+ sortNodePosition(element: VisualElement): number;
2314
+ measureViewportBox(withTransform?: boolean): Box;
2315
+ addVariantChild(child: VisualElement): undefined | (() => void);
2316
+ getClosestVariantNode(): VisualElement | undefined;
2317
+ shouldReduceMotion?: boolean | null;
2318
+ animateMotionValue?: typeof startAnimation;
2319
+ projection?: IProjectionNode;
2320
+ /**
2321
+ * Visibility
2322
+ */
2323
+ isVisible?: boolean;
2324
+ setVisibility(visibility: boolean): void;
2325
+ hasValue(key: string): boolean;
2326
+ addValue(key: string, value: MotionValue<any>): void;
2327
+ removeValue(key: string): void;
2328
+ getValue(key: string): undefined | MotionValue;
2329
+ getValue(key: string, defaultValue: string | number): MotionValue;
2330
+ getValue(key: string, defaultValue?: string | number): undefined | MotionValue;
2331
+ forEachValue(callback: (value: MotionValue, key: string) => void): void;
2332
+ readValue(key: string): string | number | undefined | null;
2333
+ setBaseTarget(key: string, value: string | number | null): void;
2334
+ getBaseTarget(key: string): number | string | undefined | null;
2335
+ getStaticValue(key: string): number | string | undefined;
2336
+ setStaticValue(key: string, value: number | string): void;
2337
+ getLatestValues(): ResolvedValues;
2338
+ scheduleRender(): void;
2339
+ makeTargetAnimatable(target: TargetAndTransition, isLive?: boolean): TargetAndTransition;
2340
+ setProps(props: MotionProps): void;
2341
+ getProps(): MotionProps;
2342
+ getVariant(name: string): Variant | undefined;
2343
+ getDefaultTransition(): Transition | undefined;
2344
+ getVariantContext(startAtParent?: boolean): undefined | {
2345
+ initial?: string | string[];
2346
+ animate?: string | string[];
2347
+ exit?: string | string[];
2348
+ whileHover?: string | string[];
2349
+ whileDrag?: string | string[];
2350
+ whileFocus?: string | string[];
2351
+ whileTap?: string | string[];
2352
+ };
2353
+ getTransformPagePoint: () => TransformPoint | undefined;
2354
+ build(): RenderState;
2355
+ syncRender(): void;
2356
+ isPresenceRoot?: boolean;
2357
+ isPresent?: boolean;
2358
+ prevDragCursor?: Point;
2359
+ getLayoutId(): string | undefined;
2360
+ animationState?: AnimationState;
2361
+ }
2362
+ declare type ScrapeMotionValuesFromProps = (props: MotionProps) => {
2363
+ [key: string]: MotionValue | string | number;
2364
+ };
2365
+ declare type VisualElementOptions<Instance, RenderState = any> = {
2366
+ visualState: VisualState<Instance, RenderState>;
2367
+ parent?: VisualElement<unknown>;
2368
+ variantParent?: VisualElement<unknown>;
2369
+ presenceId?: number | undefined;
2370
+ props: MotionProps;
2371
+ blockInitialAnimation?: boolean;
2372
+ shouldReduceMotion?: boolean | null;
2373
+ };
2374
+ declare type CreateVisualElement<Instance> = (Component: string | React.ComponentType, options: VisualElementOptions<Instance>) => VisualElement<Instance>;
2375
+ /**
2376
+ * A generic set of string/number values
2377
+ */
2378
+ interface ResolvedValues {
2379
+ [key: string]: string | number;
2380
+ }
2381
+
2382
+ /**
2383
+ * @public
2384
+ */
2385
+ interface FeatureProps extends MotionProps {
2386
+ visualElement: VisualElement;
2387
+ }
2388
+ declare type FeatureComponent = React.ComponentType<FeatureProps>;
2389
+ interface FeatureComponents {
2390
+ animation?: FeatureComponent;
2391
+ exit?: FeatureComponent;
2392
+ drag?: FeatureComponent;
2393
+ tap?: FeatureComponent;
2394
+ focus?: FeatureComponent;
2395
+ hover?: FeatureComponent;
2396
+ pan?: FeatureComponent;
2397
+ inView?: FeatureComponent;
2398
+ measureLayout?: FeatureComponent;
2399
+ }
2400
+
2401
+ declare const animations: FeatureComponents;
2402
+
2403
+ declare function useVisualElementContext(): VisualElement<any, any> | undefined;
2404
+
2405
+ declare function checkTargetForNewValues(visualElement: VisualElement, target: TargetWithKeyframes, origin: ResolvedValues): void;
2406
+
2407
+ declare const createBox: () => Box;
2408
+
2409
+ declare function calcLength(axis: Axis): number;
2410
+
2411
+ declare function isDragActive(): boolean;
2412
+
2413
+ declare type EventListenerWithPointInfo = (e: MouseEvent | TouchEvent | PointerEvent, info: EventInfo) => void;
2414
+ declare const wrapHandler: (handler: EventListenerWithPointInfo, shouldFilterPrimaryPointer?: boolean) => EventListener;
2415
+
2416
+ declare function addPointerEvent(target: EventTarget, eventName: string, handler: EventListenerWithPointInfo, options?: AddEventListenerOptions): () => void;
2417
+
2418
+ declare const isMotionValue: (value: any) => value is MotionValue<any>;
2419
+
2420
+ declare const isBrowser: boolean;
2421
+
2422
+ declare function useUnmountEffect(callback: () => void): void;
2423
+
2424
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
2425
+
2426
+ declare function useForceUpdate(): [VoidFunction, number];
2427
+
2428
+ export { AnimationLifecycles, AnimationType, CreateVisualElement, ResolvedValues, ScrapeMotionValuesFromProps, VisualState, addPointerEvent, animations, calcLength, checkTargetForNewValues, createBox, filterProps, isBrowser, isDragActive, isMotionValue, makeUseVisualState, useForceUpdate, useIsomorphicLayoutEffect, useUnmountEffect, useVisualElementContext, wrapHandler };