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,4118 @@
1
+ /// <reference types="react" />
2
+ import * as React$1 from 'react';
3
+ import { RefObject, CSSProperties, SVGAttributes, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, ReactHTML, DetailedHTMLFactory, HTMLAttributes, useEffect } from 'react';
4
+ import { Easing as Easing$1, SpringOptions } from 'popmotion';
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ declare type Subscriber<T> = (v: T) => void;
10
+ /**
11
+ * @public
12
+ */
13
+ declare type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void;
14
+ /**
15
+ * `MotionValue` is used to track the state and velocity of motion values.
16
+ *
17
+ * @public
18
+ */
19
+ declare class MotionValue<V = any> {
20
+ /**
21
+ * This will be replaced by the build step with the latest version number.
22
+ * When MotionValues are provided to motion components, warn if versions are mixed.
23
+ */
24
+ version: string;
25
+ clearListeners(): void;
26
+ /**
27
+ * Sets the state of the `MotionValue`.
28
+ *
29
+ * @remarks
30
+ *
31
+ * ```jsx
32
+ * const x = useMotionValue(0)
33
+ * x.set(10)
34
+ * ```
35
+ *
36
+ * @param latest - Latest value to set.
37
+ * @param render - Whether to notify render subscribers. Defaults to `true`
38
+ *
39
+ * @public
40
+ */
41
+ set(v: V, render?: boolean): void;
42
+ updateAndNotify: (v: V, render?: boolean) => void;
43
+ /**
44
+ * Returns the latest state of `MotionValue`
45
+ *
46
+ * @returns - The latest state of `MotionValue`
47
+ *
48
+ * @public
49
+ */
50
+ get(): V;
51
+ /**
52
+ * @public
53
+ */
54
+ getPrevious(): V;
55
+ /**
56
+ * Returns the latest velocity of `MotionValue`
57
+ *
58
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
59
+ *
60
+ * @public
61
+ */
62
+ getVelocity(): number;
63
+ hasAnimated: boolean;
64
+ /**
65
+ * Stop the currently active animation.
66
+ *
67
+ * @public
68
+ */
69
+ stop(): void;
70
+ /**
71
+ * Returns `true` if this value is currently animating.
72
+ *
73
+ * @public
74
+ */
75
+ isAnimating(): boolean;
76
+ private clearAnimation;
77
+ /**
78
+ * Destroy and clean up subscribers to this `MotionValue`.
79
+ *
80
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
81
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
82
+ * created a `MotionValue` via the `motionValue` function.
83
+ *
84
+ * @public
85
+ */
86
+ destroy(): void;
87
+ }
88
+ declare function motionValue<V>(init: V): MotionValue<V>;
89
+
90
+ /**
91
+ * @public
92
+ */
93
+ declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
94
+ /**
95
+ * @public
96
+ */
97
+ interface AnimationControls {
98
+ /**
99
+ * Starts an animation on all linked components.
100
+ *
101
+ * @remarks
102
+ *
103
+ * ```jsx
104
+ * controls.start("variantLabel")
105
+ * controls.start({
106
+ * x: 0,
107
+ * transition: { duration: 1 }
108
+ * })
109
+ * ```
110
+ *
111
+ * @param definition - Properties or variant label to animate to
112
+ * @param transition - Optional `transtion` to apply to a variant
113
+ * @returns - A `Promise` that resolves when all animations have completed.
114
+ *
115
+ * @public
116
+ */
117
+ start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
118
+ /**
119
+ * Stops animations on all linked components.
120
+ *
121
+ * ```jsx
122
+ * controls.stop()
123
+ * ```
124
+ *
125
+ * @public
126
+ */
127
+ stop(): void;
128
+ mount(): () => void;
129
+ }
130
+
131
+ interface Point {
132
+ x: number;
133
+ y: number;
134
+ }
135
+ interface Axis {
136
+ min: number;
137
+ max: number;
138
+ }
139
+ interface Box {
140
+ x: Axis;
141
+ y: Axis;
142
+ }
143
+ interface BoundingBox {
144
+ top: number;
145
+ right: number;
146
+ bottom: number;
147
+ left: number;
148
+ }
149
+ interface AxisDelta {
150
+ translate: number;
151
+ scale: number;
152
+ origin: number;
153
+ originPoint: number;
154
+ }
155
+ interface Delta {
156
+ x: AxisDelta;
157
+ y: AxisDelta;
158
+ }
159
+ declare type TransformPoint = (point: Point) => Point;
160
+
161
+ /**
162
+ * Passed in to pan event handlers like `onPan` the `PanInfo` object contains
163
+ * information about the current state of the tap gesture such as its
164
+ * `point`, `delta`, `offset` and `velocity`.
165
+ *
166
+ * ```jsx
167
+ * <motion.div onPan={(event, info) => {
168
+ * console.log(info.point.x, info.point.y)
169
+ * }} />
170
+ * ```
171
+ *
172
+ * @public
173
+ */
174
+ interface PanInfo {
175
+ /**
176
+ * Contains `x` and `y` values for the current pan position relative
177
+ * to the device or page.
178
+ *
179
+ * ```jsx
180
+ * function onPan(event, info) {
181
+ * console.log(info.point.x, info.point.y)
182
+ * }
183
+ *
184
+ * <motion.div onPan={onPan} />
185
+ * ```
186
+ *
187
+ * @public
188
+ */
189
+ point: Point;
190
+ /**
191
+ * Contains `x` and `y` values for the distance moved since
192
+ * the last event.
193
+ *
194
+ * ```jsx
195
+ * function onPan(event, info) {
196
+ * console.log(info.delta.x, info.delta.y)
197
+ * }
198
+ *
199
+ * <motion.div onPan={onPan} />
200
+ * ```
201
+ *
202
+ * @public
203
+ */
204
+ delta: Point;
205
+ /**
206
+ * Contains `x` and `y` values for the distance moved from
207
+ * the first pan event.
208
+ *
209
+ * ```jsx
210
+ * function onPan(event, info) {
211
+ * console.log(info.offset.x, info.offset.y)
212
+ * }
213
+ *
214
+ * <motion.div onPan={onPan} />
215
+ * ```
216
+ *
217
+ * @public
218
+ */
219
+ offset: Point;
220
+ /**
221
+ * Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
222
+ *
223
+ * ```jsx
224
+ * function onPan(event, info) {
225
+ * console.log(info.velocity.x, info.velocity.y)
226
+ * }
227
+ *
228
+ * <motion.div onPan={onPan} />
229
+ * ```
230
+ *
231
+ * @public
232
+ */
233
+ velocity: Point;
234
+ }
235
+
236
+ interface DragControlOptions {
237
+ snapToCursor?: boolean;
238
+ cursorProgress?: Point;
239
+ }
240
+
241
+ /**
242
+ * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.
243
+ *
244
+ * ```jsx
245
+ * const dragControls = useDragControls()
246
+ *
247
+ * function startDrag(event) {
248
+ * dragControls.start(event, { snapToCursor: true })
249
+ * }
250
+ *
251
+ * return (
252
+ * <>
253
+ * <div onPointerDown={startDrag} />
254
+ * <motion.div drag="x" dragControls={dragControls} />
255
+ * </>
256
+ * )
257
+ * ```
258
+ *
259
+ * @public
260
+ */
261
+ declare class DragControls {
262
+ private componentControls;
263
+ /**
264
+ * Start a drag gesture on every `motion` component that has this set of drag controls
265
+ * passed into it via the `dragControls` prop.
266
+ *
267
+ * ```jsx
268
+ * dragControls.start(e, {
269
+ * snapToCursor: true
270
+ * })
271
+ * ```
272
+ *
273
+ * @param event - PointerEvent
274
+ * @param options - Options
275
+ *
276
+ * @public
277
+ */
278
+ start(event: React$1.MouseEvent | React$1.TouchEvent | React$1.PointerEvent | MouseEvent | TouchEvent | PointerEvent, options?: DragControlOptions): void;
279
+ }
280
+ /**
281
+ * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop
282
+ * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we
283
+ * might want to initiate that dragging from a different component than the draggable one.
284
+ *
285
+ * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
286
+ * the draggable component's `dragControls` prop. It exposes a `start` method
287
+ * that can start dragging from pointer events on other components.
288
+ *
289
+ * ```jsx
290
+ * const dragControls = useDragControls()
291
+ *
292
+ * function startDrag(event) {
293
+ * dragControls.start(event, { snapToCursor: true })
294
+ * }
295
+ *
296
+ * return (
297
+ * <>
298
+ * <div onPointerDown={startDrag} />
299
+ * <motion.div drag="x" dragControls={dragControls} />
300
+ * </>
301
+ * )
302
+ * ```
303
+ *
304
+ * @public
305
+ */
306
+ declare function useDragControls(): DragControls;
307
+
308
+ declare type DragElastic = boolean | number | Partial<BoundingBox>;
309
+ /**
310
+ * @public
311
+ */
312
+ interface DragHandlers {
313
+ /**
314
+ * Callback function that fires when dragging starts.
315
+ *
316
+ * ```jsx
317
+ * <motion.div
318
+ * drag
319
+ * onDragStart={
320
+ * (event, info) => console.log(info.point.x, info.point.y)
321
+ * }
322
+ * />
323
+ * ```
324
+ *
325
+ * @public
326
+ */
327
+ onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
328
+ /**
329
+ * Callback function that fires when dragging ends.
330
+ *
331
+ * ```jsx
332
+ * <motion.div
333
+ * drag
334
+ * onDragEnd={
335
+ * (event, info) => console.log(info.point.x, info.point.y)
336
+ * }
337
+ * />
338
+ * ```
339
+ *
340
+ * @public
341
+ */
342
+ onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
343
+ /**
344
+ * Callback function that fires when the component is dragged.
345
+ *
346
+ * ```jsx
347
+ * <motion.div
348
+ * drag
349
+ * onDrag={
350
+ * (event, info) => console.log(info.point.x, info.point.y)
351
+ * }
352
+ * />
353
+ * ```
354
+ *
355
+ * @public
356
+ */
357
+ onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
358
+ /**
359
+ * Callback function that fires a drag direction is determined.
360
+ *
361
+ * ```jsx
362
+ * <motion.div
363
+ * drag
364
+ * dragDirectionLock
365
+ * onDirectionLock={axis => console.log(axis)}
366
+ * />
367
+ * ```
368
+ *
369
+ * @public
370
+ */
371
+ onDirectionLock?(axis: "x" | "y"): void;
372
+ /**
373
+ * Callback function that fires when drag momentum/bounce transition finishes.
374
+ *
375
+ * ```jsx
376
+ * <motion.div
377
+ * drag
378
+ * onDragTransitionEnd={() => console.log('Drag transition complete')}
379
+ * />
380
+ * ```
381
+ *
382
+ * @public
383
+ */
384
+ onDragTransitionEnd?(): void;
385
+ }
386
+ /**
387
+ * @public
388
+ */
389
+ declare type InertiaOptions = Partial<Omit<Inertia, "velocity" | "type">>;
390
+ /**
391
+ * @public
392
+ */
393
+ interface DraggableProps extends DragHandlers {
394
+ /**
395
+ * Enable dragging for this element. Set to `false` by default.
396
+ * Set `true` to drag in both directions.
397
+ * Set `"x"` or `"y"` to only drag in a specific direction.
398
+ *
399
+ * ```jsx
400
+ * <motion.div drag="x" />
401
+ * ```
402
+ */
403
+ drag?: boolean | "x" | "y";
404
+ /**
405
+ * Properties or variant label to animate to while the drag gesture is recognised.
406
+ *
407
+ * ```jsx
408
+ * <motion.div whileDrag={{ scale: 1.2 }} />
409
+ * ```
410
+ */
411
+ whileDrag?: VariantLabels | TargetAndTransition;
412
+ /**
413
+ * If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
414
+ *
415
+ * ```jsx
416
+ * <motion.div drag dragDirectionLock />
417
+ * ```
418
+ */
419
+ dragDirectionLock?: boolean;
420
+ /**
421
+ * Allows drag gesture propagation to child components. Set to `false` by
422
+ * default.
423
+ *
424
+ * ```jsx
425
+ * <motion.div drag="x" dragPropagation />
426
+ * ```
427
+ */
428
+ dragPropagation?: boolean;
429
+ /**
430
+ * Applies constraints on the permitted draggable area.
431
+ *
432
+ * It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
433
+ * This will define a distance the named edge of the draggable component.
434
+ *
435
+ * Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
436
+ * This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
437
+ * of the component you want to use as constraints.
438
+ *
439
+ * ```jsx
440
+ * // In pixels
441
+ * <motion.div
442
+ * drag="x"
443
+ * dragConstraints={{ left: 0, right: 300 }}
444
+ * />
445
+ *
446
+ * // As a ref to another component
447
+ * const MyComponent = () => {
448
+ * const constraintsRef = useRef(null)
449
+ *
450
+ * return (
451
+ * <motion.div ref={constraintsRef}>
452
+ * <motion.div drag dragConstraints={constraintsRef} />
453
+ * </motion.div>
454
+ * )
455
+ * }
456
+ * ```
457
+ */
458
+ dragConstraints?: false | Partial<BoundingBox> | RefObject<Element>;
459
+ /**
460
+ * The degree of movement allowed outside constraints. 0 = no movement, 1 =
461
+ * full movement.
462
+ *
463
+ * Set to `0.5` by default. Can also be set as `false` to disable movement.
464
+ *
465
+ * By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
466
+ * per constraint. Any missing values will be set to `0`.
467
+ *
468
+ * ```jsx
469
+ * <motion.div
470
+ * drag
471
+ * dragConstraints={{ left: 0, right: 300 }}
472
+ * dragElastic={0.2}
473
+ * />
474
+ * ```
475
+ */
476
+ dragElastic?: DragElastic;
477
+ /**
478
+ * Apply momentum from the pan gesture to the component when dragging
479
+ * finishes. Set to `true` by default.
480
+ *
481
+ * ```jsx
482
+ * <motion.div
483
+ * drag
484
+ * dragConstraints={{ left: 0, right: 300 }}
485
+ * dragMomentum={false}
486
+ * />
487
+ * ```
488
+ */
489
+ dragMomentum?: boolean;
490
+ /**
491
+ * Allows you to change dragging inertia parameters.
492
+ * 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.
493
+ * See {@link https://framer.com/api/animation/#inertia | Inertia} for all properties you can use.
494
+ *
495
+ * ```jsx
496
+ * <motion.div
497
+ * drag
498
+ * dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
499
+ * />
500
+ * ```
501
+ */
502
+ dragTransition?: InertiaOptions;
503
+ /**
504
+ * Usually, dragging is initiated by pressing down on a component and moving it. For some
505
+ * use-cases, for instance clicking at an arbitrary point on a video scrubber, we
506
+ * might want to initiate dragging from a different component than the draggable one.
507
+ *
508
+ * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
509
+ * the draggable component's `dragControls` prop. It exposes a `start` method
510
+ * that can start dragging from pointer events on other components.
511
+ *
512
+ * ```jsx
513
+ * const dragControls = useDragControls()
514
+ *
515
+ * function startDrag(event) {
516
+ * dragControls.start(event, { snapToCursor: true })
517
+ * }
518
+ *
519
+ * return (
520
+ * <>
521
+ * <div onPointerDown={startDrag} />
522
+ * <motion.div drag="x" dragControls={dragControls} />
523
+ * </>
524
+ * )
525
+ * ```
526
+ */
527
+ dragControls?: DragControls;
528
+ /**
529
+ * If true, element will snap back to its origin when dragging ends.
530
+ *
531
+ * Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
532
+ * with `dragElastic={1}`, but when used together `dragConstraints` can define
533
+ * a wider draggable area and `dragSnapToOrigin` will ensure the element
534
+ * animates back to its origin on release.
535
+ */
536
+ dragSnapToOrigin?: boolean;
537
+ /**
538
+ * By default, if `drag` is defined on a component then an event listener will be attached
539
+ * to automatically initiate dragging when a user presses down on it.
540
+ *
541
+ * By setting `dragListener` to `false`, this event listener will not be created.
542
+ *
543
+ * ```jsx
544
+ * const dragControls = useDragControls()
545
+ *
546
+ * function startDrag(event) {
547
+ * dragControls.start(event, { snapToCursor: true })
548
+ * }
549
+ *
550
+ * return (
551
+ * <>
552
+ * <div onPointerDown={startDrag} />
553
+ * <motion.div
554
+ * drag="x"
555
+ * dragControls={dragControls}
556
+ * dragListener={false}
557
+ * />
558
+ * </>
559
+ * )
560
+ * ```
561
+ */
562
+ dragListener?: boolean;
563
+ /**
564
+ * If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
565
+ *
566
+ * @public
567
+ */
568
+ onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
569
+ /**
570
+ * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
571
+ * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
572
+ * This allows you to manually control how updates from a drag gesture on an element is applied.
573
+ *
574
+ * @public
575
+ */
576
+ _dragX?: MotionValue<number>;
577
+ /**
578
+ * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
579
+ * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
580
+ * This allows you to manually control how updates from a drag gesture on an element is applied.
581
+ *
582
+ * @public
583
+ */
584
+ _dragY?: MotionValue<number>;
585
+ }
586
+
587
+ /**
588
+ * @public
589
+ */
590
+ interface LayoutProps {
591
+ /**
592
+ * If `true`, this component will automatically animate to its new position when
593
+ * its layout changes.
594
+ *
595
+ * ```jsx
596
+ * <motion.div layout />
597
+ * ```
598
+ *
599
+ * This will perform a layout animation using performant transforms. Part of this technique
600
+ * involved animating an element's scale. This can introduce visual distortions on children,
601
+ * `boxShadow` and `borderRadius`.
602
+ *
603
+ * To correct distortion on immediate children, add `layout` to those too.
604
+ *
605
+ * `boxShadow` and `borderRadius` will automatically be corrected if they are already being
606
+ * animated on this component. Otherwise, set them directly via the `initial` prop.
607
+ *
608
+ * If `layout` is set to `"position"`, the size of the component will change instantly and
609
+ * only its position will animate. If `layout` is set to `"size"`, the position of the
610
+ * component will change instantly but its size will animate.
611
+ *
612
+ * If `layout` is set to `"size"`, the position of the component will change instantly and
613
+ * only its size will animate.
614
+ *
615
+ * @public
616
+ */
617
+ layout?: boolean | "position" | "size";
618
+ /**
619
+ * Enable shared layout transitions between different components with the same `layoutId`.
620
+ *
621
+ * When a component with a layoutId is removed from the React tree, and then
622
+ * added elsewhere, it will visually animate from the previous component's bounding box
623
+ * and its latest animated values.
624
+ *
625
+ * ```jsx
626
+ * {items.map(item => (
627
+ * <motion.li layout>
628
+ * {item.name}
629
+ * {item.isSelected && <motion.div layoutId="underline" />}
630
+ * </motion.li>
631
+ * ))}
632
+ * ```
633
+ *
634
+ * If the previous component remains in the tree it will crossfade with the new component.
635
+ *
636
+ * @public
637
+ */
638
+ layoutId?: string;
639
+ /**
640
+ * A callback that will fire when a layout animation on this component starts.
641
+ *
642
+ * @public
643
+ */
644
+ onLayoutAnimationStart?(): void;
645
+ /**
646
+ * A callback that will fire when a layout animation on this component completes.
647
+ *
648
+ * @public
649
+ */
650
+ onLayoutAnimationComplete?(): void;
651
+ /**
652
+ * @public
653
+ */
654
+ layoutDependency?: any;
655
+ /**
656
+ * Wether a projection node should measure its scroll when it or its descendants update their layout.
657
+ *
658
+ * @public
659
+ */
660
+ layoutScroll?: boolean;
661
+ }
662
+
663
+ declare enum AnimationType {
664
+ Animate = "animate",
665
+ Hover = "whileHover",
666
+ Tap = "whileTap",
667
+ Drag = "whileDrag",
668
+ Focus = "whileFocus",
669
+ InView = "whileInView",
670
+ Exit = "exit"
671
+ }
672
+
673
+ declare type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
674
+ declare type AnimationOptions$1 = {
675
+ delay?: number;
676
+ transitionOverride?: Transition;
677
+ custom?: any;
678
+ type?: AnimationType;
679
+ };
680
+ declare function animateVisualElement(visualElement: VisualElement, definition: AnimationDefinition, options?: AnimationOptions$1): Promise<void>;
681
+
682
+ declare type LayoutMeasureListener = (layout: Box, prevLayout?: Box) => void;
683
+ declare type BeforeLayoutMeasureListener = () => void;
684
+ declare type LayoutUpdateListener = (layout: Axis, prevLayout: Axis) => void;
685
+ declare type UpdateListener = (latest: ResolvedValues) => void;
686
+ declare type AnimationStartListener = (definition: AnimationDefinition) => void;
687
+ declare type AnimationCompleteListener = (definition: AnimationDefinition) => void;
688
+ declare type LayoutAnimationStartListener = () => void;
689
+ declare type LayoutAnimationCompleteListener = () => void;
690
+ declare type SetAxisTargetListener = () => void;
691
+ declare type RenderListener = () => void;
692
+ interface LayoutLifecycles {
693
+ onBeforeLayoutMeasure?(box: Box): void;
694
+ onLayoutMeasure?(box: Box, prevBox: Box): void;
695
+ }
696
+ interface AnimationLifecycles {
697
+ /**
698
+ * Callback with latest motion values, fired max once per frame.
699
+ *
700
+ * ```jsx
701
+ * function onUpdate(latest) {
702
+ * console.log(latest.x, latest.opacity)
703
+ * }
704
+ *
705
+ * <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
706
+ * ```
707
+ */
708
+ onUpdate?(latest: ResolvedValues): void;
709
+ /**
710
+ * Callback when animation defined in `animate` begins.
711
+ *
712
+ * The provided callback will be called with the triggering animation definition.
713
+ * If this is a variant, it'll be the variant name, and if a target object
714
+ * then it'll be the target object.
715
+ *
716
+ * This way, it's possible to figure out which animation has started.
717
+ *
718
+ * ```jsx
719
+ * function onStart() {
720
+ * console.log("Animation started")
721
+ * }
722
+ *
723
+ * <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
724
+ * ```
725
+ */
726
+ onAnimationStart?(definition: AnimationDefinition): void;
727
+ /**
728
+ * Callback when animation defined in `animate` is complete.
729
+ *
730
+ * The provided callback will be called with the triggering animation definition.
731
+ * If this is a variant, it'll be the variant name, and if a target object
732
+ * then it'll be the target object.
733
+ *
734
+ * This way, it's possible to figure out which animation has completed.
735
+ *
736
+ * ```jsx
737
+ * function onComplete() {
738
+ * console.log("Animation completed")
739
+ * }
740
+ *
741
+ * <motion.div
742
+ * animate={{ x: 100 }}
743
+ * onAnimationComplete={definition => {
744
+ * console.log('Completed animating', definition)
745
+ * }}
746
+ * />
747
+ * ```
748
+ */
749
+ onAnimationComplete?(definition: AnimationDefinition): void;
750
+ }
751
+ declare type VisualElementLifecycles = LayoutLifecycles & AnimationLifecycles;
752
+ interface LifecycleManager {
753
+ onLayoutMeasure: (callback: LayoutMeasureListener) => () => void;
754
+ notifyLayoutMeasure: LayoutMeasureListener;
755
+ onBeforeLayoutMeasure: (callback: BeforeLayoutMeasureListener) => () => void;
756
+ notifyBeforeLayoutMeasure: BeforeLayoutMeasureListener;
757
+ onLayoutUpdate: (callback: LayoutUpdateListener) => () => void;
758
+ notifyLayoutUpdate: LayoutUpdateListener;
759
+ onUpdate: (callback: UpdateListener) => () => void;
760
+ notifyUpdate: UpdateListener;
761
+ onAnimationStart: (callback: AnimationStartListener) => () => void;
762
+ notifyAnimationStart: AnimationStartListener;
763
+ onAnimationComplete: (callback: AnimationCompleteListener) => () => void;
764
+ notifyAnimationComplete: AnimationCompleteListener;
765
+ onLayoutAnimationStart: (callback: LayoutAnimationStartListener) => () => void;
766
+ notifyLayoutAnimationStart: LayoutAnimationStartListener;
767
+ onLayoutAnimationComplete: (callback: LayoutAnimationCompleteListener) => () => void;
768
+ notifyLayoutAnimationComplete: LayoutAnimationCompleteListener;
769
+ onSetAxisTarget: (callback: SetAxisTargetListener) => () => void;
770
+ notifySetAxisTarget: SetAxisTargetListener;
771
+ onRender: (callback: RenderListener) => () => void;
772
+ notifyRender: RenderListener;
773
+ onUnmount: (callback: () => void) => () => void;
774
+ notifyUnmount: () => void;
775
+ clearAllListeners: () => void;
776
+ updatePropListeners: (props: MotionProps) => void;
777
+ }
778
+
779
+ /** @public */
780
+ interface EventInfo {
781
+ point: Point;
782
+ }
783
+
784
+ /**
785
+ * @public
786
+ */
787
+ interface FocusHandlers {
788
+ /**
789
+ * Properties or variant label to animate to while the focus gesture is recognised.
790
+ *
791
+ * ```jsx
792
+ * <motion.input whileFocus={{ scale: 1.2 }} />
793
+ * ```
794
+ */
795
+ whileFocus?: VariantLabels | TargetAndTransition;
796
+ }
797
+ /**
798
+ * Passed in to tap event handlers like `onTap` the `TapInfo` object contains
799
+ * information about the tap gesture such as it‘s location.
800
+ *
801
+ * ```jsx
802
+ * function onTap(event, info) {
803
+ * console.log(info.point.x, info.point.y)
804
+ * }
805
+ *
806
+ * <motion.div onTap={onTap} />
807
+ * ```
808
+ *
809
+ * @public
810
+ */
811
+ interface TapInfo {
812
+ /**
813
+ * Contains `x` and `y` values for the tap gesture relative to the
814
+ * device or page.
815
+ *
816
+ * ```jsx
817
+ * function onTapStart(event, info) {
818
+ * console.log(info.point.x, info.point.y)
819
+ * }
820
+ *
821
+ * <motion.div onTapStart={onTapStart} />
822
+ * ```
823
+ *
824
+ * @public
825
+ */
826
+ point: Point;
827
+ }
828
+ /**
829
+ * @public
830
+ */
831
+ interface TapHandlers {
832
+ /**
833
+ * Callback when the tap gesture successfully ends on this element.
834
+ *
835
+ * ```jsx
836
+ * function onTap(event, info) {
837
+ * console.log(info.point.x, info.point.y)
838
+ * }
839
+ *
840
+ * <motion.div onTap={onTap} />
841
+ * ```
842
+ *
843
+ * @param event - The originating pointer event.
844
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
845
+ */
846
+ onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
847
+ /**
848
+ * Callback when the tap gesture starts on this element.
849
+ *
850
+ * ```jsx
851
+ * function onTapStart(event, info) {
852
+ * console.log(info.point.x, info.point.y)
853
+ * }
854
+ *
855
+ * <motion.div onTapStart={onTapStart} />
856
+ * ```
857
+ *
858
+ * @param event - The originating pointer event.
859
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
860
+ */
861
+ onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
862
+ /**
863
+ * Callback when the tap gesture ends outside this element.
864
+ *
865
+ * ```jsx
866
+ * function onTapCancel(event, info) {
867
+ * console.log(info.point.x, info.point.y)
868
+ * }
869
+ *
870
+ * <motion.div onTapCancel={onTapCancel} />
871
+ * ```
872
+ *
873
+ * @param event - The originating pointer event.
874
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
875
+ */
876
+ onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
877
+ /**
878
+ * Properties or variant label to animate to while the component is pressed.
879
+ *
880
+ * ```jsx
881
+ * <motion.div whileTap={{ scale: 0.8 }} />
882
+ * ```
883
+ */
884
+ whileTap?: VariantLabels | TargetAndTransition;
885
+ }
886
+ /**
887
+ * @public
888
+ */
889
+ interface PanHandlers {
890
+ /**
891
+ * Callback function that fires when the pan gesture is recognised on this element.
892
+ *
893
+ * **Note:** For pan gestures to work correctly with touch input, the element needs
894
+ * touch scrolling to be disabled on either x/y or both axis with the
895
+ * [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
896
+ *
897
+ * ```jsx
898
+ * function onPan(event, info) {
899
+ * console.log(info.point.x, info.point.y)
900
+ * }
901
+ *
902
+ * <motion.div onPan={onPan} />
903
+ * ```
904
+ *
905
+ * @param event - The originating pointer event.
906
+ * @param info - A {@link PanInfo} object containing `x` and `y` values for:
907
+ *
908
+ * - `point`: Relative to the device or page.
909
+ * - `delta`: Distance moved since the last event.
910
+ * - `offset`: Offset from the original pan event.
911
+ * - `velocity`: Current velocity of the pointer.
912
+ */
913
+ onPan?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
914
+ /**
915
+ * Callback function that fires when the pan gesture begins on this element.
916
+ *
917
+ * ```jsx
918
+ * function onPanStart(event, info) {
919
+ * console.log(info.point.x, info.point.y)
920
+ * }
921
+ *
922
+ * <motion.div onPanStart={onPanStart} />
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
+ onPanStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
934
+ /**
935
+ * Callback function that fires when we begin detecting a pan gesture. This
936
+ * is analogous to `onMouseStart` or `onTouchStart`.
937
+ *
938
+ * ```jsx
939
+ * function onPanSessionStart(event, info) {
940
+ * console.log(info.point.x, info.point.y)
941
+ * }
942
+ *
943
+ * <motion.div onPanSessionStart={onPanSessionStart} />
944
+ * ```
945
+ *
946
+ * @param event - The originating pointer event.
947
+ * @param info - An {@link EventInfo} object containing `x`/`y` values for:
948
+ *
949
+ * - `point`: Relative to the device or page.
950
+ */
951
+ onPanSessionStart?(event: MouseEvent | TouchEvent | PointerEvent, info: EventInfo): void;
952
+ /**
953
+ * Callback function that fires when the pan gesture ends on this element.
954
+ *
955
+ * ```jsx
956
+ * function onPanEnd(event, info) {
957
+ * console.log(info.point.x, info.point.y)
958
+ * }
959
+ *
960
+ * <motion.div onPanEnd={onPanEnd} />
961
+ * ```
962
+ *
963
+ * @param event - The originating pointer event.
964
+ * @param info - A {@link PanInfo} object containing `x`/`y` values for:
965
+ *
966
+ * - `point`: Relative to the device or page.
967
+ * - `delta`: Distance moved since the last event.
968
+ * - `offset`: Offset from the original pan event.
969
+ * - `velocity`: Current velocity of the pointer.
970
+ */
971
+ onPanEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
972
+ }
973
+ /**
974
+ * @public
975
+ */
976
+ interface HoverHandlers {
977
+ /**
978
+ * Properties or variant label to animate to while the hover gesture is recognised.
979
+ *
980
+ * ```jsx
981
+ * <motion.div whileHover={{ scale: 1.2 }} />
982
+ * ```
983
+ */
984
+ whileHover?: VariantLabels | TargetAndTransition;
985
+ /**
986
+ * Callback function that fires when pointer starts hovering over the component.
987
+ *
988
+ * ```jsx
989
+ * <motion.div onHoverStart={() => console.log('Hover starts')} />
990
+ * ```
991
+ */
992
+ onHoverStart?(event: MouseEvent, info: EventInfo): void;
993
+ /**
994
+ * Callback function that fires when pointer stops hovering over the component.
995
+ *
996
+ * ```jsx
997
+ * <motion.div onHoverEnd={() => console.log("Hover ends")} />
998
+ * ```
999
+ */
1000
+ onHoverEnd?(event: MouseEvent, info: EventInfo): void;
1001
+ }
1002
+
1003
+ declare type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
1004
+ interface ViewportOptions {
1005
+ root?: RefObject<Element>;
1006
+ once?: boolean;
1007
+ margin?: string;
1008
+ amount?: "some" | "all" | number;
1009
+ fallback?: boolean;
1010
+ }
1011
+ interface ViewportProps {
1012
+ whileInView?: VariantLabels | TargetAndTransition;
1013
+ onViewportEnter?: ViewportEventHandler;
1014
+ onViewportLeave?: ViewportEventHandler;
1015
+ viewport?: ViewportOptions;
1016
+ }
1017
+
1018
+ /**
1019
+ * Either a string, or array of strings, that reference variants defined via the `variants` prop.
1020
+ * @public
1021
+ */
1022
+ declare type VariantLabels = string | string[];
1023
+ interface TransformProperties {
1024
+ x?: string | number;
1025
+ y?: string | number;
1026
+ z?: string | number;
1027
+ translateX?: string | number;
1028
+ translateY?: string | number;
1029
+ translateZ?: string | number;
1030
+ rotate?: string | number;
1031
+ rotateX?: string | number;
1032
+ rotateY?: string | number;
1033
+ rotateZ?: string | number;
1034
+ scale?: string | number;
1035
+ scaleX?: string | number;
1036
+ scaleY?: string | number;
1037
+ scaleZ?: string | number;
1038
+ skew?: string | number;
1039
+ skewX?: string | number;
1040
+ skewY?: string | number;
1041
+ originX?: string | number;
1042
+ originY?: string | number;
1043
+ originZ?: string | number;
1044
+ perspective?: string | number;
1045
+ transformPerspective?: string | number;
1046
+ }
1047
+ /**
1048
+ * @public
1049
+ */
1050
+ interface SVGPathProperties {
1051
+ pathLength?: number;
1052
+ pathOffset?: number;
1053
+ pathSpacing?: number;
1054
+ }
1055
+ interface CustomStyles {
1056
+ /**
1057
+ * Framer Library custom prop types. These are not actually supported in Motion - preferably
1058
+ * we'd have a way of external consumers injecting supported styles into this library.
1059
+ */
1060
+ size?: string | number;
1061
+ radius?: string | number;
1062
+ shadow?: string;
1063
+ image?: string;
1064
+ }
1065
+ declare type MakeMotion<T> = MakeCustomValueType<{
1066
+ [K in keyof T]: T[K] | MotionValue<number> | MotionValue<string> | MotionValue<any>;
1067
+ }>;
1068
+ declare type MotionCSS = MakeMotion<Omit$1<CSSProperties, "rotate" | "scale" | "perspective">>;
1069
+ /**
1070
+ * @public
1071
+ */
1072
+ declare type MotionTransform = MakeMotion<TransformProperties>;
1073
+ /**
1074
+ * @public
1075
+ */
1076
+ declare type MotionStyle = MotionCSS & MotionTransform & MakeMotion<SVGPathProperties> & MakeCustomValueType<CustomStyles>;
1077
+ /**
1078
+ * @public
1079
+ */
1080
+ interface RelayoutInfo {
1081
+ delta: {
1082
+ x: number;
1083
+ y: number;
1084
+ width: number;
1085
+ height: number;
1086
+ };
1087
+ }
1088
+ /**
1089
+ * @public
1090
+ */
1091
+ declare type ResolveLayoutTransition = (info: RelayoutInfo) => Transition | boolean;
1092
+ /**
1093
+ * @public
1094
+ */
1095
+ interface AnimationProps {
1096
+ /**
1097
+ * Properties, variant label or array of variant labels to start in.
1098
+ *
1099
+ * Set to `false` to initialise with the values in `animate` (disabling the mount animation)
1100
+ *
1101
+ * ```jsx
1102
+ * // As values
1103
+ * <motion.div initial={{ opacity: 1 }} />
1104
+ *
1105
+ * // As variant
1106
+ * <motion.div initial="visible" variants={variants} />
1107
+ *
1108
+ * // Multiple variants
1109
+ * <motion.div initial={["visible", "active"]} variants={variants} />
1110
+ *
1111
+ * // As false (disable mount animation)
1112
+ * <motion.div initial={false} animate={{ opacity: 0 }} />
1113
+ * ```
1114
+ */
1115
+ initial?: boolean | Target | VariantLabels;
1116
+ /**
1117
+ * Values to animate to, variant label(s), or `AnimationControls`.
1118
+ *
1119
+ * ```jsx
1120
+ * // As values
1121
+ * <motion.div animate={{ opacity: 1 }} />
1122
+ *
1123
+ * // As variant
1124
+ * <motion.div animate="visible" variants={variants} />
1125
+ *
1126
+ * // Multiple variants
1127
+ * <motion.div animate={["visible", "active"]} variants={variants} />
1128
+ *
1129
+ * // AnimationControls
1130
+ * <motion.div animate={animation} />
1131
+ * ```
1132
+ */
1133
+ animate?: AnimationControls | TargetAndTransition | VariantLabels | boolean;
1134
+ /**
1135
+ * A target to animate to when this component is removed from the tree.
1136
+ *
1137
+ * This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
1138
+ *
1139
+ * This limitation exists because React doesn't allow components to defer unmounting until after
1140
+ * an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
1141
+ *
1142
+ * ```jsx
1143
+ * import { AnimatePresence, motion } from 'framer-motion'
1144
+ *
1145
+ * export const MyComponent = ({ isVisible }) => {
1146
+ * return (
1147
+ * <AnimatePresence>
1148
+ * {isVisible && (
1149
+ * <motion.div
1150
+ * initial={{ opacity: 0 }}
1151
+ * animate={{ opacity: 1 }}
1152
+ * exit={{ opacity: 0 }}
1153
+ * />
1154
+ * )}
1155
+ * </AnimatePresence>
1156
+ * )
1157
+ * }
1158
+ * ```
1159
+ */
1160
+ exit?: TargetAndTransition | VariantLabels;
1161
+ /**
1162
+ * Variants allow you to define animation states and organise them by name. They allow
1163
+ * you to control animations throughout a component tree by switching a single `animate` prop.
1164
+ *
1165
+ * Using `transition` options like `delayChildren` and `staggerChildren`, you can orchestrate
1166
+ * when children animations play relative to their parent.
1167
+
1168
+ *
1169
+ * After passing variants to one or more `motion` component's `variants` prop, these variants
1170
+ * can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
1171
+ *
1172
+ * ```jsx
1173
+ * const variants = {
1174
+ * active: {
1175
+ * backgroundColor: "#f00"
1176
+ * },
1177
+ * inactive: {
1178
+ * backgroundColor: "#fff",
1179
+ * transition: { duration: 2 }
1180
+ * }
1181
+ * }
1182
+ *
1183
+ * <motion.div variants={variants} animate="active" />
1184
+ * ```
1185
+ */
1186
+ variants?: Variants;
1187
+ /**
1188
+ * Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
1189
+ * ```jsx
1190
+ * const spring = {
1191
+ * type: "spring",
1192
+ * damping: 10,
1193
+ * stiffness: 100
1194
+ * }
1195
+ *
1196
+ * <motion.div transition={spring} animate={{ scale: 1.2 }} />
1197
+ * ```
1198
+ */
1199
+ transition?: Transition;
1200
+ }
1201
+ /**
1202
+ * @public
1203
+ */
1204
+ interface MotionAdvancedProps {
1205
+ /**
1206
+ * Custom data to use to resolve dynamic variants differently for each animating component.
1207
+ *
1208
+ * ```jsx
1209
+ * const variants = {
1210
+ * visible: (custom) => ({
1211
+ * opacity: 1,
1212
+ * transition: { delay: custom * 0.2 }
1213
+ * })
1214
+ * }
1215
+ *
1216
+ * <motion.div custom={0} animate="visible" variants={variants} />
1217
+ * <motion.div custom={1} animate="visible" variants={variants} />
1218
+ * <motion.div custom={2} animate="visible" variants={variants} />
1219
+ * ```
1220
+ *
1221
+ * @public
1222
+ */
1223
+ custom?: any;
1224
+ /**
1225
+ * @public
1226
+ * Set to `false` to prevent inheriting variant changes from its parent.
1227
+ */
1228
+ inherit?: boolean;
1229
+ }
1230
+ /**
1231
+ * Props for `motion` components.
1232
+ *
1233
+ * @public
1234
+ */
1235
+ interface MotionProps extends AnimationProps, VisualElementLifecycles, PanHandlers, TapHandlers, HoverHandlers, FocusHandlers, ViewportProps, DraggableProps, LayoutProps, MotionAdvancedProps {
1236
+ /**
1237
+ *
1238
+ * The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values.
1239
+ *
1240
+ * ```jsx
1241
+ * export const MyComponent = () => {
1242
+ * const x = useMotionValue(0)
1243
+ *
1244
+ * return <motion.div style={{ x, opacity: 1, scale: 0.5 }} />
1245
+ * }
1246
+ * ```
1247
+ */
1248
+ style?: MotionStyle;
1249
+ /**
1250
+ * By default, Framer Motion generates a `transform` property with a sensible transform order. `transformTemplate`
1251
+ * can be used to create a different order, or to append/preprend the automatically generated `transform` property.
1252
+ *
1253
+ * ```jsx
1254
+ * <motion.div
1255
+ * style={{ x: 0, rotate: 180 }}
1256
+ * transformTemplate={
1257
+ * ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
1258
+ * }
1259
+ * />
1260
+ * ```
1261
+ *
1262
+ * @param transform - The latest animated transform props.
1263
+ * @param generatedTransform - The transform string as automatically generated by Framer Motion
1264
+ *
1265
+ * @public
1266
+ */
1267
+ transformTemplate?(transform: TransformProperties, generatedTransform: string): string;
1268
+ }
1269
+
1270
+ /**
1271
+ * @public
1272
+ */
1273
+ declare type ResolvedKeyframesTarget = [null, ...number[]] | number[] | [null, ...string[]] | string[];
1274
+ /**
1275
+ * @public
1276
+ */
1277
+ declare type KeyframesTarget = ResolvedKeyframesTarget | [null, ...CustomValueType[]] | CustomValueType[];
1278
+ /**
1279
+ * @public
1280
+ */
1281
+ declare type ResolvedSingleTarget = string | number;
1282
+ /**
1283
+ * @public
1284
+ */
1285
+ declare type SingleTarget = ResolvedSingleTarget | CustomValueType;
1286
+ /**
1287
+ * @public
1288
+ */
1289
+ declare type ResolvedValueTarget = ResolvedSingleTarget | ResolvedKeyframesTarget;
1290
+ /**
1291
+ * @public
1292
+ */
1293
+ declare type ValueTarget = SingleTarget | KeyframesTarget;
1294
+ /**
1295
+ * A function that accepts a progress value between `0` and `1` and returns a
1296
+ * new one.
1297
+ *
1298
+ * ```jsx
1299
+ * <motion.div
1300
+ * animate={{ opacity: 0 }}
1301
+ * transition={{
1302
+ * duration: 1,
1303
+ * ease: progress => progress * progress
1304
+ * }}
1305
+ * />
1306
+ * ```
1307
+ *
1308
+ * @public
1309
+ */
1310
+ declare type EasingFunction = (v: number) => number;
1311
+ /**
1312
+ * The easing function to use. Set as one of:
1313
+ *
1314
+ * - The name of an in-built easing function.
1315
+ * - An array of four numbers to define a cubic bezier curve.
1316
+ * - An easing function, that accepts and returns a progress value between `0` and `1`.
1317
+ *
1318
+ * @public
1319
+ */
1320
+ declare type Easing = [number, number, number, number] | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate" | EasingFunction;
1321
+ /**
1322
+ * Options for orchestrating the timing of animations.
1323
+ *
1324
+ * @public
1325
+ */
1326
+ interface Orchestration {
1327
+ /**
1328
+ * Delay the animation by this duration (in seconds). Defaults to `0`.
1329
+ *
1330
+ * @remarks
1331
+ * ```javascript
1332
+ * const transition = {
1333
+ * delay: 0.2
1334
+ * }
1335
+ * ```
1336
+ *
1337
+ * @public
1338
+ */
1339
+ delay?: number;
1340
+ /**
1341
+ * Describes the relationship between the transition and its children. Set
1342
+ * to `false` by default.
1343
+ *
1344
+ * @remarks
1345
+ * When using variants, the transition can be scheduled in relation to its
1346
+ * children with either `"beforeChildren"` to finish this transition before
1347
+ * starting children transitions, `"afterChildren"` to finish children
1348
+ * transitions before starting this transition.
1349
+ *
1350
+ * ```jsx
1351
+ * const list = {
1352
+ * hidden: {
1353
+ * opacity: 0,
1354
+ * transition: { when: "afterChildren" }
1355
+ * }
1356
+ * }
1357
+ *
1358
+ * const item = {
1359
+ * hidden: {
1360
+ * opacity: 0,
1361
+ * transition: { duration: 2 }
1362
+ * }
1363
+ * }
1364
+ *
1365
+ * return (
1366
+ * <motion.ul variants={list} animate="hidden">
1367
+ * <motion.li variants={item} />
1368
+ * <motion.li variants={item} />
1369
+ * </motion.ul>
1370
+ * )
1371
+ * ```
1372
+ *
1373
+ * @public
1374
+ */
1375
+ when?: false | "beforeChildren" | "afterChildren" | string;
1376
+ /**
1377
+ * When using variants, children animations will start after this duration
1378
+ * (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.
1379
+ *
1380
+ * ```jsx
1381
+ * const container = {
1382
+ * hidden: { opacity: 0 },
1383
+ * show: {
1384
+ * opacity: 1,
1385
+ * transition: {
1386
+ * delayChildren: 0.5
1387
+ * }
1388
+ * }
1389
+ * }
1390
+ *
1391
+ * const item = {
1392
+ * hidden: { opacity: 0 },
1393
+ * show: { opacity: 1 }
1394
+ * }
1395
+ *
1396
+ * return (
1397
+ * <motion.ul
1398
+ * variants={container}
1399
+ * initial="hidden"
1400
+ * animate="show"
1401
+ * >
1402
+ * <motion.li variants={item} />
1403
+ * <motion.li variants={item} />
1404
+ * </motion.ul>
1405
+ * )
1406
+ * ```
1407
+ *
1408
+ * @public
1409
+ */
1410
+ delayChildren?: number;
1411
+ /**
1412
+ * When using variants, animations of child components can be staggered by this
1413
+ * duration (in seconds).
1414
+ *
1415
+ * For instance, if `staggerChildren` is `0.01`, the first child will be
1416
+ * delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
1417
+ * on.
1418
+ *
1419
+ * The calculated stagger delay will be added to `delayChildren`.
1420
+ *
1421
+ * ```jsx
1422
+ * const container = {
1423
+ * hidden: { opacity: 0 },
1424
+ * show: {
1425
+ * opacity: 1,
1426
+ * transition: {
1427
+ * staggerChildren: 0.5
1428
+ * }
1429
+ * }
1430
+ * }
1431
+ *
1432
+ * const item = {
1433
+ * hidden: { opacity: 0 },
1434
+ * show: { opacity: 1 }
1435
+ * }
1436
+ *
1437
+ * return (
1438
+ * <motion.ol
1439
+ * variants={container}
1440
+ * initial="hidden"
1441
+ * animate="show"
1442
+ * >
1443
+ * <motion.li variants={item} />
1444
+ * <motion.li variants={item} />
1445
+ * </motion.ol>
1446
+ * )
1447
+ * ```
1448
+ *
1449
+ * @public
1450
+ */
1451
+ staggerChildren?: number;
1452
+ /**
1453
+ * The direction in which to stagger children.
1454
+ *
1455
+ * A value of `1` staggers from the first to the last while `-1`
1456
+ * staggers from the last to the first.
1457
+ *
1458
+ * ```jsx
1459
+ * const container = {
1460
+ * hidden: { opacity: 0 },
1461
+ * show: {
1462
+ * opacity: 1,
1463
+ * transition: {
1464
+ * delayChildren: 0.5,
1465
+ * staggerDirection: -1
1466
+ * }
1467
+ * }
1468
+ * }
1469
+ *
1470
+ * const item = {
1471
+ * hidden: { opacity: 0 },
1472
+ * show: { opacity: 1 }
1473
+ * }
1474
+ *
1475
+ * return (
1476
+ * <motion.ul
1477
+ * variants={container}
1478
+ * initial="hidden"
1479
+ * animate="show"
1480
+ * >
1481
+ * <motion.li variants={item} size={50} />
1482
+ * <motion.li variants={item} size={50} />
1483
+ * </motion.ul>
1484
+ * )
1485
+ * ```
1486
+ *
1487
+ * @public
1488
+ */
1489
+ staggerDirection?: number;
1490
+ }
1491
+ interface Repeat {
1492
+ /**
1493
+ * The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
1494
+ *
1495
+ * Without setting `repeatType`, this will loop the animation.
1496
+ *
1497
+ * ```jsx
1498
+ * <motion.div
1499
+ * animate={{ rotate: 180 }}
1500
+ * transition={{ repeat: Infinity, duration: 2 }}
1501
+ * />
1502
+ * ```
1503
+ *
1504
+ * @public
1505
+ */
1506
+ repeat?: number;
1507
+ /**
1508
+ * How to repeat the animation. This can be either:
1509
+ *
1510
+ * "loop": Repeats the animation from the start
1511
+ *
1512
+ * "reverse": Alternates between forward and backwards playback
1513
+ *
1514
+ * "mirror": Switches `from` and `to` alternately
1515
+ *
1516
+ * ```jsx
1517
+ * <motion.div
1518
+ * animate={{ rotate: 180 }}
1519
+ * transition={{
1520
+ * repeat: 1,
1521
+ * repeatType: "reverse",
1522
+ * duration: 2
1523
+ * }}
1524
+ * />
1525
+ * ```
1526
+ *
1527
+ * @public
1528
+ */
1529
+ repeatType?: "loop" | "reverse" | "mirror";
1530
+ /**
1531
+ * When repeating an animation, `repeatDelay` will set the
1532
+ * duration of the time to wait, in seconds, between each repetition.
1533
+ *
1534
+ * ```jsx
1535
+ * <motion.div
1536
+ * animate={{ rotate: 180 }}
1537
+ * transition={{ repeat: Infinity, repeatDelay: 1 }}
1538
+ * />
1539
+ * ```
1540
+ *
1541
+ * @public
1542
+ */
1543
+ repeatDelay?: number;
1544
+ }
1545
+ /**
1546
+ * An animation that animates between two or more values over a specific duration of time.
1547
+ * This is the default animation for non-physical values like `color` and `opacity`.
1548
+ *
1549
+ * @public
1550
+ */
1551
+ interface Tween extends Repeat {
1552
+ /**
1553
+ * Set `type` to `"tween"` to use a duration-based tween animation.
1554
+ * If any non-orchestration `transition` values are set without a `type` property,
1555
+ * this is used as the default animation.
1556
+ *
1557
+ * ```jsx
1558
+ * <motion.path
1559
+ * animate={{ pathLength: 1 }}
1560
+ * transition={{ duration: 2, type: "tween" }}
1561
+ * />
1562
+ * ```
1563
+ *
1564
+ * @public
1565
+ */
1566
+ type?: "tween";
1567
+ /**
1568
+ * The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
1569
+ *
1570
+ * ```jsx
1571
+ * const variants = {
1572
+ * visible: {
1573
+ * opacity: 1,
1574
+ * transition: { duration: 2 }
1575
+ * }
1576
+ * }
1577
+ * ```
1578
+ *
1579
+ * @public
1580
+ */
1581
+ duration?: number;
1582
+ /**
1583
+ * The easing function to use. Set as one of the below.
1584
+ *
1585
+ * - The name of an existing easing function.
1586
+ *
1587
+ * - An array of four numbers to define a cubic bezier curve.
1588
+ *
1589
+ * - An easing function, that accepts and returns a value `0-1`.
1590
+ *
1591
+ * If the animating value is set as an array of multiple values for a keyframes
1592
+ * animation, `ease` can be set as an array of easing functions to set different easings between
1593
+ * each of those values.
1594
+ *
1595
+ *
1596
+ * ```jsx
1597
+ * <motion.div
1598
+ * animate={{ opacity: 0 }}
1599
+ * transition={{ ease: [0.17, 0.67, 0.83, 0.67] }}
1600
+ * />
1601
+ * ```
1602
+ *
1603
+ * @public
1604
+ */
1605
+ ease?: Easing | Easing[];
1606
+ /**
1607
+ * When animating keyframes, `times` can be used to determine where in the animation each keyframe is reached.
1608
+ * Each value in `times` is a value between `0` and `1`, representing `duration`.
1609
+ *
1610
+ * There must be the same number of `times` as there are keyframes.
1611
+ * Defaults to an array of evenly-spread durations.
1612
+ *
1613
+ * ```jsx
1614
+ * <motion.div
1615
+ * animate={{ scale: [0, 1, 0.5, 1] }}
1616
+ * transition={{ times: [0, 0.1, 0.9, 1] }}
1617
+ * />
1618
+ * ```
1619
+ *
1620
+ * @public
1621
+ */
1622
+ times?: number[];
1623
+ /**
1624
+ * 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.
1625
+ *
1626
+ * ```jsx
1627
+ * <motion.div
1628
+ * animate={{ backgroundColor: ["#0f0", "#00f", "#f00"] }}
1629
+ * transition={{ easings: ["easeIn", "easeOut"] }}
1630
+ * />
1631
+ * ```
1632
+ *
1633
+ * @public
1634
+ */
1635
+ easings?: Easing[];
1636
+ /**
1637
+ * The value to animate from.
1638
+ * By default, this is the current state of the animating value.
1639
+ *
1640
+ * ```jsx
1641
+ * <motion.div
1642
+ * animate={{ rotate: 180 }}
1643
+ * transition={{ from: 90, duration: 2 }}
1644
+ * />
1645
+ * ```
1646
+ *
1647
+ * @public
1648
+ */
1649
+ from?: number | string;
1650
+ }
1651
+ /**
1652
+ * An animation that simulates spring physics for realistic motion.
1653
+ * This is the default animation for physical values like `x`, `y`, `scale` and `rotate`.
1654
+ *
1655
+ * @public
1656
+ */
1657
+ interface Spring extends Repeat {
1658
+ /**
1659
+ * Set `type` to `"spring"` to animate using spring physics for natural
1660
+ * movement. Type is set to `"spring"` by default.
1661
+ *
1662
+ * ```jsx
1663
+ * <motion.div
1664
+ * animate={{ rotate: 180 }}
1665
+ * transition={{ type: 'spring' }}
1666
+ * />
1667
+ * ```
1668
+ *
1669
+ * @public
1670
+ */
1671
+ type: "spring";
1672
+ /**
1673
+ * Stiffness of the spring. Higher values will create more sudden movement.
1674
+ * Set to `100` by default.
1675
+ *
1676
+ * ```jsx
1677
+ * <motion.section
1678
+ * animate={{ rotate: 180 }}
1679
+ * transition={{ type: 'spring', stiffness: 50 }}
1680
+ * />
1681
+ * ```
1682
+ *
1683
+ * @public
1684
+ */
1685
+ stiffness?: number;
1686
+ /**
1687
+ * Strength of opposing force. If set to 0, spring will oscillate
1688
+ * indefinitely. Set to `10` by default.
1689
+ *
1690
+ * ```jsx
1691
+ * <motion.a
1692
+ * animate={{ rotate: 180 }}
1693
+ * transition={{ type: 'spring', damping: 300 }}
1694
+ * />
1695
+ * ```
1696
+ *
1697
+ * @public
1698
+ */
1699
+ damping?: number;
1700
+ /**
1701
+ * Mass of the moving object. Higher values will result in more lethargic
1702
+ * movement. Set to `1` by default.
1703
+ *
1704
+ * ```jsx
1705
+ * <motion.feTurbulence
1706
+ * animate={{ baseFrequency: 0.5 } as any}
1707
+ * transition={{ type: "spring", mass: 0.5 }}
1708
+ * />
1709
+ * ```
1710
+ *
1711
+ * @public
1712
+ */
1713
+ mass?: number;
1714
+ /**
1715
+ * The duration of the animation, defined in seconds. Spring animations can be a maximum of 10 seconds.
1716
+ *
1717
+ * If `bounce` is set, this defaults to `0.8`.
1718
+ *
1719
+ * Note: `duration` and `bounce` will be overridden if `stiffness`, `damping` or `mass` are set.
1720
+ *
1721
+ * ```jsx
1722
+ * <motion.div
1723
+ * animate={{ x: 100 }}
1724
+ * transition={{ type: "spring", duration: 0.8 }}
1725
+ * />
1726
+ * ```
1727
+ *
1728
+ * @public
1729
+ */
1730
+ duration?: number;
1731
+ /**
1732
+ * `bounce` determines the "bounciness" of a spring animation.
1733
+ *
1734
+ * `0` is no bounce, and `1` is extremely bouncy.
1735
+ *
1736
+ * If `duration` is set, this defaults to `0.25`.
1737
+ *
1738
+ * Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
1739
+ *
1740
+ * ```jsx
1741
+ * <motion.div
1742
+ * animate={{ x: 100 }}
1743
+ * transition={{ type: "spring", bounce: 0.25 }}
1744
+ * />
1745
+ * ```
1746
+ *
1747
+ * @public
1748
+ */
1749
+ bounce?: number;
1750
+ /**
1751
+ * End animation if absolute speed (in units per second) drops below this
1752
+ * value and delta is smaller than `restDelta`. Set to `0.01` by default.
1753
+ *
1754
+ * ```jsx
1755
+ * <motion.div
1756
+ * animate={{ rotate: 180 }}
1757
+ * transition={{ type: 'spring', restSpeed: 0.5 }}
1758
+ * />
1759
+ * ```
1760
+ *
1761
+ * @public
1762
+ */
1763
+ restSpeed?: number;
1764
+ /**
1765
+ * End animation if distance is below this value and speed is below
1766
+ * `restSpeed`. When animation ends, spring gets “snapped” to. Set to
1767
+ * `0.01` by default.
1768
+ *
1769
+ * ```jsx
1770
+ * <motion.div
1771
+ * animate={{ rotate: 180 }}
1772
+ * transition={{ type: 'spring', restDelta: 0.5 }}
1773
+ * />
1774
+ * ```
1775
+ *
1776
+ * @public
1777
+ */
1778
+ restDelta?: number;
1779
+ /**
1780
+ * The value to animate from.
1781
+ * By default, this is the initial state of the animating value.
1782
+ *
1783
+ * ```jsx
1784
+ * <motion.div
1785
+ * animate={{ rotate: 180 }}
1786
+ * transition={{ type: 'spring', from: 90 }}
1787
+ * />
1788
+ * ```
1789
+ *
1790
+ * @public
1791
+ */
1792
+ from?: number | string;
1793
+ /**
1794
+ * The initial velocity of the spring. By default this is the current velocity of the component.
1795
+ *
1796
+ * ```jsx
1797
+ * <motion.div
1798
+ * animate={{ rotate: 180 }}
1799
+ * transition={{ type: 'spring', velocity: 2 }}
1800
+ * />
1801
+ * ```
1802
+ *
1803
+ * @public
1804
+ */
1805
+ velocity?: number;
1806
+ }
1807
+ /**
1808
+ * An animation that decelerates a value based on its initial velocity,
1809
+ * usually used to implement inertial scrolling.
1810
+ *
1811
+ * Optionally, `min` and `max` boundaries can be defined, and inertia
1812
+ * will snap to these with a spring animation.
1813
+ *
1814
+ * This animation will automatically precalculate a target value,
1815
+ * which can be modified with the `modifyTarget` property.
1816
+ *
1817
+ * This allows you to add snap-to-grid or similar functionality.
1818
+ *
1819
+ * Inertia is also the animation used for `dragTransition`, and can be configured via that prop.
1820
+ *
1821
+ * @public
1822
+ */
1823
+ interface Inertia {
1824
+ /**
1825
+ * Set `type` to animate using the inertia animation. Set to `"tween"` by
1826
+ * default. This can be used for natural deceleration, like momentum scrolling.
1827
+ *
1828
+ * ```jsx
1829
+ * <motion.div
1830
+ * animate={{ rotate: 180 }}
1831
+ * transition={{ type: "inertia", velocity: 50 }}
1832
+ * />
1833
+ * ```
1834
+ *
1835
+ * @public
1836
+ */
1837
+ type: "inertia";
1838
+ /**
1839
+ * A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
1840
+ *
1841
+ * ```jsx
1842
+ * <motion.div
1843
+ * drag
1844
+ * dragTransition={{
1845
+ * power: 0,
1846
+ * // Snap calculated target to nearest 50 pixels
1847
+ * modifyTarget: target => Math.round(target / 50) * 50
1848
+ * }}
1849
+ * />
1850
+ * ```
1851
+ *
1852
+ * @public
1853
+ */
1854
+ modifyTarget?(v: number): number;
1855
+ /**
1856
+ * If `min` or `max` is set, this affects the stiffness of the bounce
1857
+ * spring. Higher values will create more sudden movement. Set to `500` by
1858
+ * default.
1859
+ *
1860
+ * ```jsx
1861
+ * <motion.div
1862
+ * drag
1863
+ * dragTransition={{
1864
+ * min: 0,
1865
+ * max: 100,
1866
+ * bounceStiffness: 100
1867
+ * }}
1868
+ * />
1869
+ * ```
1870
+ *
1871
+ * @public
1872
+ */
1873
+ bounceStiffness?: number;
1874
+ /**
1875
+ * If `min` or `max` is set, this affects the damping of the bounce spring.
1876
+ * If set to `0`, spring will oscillate indefinitely. Set to `10` by
1877
+ * default.
1878
+ *
1879
+ * ```jsx
1880
+ * <motion.div
1881
+ * drag
1882
+ * dragTransition={{
1883
+ * min: 0,
1884
+ * max: 100,
1885
+ * bounceDamping: 8
1886
+ * }}
1887
+ * />
1888
+ * ```
1889
+ *
1890
+ * @public
1891
+ */
1892
+ bounceDamping?: number;
1893
+ /**
1894
+ * A higher power value equals a further target. Set to `0.8` by default.
1895
+ *
1896
+ * ```jsx
1897
+ * <motion.div
1898
+ * drag
1899
+ * dragTransition={{ power: 0.2 }}
1900
+ * />
1901
+ * ```
1902
+ *
1903
+ * @public
1904
+ */
1905
+ power?: number;
1906
+ /**
1907
+ * Adjusting the time constant will change the duration of the
1908
+ * deceleration, thereby affecting its feel. Set to `700` by default.
1909
+ *
1910
+ * ```jsx
1911
+ * <motion.div
1912
+ * drag
1913
+ * dragTransition={{ timeConstant: 200 }}
1914
+ * />
1915
+ * ```
1916
+ *
1917
+ * @public
1918
+ */
1919
+ timeConstant?: number;
1920
+ /**
1921
+ * End the animation if the distance to the animation target is below this value, and the absolute speed is below `restSpeed`.
1922
+ * When the animation ends, the value gets snapped to the animation target. Set to `0.01` by default.
1923
+ * Generally the default values provide smooth animation endings, only in rare cases should you need to customize these.
1924
+ *
1925
+ * ```jsx
1926
+ * <motion.div
1927
+ * drag
1928
+ * dragTransition={{ restDelta: 10 }}
1929
+ * />
1930
+ * ```
1931
+ *
1932
+ * @public
1933
+ */
1934
+ restDelta?: number;
1935
+ /**
1936
+ * 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).
1937
+ *
1938
+ * ```jsx
1939
+ * <motion.div
1940
+ * drag
1941
+ * dragTransition={{ min: 0, max: 100 }}
1942
+ * />
1943
+ * ```
1944
+ *
1945
+ * @public
1946
+ */
1947
+ min?: number;
1948
+ /**
1949
+ * Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
1950
+ *
1951
+ * ```jsx
1952
+ * <motion.div
1953
+ * drag
1954
+ * dragTransition={{ min: 0, max: 100 }}
1955
+ * />
1956
+ * ```
1957
+ *
1958
+ * @public
1959
+ */
1960
+ max?: number;
1961
+ /**
1962
+ * The value to animate from. By default, this is the current state of the animating value.
1963
+ *
1964
+ * ```jsx
1965
+ * <Frame
1966
+ * drag
1967
+ * dragTransition={{ from: 50 }}
1968
+ * />
1969
+ * ```
1970
+ *
1971
+ * @public
1972
+ */
1973
+ from?: number | string;
1974
+ /**
1975
+ * The initial velocity of the animation.
1976
+ * By default this is the current velocity of the component.
1977
+ *
1978
+ * ```jsx
1979
+ * <motion.div
1980
+ * animate={{ rotate: 180 }}
1981
+ * transition={{ type: 'inertia', velocity: 200 }}
1982
+ * />
1983
+ * ```
1984
+ *
1985
+ * @public
1986
+ */
1987
+ velocity?: number;
1988
+ }
1989
+ /**
1990
+ * Keyframes tweens between multiple `values`.
1991
+ *
1992
+ * These tweens can be arranged using the `duration`, `easings`, and `times` properties.
1993
+ */
1994
+ interface Keyframes {
1995
+ /**
1996
+ * Set `type` to `"keyframes"` to animate using the keyframes animation.
1997
+ * Set to `"tween"` by default. This can be used to animate between a series of values.
1998
+ *
1999
+ * @public
2000
+ */
2001
+ type: "keyframes";
2002
+ /**
2003
+ * An array of numbers between 0 and 1, where `1` represents the `total` duration.
2004
+ *
2005
+ * 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`.
2006
+ *
2007
+ * Defaults to an array of evenly-spread durations.
2008
+ *
2009
+ * @public
2010
+ */
2011
+ times?: number[];
2012
+ /**
2013
+ * An array of easing functions for each generated tween, or a single easing function applied to all tweens.
2014
+ *
2015
+ * This array should be one item less than `values`, as these easings apply to the transitions *between* the `values`.
2016
+ *
2017
+ * ```jsx
2018
+ * const transition = {
2019
+ * backgroundColor: {
2020
+ * type: 'keyframes',
2021
+ * easings: ['circIn', 'circOut']
2022
+ * }
2023
+ * }
2024
+ * ```
2025
+ *
2026
+ * @public
2027
+ */
2028
+ ease?: Easing | Easing[];
2029
+ /**
2030
+ * The total duration of the animation. Set to `0.3` by default.
2031
+ *
2032
+ * ```jsx
2033
+ * const transition = {
2034
+ * type: "keyframes",
2035
+ * duration: 2
2036
+ * }
2037
+ *
2038
+ * <Frame
2039
+ * animate={{ opacity: 0 }}
2040
+ * transition={transition}
2041
+ * />
2042
+ * ```
2043
+ *
2044
+ * @public
2045
+ */
2046
+ duration?: number;
2047
+ /**
2048
+ * @public
2049
+ */
2050
+ repeatDelay?: number;
2051
+ }
2052
+ /**
2053
+ * @public
2054
+ */
2055
+ interface Just {
2056
+ /**
2057
+ * @public
2058
+ */
2059
+ type: "just";
2060
+ }
2061
+ /**
2062
+ * @public
2063
+ */
2064
+ interface None {
2065
+ /**
2066
+ * Set `type` to `false` for an instant transition.
2067
+ *
2068
+ * @public
2069
+ */
2070
+ type: false;
2071
+ }
2072
+ /**
2073
+ * @public
2074
+ */
2075
+ declare type PermissiveTransitionDefinition = {
2076
+ [key: string]: any;
2077
+ };
2078
+ /**
2079
+ * @public
2080
+ */
2081
+ declare type TransitionDefinition = Tween | Spring | Keyframes | Inertia | Just | None | PermissiveTransitionDefinition;
2082
+ declare type TransitionMap = Orchestration & {
2083
+ [key: string]: TransitionDefinition;
2084
+ };
2085
+ /**
2086
+ * Transition props
2087
+ *
2088
+ * @public
2089
+ */
2090
+ declare type Transition = (Orchestration & Repeat & TransitionDefinition) | (Orchestration & Repeat & TransitionMap);
2091
+ declare type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
2092
+ declare type CSSPropertiesWithoutTransitionOrSingleTransforms = Omit$1<CSSProperties, "transition" | "rotate" | "scale" | "perspective">;
2093
+ declare type TargetProperties = CSSPropertiesWithoutTransitionOrSingleTransforms & SVGAttributes<SVGElement> & TransformProperties & CustomStyles & SVGPathProperties;
2094
+ /**
2095
+ * @public
2096
+ */
2097
+ declare type MakeCustomValueType<T> = {
2098
+ [K in keyof T]: T[K] | CustomValueType;
2099
+ };
2100
+ /**
2101
+ * @public
2102
+ */
2103
+ declare type Target = MakeCustomValueType<TargetProperties>;
2104
+ /**
2105
+ * @public
2106
+ */
2107
+ declare type MakeKeyframes<T> = {
2108
+ [K in keyof T]: T[K] | T[K][] | [null, ...T[K][]];
2109
+ };
2110
+ /**
2111
+ * @public
2112
+ */
2113
+ declare type TargetWithKeyframes = MakeKeyframes<Target>;
2114
+ /**
2115
+ * An object that specifies values to animate to. Each value may be set either as
2116
+ * a single value, or an array of values.
2117
+ *
2118
+ * It may also option contain these properties:
2119
+ *
2120
+ * - `transition`: Specifies transitions for all or individual values.
2121
+ * - `transitionEnd`: Specifies values to set when the animation finishes.
2122
+ *
2123
+ * ```jsx
2124
+ * const target = {
2125
+ * x: "0%",
2126
+ * opacity: 0,
2127
+ * transition: { duration: 1 },
2128
+ * transitionEnd: { display: "none" }
2129
+ * }
2130
+ * ```
2131
+ *
2132
+ * @public
2133
+ */
2134
+ declare type TargetAndTransition = TargetWithKeyframes & {
2135
+ transition?: Transition;
2136
+ transitionEnd?: Target;
2137
+ };
2138
+ declare type TargetResolver = (custom: any, current: Target, velocity: Target) => TargetAndTransition | string;
2139
+ /**
2140
+ * @public
2141
+ */
2142
+ declare type Variant = TargetAndTransition | TargetResolver;
2143
+ /**
2144
+ * @public
2145
+ */
2146
+ declare type Variants = {
2147
+ [key: string]: Variant;
2148
+ };
2149
+ /**
2150
+ * @public
2151
+ */
2152
+ interface CustomValueType {
2153
+ mix: (from: any, to: any) => (p: number) => number | string;
2154
+ toValue: () => number | string;
2155
+ }
2156
+
2157
+ /**
2158
+ * Start animation on a MotionValue. This function is an interface between
2159
+ * Framer Motion and Popmotion
2160
+ */
2161
+ declare function startAnimation(key: string, value: MotionValue, target: ResolvedValueTarget, transition?: Transition): Promise<void>;
2162
+
2163
+ interface VisualState<Instance, RenderState> {
2164
+ renderState: RenderState;
2165
+ latestValues: ResolvedValues;
2166
+ mount?: (instance: Instance) => void;
2167
+ }
2168
+ declare type UseVisualState<Instance, RenderState> = (props: MotionProps, isStatic: boolean) => VisualState<Instance, RenderState>;
2169
+ interface UseVisualStateConfig<Instance, RenderState> {
2170
+ scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps;
2171
+ createRenderState: () => RenderState;
2172
+ onMount?: (props: MotionProps, instance: Instance, visualState: VisualState<Instance, RenderState>) => void;
2173
+ }
2174
+ declare const makeUseVisualState: <I, RS>(config: UseVisualStateConfig<I, RS>) => UseVisualState<I, RS>;
2175
+
2176
+ interface AnimationState {
2177
+ animateChanges: (options?: AnimationOptions$1, type?: AnimationType) => Promise<any>;
2178
+ setActive: (type: AnimationType, isActive: boolean, options?: AnimationOptions$1) => Promise<any>;
2179
+ setAnimateFunction: (fn: any) => void;
2180
+ isAnimated(key: string): boolean;
2181
+ getState: () => {
2182
+ [key: string]: AnimationTypeState;
2183
+ };
2184
+ }
2185
+ interface AnimationTypeState {
2186
+ isActive: boolean;
2187
+ protectedKeys: {
2188
+ [key: string]: true;
2189
+ };
2190
+ needsAnimating: {
2191
+ [key: string]: boolean;
2192
+ };
2193
+ prevResolvedValues: {
2194
+ [key: string]: any;
2195
+ };
2196
+ prevProp?: VariantLabels | TargetAndTransition;
2197
+ }
2198
+
2199
+ declare class NodeStack {
2200
+ lead?: IProjectionNode;
2201
+ prevLead?: IProjectionNode;
2202
+ members: IProjectionNode[];
2203
+ add(node: IProjectionNode): void;
2204
+ remove(node: IProjectionNode): void;
2205
+ relegate(node: IProjectionNode): boolean;
2206
+ promote(node: IProjectionNode, preserveFollowOpacity?: boolean): void;
2207
+ exitAnimationComplete(): void;
2208
+ scheduleRender(): void;
2209
+ /**
2210
+ * Clear any leads that have been removed this render to prevent them from being
2211
+ * used in future animations and to prevent memory leaks
2212
+ */
2213
+ removeLeadSnapshot(): void;
2214
+ }
2215
+
2216
+ /**
2217
+ * @public
2218
+ */
2219
+ interface AnimationPlaybackControls {
2220
+ stop: () => void;
2221
+ isAnimating: () => boolean;
2222
+ }
2223
+ /**
2224
+ * @public
2225
+ */
2226
+ interface AnimationPlaybackLifecycles<V> {
2227
+ onUpdate?: (latest: V) => void;
2228
+ onPlay?: () => void;
2229
+ onComplete?: () => void;
2230
+ onRepeat?: () => void;
2231
+ onStop?: () => void;
2232
+ }
2233
+ /**
2234
+ * @public
2235
+ */
2236
+ declare type AnimationOptions<V> = (Tween | Spring) & AnimationPlaybackLifecycles<V> & {
2237
+ delay?: number;
2238
+ type?: "tween" | "spring";
2239
+ };
2240
+ /**
2241
+ * Animate a single value or a `MotionValue`.
2242
+ *
2243
+ * The first argument is either a `MotionValue` to animate, or an initial animation value.
2244
+ *
2245
+ * The second is either a value to animate to, or an array of keyframes to animate through.
2246
+ *
2247
+ * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
2248
+ *
2249
+ * Returns `AnimationPlaybackControls`, currently just a `stop` method.
2250
+ *
2251
+ * ```javascript
2252
+ * const x = useMotionValue(0)
2253
+ *
2254
+ * useEffect(() => {
2255
+ * const controls = animate(x, 100, {
2256
+ * type: "spring",
2257
+ * stiffness: 2000,
2258
+ * onComplete: v => {}
2259
+ * })
2260
+ *
2261
+ * return controls.stop
2262
+ * })
2263
+ * ```
2264
+ *
2265
+ * @public
2266
+ */
2267
+ declare function animate<V>(from: MotionValue<V> | V, to: V | V[], transition?: AnimationOptions<V>): AnimationPlaybackControls;
2268
+
2269
+ interface WithDepth {
2270
+ depth: number;
2271
+ }
2272
+
2273
+ declare class FlatTree {
2274
+ private children;
2275
+ private isDirty;
2276
+ add(child: WithDepth): void;
2277
+ remove(child: WithDepth): void;
2278
+ forEach(callback: (child: WithDepth) => void): void;
2279
+ }
2280
+
2281
+ interface SwitchLayoutGroup {
2282
+ register?: (member: IProjectionNode) => void;
2283
+ deregister?: (member: IProjectionNode) => void;
2284
+ }
2285
+ declare type SwitchLayoutGroupContext = SwitchLayoutGroup & InitialPromotionConfig;
2286
+ declare type InitialPromotionConfig = {
2287
+ /**
2288
+ * The initial transition to use when the elements in this group mount (and automatically promoted).
2289
+ * Subsequent updates should provide a transition in the promote method.
2290
+ */
2291
+ transition?: Transition;
2292
+ /**
2293
+ * If the follow tree should preserve its opacity when the lead is promoted on mount
2294
+ */
2295
+ shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean;
2296
+ };
2297
+
2298
+ interface Snapshot {
2299
+ measured: Box;
2300
+ layout: Box;
2301
+ latestValues: ResolvedValues;
2302
+ isShared?: boolean;
2303
+ }
2304
+ interface Layout {
2305
+ measured: Box;
2306
+ actual: Box;
2307
+ }
2308
+ declare type LayoutEvents = "willUpdate" | "didUpdate" | "beforeMeasure" | "measure" | "projectionUpdate" | "animationStart" | "animationComplete";
2309
+ interface IProjectionNode<I = unknown> {
2310
+ id: number | undefined;
2311
+ parent?: IProjectionNode;
2312
+ relativeParent?: IProjectionNode;
2313
+ root?: IProjectionNode;
2314
+ children: Set<IProjectionNode>;
2315
+ path: IProjectionNode[];
2316
+ nodes?: FlatTree;
2317
+ depth: number;
2318
+ instance: I;
2319
+ mount: (node: I, isLayoutDirty?: boolean) => void;
2320
+ unmount: () => void;
2321
+ options: ProjectionNodeOptions;
2322
+ setOptions(options: ProjectionNodeOptions): void;
2323
+ layout?: Layout;
2324
+ snapshot?: Snapshot;
2325
+ target?: Box;
2326
+ relativeTarget?: Box;
2327
+ targetDelta?: Delta;
2328
+ targetWithTransforms?: Box;
2329
+ scroll?: Point;
2330
+ treeScale?: Point;
2331
+ projectionDelta?: Delta;
2332
+ latestValues: ResolvedValues;
2333
+ isLayoutDirty: boolean;
2334
+ shouldResetTransform: boolean;
2335
+ prevTransformTemplateValue: string | undefined;
2336
+ isUpdateBlocked(): boolean;
2337
+ updateManuallyBlocked: boolean;
2338
+ updateBlockedByResize: boolean;
2339
+ blockUpdate(): void;
2340
+ unblockUpdate(): void;
2341
+ isUpdating: boolean;
2342
+ needsReset: boolean;
2343
+ startUpdate(): void;
2344
+ willUpdate(notifyListeners?: boolean): void;
2345
+ didUpdate(): void;
2346
+ measure(): Box;
2347
+ updateLayout(): void;
2348
+ updateSnapshot(): void;
2349
+ clearSnapshot(): void;
2350
+ updateScroll(): void;
2351
+ scheduleUpdateProjection(): void;
2352
+ scheduleCheckAfterUnmount(): void;
2353
+ checkUpdateFailed(): void;
2354
+ potentialNodes: Map<number, IProjectionNode>;
2355
+ sharedNodes: Map<string, NodeStack>;
2356
+ registerPotentialNode(id: number, node: IProjectionNode): void;
2357
+ registerSharedNode(id: string, node: IProjectionNode): void;
2358
+ getStack(): NodeStack | undefined;
2359
+ isVisible: boolean;
2360
+ hide(): void;
2361
+ show(): void;
2362
+ scheduleRender(notifyAll?: boolean): void;
2363
+ getClosestProjectingParent(): IProjectionNode | undefined;
2364
+ setTargetDelta(delta: Delta): void;
2365
+ resetTransform(): void;
2366
+ resetRotation(): void;
2367
+ applyTransform(box: Box, transformOnly?: boolean): Box;
2368
+ resolveTargetDelta(): void;
2369
+ calcProjection(): void;
2370
+ getProjectionStyles(styles?: MotionStyle): MotionStyle | undefined;
2371
+ clearMeasurements(): void;
2372
+ resetTree(): void;
2373
+ animationValues?: ResolvedValues;
2374
+ currentAnimation?: AnimationPlaybackControls;
2375
+ isTreeAnimating?: boolean;
2376
+ isAnimationBlocked?: boolean;
2377
+ isTreeAnimationBlocked: () => boolean;
2378
+ setAnimationOrigin(delta: Delta): void;
2379
+ startAnimation(transition: Transition): void;
2380
+ finishAnimation(): void;
2381
+ isLead(): boolean;
2382
+ promote(options?: {
2383
+ needsReset?: boolean;
2384
+ transition?: Transition;
2385
+ preserveFollowOpacity?: boolean;
2386
+ }): void;
2387
+ relegate(): boolean;
2388
+ resumeFrom?: IProjectionNode;
2389
+ resumingFrom?: IProjectionNode;
2390
+ isPresent?: boolean;
2391
+ addEventListener(name: LayoutEvents, handler: any): VoidFunction;
2392
+ notifyListeners(name: LayoutEvents, ...args: any): void;
2393
+ hasListeners(name: LayoutEvents): boolean;
2394
+ preserveOpacity?: boolean;
2395
+ }
2396
+ interface ProjectionNodeOptions {
2397
+ animate?: boolean;
2398
+ layoutScroll?: boolean;
2399
+ alwaysMeasureLayout?: boolean;
2400
+ scheduleRender?: VoidFunction;
2401
+ onExitComplete?: VoidFunction;
2402
+ animationType?: "size" | "position" | "both";
2403
+ layoutId?: string;
2404
+ layout?: boolean | string;
2405
+ visualElement?: VisualElement;
2406
+ crossfade?: boolean;
2407
+ transition?: Transition;
2408
+ initialPromotionConfig?: InitialPromotionConfig;
2409
+ }
2410
+
2411
+ /**
2412
+ * @public
2413
+ */
2414
+ interface MotionConfigContext {
2415
+ /**
2416
+ * Defines a new default transition for the entire tree.
2417
+ *
2418
+ * @public
2419
+ */
2420
+ transition?: Transition;
2421
+ /**
2422
+ * If true, will respect the device prefersReducedMotion setting by switching
2423
+ * transform animations off.
2424
+ *
2425
+ * @public
2426
+ */
2427
+ reducedMotion?: "always" | "never" | "user";
2428
+ }
2429
+ /**
2430
+ * @public
2431
+ */
2432
+ declare const MotionConfigContext: React$1.Context<MotionConfigContext>;
2433
+
2434
+ declare type IsValidProp = (key: string) => boolean;
2435
+ declare function filterProps(props: MotionProps, isDom: boolean, forwardMotionProps: boolean): {};
2436
+
2437
+ interface MotionConfigProps extends Partial<MotionConfigContext> {
2438
+ children?: React$1.ReactNode;
2439
+ isValidProp?: IsValidProp;
2440
+ }
2441
+ /**
2442
+ * `MotionConfig` is used to set configuration options for all children `motion` components.
2443
+ *
2444
+ * ```jsx
2445
+ * import { motion, MotionConfig } from "framer-motion"
2446
+ *
2447
+ * export function App() {
2448
+ * return (
2449
+ * <MotionConfig transition={{ type: "spring" }}>
2450
+ * <motion.div animate={{ x: 100 }} />
2451
+ * </MotionConfig>
2452
+ * )
2453
+ * }
2454
+ * ```
2455
+ *
2456
+ * @public
2457
+ */
2458
+ declare function MotionConfig({ children, isValidProp, ...config }: MotionConfigProps): JSX.Element;
2459
+
2460
+ interface VisualElement<Instance = any, RenderState = any> extends LifecycleManager {
2461
+ treeType: string;
2462
+ depth: number;
2463
+ parent?: VisualElement;
2464
+ children: Set<VisualElement>;
2465
+ variantChildren?: Set<VisualElement>;
2466
+ current: Instance | null;
2467
+ manuallyAnimateOnMount: boolean;
2468
+ blockInitialAnimation?: boolean;
2469
+ presenceId: number | undefined;
2470
+ isMounted(): boolean;
2471
+ mount(instance: Instance): void;
2472
+ unmount(): void;
2473
+ isStatic?: boolean;
2474
+ getInstance(): Instance | null;
2475
+ sortNodePosition(element: VisualElement): number;
2476
+ measureViewportBox(withTransform?: boolean): Box;
2477
+ addVariantChild(child: VisualElement): undefined | (() => void);
2478
+ getClosestVariantNode(): VisualElement | undefined;
2479
+ shouldReduceMotion?: boolean | null;
2480
+ animateMotionValue?: typeof startAnimation;
2481
+ projection?: IProjectionNode;
2482
+ /**
2483
+ * Visibility
2484
+ */
2485
+ isVisible?: boolean;
2486
+ setVisibility(visibility: boolean): void;
2487
+ hasValue(key: string): boolean;
2488
+ addValue(key: string, value: MotionValue<any>): void;
2489
+ removeValue(key: string): void;
2490
+ getValue(key: string): undefined | MotionValue;
2491
+ getValue(key: string, defaultValue: string | number): MotionValue;
2492
+ getValue(key: string, defaultValue?: string | number): undefined | MotionValue;
2493
+ forEachValue(callback: (value: MotionValue, key: string) => void): void;
2494
+ readValue(key: string): string | number | undefined | null;
2495
+ setBaseTarget(key: string, value: string | number | null): void;
2496
+ getBaseTarget(key: string): number | string | undefined | null;
2497
+ getStaticValue(key: string): number | string | undefined;
2498
+ setStaticValue(key: string, value: number | string): void;
2499
+ getLatestValues(): ResolvedValues;
2500
+ scheduleRender(): void;
2501
+ makeTargetAnimatable(target: TargetAndTransition, isLive?: boolean): TargetAndTransition;
2502
+ setProps(props: MotionProps): void;
2503
+ getProps(): MotionProps;
2504
+ getVariant(name: string): Variant | undefined;
2505
+ getDefaultTransition(): Transition | undefined;
2506
+ getVariantContext(startAtParent?: boolean): undefined | {
2507
+ initial?: string | string[];
2508
+ animate?: string | string[];
2509
+ exit?: string | string[];
2510
+ whileHover?: string | string[];
2511
+ whileDrag?: string | string[];
2512
+ whileFocus?: string | string[];
2513
+ whileTap?: string | string[];
2514
+ };
2515
+ getTransformPagePoint: () => TransformPoint | undefined;
2516
+ build(): RenderState;
2517
+ syncRender(): void;
2518
+ isPresenceRoot?: boolean;
2519
+ isPresent?: boolean;
2520
+ prevDragCursor?: Point;
2521
+ getLayoutId(): string | undefined;
2522
+ animationState?: AnimationState;
2523
+ }
2524
+ interface VisualElementConfig<Instance, RenderState, Options> {
2525
+ treeType?: string;
2526
+ getBaseTarget?(props: MotionProps, key: string): string | number | undefined | MotionValue;
2527
+ build(visualElement: VisualElement<Instance>, renderState: RenderState, latestValues: ResolvedValues, options: Options, props: MotionProps): void;
2528
+ sortNodePosition?: (a: Instance, b: Instance) => number;
2529
+ makeTargetAnimatable(element: VisualElement<Instance>, target: TargetAndTransition, props: MotionProps, isLive: boolean): TargetAndTransition;
2530
+ measureViewportBox(instance: Instance, props: MotionProps & MotionConfigProps): Box;
2531
+ readValueFromInstance(instance: Instance, key: string, options: Options): string | number | null | undefined;
2532
+ resetTransform(element: VisualElement<Instance>, instance: Instance, props: MotionProps): void;
2533
+ restoreTransform(instance: Instance, renderState: RenderState): void;
2534
+ render(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: IProjectionNode): void;
2535
+ removeValueFromRenderState(key: string, renderState: RenderState): void;
2536
+ scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps;
2537
+ }
2538
+ declare type ScrapeMotionValuesFromProps = (props: MotionProps) => {
2539
+ [key: string]: MotionValue | string | number;
2540
+ };
2541
+ declare type VisualElementOptions<Instance, RenderState = any> = {
2542
+ visualState: VisualState<Instance, RenderState>;
2543
+ parent?: VisualElement<unknown>;
2544
+ variantParent?: VisualElement<unknown>;
2545
+ presenceId?: number | undefined;
2546
+ props: MotionProps;
2547
+ blockInitialAnimation?: boolean;
2548
+ shouldReduceMotion?: boolean | null;
2549
+ };
2550
+ declare type CreateVisualElement<Instance> = (Component: string | React$1.ComponentType, options: VisualElementOptions<Instance>) => VisualElement<Instance>;
2551
+ /**
2552
+ * A generic set of string/number values
2553
+ */
2554
+ interface ResolvedValues {
2555
+ [key: string]: string | number;
2556
+ }
2557
+
2558
+ declare type UnionStringArray$1<T extends Readonly<string[]>> = T[number];
2559
+ declare const svgElements: readonly ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "svg", "switch", "symbol", "text", "tspan", "use", "view", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "linearGradient", "radialGradient", "textPath"];
2560
+ declare type SVGElements = UnionStringArray$1<typeof svgElements>;
2561
+
2562
+ declare type UnionStringArray<T extends Readonly<string[]>> = T[number];
2563
+ declare const htmlElements: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "webview"];
2564
+ declare type HTMLElements = UnionStringArray<typeof htmlElements>;
2565
+
2566
+ /**
2567
+ * @public
2568
+ */
2569
+ declare type ForwardRefComponent<T, P> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
2570
+ /**
2571
+ * Support for React component props
2572
+ */
2573
+ declare type UnwrapFactoryAttributes<F> = F extends DetailedHTMLFactory<infer P, any> ? P : never;
2574
+ declare type UnwrapFactoryElement<F> = F extends DetailedHTMLFactory<any, infer P> ? P : never;
2575
+ declare type HTMLAttributesWithoutMotionProps<Attributes extends HTMLAttributes<Element>, Element extends HTMLElement> = {
2576
+ [K in Exclude<keyof Attributes, keyof MotionProps>]?: Attributes[K];
2577
+ };
2578
+ /**
2579
+ * @public
2580
+ */
2581
+ declare type HTMLMotionProps<TagName extends keyof ReactHTML> = HTMLAttributesWithoutMotionProps<UnwrapFactoryAttributes<ReactHTML[TagName]>, UnwrapFactoryElement<ReactHTML[TagName]>> & MotionProps;
2582
+ /**
2583
+ * Motion-optimised versions of React's HTML components.
2584
+ *
2585
+ * @public
2586
+ */
2587
+ declare type HTMLMotionComponents = {
2588
+ [K in HTMLElements]: ForwardRefComponent<UnwrapFactoryElement<ReactHTML[K]>, HTMLMotionProps<K>>;
2589
+ };
2590
+
2591
+ interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes<T>, Exclude<keyof SVGAttributes<T>, keyof MotionProps>> {
2592
+ }
2593
+ /**
2594
+ * Blanket-accept any SVG attribute as a `MotionValue`
2595
+ * @public
2596
+ */
2597
+ declare type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>;
2598
+ declare type UnwrapSVGFactoryElement<F> = F extends React.SVGProps<infer P> ? P : never;
2599
+ /**
2600
+ * @public
2601
+ */
2602
+ interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps {
2603
+ }
2604
+ /**
2605
+ * Motion-optimised versions of React's SVG components.
2606
+ *
2607
+ * @public
2608
+ */
2609
+ declare type SVGMotionComponents = {
2610
+ [K in SVGElements]: ForwardRefComponent<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>, SVGMotionProps<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>>>;
2611
+ };
2612
+
2613
+ /**
2614
+ * @public
2615
+ */
2616
+ interface FeatureProps extends MotionProps {
2617
+ visualElement: VisualElement;
2618
+ }
2619
+ declare type FeatureNames = {
2620
+ animation: true;
2621
+ exit: true;
2622
+ drag: true;
2623
+ tap: true;
2624
+ focus: true;
2625
+ hover: true;
2626
+ pan: true;
2627
+ inView: true;
2628
+ measureLayout: true;
2629
+ };
2630
+ declare type FeatureComponent = React$1.ComponentType<FeatureProps>;
2631
+ /**
2632
+ * @public
2633
+ */
2634
+ interface FeatureDefinition {
2635
+ isEnabled: (props: MotionProps) => boolean;
2636
+ Component?: FeatureComponent;
2637
+ }
2638
+ interface FeatureComponents {
2639
+ animation?: FeatureComponent;
2640
+ exit?: FeatureComponent;
2641
+ drag?: FeatureComponent;
2642
+ tap?: FeatureComponent;
2643
+ focus?: FeatureComponent;
2644
+ hover?: FeatureComponent;
2645
+ pan?: FeatureComponent;
2646
+ inView?: FeatureComponent;
2647
+ measureLayout?: FeatureComponent;
2648
+ }
2649
+ interface FeatureBundle extends FeatureComponents {
2650
+ renderer: CreateVisualElement<any>;
2651
+ projectionNodeConstructor?: any;
2652
+ }
2653
+ declare type LazyFeatureBundle$1 = () => Promise<FeatureBundle>;
2654
+ declare type FeatureDefinitions = {
2655
+ [K in keyof FeatureNames]: FeatureDefinition;
2656
+ };
2657
+ declare type LoadedFeatures = FeatureDefinitions & {
2658
+ projectionNodeConstructor?: any;
2659
+ };
2660
+ declare type RenderComponent<Instance, RenderState> = (Component: string | React$1.ComponentType, props: MotionProps, projectionId: number | undefined, ref: React$1.Ref<Instance>, visualState: VisualState<Instance, RenderState>, isStatic: boolean, visualElement?: VisualElement) => any;
2661
+
2662
+ interface MotionComponentConfig<Instance, RenderState> {
2663
+ preloadedFeatures?: FeatureBundle;
2664
+ createVisualElement?: CreateVisualElement<Instance>;
2665
+ projectionNodeConstructor?: any;
2666
+ useRender: RenderComponent<Instance, RenderState>;
2667
+ useVisualState: UseVisualState<Instance, RenderState>;
2668
+ Component: string | React$1.ComponentType;
2669
+ }
2670
+ /**
2671
+ * Create a `motion` component.
2672
+ *
2673
+ * This function accepts a Component argument, which can be either a string (ie "div"
2674
+ * for `motion.div`), or an actual React component.
2675
+ *
2676
+ * Alongside this is a config option which provides a way of rendering the provided
2677
+ * component "offline", or outside the React render cycle.
2678
+ */
2679
+ declare function createMotionComponent<Props extends {}, Instance, RenderState>({ preloadedFeatures, createVisualElement, projectionNodeConstructor, useRender, useVisualState, Component, }: MotionComponentConfig<Instance, RenderState>): React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<Props & MotionProps> & React$1.RefAttributes<Instance>>;
2680
+
2681
+ /**
2682
+ * I'd rather the return type of `custom` to be implicit but this throws
2683
+ * incorrect relative paths in the exported types and API Extractor throws
2684
+ * a wobbly.
2685
+ */
2686
+ declare type CustomDomComponent<Props> = React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<Props & MotionProps> & React$1.RefAttributes<SVGElement | HTMLElement>>;
2687
+ interface CustomMotionComponentConfig {
2688
+ forwardMotionProps?: boolean;
2689
+ }
2690
+
2691
+ declare type DOMMotionComponents = HTMLMotionComponents & SVGMotionComponents;
2692
+
2693
+ /**
2694
+ * HTML & SVG components, optimised for use with gestures and animation. These can be used as
2695
+ * drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
2696
+ *
2697
+ * @public
2698
+ */
2699
+ declare const motion: (<Props>(Component: string | React$1.ComponentType<Props>, customMotionComponentConfig?: CustomMotionComponentConfig) => CustomDomComponent<Props>) & HTMLMotionComponents & SVGMotionComponents;
2700
+ /**
2701
+ * Create a DOM `motion` component with the provided string. This is primarily intended
2702
+ * as a full alternative to `motion` for consumers who have to support environments that don't
2703
+ * support `Proxy`.
2704
+ *
2705
+ * ```javascript
2706
+ * import { createDomMotionComponent } from "framer-motion"
2707
+ *
2708
+ * const motion = {
2709
+ * div: createDomMotionComponent('div')
2710
+ * }
2711
+ * ```
2712
+ *
2713
+ * @public
2714
+ */
2715
+ declare function createDomMotionComponent<T extends keyof DOMMotionComponents>(key: T): DOMMotionComponents[T];
2716
+
2717
+ /**
2718
+ * @public
2719
+ */
2720
+ declare const m: (<Props>(Component: string | React$1.ComponentType<Props>, customMotionComponentConfig?: CustomMotionComponentConfig) => CustomDomComponent<Props>) & HTMLMotionComponents & SVGMotionComponents;
2721
+
2722
+ /**
2723
+ * @public
2724
+ */
2725
+ interface AnimatePresenceProps {
2726
+ /**
2727
+ * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children
2728
+ * that are present when the component is first rendered.
2729
+ *
2730
+ * ```jsx
2731
+ * <AnimatePresence initial={false}>
2732
+ * {isVisible && (
2733
+ * <motion.div
2734
+ * key="modal"
2735
+ * initial={{ opacity: 0 }}
2736
+ * animate={{ opacity: 1 }}
2737
+ * exit={{ opacity: 0 }}
2738
+ * />
2739
+ * )}
2740
+ * </AnimatePresence>
2741
+ * ```
2742
+ *
2743
+ * @public
2744
+ */
2745
+ initial?: boolean;
2746
+ /**
2747
+ * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`
2748
+ * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.
2749
+ * This will ensure all leaving components animate using the latest data.
2750
+ *
2751
+ * @public
2752
+ */
2753
+ custom?: any;
2754
+ /**
2755
+ * Fires when all exiting nodes have completed animating out.
2756
+ *
2757
+ * @public
2758
+ */
2759
+ onExitComplete?: () => void;
2760
+ /**
2761
+ * If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component
2762
+ * will finish its exit animation before the entering component is rendered.
2763
+ *
2764
+ * ```jsx
2765
+ * const MyComponent = ({ currentItem }) => (
2766
+ * <AnimatePresence exitBeforeEnter>
2767
+ * <motion.div key={currentItem} exit={{ opacity: 0 }} />
2768
+ * </AnimatePresence>
2769
+ * )
2770
+ * ```
2771
+ *
2772
+ * @beta
2773
+ */
2774
+ exitBeforeEnter?: boolean;
2775
+ }
2776
+
2777
+ /**
2778
+ * `AnimatePresence` enables the animation of components that have been removed from the tree.
2779
+ *
2780
+ * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
2781
+ *
2782
+ * Any `motion` components that have an `exit` property defined will animate out when removed from
2783
+ * the tree.
2784
+ *
2785
+ * ```jsx
2786
+ * import { motion, AnimatePresence } from 'framer-motion'
2787
+ *
2788
+ * export const Items = ({ items }) => (
2789
+ * <AnimatePresence>
2790
+ * {items.map(item => (
2791
+ * <motion.div
2792
+ * key={item.id}
2793
+ * initial={{ opacity: 0 }}
2794
+ * animate={{ opacity: 1 }}
2795
+ * exit={{ opacity: 0 }}
2796
+ * />
2797
+ * ))}
2798
+ * </AnimatePresence>
2799
+ * )
2800
+ * ```
2801
+ *
2802
+ * You can sequence exit animations throughout a tree using variants.
2803
+ *
2804
+ * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
2805
+ * once all `motion` components have finished animating out. Likewise, any components using
2806
+ * `usePresence` all need to call `safeToRemove`.
2807
+ *
2808
+ * @public
2809
+ */
2810
+ declare const AnimatePresence: React$1.FunctionComponent<React$1.PropsWithChildren<AnimatePresenceProps>>;
2811
+
2812
+ declare const AnimateSharedLayout: React$1.FunctionComponent;
2813
+
2814
+ declare type LazyFeatureBundle = () => Promise<FeatureBundle>;
2815
+ /**
2816
+ * @public
2817
+ */
2818
+ interface LazyProps {
2819
+ children?: React.ReactNode;
2820
+ /**
2821
+ * Can be used to provide a feature bundle synchronously or asynchronously.
2822
+ *
2823
+ * ```jsx
2824
+ * // features.js
2825
+ * import { domAnimations } from "framer-motion"
2826
+ * export default domAnimations
2827
+ *
2828
+ * // index.js
2829
+ * import { LazyMotion, m } from "framer-motion"
2830
+ *
2831
+ * const loadFeatures = import("./features.js")
2832
+ * .then(res => res.default)
2833
+ *
2834
+ * function Component() {
2835
+ * return (
2836
+ * <LazyMotion features={loadFeatures}>
2837
+ * <m.div animate={{ scale: 1.5 }} />
2838
+ * </LazyMotion>
2839
+ * )
2840
+ * }
2841
+ * ```
2842
+ *
2843
+ * @public
2844
+ */
2845
+ features: FeatureBundle | LazyFeatureBundle;
2846
+ /**
2847
+ * If `true`, will throw an error if a `motion` component renders within
2848
+ * a `LazyMotion` component.
2849
+ *
2850
+ * ```jsx
2851
+ * // This component will throw an error that explains using a motion component
2852
+ * // instead of the m component will break the benefits of code-splitting.
2853
+ * function Component() {
2854
+ * return (
2855
+ * <LazyMotion features={domAnimation} strict>
2856
+ * <motion.div />
2857
+ * </LazyMotion>
2858
+ * )
2859
+ * }
2860
+ * ```
2861
+ *
2862
+ * @public
2863
+ */
2864
+ strict?: boolean;
2865
+ }
2866
+
2867
+ /**
2868
+ * Used in conjunction with the `m` component to reduce bundle size.
2869
+ *
2870
+ * `m` is a version of the `motion` component that only loads functionality
2871
+ * critical for the initial render.
2872
+ *
2873
+ * `LazyMotion` can then be used to either synchronously or asynchronously
2874
+ * load animation and gesture support.
2875
+ *
2876
+ * ```jsx
2877
+ * // Synchronous loading
2878
+ * import { LazyMotion, m, domAnimations } from "framer-motion"
2879
+ *
2880
+ * function App() {
2881
+ * return (
2882
+ * <LazyMotion features={domAnimations}>
2883
+ * <m.div animate={{ scale: 2 }} />
2884
+ * </LazyMotion>
2885
+ * )
2886
+ * }
2887
+ *
2888
+ * // Asynchronous loading
2889
+ * import { LazyMotion, m } from "framer-motion"
2890
+ *
2891
+ * function App() {
2892
+ * return (
2893
+ * <LazyMotion features={() => import('./path/to/domAnimations')}>
2894
+ * <m.div animate={{ scale: 2 }} />
2895
+ * </LazyMotion>
2896
+ * )
2897
+ * }
2898
+ * ```
2899
+ *
2900
+ * @public
2901
+ */
2902
+ declare function LazyMotion({ children, features, strict }: LazyProps): JSX.Element;
2903
+
2904
+ declare type InheritOption = boolean | "id";
2905
+ interface Props$2 {
2906
+ id?: string;
2907
+ inherit?: InheritOption;
2908
+ /**
2909
+ * @deprecated
2910
+ */
2911
+ inheritId?: boolean;
2912
+ }
2913
+ declare const LayoutGroup: React$1.FunctionComponent<React$1.PropsWithChildren<Props$2>>;
2914
+
2915
+ interface Props$1<V> {
2916
+ /**
2917
+ * A HTML element to render this component as. Defaults to `"li"`.
2918
+ *
2919
+ * @public
2920
+ */
2921
+ as?: keyof ReactHTML;
2922
+ /**
2923
+ * The value in the list that this component represents.
2924
+ *
2925
+ * @public
2926
+ */
2927
+ value: V;
2928
+ /**
2929
+ * A subset of layout options primarily used to disable layout="size"
2930
+ *
2931
+ * @public
2932
+ * @default true
2933
+ */
2934
+ layout?: true | "position";
2935
+ }
2936
+
2937
+ interface Props<V> {
2938
+ /**
2939
+ * A HTML element to render this component as. Defaults to `"ul"`.
2940
+ *
2941
+ * @public
2942
+ */
2943
+ as?: keyof ReactHTML;
2944
+ /**
2945
+ * The axis to reorder along. By default, items will be draggable on this axis.
2946
+ * To make draggable on both axes, set `<Reorder.Item drag />`
2947
+ *
2948
+ * @public
2949
+ */
2950
+ axis?: "x" | "y";
2951
+ /**
2952
+ * A callback to fire with the new value order. For instance, if the values
2953
+ * are provided as a state from `useState`, this could be the set state function.
2954
+ *
2955
+ * @public
2956
+ */
2957
+ onReorder: (newOrder: any[]) => void;
2958
+ /**
2959
+ * The latest values state.
2960
+ *
2961
+ * ```jsx
2962
+ * function Component() {
2963
+ * const [items, setItems] = useState([0, 1, 2])
2964
+ *
2965
+ * return (
2966
+ * <Reorder.Group values={items} onReorder={setItems}>
2967
+ * {items.map((item) => <Reorder.Item key={item} value={item} />)}
2968
+ * </Reorder.Group>
2969
+ * )
2970
+ * }
2971
+ * ```
2972
+ *
2973
+ * @public
2974
+ */
2975
+ values: V[];
2976
+ }
2977
+
2978
+ declare const Reorder: {
2979
+ Group: React$1.ForwardRefExoticComponent<Props<unknown> & {
2980
+ color?: string | undefined;
2981
+ translate?: "no" | "yes" | undefined;
2982
+ hidden?: boolean | undefined;
2983
+ onPlay?: React$1.ReactEventHandler<any> | undefined;
2984
+ className?: string | undefined;
2985
+ id?: string | undefined;
2986
+ lang?: string | undefined;
2987
+ role?: React$1.AriaRole | undefined;
2988
+ tabIndex?: number | undefined;
2989
+ "aria-activedescendant"?: string | undefined;
2990
+ "aria-atomic"?: (boolean | "false" | "true") | undefined;
2991
+ "aria-autocomplete"?: "none" | "inline" | "both" | "list" | undefined;
2992
+ "aria-busy"?: (boolean | "false" | "true") | undefined;
2993
+ "aria-checked"?: boolean | "mixed" | "false" | "true" | undefined;
2994
+ "aria-colcount"?: number | undefined;
2995
+ "aria-colindex"?: number | undefined;
2996
+ "aria-colspan"?: number | undefined;
2997
+ "aria-controls"?: string | undefined;
2998
+ "aria-current"?: boolean | "page" | "false" | "true" | "step" | "location" | "date" | "time" | undefined;
2999
+ "aria-describedby"?: string | undefined;
3000
+ "aria-details"?: string | undefined;
3001
+ "aria-disabled"?: (boolean | "false" | "true") | undefined;
3002
+ "aria-dropeffect"?: "none" | "copy" | "move" | "link" | "execute" | "popup" | undefined;
3003
+ "aria-errormessage"?: string | undefined;
3004
+ "aria-expanded"?: (boolean | "false" | "true") | undefined;
3005
+ "aria-flowto"?: string | undefined;
3006
+ "aria-grabbed"?: (boolean | "false" | "true") | undefined;
3007
+ "aria-haspopup"?: boolean | "grid" | "listbox" | "menu" | "false" | "true" | "dialog" | "tree" | undefined;
3008
+ "aria-hidden"?: (boolean | "false" | "true") | undefined;
3009
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
3010
+ "aria-keyshortcuts"?: string | undefined;
3011
+ "aria-label"?: string | undefined;
3012
+ "aria-labelledby"?: string | undefined;
3013
+ "aria-level"?: number | undefined;
3014
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
3015
+ "aria-modal"?: (boolean | "false" | "true") | undefined;
3016
+ "aria-multiline"?: (boolean | "false" | "true") | undefined;
3017
+ "aria-multiselectable"?: (boolean | "false" | "true") | undefined;
3018
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
3019
+ "aria-owns"?: string | undefined;
3020
+ "aria-placeholder"?: string | undefined;
3021
+ "aria-posinset"?: number | undefined;
3022
+ "aria-pressed"?: boolean | "mixed" | "false" | "true" | undefined;
3023
+ "aria-readonly"?: (boolean | "false" | "true") | undefined;
3024
+ "aria-relevant"?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
3025
+ "aria-required"?: (boolean | "false" | "true") | undefined;
3026
+ "aria-roledescription"?: string | undefined;
3027
+ "aria-rowcount"?: number | undefined;
3028
+ "aria-rowindex"?: number | undefined;
3029
+ "aria-rowspan"?: number | undefined;
3030
+ "aria-selected"?: (boolean | "false" | "true") | undefined;
3031
+ "aria-setsize"?: number | undefined;
3032
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
3033
+ "aria-valuemax"?: number | undefined;
3034
+ "aria-valuemin"?: number | undefined;
3035
+ "aria-valuenow"?: number | undefined;
3036
+ "aria-valuetext"?: string | undefined;
3037
+ children?: React$1.ReactNode;
3038
+ dangerouslySetInnerHTML?: {
3039
+ __html: string;
3040
+ } | undefined;
3041
+ onCopy?: React$1.ClipboardEventHandler<any> | undefined;
3042
+ onCopyCapture?: React$1.ClipboardEventHandler<any> | undefined;
3043
+ onCut?: React$1.ClipboardEventHandler<any> | undefined;
3044
+ onCutCapture?: React$1.ClipboardEventHandler<any> | undefined;
3045
+ onPaste?: React$1.ClipboardEventHandler<any> | undefined;
3046
+ onPasteCapture?: React$1.ClipboardEventHandler<any> | undefined;
3047
+ onCompositionEnd?: React$1.CompositionEventHandler<any> | undefined;
3048
+ onCompositionEndCapture?: React$1.CompositionEventHandler<any> | undefined;
3049
+ onCompositionStart?: React$1.CompositionEventHandler<any> | undefined;
3050
+ onCompositionStartCapture?: React$1.CompositionEventHandler<any> | undefined;
3051
+ onCompositionUpdate?: React$1.CompositionEventHandler<any> | undefined;
3052
+ onCompositionUpdateCapture?: React$1.CompositionEventHandler<any> | undefined;
3053
+ onFocus?: React$1.FocusEventHandler<any> | undefined;
3054
+ onFocusCapture?: React$1.FocusEventHandler<any> | undefined;
3055
+ onBlur?: React$1.FocusEventHandler<any> | undefined;
3056
+ onBlurCapture?: React$1.FocusEventHandler<any> | undefined;
3057
+ onChange?: React$1.FormEventHandler<any> | undefined;
3058
+ onChangeCapture?: React$1.FormEventHandler<any> | undefined;
3059
+ onBeforeInput?: React$1.FormEventHandler<any> | undefined;
3060
+ onBeforeInputCapture?: React$1.FormEventHandler<any> | undefined;
3061
+ onInput?: React$1.FormEventHandler<any> | undefined;
3062
+ onInputCapture?: React$1.FormEventHandler<any> | undefined;
3063
+ onReset?: React$1.FormEventHandler<any> | undefined;
3064
+ onResetCapture?: React$1.FormEventHandler<any> | undefined;
3065
+ onSubmit?: React$1.FormEventHandler<any> | undefined;
3066
+ onSubmitCapture?: React$1.FormEventHandler<any> | undefined;
3067
+ onInvalid?: React$1.FormEventHandler<any> | undefined;
3068
+ onInvalidCapture?: React$1.FormEventHandler<any> | undefined;
3069
+ onLoad?: React$1.ReactEventHandler<any> | undefined;
3070
+ onLoadCapture?: React$1.ReactEventHandler<any> | undefined;
3071
+ onError?: React$1.ReactEventHandler<any> | undefined;
3072
+ onErrorCapture?: React$1.ReactEventHandler<any> | undefined;
3073
+ onKeyDown?: React$1.KeyboardEventHandler<any> | undefined;
3074
+ onKeyDownCapture?: React$1.KeyboardEventHandler<any> | undefined;
3075
+ onKeyPress?: React$1.KeyboardEventHandler<any> | undefined;
3076
+ onKeyPressCapture?: React$1.KeyboardEventHandler<any> | undefined;
3077
+ onKeyUp?: React$1.KeyboardEventHandler<any> | undefined;
3078
+ onKeyUpCapture?: React$1.KeyboardEventHandler<any> | undefined;
3079
+ onAbort?: React$1.ReactEventHandler<any> | undefined;
3080
+ onAbortCapture?: React$1.ReactEventHandler<any> | undefined;
3081
+ onCanPlay?: React$1.ReactEventHandler<any> | undefined;
3082
+ onCanPlayCapture?: React$1.ReactEventHandler<any> | undefined;
3083
+ onCanPlayThrough?: React$1.ReactEventHandler<any> | undefined;
3084
+ onCanPlayThroughCapture?: React$1.ReactEventHandler<any> | undefined;
3085
+ onDurationChange?: React$1.ReactEventHandler<any> | undefined;
3086
+ onDurationChangeCapture?: React$1.ReactEventHandler<any> | undefined;
3087
+ onEmptied?: React$1.ReactEventHandler<any> | undefined;
3088
+ onEmptiedCapture?: React$1.ReactEventHandler<any> | undefined;
3089
+ onEncrypted?: React$1.ReactEventHandler<any> | undefined;
3090
+ onEncryptedCapture?: React$1.ReactEventHandler<any> | undefined;
3091
+ onEnded?: React$1.ReactEventHandler<any> | undefined;
3092
+ onEndedCapture?: React$1.ReactEventHandler<any> | undefined;
3093
+ onLoadedData?: React$1.ReactEventHandler<any> | undefined;
3094
+ onLoadedDataCapture?: React$1.ReactEventHandler<any> | undefined;
3095
+ onLoadedMetadata?: React$1.ReactEventHandler<any> | undefined;
3096
+ onLoadedMetadataCapture?: React$1.ReactEventHandler<any> | undefined;
3097
+ onLoadStart?: React$1.ReactEventHandler<any> | undefined;
3098
+ onLoadStartCapture?: React$1.ReactEventHandler<any> | undefined;
3099
+ onPause?: React$1.ReactEventHandler<any> | undefined;
3100
+ onPauseCapture?: React$1.ReactEventHandler<any> | undefined;
3101
+ onPlayCapture?: React$1.ReactEventHandler<any> | undefined;
3102
+ onPlaying?: React$1.ReactEventHandler<any> | undefined;
3103
+ onPlayingCapture?: React$1.ReactEventHandler<any> | undefined;
3104
+ onProgress?: React$1.ReactEventHandler<any> | undefined;
3105
+ onProgressCapture?: React$1.ReactEventHandler<any> | undefined;
3106
+ onRateChange?: React$1.ReactEventHandler<any> | undefined;
3107
+ onRateChangeCapture?: React$1.ReactEventHandler<any> | undefined;
3108
+ onSeeked?: React$1.ReactEventHandler<any> | undefined;
3109
+ onSeekedCapture?: React$1.ReactEventHandler<any> | undefined;
3110
+ onSeeking?: React$1.ReactEventHandler<any> | undefined;
3111
+ onSeekingCapture?: React$1.ReactEventHandler<any> | undefined;
3112
+ onStalled?: React$1.ReactEventHandler<any> | undefined;
3113
+ onStalledCapture?: React$1.ReactEventHandler<any> | undefined;
3114
+ onSuspend?: React$1.ReactEventHandler<any> | undefined;
3115
+ onSuspendCapture?: React$1.ReactEventHandler<any> | undefined;
3116
+ onTimeUpdate?: React$1.ReactEventHandler<any> | undefined;
3117
+ onTimeUpdateCapture?: React$1.ReactEventHandler<any> | undefined;
3118
+ onVolumeChange?: React$1.ReactEventHandler<any> | undefined;
3119
+ onVolumeChangeCapture?: React$1.ReactEventHandler<any> | undefined;
3120
+ onWaiting?: React$1.ReactEventHandler<any> | undefined;
3121
+ onWaitingCapture?: React$1.ReactEventHandler<any> | undefined;
3122
+ onAuxClick?: React$1.MouseEventHandler<any> | undefined;
3123
+ onAuxClickCapture?: React$1.MouseEventHandler<any> | undefined;
3124
+ onClick?: React$1.MouseEventHandler<any> | undefined;
3125
+ onClickCapture?: React$1.MouseEventHandler<any> | undefined;
3126
+ onContextMenu?: React$1.MouseEventHandler<any> | undefined;
3127
+ onContextMenuCapture?: React$1.MouseEventHandler<any> | undefined;
3128
+ onDoubleClick?: React$1.MouseEventHandler<any> | undefined;
3129
+ onDoubleClickCapture?: React$1.MouseEventHandler<any> | undefined;
3130
+ onDragCapture?: React$1.DragEventHandler<any> | undefined;
3131
+ onDragEndCapture?: React$1.DragEventHandler<any> | undefined;
3132
+ onDragEnter?: React$1.DragEventHandler<any> | undefined;
3133
+ onDragEnterCapture?: React$1.DragEventHandler<any> | undefined;
3134
+ onDragExit?: React$1.DragEventHandler<any> | undefined;
3135
+ onDragExitCapture?: React$1.DragEventHandler<any> | undefined;
3136
+ onDragLeave?: React$1.DragEventHandler<any> | undefined;
3137
+ onDragLeaveCapture?: React$1.DragEventHandler<any> | undefined;
3138
+ onDragOver?: React$1.DragEventHandler<any> | undefined;
3139
+ onDragOverCapture?: React$1.DragEventHandler<any> | undefined;
3140
+ onDragStartCapture?: React$1.DragEventHandler<any> | undefined;
3141
+ onDrop?: React$1.DragEventHandler<any> | undefined;
3142
+ onDropCapture?: React$1.DragEventHandler<any> | undefined;
3143
+ onMouseDown?: React$1.MouseEventHandler<any> | undefined;
3144
+ onMouseDownCapture?: React$1.MouseEventHandler<any> | undefined;
3145
+ onMouseEnter?: React$1.MouseEventHandler<any> | undefined;
3146
+ onMouseLeave?: React$1.MouseEventHandler<any> | undefined;
3147
+ onMouseMove?: React$1.MouseEventHandler<any> | undefined;
3148
+ onMouseMoveCapture?: React$1.MouseEventHandler<any> | undefined;
3149
+ onMouseOut?: React$1.MouseEventHandler<any> | undefined;
3150
+ onMouseOutCapture?: React$1.MouseEventHandler<any> | undefined;
3151
+ onMouseOver?: React$1.MouseEventHandler<any> | undefined;
3152
+ onMouseOverCapture?: React$1.MouseEventHandler<any> | undefined;
3153
+ onMouseUp?: React$1.MouseEventHandler<any> | undefined;
3154
+ onMouseUpCapture?: React$1.MouseEventHandler<any> | undefined;
3155
+ onSelect?: React$1.ReactEventHandler<any> | undefined;
3156
+ onSelectCapture?: React$1.ReactEventHandler<any> | undefined;
3157
+ onTouchCancel?: React$1.TouchEventHandler<any> | undefined;
3158
+ onTouchCancelCapture?: React$1.TouchEventHandler<any> | undefined;
3159
+ onTouchEnd?: React$1.TouchEventHandler<any> | undefined;
3160
+ onTouchEndCapture?: React$1.TouchEventHandler<any> | undefined;
3161
+ onTouchMove?: React$1.TouchEventHandler<any> | undefined;
3162
+ onTouchMoveCapture?: React$1.TouchEventHandler<any> | undefined;
3163
+ onTouchStart?: React$1.TouchEventHandler<any> | undefined;
3164
+ onTouchStartCapture?: React$1.TouchEventHandler<any> | undefined;
3165
+ onPointerDown?: React$1.PointerEventHandler<any> | undefined;
3166
+ onPointerDownCapture?: React$1.PointerEventHandler<any> | undefined;
3167
+ onPointerMove?: React$1.PointerEventHandler<any> | undefined;
3168
+ onPointerMoveCapture?: React$1.PointerEventHandler<any> | undefined;
3169
+ onPointerUp?: React$1.PointerEventHandler<any> | undefined;
3170
+ onPointerUpCapture?: React$1.PointerEventHandler<any> | undefined;
3171
+ onPointerCancel?: React$1.PointerEventHandler<any> | undefined;
3172
+ onPointerCancelCapture?: React$1.PointerEventHandler<any> | undefined;
3173
+ onPointerEnter?: React$1.PointerEventHandler<any> | undefined;
3174
+ onPointerEnterCapture?: React$1.PointerEventHandler<any> | undefined;
3175
+ onPointerLeave?: React$1.PointerEventHandler<any> | undefined;
3176
+ onPointerLeaveCapture?: React$1.PointerEventHandler<any> | undefined;
3177
+ onPointerOver?: React$1.PointerEventHandler<any> | undefined;
3178
+ onPointerOverCapture?: React$1.PointerEventHandler<any> | undefined;
3179
+ onPointerOut?: React$1.PointerEventHandler<any> | undefined;
3180
+ onPointerOutCapture?: React$1.PointerEventHandler<any> | undefined;
3181
+ onGotPointerCapture?: React$1.PointerEventHandler<any> | undefined;
3182
+ onGotPointerCaptureCapture?: React$1.PointerEventHandler<any> | undefined;
3183
+ onLostPointerCapture?: React$1.PointerEventHandler<any> | undefined;
3184
+ onLostPointerCaptureCapture?: React$1.PointerEventHandler<any> | undefined;
3185
+ onScroll?: React$1.UIEventHandler<any> | undefined;
3186
+ onScrollCapture?: React$1.UIEventHandler<any> | undefined;
3187
+ onWheel?: React$1.WheelEventHandler<any> | undefined;
3188
+ onWheelCapture?: React$1.WheelEventHandler<any> | undefined;
3189
+ onAnimationStartCapture?: React$1.AnimationEventHandler<any> | undefined;
3190
+ onAnimationEnd?: React$1.AnimationEventHandler<any> | undefined;
3191
+ onAnimationEndCapture?: React$1.AnimationEventHandler<any> | undefined;
3192
+ onAnimationIteration?: React$1.AnimationEventHandler<any> | undefined;
3193
+ onAnimationIterationCapture?: React$1.AnimationEventHandler<any> | undefined;
3194
+ onTransitionEnd?: React$1.TransitionEventHandler<any> | undefined;
3195
+ onTransitionEndCapture?: React$1.TransitionEventHandler<any> | undefined;
3196
+ draggable?: (boolean | "false" | "true") | undefined;
3197
+ slot?: string | undefined;
3198
+ title?: string | undefined;
3199
+ defaultChecked?: boolean | undefined;
3200
+ defaultValue?: string | number | readonly string[] | undefined;
3201
+ suppressContentEditableWarning?: boolean | undefined;
3202
+ suppressHydrationWarning?: boolean | undefined;
3203
+ accessKey?: string | undefined;
3204
+ contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
3205
+ contextMenu?: string | undefined;
3206
+ dir?: string | undefined;
3207
+ placeholder?: string | undefined;
3208
+ spellCheck?: (boolean | "false" | "true") | undefined;
3209
+ radioGroup?: string | undefined;
3210
+ about?: string | undefined;
3211
+ datatype?: string | undefined;
3212
+ inlist?: any;
3213
+ prefix?: string | undefined;
3214
+ property?: string | undefined;
3215
+ resource?: string | undefined;
3216
+ typeof?: string | undefined;
3217
+ vocab?: string | undefined;
3218
+ autoCapitalize?: string | undefined;
3219
+ autoCorrect?: string | undefined;
3220
+ autoSave?: string | undefined;
3221
+ itemProp?: string | undefined;
3222
+ itemScope?: boolean | undefined;
3223
+ itemType?: string | undefined;
3224
+ itemID?: string | undefined;
3225
+ itemRef?: string | undefined;
3226
+ results?: number | undefined;
3227
+ security?: string | undefined;
3228
+ unselectable?: "off" | "on" | undefined;
3229
+ inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
3230
+ is?: string | undefined;
3231
+ } & MotionProps & React$1.RefAttributes<any>>;
3232
+ Item: React$1.ForwardRefExoticComponent<Props$1<unknown> & {
3233
+ color?: string | undefined;
3234
+ translate?: "no" | "yes" | undefined;
3235
+ hidden?: boolean | undefined;
3236
+ onPlay?: React$1.ReactEventHandler<any> | undefined;
3237
+ className?: string | undefined;
3238
+ id?: string | undefined;
3239
+ lang?: string | undefined;
3240
+ role?: React$1.AriaRole | undefined;
3241
+ tabIndex?: number | undefined;
3242
+ "aria-activedescendant"?: string | undefined;
3243
+ "aria-atomic"?: (boolean | "false" | "true") | undefined;
3244
+ "aria-autocomplete"?: "none" | "inline" | "both" | "list" | undefined;
3245
+ "aria-busy"?: (boolean | "false" | "true") | undefined;
3246
+ "aria-checked"?: boolean | "mixed" | "false" | "true" | undefined;
3247
+ "aria-colcount"?: number | undefined;
3248
+ "aria-colindex"?: number | undefined;
3249
+ "aria-colspan"?: number | undefined;
3250
+ "aria-controls"?: string | undefined;
3251
+ "aria-current"?: boolean | "page" | "false" | "true" | "step" | "location" | "date" | "time" | undefined;
3252
+ "aria-describedby"?: string | undefined;
3253
+ "aria-details"?: string | undefined;
3254
+ "aria-disabled"?: (boolean | "false" | "true") | undefined;
3255
+ "aria-dropeffect"?: "none" | "copy" | "move" | "link" | "execute" | "popup" | undefined;
3256
+ "aria-errormessage"?: string | undefined;
3257
+ "aria-expanded"?: (boolean | "false" | "true") | undefined;
3258
+ "aria-flowto"?: string | undefined;
3259
+ "aria-grabbed"?: (boolean | "false" | "true") | undefined;
3260
+ "aria-haspopup"?: boolean | "grid" | "listbox" | "menu" | "false" | "true" | "dialog" | "tree" | undefined;
3261
+ "aria-hidden"?: (boolean | "false" | "true") | undefined;
3262
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
3263
+ "aria-keyshortcuts"?: string | undefined;
3264
+ "aria-label"?: string | undefined;
3265
+ "aria-labelledby"?: string | undefined;
3266
+ "aria-level"?: number | undefined;
3267
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
3268
+ "aria-modal"?: (boolean | "false" | "true") | undefined;
3269
+ "aria-multiline"?: (boolean | "false" | "true") | undefined;
3270
+ "aria-multiselectable"?: (boolean | "false" | "true") | undefined;
3271
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
3272
+ "aria-owns"?: string | undefined;
3273
+ "aria-placeholder"?: string | undefined;
3274
+ "aria-posinset"?: number | undefined;
3275
+ "aria-pressed"?: boolean | "mixed" | "false" | "true" | undefined;
3276
+ "aria-readonly"?: (boolean | "false" | "true") | undefined;
3277
+ "aria-relevant"?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
3278
+ "aria-required"?: (boolean | "false" | "true") | undefined;
3279
+ "aria-roledescription"?: string | undefined;
3280
+ "aria-rowcount"?: number | undefined;
3281
+ "aria-rowindex"?: number | undefined;
3282
+ "aria-rowspan"?: number | undefined;
3283
+ "aria-selected"?: (boolean | "false" | "true") | undefined;
3284
+ "aria-setsize"?: number | undefined;
3285
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
3286
+ "aria-valuemax"?: number | undefined;
3287
+ "aria-valuemin"?: number | undefined;
3288
+ "aria-valuenow"?: number | undefined;
3289
+ "aria-valuetext"?: string | undefined;
3290
+ children?: React$1.ReactNode;
3291
+ dangerouslySetInnerHTML?: {
3292
+ __html: string;
3293
+ } | undefined;
3294
+ onCopy?: React$1.ClipboardEventHandler<any> | undefined;
3295
+ onCopyCapture?: React$1.ClipboardEventHandler<any> | undefined;
3296
+ onCut?: React$1.ClipboardEventHandler<any> | undefined;
3297
+ onCutCapture?: React$1.ClipboardEventHandler<any> | undefined;
3298
+ onPaste?: React$1.ClipboardEventHandler<any> | undefined;
3299
+ onPasteCapture?: React$1.ClipboardEventHandler<any> | undefined;
3300
+ onCompositionEnd?: React$1.CompositionEventHandler<any> | undefined;
3301
+ onCompositionEndCapture?: React$1.CompositionEventHandler<any> | undefined;
3302
+ onCompositionStart?: React$1.CompositionEventHandler<any> | undefined;
3303
+ onCompositionStartCapture?: React$1.CompositionEventHandler<any> | undefined;
3304
+ onCompositionUpdate?: React$1.CompositionEventHandler<any> | undefined;
3305
+ onCompositionUpdateCapture?: React$1.CompositionEventHandler<any> | undefined;
3306
+ onFocus?: React$1.FocusEventHandler<any> | undefined;
3307
+ onFocusCapture?: React$1.FocusEventHandler<any> | undefined;
3308
+ onBlur?: React$1.FocusEventHandler<any> | undefined;
3309
+ onBlurCapture?: React$1.FocusEventHandler<any> | undefined;
3310
+ onChange?: React$1.FormEventHandler<any> | undefined;
3311
+ onChangeCapture?: React$1.FormEventHandler<any> | undefined;
3312
+ onBeforeInput?: React$1.FormEventHandler<any> | undefined;
3313
+ onBeforeInputCapture?: React$1.FormEventHandler<any> | undefined;
3314
+ onInput?: React$1.FormEventHandler<any> | undefined;
3315
+ onInputCapture?: React$1.FormEventHandler<any> | undefined;
3316
+ onReset?: React$1.FormEventHandler<any> | undefined;
3317
+ onResetCapture?: React$1.FormEventHandler<any> | undefined;
3318
+ onSubmit?: React$1.FormEventHandler<any> | undefined;
3319
+ onSubmitCapture?: React$1.FormEventHandler<any> | undefined;
3320
+ onInvalid?: React$1.FormEventHandler<any> | undefined;
3321
+ onInvalidCapture?: React$1.FormEventHandler<any> | undefined;
3322
+ onLoad?: React$1.ReactEventHandler<any> | undefined;
3323
+ onLoadCapture?: React$1.ReactEventHandler<any> | undefined;
3324
+ onError?: React$1.ReactEventHandler<any> | undefined;
3325
+ onErrorCapture?: React$1.ReactEventHandler<any> | undefined;
3326
+ onKeyDown?: React$1.KeyboardEventHandler<any> | undefined;
3327
+ onKeyDownCapture?: React$1.KeyboardEventHandler<any> | undefined;
3328
+ onKeyPress?: React$1.KeyboardEventHandler<any> | undefined;
3329
+ onKeyPressCapture?: React$1.KeyboardEventHandler<any> | undefined;
3330
+ onKeyUp?: React$1.KeyboardEventHandler<any> | undefined;
3331
+ onKeyUpCapture?: React$1.KeyboardEventHandler<any> | undefined;
3332
+ onAbort?: React$1.ReactEventHandler<any> | undefined;
3333
+ onAbortCapture?: React$1.ReactEventHandler<any> | undefined;
3334
+ onCanPlay?: React$1.ReactEventHandler<any> | undefined;
3335
+ onCanPlayCapture?: React$1.ReactEventHandler<any> | undefined;
3336
+ onCanPlayThrough?: React$1.ReactEventHandler<any> | undefined;
3337
+ onCanPlayThroughCapture?: React$1.ReactEventHandler<any> | undefined;
3338
+ onDurationChange?: React$1.ReactEventHandler<any> | undefined;
3339
+ onDurationChangeCapture?: React$1.ReactEventHandler<any> | undefined;
3340
+ onEmptied?: React$1.ReactEventHandler<any> | undefined;
3341
+ onEmptiedCapture?: React$1.ReactEventHandler<any> | undefined;
3342
+ onEncrypted?: React$1.ReactEventHandler<any> | undefined;
3343
+ onEncryptedCapture?: React$1.ReactEventHandler<any> | undefined;
3344
+ onEnded?: React$1.ReactEventHandler<any> | undefined;
3345
+ onEndedCapture?: React$1.ReactEventHandler<any> | undefined;
3346
+ onLoadedData?: React$1.ReactEventHandler<any> | undefined;
3347
+ onLoadedDataCapture?: React$1.ReactEventHandler<any> | undefined;
3348
+ onLoadedMetadata?: React$1.ReactEventHandler<any> | undefined;
3349
+ onLoadedMetadataCapture?: React$1.ReactEventHandler<any> | undefined;
3350
+ onLoadStart?: React$1.ReactEventHandler<any> | undefined;
3351
+ onLoadStartCapture?: React$1.ReactEventHandler<any> | undefined;
3352
+ onPause?: React$1.ReactEventHandler<any> | undefined;
3353
+ onPauseCapture?: React$1.ReactEventHandler<any> | undefined;
3354
+ onPlayCapture?: React$1.ReactEventHandler<any> | undefined;
3355
+ onPlaying?: React$1.ReactEventHandler<any> | undefined;
3356
+ onPlayingCapture?: React$1.ReactEventHandler<any> | undefined;
3357
+ onProgress?: React$1.ReactEventHandler<any> | undefined;
3358
+ onProgressCapture?: React$1.ReactEventHandler<any> | undefined;
3359
+ onRateChange?: React$1.ReactEventHandler<any> | undefined;
3360
+ onRateChangeCapture?: React$1.ReactEventHandler<any> | undefined;
3361
+ onSeeked?: React$1.ReactEventHandler<any> | undefined;
3362
+ onSeekedCapture?: React$1.ReactEventHandler<any> | undefined;
3363
+ onSeeking?: React$1.ReactEventHandler<any> | undefined;
3364
+ onSeekingCapture?: React$1.ReactEventHandler<any> | undefined;
3365
+ onStalled?: React$1.ReactEventHandler<any> | undefined;
3366
+ onStalledCapture?: React$1.ReactEventHandler<any> | undefined;
3367
+ onSuspend?: React$1.ReactEventHandler<any> | undefined;
3368
+ onSuspendCapture?: React$1.ReactEventHandler<any> | undefined;
3369
+ onTimeUpdate?: React$1.ReactEventHandler<any> | undefined;
3370
+ onTimeUpdateCapture?: React$1.ReactEventHandler<any> | undefined;
3371
+ onVolumeChange?: React$1.ReactEventHandler<any> | undefined;
3372
+ onVolumeChangeCapture?: React$1.ReactEventHandler<any> | undefined;
3373
+ onWaiting?: React$1.ReactEventHandler<any> | undefined;
3374
+ onWaitingCapture?: React$1.ReactEventHandler<any> | undefined;
3375
+ onAuxClick?: React$1.MouseEventHandler<any> | undefined;
3376
+ onAuxClickCapture?: React$1.MouseEventHandler<any> | undefined;
3377
+ onClick?: React$1.MouseEventHandler<any> | undefined;
3378
+ onClickCapture?: React$1.MouseEventHandler<any> | undefined;
3379
+ onContextMenu?: React$1.MouseEventHandler<any> | undefined;
3380
+ onContextMenuCapture?: React$1.MouseEventHandler<any> | undefined;
3381
+ onDoubleClick?: React$1.MouseEventHandler<any> | undefined;
3382
+ onDoubleClickCapture?: React$1.MouseEventHandler<any> | undefined;
3383
+ onDragCapture?: React$1.DragEventHandler<any> | undefined;
3384
+ onDragEndCapture?: React$1.DragEventHandler<any> | undefined;
3385
+ onDragEnter?: React$1.DragEventHandler<any> | undefined;
3386
+ onDragEnterCapture?: React$1.DragEventHandler<any> | undefined;
3387
+ onDragExit?: React$1.DragEventHandler<any> | undefined;
3388
+ onDragExitCapture?: React$1.DragEventHandler<any> | undefined;
3389
+ onDragLeave?: React$1.DragEventHandler<any> | undefined;
3390
+ onDragLeaveCapture?: React$1.DragEventHandler<any> | undefined;
3391
+ onDragOver?: React$1.DragEventHandler<any> | undefined;
3392
+ onDragOverCapture?: React$1.DragEventHandler<any> | undefined;
3393
+ onDragStartCapture?: React$1.DragEventHandler<any> | undefined;
3394
+ onDrop?: React$1.DragEventHandler<any> | undefined;
3395
+ onDropCapture?: React$1.DragEventHandler<any> | undefined;
3396
+ onMouseDown?: React$1.MouseEventHandler<any> | undefined;
3397
+ onMouseDownCapture?: React$1.MouseEventHandler<any> | undefined;
3398
+ onMouseEnter?: React$1.MouseEventHandler<any> | undefined;
3399
+ onMouseLeave?: React$1.MouseEventHandler<any> | undefined;
3400
+ onMouseMove?: React$1.MouseEventHandler<any> | undefined;
3401
+ onMouseMoveCapture?: React$1.MouseEventHandler<any> | undefined;
3402
+ onMouseOut?: React$1.MouseEventHandler<any> | undefined;
3403
+ onMouseOutCapture?: React$1.MouseEventHandler<any> | undefined;
3404
+ onMouseOver?: React$1.MouseEventHandler<any> | undefined;
3405
+ onMouseOverCapture?: React$1.MouseEventHandler<any> | undefined;
3406
+ onMouseUp?: React$1.MouseEventHandler<any> | undefined;
3407
+ onMouseUpCapture?: React$1.MouseEventHandler<any> | undefined;
3408
+ onSelect?: React$1.ReactEventHandler<any> | undefined;
3409
+ onSelectCapture?: React$1.ReactEventHandler<any> | undefined;
3410
+ onTouchCancel?: React$1.TouchEventHandler<any> | undefined;
3411
+ onTouchCancelCapture?: React$1.TouchEventHandler<any> | undefined;
3412
+ onTouchEnd?: React$1.TouchEventHandler<any> | undefined;
3413
+ onTouchEndCapture?: React$1.TouchEventHandler<any> | undefined;
3414
+ onTouchMove?: React$1.TouchEventHandler<any> | undefined;
3415
+ onTouchMoveCapture?: React$1.TouchEventHandler<any> | undefined;
3416
+ onTouchStart?: React$1.TouchEventHandler<any> | undefined;
3417
+ onTouchStartCapture?: React$1.TouchEventHandler<any> | undefined;
3418
+ onPointerDown?: React$1.PointerEventHandler<any> | undefined;
3419
+ onPointerDownCapture?: React$1.PointerEventHandler<any> | undefined;
3420
+ onPointerMove?: React$1.PointerEventHandler<any> | undefined;
3421
+ onPointerMoveCapture?: React$1.PointerEventHandler<any> | undefined;
3422
+ onPointerUp?: React$1.PointerEventHandler<any> | undefined;
3423
+ onPointerUpCapture?: React$1.PointerEventHandler<any> | undefined;
3424
+ onPointerCancel?: React$1.PointerEventHandler<any> | undefined;
3425
+ onPointerCancelCapture?: React$1.PointerEventHandler<any> | undefined;
3426
+ onPointerEnter?: React$1.PointerEventHandler<any> | undefined;
3427
+ onPointerEnterCapture?: React$1.PointerEventHandler<any> | undefined;
3428
+ onPointerLeave?: React$1.PointerEventHandler<any> | undefined;
3429
+ onPointerLeaveCapture?: React$1.PointerEventHandler<any> | undefined;
3430
+ onPointerOver?: React$1.PointerEventHandler<any> | undefined;
3431
+ onPointerOverCapture?: React$1.PointerEventHandler<any> | undefined;
3432
+ onPointerOut?: React$1.PointerEventHandler<any> | undefined;
3433
+ onPointerOutCapture?: React$1.PointerEventHandler<any> | undefined;
3434
+ onGotPointerCapture?: React$1.PointerEventHandler<any> | undefined;
3435
+ onGotPointerCaptureCapture?: React$1.PointerEventHandler<any> | undefined;
3436
+ onLostPointerCapture?: React$1.PointerEventHandler<any> | undefined;
3437
+ onLostPointerCaptureCapture?: React$1.PointerEventHandler<any> | undefined;
3438
+ onScroll?: React$1.UIEventHandler<any> | undefined;
3439
+ onScrollCapture?: React$1.UIEventHandler<any> | undefined;
3440
+ onWheel?: React$1.WheelEventHandler<any> | undefined;
3441
+ onWheelCapture?: React$1.WheelEventHandler<any> | undefined;
3442
+ onAnimationStartCapture?: React$1.AnimationEventHandler<any> | undefined;
3443
+ onAnimationEnd?: React$1.AnimationEventHandler<any> | undefined;
3444
+ onAnimationEndCapture?: React$1.AnimationEventHandler<any> | undefined;
3445
+ onAnimationIteration?: React$1.AnimationEventHandler<any> | undefined;
3446
+ onAnimationIterationCapture?: React$1.AnimationEventHandler<any> | undefined;
3447
+ onTransitionEnd?: React$1.TransitionEventHandler<any> | undefined;
3448
+ onTransitionEndCapture?: React$1.TransitionEventHandler<any> | undefined;
3449
+ draggable?: (boolean | "false" | "true") | undefined;
3450
+ slot?: string | undefined;
3451
+ title?: string | undefined;
3452
+ defaultChecked?: boolean | undefined;
3453
+ defaultValue?: string | number | readonly string[] | undefined;
3454
+ suppressContentEditableWarning?: boolean | undefined;
3455
+ suppressHydrationWarning?: boolean | undefined;
3456
+ accessKey?: string | undefined;
3457
+ contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
3458
+ contextMenu?: string | undefined;
3459
+ dir?: string | undefined;
3460
+ placeholder?: string | undefined;
3461
+ spellCheck?: (boolean | "false" | "true") | undefined;
3462
+ radioGroup?: string | undefined;
3463
+ about?: string | undefined;
3464
+ datatype?: string | undefined;
3465
+ inlist?: any;
3466
+ prefix?: string | undefined;
3467
+ property?: string | undefined;
3468
+ resource?: string | undefined;
3469
+ typeof?: string | undefined;
3470
+ vocab?: string | undefined;
3471
+ autoCapitalize?: string | undefined;
3472
+ autoCorrect?: string | undefined;
3473
+ autoSave?: string | undefined;
3474
+ itemProp?: string | undefined;
3475
+ itemScope?: boolean | undefined;
3476
+ itemType?: string | undefined;
3477
+ itemID?: string | undefined;
3478
+ itemRef?: string | undefined;
3479
+ results?: number | undefined;
3480
+ security?: string | undefined;
3481
+ unselectable?: "off" | "on" | undefined;
3482
+ inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
3483
+ is?: string | undefined;
3484
+ } & MotionProps & React$1.RefAttributes<any>>;
3485
+ };
3486
+
3487
+ declare const animations: FeatureComponents;
3488
+
3489
+ interface MotionContextProps {
3490
+ visualElement?: VisualElement;
3491
+ initial?: false | string | string[];
3492
+ animate?: string | string[];
3493
+ }
3494
+ declare const MotionContext: React$1.Context<MotionContextProps>;
3495
+ declare function useVisualElementContext(): VisualElement<any, any> | undefined;
3496
+
3497
+ declare function checkTargetForNewValues(visualElement: VisualElement, target: TargetWithKeyframes, origin: ResolvedValues): void;
3498
+
3499
+ declare const createBox: () => Box;
3500
+
3501
+ declare function calcLength(axis: Axis): number;
3502
+
3503
+ declare function isDragActive(): boolean;
3504
+
3505
+ declare type EventListenerWithPointInfo = (e: MouseEvent | TouchEvent | PointerEvent, info: EventInfo) => void;
3506
+ declare const wrapHandler: (handler: EventListenerWithPointInfo, shouldFilterPrimaryPointer?: boolean) => EventListener;
3507
+
3508
+ declare function addPointerEvent(target: EventTarget, eventName: string, handler: EventListenerWithPointInfo, options?: AddEventListenerOptions): () => void;
3509
+
3510
+ declare const isMotionValue: (value: any) => value is MotionValue<any>;
3511
+
3512
+ declare const isBrowser: boolean;
3513
+
3514
+ declare function useUnmountEffect(callback: () => void): void;
3515
+
3516
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
3517
+
3518
+ declare function useForceUpdate(): [VoidFunction, number];
3519
+
3520
+ /**
3521
+ * @public
3522
+ */
3523
+ declare const domAnimation: FeatureBundle;
3524
+
3525
+ /**
3526
+ * @public
3527
+ */
3528
+ declare const domMax: FeatureBundle;
3529
+
3530
+ /**
3531
+ * Creates a `MotionValue` to track the state and velocity of a value.
3532
+ *
3533
+ * Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.
3534
+ *
3535
+ * ```jsx
3536
+ * export const MyComponent = () => {
3537
+ * const scale = useMotionValue(1)
3538
+ *
3539
+ * return <motion.div style={{ scale }} />
3540
+ * }
3541
+ * ```
3542
+ *
3543
+ * @param initial - The initial state.
3544
+ *
3545
+ * @public
3546
+ */
3547
+ declare function useMotionValue<T>(initial: T): MotionValue<T>;
3548
+
3549
+ /**
3550
+ * Combine multiple motion values into a new one using a string template literal.
3551
+ *
3552
+ * ```jsx
3553
+ * import {
3554
+ * motion,
3555
+ * useSpring,
3556
+ * useMotionValue,
3557
+ * useMotionTemplate
3558
+ * } from "framer-motion"
3559
+ *
3560
+ * function Component() {
3561
+ * const shadowX = useSpring(0)
3562
+ * const shadowY = useMotionValue(0)
3563
+ * const shadow = useMotionTemplate`drop-shadow(${shadowX}px ${shadowY}px 20px rgba(0,0,0,0.3))`
3564
+ *
3565
+ * return <motion.div style={{ filter: shadow }} />
3566
+ * }
3567
+ * ```
3568
+ *
3569
+ * @public
3570
+ */
3571
+ declare function useMotionTemplate(fragments: TemplateStringsArray, ...values: MotionValue[]): MotionValue<string>;
3572
+
3573
+ /**
3574
+ * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
3575
+ *
3576
+ * TODO: Remove and move to library
3577
+ */
3578
+ declare function resolveMotionValue(value?: string | number | CustomValueType | MotionValue): string | number;
3579
+
3580
+ /**
3581
+ * @public
3582
+ */
3583
+ interface TransformOptions<T> {
3584
+ /**
3585
+ * Clamp values to within the given range. Defaults to `true`
3586
+ *
3587
+ * @public
3588
+ */
3589
+ clamp?: boolean;
3590
+ /**
3591
+ * Easing functions to use on the interpolations between each value in the input and output ranges.
3592
+ *
3593
+ * If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition **between** each.
3594
+ *
3595
+ * @public
3596
+ */
3597
+ ease?: Easing$1 | Easing$1[];
3598
+ }
3599
+ /**
3600
+ * Transforms numbers into other values by mapping them from an input range to an output range.
3601
+ * Returns the type of the input provided.
3602
+ *
3603
+ * @remarks
3604
+ *
3605
+ * Given an input range of `[0, 200]` and an output range of
3606
+ * `[0, 1]`, this function will return a value between `0` and `1`.
3607
+ * The input range must be a linear series of numbers. The output range
3608
+ * can be any supported value type, such as numbers, colors, shadows, arrays, objects and more.
3609
+ * Every value in the output range must be of the same type and in the same format.
3610
+ *
3611
+ * ```jsx
3612
+ * import * as React from "react"
3613
+ * import { transform } from "framer-motion"
3614
+ *
3615
+ * export function MyComponent() {
3616
+ * const inputRange = [0, 200]
3617
+ * const outputRange = [0, 1]
3618
+ * const output = transform(100, inputRange, outputRange)
3619
+ *
3620
+ * // Returns 0.5
3621
+ * return <div>{output}</div>
3622
+ * }
3623
+ * ```
3624
+ *
3625
+ * @param inputValue - A number to transform between the input and output ranges.
3626
+ * @param inputRange - A linear series of numbers (either all increasing or decreasing).
3627
+ * @param outputRange - A series of numbers, colors, strings, or arrays/objects of those. Must be the same length as `inputRange`.
3628
+ * @param options - Clamp: Clamp values to within the given range. Defaults to `true`.
3629
+ *
3630
+ * @public
3631
+ */
3632
+ declare function transform<T>(inputValue: number, inputRange: number[], outputRange: T[], options?: TransformOptions<T>): T;
3633
+ /**
3634
+ *
3635
+ * Transforms numbers into other values by mapping them from an input range to an output range.
3636
+ *
3637
+ * Given an input range of `[0, 200]` and an output range of
3638
+ * `[0, 1]`, this function will return a value between `0` and `1`.
3639
+ * The input range must be a linear series of numbers. The output range
3640
+ * can be any supported value type, such as numbers, colors, shadows, arrays, objects and more.
3641
+ * Every value in the output range must be of the same type and in the same format.
3642
+ *
3643
+ * ```jsx
3644
+ * import * as React from "react"
3645
+ * import { Frame, transform } from "framer"
3646
+ *
3647
+ * export function MyComponent() {
3648
+ * const inputRange = [-200, -100, 100, 200]
3649
+ * const outputRange = [0, 1, 1, 0]
3650
+ * const convertRange = transform(inputRange, outputRange)
3651
+ * const output = convertRange(-150)
3652
+ *
3653
+ * // Returns 0.5
3654
+ * return <div>{output}</div>
3655
+ * }
3656
+ *
3657
+ * ```
3658
+ *
3659
+ * @param inputRange - A linear series of numbers (either all increasing or decreasing).
3660
+ * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.
3661
+ * @param options - Clamp: clamp values to within the given range. Defaults to `true`.
3662
+ *
3663
+ * @public
3664
+ */
3665
+ declare function transform<T>(inputRange: number[], outputRange: T[], options?: TransformOptions<T>): (inputValue: number) => T;
3666
+
3667
+ declare type InputRange = number[];
3668
+ declare type SingleTransformer<I, O> = (input: I) => O;
3669
+ declare type MultiTransformer<I, O> = (input: I[]) => O;
3670
+ /**
3671
+ * Create a `MotionValue` that transforms the output of another `MotionValue` by mapping it from one range of values into another.
3672
+ *
3673
+ * @remarks
3674
+ *
3675
+ * Given an input range of `[-200, -100, 100, 200]` and an output range of
3676
+ * `[0, 1, 1, 0]`, the returned `MotionValue` will:
3677
+ *
3678
+ * - When provided a value between `-200` and `-100`, will return a value between `0` and `1`.
3679
+ * - When provided a value between `-100` and `100`, will return `1`.
3680
+ * - When provided a value between `100` and `200`, will return a value between `1` and `0`
3681
+ *
3682
+ *
3683
+ * The input range must be a linear series of numbers. The output range
3684
+ * can be any value type supported by Framer Motion: numbers, colors, shadows, etc.
3685
+ *
3686
+ * Every value in the output range must be of the same type and in the same format.
3687
+ *
3688
+ * ```jsx
3689
+ * export const MyComponent = () => {
3690
+ * const x = useMotionValue(0)
3691
+ * const xRange = [-200, -100, 100, 200]
3692
+ * const opacityRange = [0, 1, 1, 0]
3693
+ * const opacity = useTransform(x, xRange, opacityRange)
3694
+ *
3695
+ * return (
3696
+ * <motion.div
3697
+ * animate={{ x: 200 }}
3698
+ * style={{ opacity, x }}
3699
+ * />
3700
+ * )
3701
+ * }
3702
+ * ```
3703
+ *
3704
+ * @param inputValue - `MotionValue`
3705
+ * @param inputRange - A linear series of numbers (either all increasing or decreasing)
3706
+ * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.
3707
+ * @param options -
3708
+ *
3709
+ * - clamp: boolean. Clamp values to within the given range. Defaults to `true`
3710
+ * - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each.
3711
+ *
3712
+ * @returns `MotionValue`
3713
+ *
3714
+ * @public
3715
+ */
3716
+ declare function useTransform<I, O>(value: MotionValue<number>, inputRange: InputRange, outputRange: O[], options?: TransformOptions<O>): MotionValue<O>;
3717
+ /**
3718
+ * Create a `MotionValue` that transforms the output of another `MotionValue` through a function.
3719
+ * In this example, `y` will always be double `x`.
3720
+ *
3721
+ * ```jsx
3722
+ * export const MyComponent = () => {
3723
+ * const x = useMotionValue(10)
3724
+ * const y = useTransform(x, value => value * 2)
3725
+ *
3726
+ * return <motion.div style={{ x, y }} />
3727
+ * }
3728
+ * ```
3729
+ *
3730
+ * @param input - A `MotionValue` that will pass its latest value through `transform` to update the returned `MotionValue`.
3731
+ * @param transform - A function that accepts the latest value from `input` and returns a new value.
3732
+ * @returns `MotionValue`
3733
+ *
3734
+ * @public
3735
+ */
3736
+ declare function useTransform<I, O>(input: MotionValue<I>, transformer: SingleTransformer<I, O>): MotionValue<O>;
3737
+ /**
3738
+ * Pass an array of `MotionValue`s and a function to combine them. In this example, `z` will be the `x` multiplied by `y`.
3739
+ *
3740
+ * ```jsx
3741
+ * export const MyComponent = () => {
3742
+ * const x = useMotionValue(0)
3743
+ * const y = useMotionValue(0)
3744
+ * const z = useTransform([x, y], ([latestX, latestY]) => latestX * latestY)
3745
+ *
3746
+ * return <motion.div style={{ x, y, z }} />
3747
+ * }
3748
+ * ```
3749
+ *
3750
+ * @param input - An array of `MotionValue`s that will pass their latest values through `transform` to update the returned `MotionValue`.
3751
+ * @param transform - A function that accepts the latest values from `input` and returns a new value.
3752
+ * @returns `MotionValue`
3753
+ *
3754
+ * @public
3755
+ */
3756
+ declare function useTransform<I, O>(input: MotionValue<string>[] | MotionValue<number>[] | MotionValue<string | number>[], transformer: MultiTransformer<I, O>): MotionValue<O>;
3757
+
3758
+ /**
3759
+ * Creates a `MotionValue` that, when `set`, will use a spring animation to animate to its new state.
3760
+ *
3761
+ * It can either work as a stand-alone `MotionValue` by initialising it with a value, or as a subscriber
3762
+ * to another `MotionValue`.
3763
+ *
3764
+ * @remarks
3765
+ *
3766
+ * ```jsx
3767
+ * const x = useSpring(0, { stiffness: 300 })
3768
+ * const y = useSpring(x, { damping: 10 })
3769
+ * ```
3770
+ *
3771
+ * @param inputValue - `MotionValue` or number. If provided a `MotionValue`, when the input `MotionValue` changes, the created `MotionValue` will spring towards that value.
3772
+ * @param springConfig - Configuration options for the spring.
3773
+ * @returns `MotionValue`
3774
+ *
3775
+ * @public
3776
+ */
3777
+ declare function useSpring(source: MotionValue | number, config?: SpringOptions): MotionValue<any>;
3778
+
3779
+ /**
3780
+ * Creates a `MotionValue` that updates when the velocity of the provided `MotionValue` changes.
3781
+ *
3782
+ * ```javascript
3783
+ * const x = useMotionValue(0)
3784
+ * const xVelocity = useVelocity(x)
3785
+ * const xAcceleration = useVelocity(xVelocity)
3786
+ * ```
3787
+ *
3788
+ * @public
3789
+ */
3790
+ declare function useVelocity(value: MotionValue<number>): MotionValue<number>;
3791
+
3792
+ /**
3793
+ * @public
3794
+ */
3795
+ interface ScrollMotionValues {
3796
+ scrollX: MotionValue<number>;
3797
+ scrollY: MotionValue<number>;
3798
+ scrollXProgress: MotionValue<number>;
3799
+ scrollYProgress: MotionValue<number>;
3800
+ }
3801
+
3802
+ /**
3803
+ * Returns MotionValues that update when the provided element scrolls:
3804
+ *
3805
+ * - `scrollX` — Horizontal scroll distance in pixels.
3806
+ * - `scrollY` — Vertical scroll distance in pixels.
3807
+ * - `scrollXProgress` — Horizontal scroll progress between `0` and `1`.
3808
+ * - `scrollYProgress` — Vertical scroll progress between `0` and `1`.
3809
+ *
3810
+ * This element must be set to `overflow: scroll` on either or both axes to report scroll offset.
3811
+ *
3812
+ * ```jsx
3813
+ * export const MyComponent = () => {
3814
+ * const ref = useRef()
3815
+ * const { scrollYProgress } = useElementScroll(ref)
3816
+ *
3817
+ * return (
3818
+ * <div ref={ref}>
3819
+ * <motion.div style={{ scaleX: scrollYProgress }} />
3820
+ * </div>
3821
+ * )
3822
+ * }
3823
+ * ```
3824
+ *
3825
+ * @public
3826
+ */
3827
+ declare function useElementScroll(ref: RefObject<HTMLElement>): ScrollMotionValues;
3828
+
3829
+ /**
3830
+ * Returns MotionValues that update when the viewport scrolls:
3831
+ *
3832
+ * - `scrollX` — Horizontal scroll distance in pixels.
3833
+ * - `scrollY` — Vertical scroll distance in pixels.
3834
+ * - `scrollXProgress` — Horizontal scroll progress between `0` and `1`.
3835
+ * - `scrollYProgress` — Vertical scroll progress between `0` and `1`.
3836
+ *
3837
+ * **Warning:** Setting `body` or `html` to `height: 100%` or similar will break the `Progress`
3838
+ * values as this breaks the browser's capability to accurately measure the page length.
3839
+ *
3840
+ * ```jsx
3841
+ * export const MyComponent = () => {
3842
+ * const { scrollYProgress } = useViewportScroll()
3843
+ * return <motion.div style={{ scaleX: scrollYProgress }} />
3844
+ * }
3845
+ * ```
3846
+ *
3847
+ * @public
3848
+ */
3849
+ declare function useViewportScroll(): ScrollMotionValues;
3850
+
3851
+ declare function useTime(): MotionValue<number>;
3852
+
3853
+ /**
3854
+ * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
3855
+ *
3856
+ * This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
3857
+ * `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
3858
+ *
3859
+ * It will actively respond to changes and re-render your components with the latest setting.
3860
+ *
3861
+ * ```jsx
3862
+ * export function Sidebar({ isOpen }) {
3863
+ * const shouldReduceMotion = useReducedMotion()
3864
+ * const closedX = shouldReduceMotion ? 0 : "-100%"
3865
+ *
3866
+ * return (
3867
+ * <motion.div animate={{
3868
+ * opacity: isOpen ? 1 : 0,
3869
+ * x: isOpen ? 0 : closedX
3870
+ * }} />
3871
+ * )
3872
+ * }
3873
+ * ```
3874
+ *
3875
+ * @return boolean
3876
+ *
3877
+ * @public
3878
+ */
3879
+ declare function useReducedMotion(): boolean | null;
3880
+ declare function useReducedMotionConfig(): boolean | null;
3881
+
3882
+ /**
3883
+ * @public
3884
+ */
3885
+ declare function animationControls(): AnimationControls;
3886
+
3887
+ /**
3888
+ * Creates `AnimationControls`, which can be used to manually start, stop
3889
+ * and sequence animations on one or more components.
3890
+ *
3891
+ * The returned `AnimationControls` should be passed to the `animate` property
3892
+ * of the components you want to animate.
3893
+ *
3894
+ * These components can then be animated with the `start` method.
3895
+ *
3896
+ * ```jsx
3897
+ * import * as React from 'react'
3898
+ * import { motion, useAnimation } from 'framer-motion'
3899
+ *
3900
+ * export function MyComponent(props) {
3901
+ * const controls = useAnimation()
3902
+ *
3903
+ * controls.start({
3904
+ * x: 100,
3905
+ * transition: { duration: 0.5 },
3906
+ * })
3907
+ *
3908
+ * return <motion.div animate={controls} />
3909
+ * }
3910
+ * ```
3911
+ *
3912
+ * @returns Animation controller with `start` and `stop` methods
3913
+ *
3914
+ * @public
3915
+ */
3916
+ declare function useAnimation(): AnimationControls;
3917
+
3918
+ declare type FrameCallback = (timestamp: number) => void;
3919
+ declare function useAnimationFrame(callback: FrameCallback): void;
3920
+
3921
+ declare type Cycle = (i?: number) => void;
3922
+ declare type CycleState<T> = [T, Cycle];
3923
+ /**
3924
+ * Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.
3925
+ *
3926
+ * An index value can be passed to the returned `cycle` function to cycle to a specific index.
3927
+ *
3928
+ * ```jsx
3929
+ * import * as React from "react"
3930
+ * import { motion, useCycle } from "framer-motion"
3931
+ *
3932
+ * export const MyComponent = () => {
3933
+ * const [x, cycleX] = useCycle(0, 50, 100)
3934
+ *
3935
+ * return (
3936
+ * <motion.div
3937
+ * animate={{ x: x }}
3938
+ * onTap={() => cycleX()}
3939
+ * />
3940
+ * )
3941
+ * }
3942
+ * ```
3943
+ *
3944
+ * @param items - items to cycle through
3945
+ * @returns [currentState, cycleState]
3946
+ *
3947
+ * @public
3948
+ */
3949
+ declare function useCycle<T>(...items: T[]): CycleState<T>;
3950
+
3951
+ /**
3952
+ * Check whether a prop name is a valid `MotionProp` key.
3953
+ *
3954
+ * @param key - Name of the property to check
3955
+ * @returns `true` is key is a valid `MotionProp`.
3956
+ *
3957
+ * @public
3958
+ */
3959
+ declare function isValidMotionProp(key: string): boolean;
3960
+
3961
+ /**
3962
+ * @public
3963
+ */
3964
+ interface PresenceContextProps {
3965
+ id: number;
3966
+ isPresent: boolean;
3967
+ register: (id: number) => () => void;
3968
+ onExitComplete?: (id: number) => void;
3969
+ initial?: false | VariantLabels;
3970
+ custom?: any;
3971
+ }
3972
+ /**
3973
+ * @public
3974
+ */
3975
+ declare const PresenceContext: React$1.Context<PresenceContextProps | null>;
3976
+
3977
+ declare type SafeToRemove = () => void;
3978
+ declare type AlwaysPresent = [true, null];
3979
+ declare type Present = [true];
3980
+ declare type NotPresent = [false, SafeToRemove];
3981
+ /**
3982
+ * When a component is the child of `AnimatePresence`, it can use `usePresence`
3983
+ * to access information about whether it's still present in the React tree.
3984
+ *
3985
+ * ```jsx
3986
+ * import { usePresence } from "framer-motion"
3987
+ *
3988
+ * export const Component = () => {
3989
+ * const [isPresent, safeToRemove] = usePresence()
3990
+ *
3991
+ * useEffect(() => {
3992
+ * !isPresent && setTimeout(safeToRemove, 1000)
3993
+ * }, [isPresent])
3994
+ *
3995
+ * return <div />
3996
+ * }
3997
+ * ```
3998
+ *
3999
+ * If `isPresent` is `false`, it means that a component has been removed the tree, but
4000
+ * `AnimatePresence` won't really remove it until `safeToRemove` has been called.
4001
+ *
4002
+ * @public
4003
+ */
4004
+ declare function usePresence(): AlwaysPresent | Present | NotPresent;
4005
+ /**
4006
+ * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
4007
+ * There is no `safeToRemove` function.
4008
+ *
4009
+ * ```jsx
4010
+ * import { useIsPresent } from "framer-motion"
4011
+ *
4012
+ * export const Component = () => {
4013
+ * const isPresent = useIsPresent()
4014
+ *
4015
+ * useEffect(() => {
4016
+ * !isPresent && console.log("I've been removed!")
4017
+ * }, [isPresent])
4018
+ *
4019
+ * return <div />
4020
+ * }
4021
+ * ```
4022
+ *
4023
+ * @public
4024
+ */
4025
+ declare function useIsPresent(): boolean;
4026
+
4027
+ /**
4028
+ * Attaches an event listener directly to the provided DOM element.
4029
+ *
4030
+ * Bypassing React's event system can be desirable, for instance when attaching non-passive
4031
+ * event handlers.
4032
+ *
4033
+ * ```jsx
4034
+ * const ref = useRef(null)
4035
+ *
4036
+ * useDomEvent(ref, 'wheel', onWheel, { passive: false })
4037
+ *
4038
+ * return <div ref={ref} />
4039
+ * ```
4040
+ *
4041
+ * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
4042
+ * @param eventName - Name of the event you want listen for.
4043
+ * @param handler - Function to fire when receiving the event.
4044
+ * @param options - Options to pass to `Event.addEventListener`.
4045
+ *
4046
+ * @public
4047
+ */
4048
+ declare function useDomEvent(ref: RefObject<EventTarget>, eventName: string, handler?: EventListener | undefined, options?: AddEventListenerOptions): void;
4049
+
4050
+ declare const visualElement: <Instance, MutableState, Options>({ treeType, build, getBaseTarget, makeTargetAnimatable, measureViewportBox, render: renderInstance, readValueFromInstance, removeValueFromRenderState, sortNodePosition, scrapeMotionValuesFromProps, }: VisualElementConfig<Instance, MutableState, Options>) => ({ parent, props, presenceId, blockInitialAnimation, visualState, shouldReduceMotion, }: VisualElementOptions<Instance, any>, options?: Options) => VisualElement<Instance, any>;
4051
+
4052
+ declare type ScaleCorrector = (latest: string | number, node: IProjectionNode) => string | number;
4053
+ interface ScaleCorrectorDefinition {
4054
+ correct: ScaleCorrector;
4055
+ applyTo?: string[];
4056
+ }
4057
+ interface ScaleCorrectorMap {
4058
+ [key: string]: ScaleCorrectorDefinition;
4059
+ }
4060
+
4061
+ declare function addScaleCorrector(correctors: ScaleCorrectorMap): void;
4062
+
4063
+ declare function useInstantTransition(): (callback: () => void) => void;
4064
+
4065
+ declare function useInstantLayoutTransition(): (cb?: (() => void) | undefined) => void;
4066
+
4067
+ declare function useResetProjection(): () => void;
4068
+
4069
+ interface NodeGroup {
4070
+ add: (node: IProjectionNode) => void;
4071
+ remove: (node: IProjectionNode) => void;
4072
+ dirty: VoidFunction;
4073
+ }
4074
+
4075
+ interface LayoutGroupContextProps {
4076
+ id?: string;
4077
+ group?: NodeGroup;
4078
+ forceRender?: VoidFunction;
4079
+ }
4080
+ declare const LayoutGroupContext: React$1.Context<LayoutGroupContextProps>;
4081
+
4082
+ /**
4083
+ * @deprecated
4084
+ */
4085
+ declare const DeprecatedLayoutGroupContext: React$1.Context<string | null>;
4086
+
4087
+ /**
4088
+ * This is not an officially supported API and may be removed
4089
+ * on any version.
4090
+ */
4091
+ declare function useAnimatedState(initialState: any): any[];
4092
+
4093
+ interface ScaleMotionValues {
4094
+ scaleX: MotionValue<number>;
4095
+ scaleY: MotionValue<number>;
4096
+ }
4097
+ /**
4098
+ * Returns a `MotionValue` each for `scaleX` and `scaleY` that update with the inverse
4099
+ * of their respective parent scales.
4100
+ *
4101
+ * This is useful for undoing the distortion of content when scaling a parent component.
4102
+ *
4103
+ * By default, `useInvertedScale` will automatically fetch `scaleX` and `scaleY` from the nearest parent.
4104
+ * By passing other `MotionValue`s in as `useInvertedScale({ scaleX, scaleY })`, it will invert the output
4105
+ * of those instead.
4106
+ *
4107
+ * ```jsx
4108
+ * const MyComponent = () => {
4109
+ * const { scaleX, scaleY } = useInvertedScale()
4110
+ * return <motion.div style={{ scaleX, scaleY }} />
4111
+ * }
4112
+ * ```
4113
+ *
4114
+ * @deprecated
4115
+ */
4116
+ declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues;
4117
+
4118
+ export { AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationLifecycles, AnimationOptions, AnimationPlaybackControls, AnimationProps, AnimationType, Axis, AxisDelta, BoundingBox, Box, CreateVisualElement, CustomDomComponent, CustomValueType, Delta, DeprecatedLayoutGroupContext, DragControls, DragElastic, DragHandlers, DraggableProps, EasingFunction, EventInfo, FeatureBundle, FeatureComponent, FeatureComponents, FeatureDefinition, FeatureDefinitions, FeatureNames, FeatureProps, FlatTree, FocusHandlers, ForwardRefComponent, HTMLMotionProps, HoverHandlers, IProjectionNode, Inertia, Keyframes, KeyframesTarget, LayoutGroup, LayoutGroupContext, LayoutProps, LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, LazyProps, LoadedFeatures, MotionAdvancedProps, MotionConfig, MotionConfigContext, MotionConfigProps, MotionContext, MotionProps, MotionStyle, MotionTransform, MotionValue, None, Orchestration, PanHandlers, PanInfo, PassiveEffect, Point, PresenceContext, RelayoutInfo, RenderComponent, Reorder, Repeat, ResolveLayoutTransition, ResolvedKeyframesTarget, ResolvedSingleTarget, ResolvedValueTarget, ResolvedValues, SVGAttributesAsMotionValues, SVGMotionProps, ScrapeMotionValuesFromProps, ScrollMotionValues, SingleTarget, Spring, Subscriber, SwitchLayoutGroupContext, TapHandlers, TapInfo, Target, TargetAndTransition, TransformPoint, Transition, Tween, ValueTarget, Variant, VariantLabels, Variants, VisualElement, VisualElementLifecycles, VisualState, addPointerEvent, addScaleCorrector, animate, animateVisualElement, animationControls, animations, calcLength, checkTargetForNewValues, createBox, createDomMotionComponent, createMotionComponent, domAnimation, domMax, filterProps, isBrowser, isDragActive, isMotionValue, isValidMotionProp, m, makeUseVisualState, motion, motionValue, resolveMotionValue, transform, useAnimation, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, usePresence, useReducedMotion, useReducedMotionConfig, useResetProjection, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useVisualElementContext, visualElement, wrapHandler };