motion-dom 14.7.1 → 14.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/cjs/index.js +408 -168
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/animation/JSAnimation.mjs +7 -1
  4. package/dist/es/animation/JSAnimation.mjs.map +1 -1
  5. package/dist/es/animation/generators/keyframes.mjs +12 -3
  6. package/dist/es/animation/generators/keyframes.mjs.map +1 -1
  7. package/dist/es/animation/utils/is-transition-defined.mjs +1 -0
  8. package/dist/es/animation/utils/is-transition-defined.mjs.map +1 -1
  9. package/dist/es/animation/waapi/supports/waapi.mjs +3 -1
  10. package/dist/es/animation/waapi/supports/waapi.mjs.map +1 -1
  11. package/dist/es/animation/waapi/transforms/TransformAnimation.mjs +31 -35
  12. package/dist/es/animation/waapi/transforms/TransformAnimation.mjs.map +1 -1
  13. package/dist/es/animation/waapi/utils/needs-mixer.mjs +11 -0
  14. package/dist/es/animation/waapi/utils/needs-mixer.mjs.map +1 -0
  15. package/dist/es/effects/svg/index.mjs +14 -0
  16. package/dist/es/effects/svg/index.mjs.map +1 -1
  17. package/dist/es/gestures/drag/VisualElementDragControls.mjs +35 -19
  18. package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
  19. package/dist/es/gestures/drag/index.mjs +4 -3
  20. package/dist/es/gestures/drag/index.mjs.map +1 -1
  21. package/dist/es/gestures/drag/projection.mjs +85 -0
  22. package/dist/es/gestures/drag/projection.mjs.map +1 -0
  23. package/dist/es/index.mjs +1 -1
  24. package/dist/es/layout/LayoutAnimationBuilder.mjs +34 -51
  25. package/dist/es/layout/LayoutAnimationBuilder.mjs.map +1 -1
  26. package/dist/es/layout/visual-element.mjs +48 -0
  27. package/dist/es/layout/visual-element.mjs.map +1 -0
  28. package/dist/es/projection/geometry/round.mjs +25 -0
  29. package/dist/es/projection/geometry/round.mjs.map +1 -0
  30. package/dist/es/projection/node/DocumentProjectionNode.mjs +2 -8
  31. package/dist/es/projection/node/DocumentProjectionNode.mjs.map +1 -1
  32. package/dist/es/projection/node/create-projection-node.mjs +68 -48
  33. package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
  34. package/dist/es/projection/utils/measure.mjs +5 -1
  35. package/dist/es/projection/utils/measure.mjs.map +1 -1
  36. package/dist/es/render/VisualElement.mjs +3 -2
  37. package/dist/es/render/VisualElement.mjs.map +1 -1
  38. package/dist/es/stats/buffer.mjs +1 -0
  39. package/dist/es/stats/buffer.mjs.map +1 -1
  40. package/dist/es/stats/index.mjs +31 -0
  41. package/dist/es/stats/index.mjs.map +1 -1
  42. package/dist/es/utils/interpolate.mjs +3 -2
  43. package/dist/es/utils/interpolate.mjs.map +1 -1
  44. package/dist/es/utils/is-ref-object.mjs +8 -0
  45. package/dist/es/utils/is-ref-object.mjs.map +1 -0
  46. package/dist/es/utils/transform.mjs.map +1 -1
  47. package/dist/es/value/index.mjs +10 -1
  48. package/dist/es/value/index.mjs.map +1 -1
  49. package/dist/index.d.ts +2048 -1931
  50. package/dist/motion-dom.dev.js +408 -168
  51. package/dist/motion-dom.js +1 -1
  52. package/dist/size-rollup-motion-value.js +1 -1
  53. package/dist/size-rollup-motion-value.js.map +1 -1
  54. package/dist/size-rollup-style-effect.js +1 -1
  55. package/dist/size-rollup-style-effect.js.map +1 -1
  56. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,1824 +1,1967 @@
1
1
  import * as motion_utils from 'motion-utils';
2
- import { Point, BoundingBox, Axis, Box, TransformPoint, Easing, Delta, EasingFunction, BezierDefinition, AxisDelta, SubscriptionManager } from 'motion-utils';
2
+ import { TransformPoint, Box, Axis, Point, BoundingBox, Easing, Delta, EasingFunction, BezierDefinition, AxisDelta, SubscriptionManager } from 'motion-utils';
3
3
 
4
4
  /**
5
- * Passed in to pan event handlers like `onPan` the `PanInfo` object contains
6
- * information about the current state of the tap gesture such as its
7
- * `point`, `delta`, `offset` and `velocity`.
8
- *
9
- * ```jsx
10
- * <motion.div onPan={(event, info) => {
11
- * console.log(info.point.x, info.point.y)
12
- * }} />
13
- * ```
14
- *
15
5
  * @public
16
6
  */
17
- interface PanInfo {
18
- /**
19
- * Contains `x` and `y` values for the current pan position relative
20
- * to the device or page.
21
- *
22
- * ```jsx
23
- * function onPan(event, info) {
24
- * console.log(info.point.x, info.point.y)
25
- * }
26
- *
27
- * <motion.div onPan={onPan} />
28
- * ```
29
- *
30
- * @public
31
- */
32
- point: Point;
33
- /**
34
- * Contains `x` and `y` values for the distance moved since
35
- * the last event.
36
- *
37
- * ```jsx
38
- * function onPan(event, info) {
39
- * console.log(info.delta.x, info.delta.y)
40
- * }
41
- *
42
- * <motion.div onPan={onPan} />
43
- * ```
44
- *
45
- * @public
46
- */
47
- delta: Point;
7
+ interface PresenceContextProps {
8
+ id: string;
9
+ isPresent: boolean;
48
10
  /**
49
- * Contains `x` and `y` values for the distance moved from
50
- * the first pan event.
51
- *
52
- * ```jsx
53
- * function onPan(event, info) {
54
- * console.log(info.offset.x, info.offset.y)
55
- * }
56
- *
57
- * <motion.div onPan={onPan} />
58
- * ```
59
- *
60
- * @public
11
+ * Registers a child with this presence. Motion components also pass
12
+ * their VisualElement, so `mode="popLayout"` can find the child's
13
+ * element when the child can't be given a ref.
61
14
  */
62
- offset: Point;
15
+ register: (id: string | number, node?: any) => () => void;
16
+ onExitComplete?: (id: string | number) => void;
17
+ initial?: false | VariantLabels;
18
+ custom?: any;
63
19
  /**
64
- * Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
65
- *
66
- * ```jsx
67
- * function onPan(event, info) {
68
- * console.log(info.velocity.x, info.velocity.y)
69
- * }
70
- *
71
- * <motion.div onPan={onPan} />
72
- * ```
73
- *
74
- * @public
20
+ * When React hides children (e.g. a re-suspended Suspense boundary)
21
+ * and shows them again, their motion values are reset to `initial`
22
+ * so the enter animation replays. Set this to keep the values they
23
+ * had instead.
75
24
  */
76
- velocity: Point;
77
- }
78
- type PanHandler = (event: Event, info: PanInfo) => void;
79
-
80
- type DragHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
81
- type DragElastic = boolean | number | Partial<BoundingBox>;
82
- interface ResolvedConstraints {
83
- x: Partial<Axis>;
84
- y: Partial<Axis>;
85
- }
86
- interface ResolvedElastic {
87
- x: Axis;
88
- y: Axis;
89
- }
90
-
91
- interface EventInfo {
92
- point: Point;
93
- }
94
- /**
95
- * A generic set of string/number values
96
- */
97
- interface ResolvedValues$1 {
98
- [key: string]: AnyResolvedKeyframe;
25
+ keepValuesOnRemount?: boolean;
99
26
  }
100
- type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
101
27
  /**
102
- * An object that specifies values to animate to. Each value may be set either as
103
- * a single value, or an array of values.
104
- *
105
- * It may also option contain these properties:
106
- *
107
- * - `transition`: Specifies transitions for all or individual values.
108
- * - `transitionEnd`: Specifies values to set when the animation finishes.
109
- *
110
- * ```jsx
111
- * const target = {
112
- * x: "0%",
113
- * opacity: 0,
114
- * transition: { duration: 1 },
115
- * transitionEnd: { display: "none" }
116
- * }
117
- * ```
118
- *
119
28
  * @public
120
29
  */
121
- type TargetAndTransition = Target & {
122
- transition?: Transition;
123
- transitionEnd?: ResolvedValues$1;
124
- };
125
- type TargetResolver = (custom: any, current: ResolvedValues$1, velocity: ResolvedValues$1) => TargetAndTransition | string;
30
+ type ReducedMotionConfig = "always" | "never" | "user";
126
31
  /**
127
- * Either a string, or array of strings, that reference variants defined via the `variants` prop.
128
32
  * @public
129
33
  */
130
- type VariantLabels = string | string[];
131
- type Variant = TargetAndTransition | TargetResolver;
132
- interface Variants {
133
- [key: string]: Variant;
134
- }
135
- /**
136
- * @deprecated
137
- */
138
- type LegacyAnimationControls = {
34
+ interface MotionConfigContextProps {
139
35
  /**
140
- * Subscribes a component's animation controls to this.
141
- *
142
- * @param controls - The controls to subscribe
143
- * @returns An unsubscribe function.
36
+ * Internal, exported only for usage in Framer
144
37
  */
145
- subscribe(visualElement: any): () => void;
38
+ transformPagePoint: TransformPoint;
146
39
  /**
147
- * Starts an animation on all linked components.
148
- *
149
- * @remarks
150
- *
151
- * ```jsx
152
- * controls.start("variantLabel")
153
- * controls.start({
154
- * x: 0,
155
- * transition: { duration: 1 }
156
- * })
157
- * ```
158
- *
159
- * @param definition - Properties or variant label to animate to
160
- * @param transition - Optional `transition` to apply to a variant
161
- * @returns - A `Promise` that resolves when all animations have completed.
40
+ * Internal. Determines whether this is a static context ie the Framer canvas. If so,
41
+ * it'll disable all dynamic functionality.
42
+ */
43
+ isStatic: boolean;
44
+ /**
45
+ * Defines a new default transition for the entire tree.
162
46
  *
163
47
  * @public
164
48
  */
165
- start(definition: AnimationDefinition, transitionOverride?: Transition): Promise<any>;
49
+ transition?: Transition;
166
50
  /**
167
- * Instantly set to a set of properties or a variant.
168
- *
169
- * ```jsx
170
- * // With properties
171
- * controls.set({ opacity: 0 })
172
- *
173
- * // With variants
174
- * controls.set("hidden")
175
- * ```
176
- *
177
- * @privateRemarks
178
- * We could perform a similar trick to `.start` where this can be called before mount
179
- * and we maintain a list of pending actions that get applied on mount. But the
180
- * expectation of `set` is that it happens synchronously and this would be difficult
181
- * to do before any children have even attached themselves. It's also poor practice
182
- * and we should discourage render-synchronous `.start` calls rather than lean into this.
51
+ * If true, will respect the device prefersReducedMotion setting by switching
52
+ * transform animations off.
183
53
  *
184
54
  * @public
185
55
  */
186
- set(definition: AnimationDefinition): void;
56
+ reducedMotion?: ReducedMotionConfig;
187
57
  /**
188
- * Stops animations on all linked components.
189
- *
190
- * ```jsx
191
- * controls.stop()
192
- * ```
58
+ * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).
59
+ * For more details see:
60
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
193
61
  *
194
62
  * @public
195
63
  */
196
- stop(): void;
197
- mount(): () => void;
198
- };
199
- interface MotionNodeAnimationOptions {
64
+ nonce?: string;
200
65
  /**
201
- * Properties, variant label or array of variant labels to start in.
202
- *
203
- * Set to `false` to initialise with the values in `animate` (disabling the mount animation)
204
- *
205
- * ```jsx
206
- * // As values
207
- * <motion.div initial={{ opacity: 1 }} />
208
- *
209
- * // As variant
210
- * <motion.div initial="visible" variants={variants} />
211
- *
212
- * // Multiple variants
213
- * <motion.div initial={["visible", "active"]} variants={variants} />
66
+ * If true, all animations will be skipped and values will be set instantly.
67
+ * Useful for E2E tests and visual regression testing.
214
68
  *
215
- * // As false (disable mount animation)
216
- * <motion.div initial={false} animate={{ opacity: 0 }} />
217
- * ```
69
+ * @public
218
70
  */
219
- initial?: TargetAndTransition | VariantLabels | boolean;
71
+ skipAnimations?: boolean;
72
+ }
73
+ interface VisualState<_Instance, RenderState> {
74
+ latestValues: ResolvedValues$1;
75
+ renderState: RenderState;
76
+ }
77
+ interface VisualElementOptions<Instance, RenderState = any> {
78
+ visualState: VisualState<Instance, RenderState>;
79
+ parent?: any;
80
+ variantParent?: any;
81
+ presenceContext: PresenceContextProps | null;
82
+ props: MotionNodeOptions;
83
+ blockInitialAnimation?: boolean;
84
+ reducedMotionConfig?: ReducedMotionConfig;
220
85
  /**
221
- * Values to animate to, variant label(s), or `LegacyAnimationControls`.
222
- *
223
- * ```jsx
224
- * // As values
225
- * <motion.div animate={{ opacity: 1 }} />
226
- *
227
- * // As variant
228
- * <motion.div animate="visible" variants={variants} />
229
- *
230
- * // Multiple variants
231
- * <motion.div animate={["visible", "active"]} variants={variants} />
232
- *
233
- * // LegacyAnimationControls
234
- * <motion.div animate={animation} />
235
- * ```
86
+ * If true, all animations will be skipped and values will be set instantly.
87
+ * Useful for E2E tests and visual regression testing.
236
88
  */
237
- animate?: TargetAndTransition | VariantLabels | boolean | LegacyAnimationControls;
89
+ skipAnimations?: boolean;
238
90
  /**
239
- * A target to animate to when this component is removed from the tree.
240
- *
241
- * This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
242
- *
243
- * This limitation exists because React doesn't allow components to defer unmounting until after
244
- * an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
245
- *
246
- * ```jsx
247
- * import { AnimatePresence, motion } from 'framer-motion'
248
- *
249
- * export const MyComponent = ({ isVisible }) => {
250
- * return (
251
- * <AnimatePresence>
252
- * {isVisible && (
253
- * <motion.div
254
- * initial={{ opacity: 0 }}
255
- * animate={{ opacity: 1 }}
256
- * exit={{ opacity: 0 }}
257
- * />
258
- * )}
259
- * </AnimatePresence>
260
- * )
261
- * }
262
- * ```
91
+ * Explicit override for SVG detection. When true, uses SVG rendering;
92
+ * when false, uses HTML rendering. If undefined, auto-detects.
263
93
  */
264
- exit?: TargetAndTransition | VariantLabels;
265
- /**
266
- * Variants allow you to define animation states and organise them by name. They allow
267
- * you to control animations throughout a component tree by switching a single `animate` prop.
268
- *
269
- * Using `transition` options like `delayChildren` and `when`, you can orchestrate
270
- * when children animations play relative to their parent.
94
+ isSVG?: boolean;
95
+ }
96
+ interface VisualElementEventCallbacks {
97
+ BeforeLayoutMeasure: () => void;
98
+ LayoutMeasure: (layout: Box, prevLayout?: Box) => void;
99
+ LayoutUpdate: (layout: Axis, prevLayout: Axis) => void;
100
+ Update: (latest: ResolvedValues$1) => void;
101
+ AnimationStart: (definition: AnimationDefinition) => void;
102
+ AnimationComplete: (definition: AnimationDefinition) => void;
103
+ LayoutAnimationStart: () => void;
104
+ LayoutAnimationComplete: () => void;
105
+ SetAxisTarget: () => void;
106
+ Unmount: () => void;
107
+ }
108
+ interface LayoutLifecycles {
109
+ onBeforeLayoutMeasure?(box: Box): void;
110
+ onLayoutMeasure?(box: Box, prevBox: Box): void;
111
+ }
112
+ type ScrapeMotionValuesFromProps = (props: MotionNodeOptions, prevProps: MotionNodeOptions, visualElement?: any) => {
113
+ [key: string]: MotionValue | AnyResolvedKeyframe;
114
+ };
115
+ type UseRenderState<RenderState = any> = () => RenderState;
116
+ /**
117
+ * Animation type for variant state management
118
+ */
119
+ type AnimationType = "animate" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "exit";
120
+ interface FeatureClass<Props = unknown> {
121
+ new (props: Props): any;
122
+ }
123
+ interface FeatureDefinition {
124
+ isEnabled: (props: MotionNodeOptions) => boolean;
125
+ Feature?: FeatureClass<unknown>;
126
+ ProjectionNode?: any;
127
+ MeasureLayout?: any;
128
+ }
129
+ type FeatureDefinitions = {
130
+ animation?: FeatureDefinition;
131
+ exit?: FeatureDefinition;
132
+ drag?: FeatureDefinition;
133
+ tap?: FeatureDefinition;
134
+ focus?: FeatureDefinition;
135
+ hover?: FeatureDefinition;
136
+ pan?: FeatureDefinition;
137
+ inView?: FeatureDefinition;
138
+ layout?: FeatureDefinition;
139
+ };
271
140
 
272
- *
273
- * After passing variants to one or more `motion` component's `variants` prop, these variants
274
- * can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
275
- *
276
- * ```jsx
277
- * const variants = {
278
- * active: {
279
- * backgroundColor: "#f00"
280
- * },
281
- * inactive: {
282
- * backgroundColor: "#fff",
283
- * transition: { duration: 2 }
284
- * }
285
- * }
286
- *
287
- * <motion.div variants={variants} animate="active" />
288
- * ```
141
+ interface VisualElementAnimationOptions {
142
+ delay?: number;
143
+ transitionOverride?: Transition;
144
+ custom?: any;
145
+ type?: AnimationType;
146
+ }
147
+
148
+ interface AnimationState$1 {
149
+ animateChanges: (type?: AnimationType) => Promise<any>;
150
+ setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
151
+ setAnimateFunction: (fn: any) => void;
152
+ getState: () => {
153
+ [key: string]: AnimationTypeState;
154
+ };
155
+ reset: () => void;
156
+ }
157
+ type AnimationList = string[] | TargetAndTransition[];
158
+ /**
159
+ * Diffs the element's animation props (one layer per AnimationType, highest
160
+ * priority wins each value) against the previous call and starts animations
161
+ * for what changed.
162
+ *
163
+ * Uses `any` type for visualElement to avoid circular dependencies. It reads
164
+ * props, parent, presenceContext, variantChildren, enteringChildren,
165
+ * manuallyAnimateOnMount, blockInitialAnimation, getValue(),
166
+ * getBaseTargetFromProps(), baseTarget and initialValues.
167
+ */
168
+ declare function createAnimationState(visualElement: any): AnimationState$1;
169
+ declare function checkVariantsDidChange(prev: any, next: any): boolean;
170
+ interface AnimationTypeState {
171
+ isActive: boolean;
172
+ protectedKeys: {
173
+ [key: string]: true;
174
+ };
175
+ needsAnimating: {
176
+ [key: string]: boolean;
177
+ };
178
+ prevResolvedValues: {
179
+ [key: string]: any;
180
+ };
181
+ /**
182
+ * The out transition of prevProp (#1725).
289
183
  */
290
- variants?: Variants;
184
+ prevOut?: any;
291
185
  /**
292
- * Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
293
- * ```jsx
294
- * const spring = {
295
- * type: "spring",
296
- * damping: 10,
297
- * stiffness: 100
298
- * }
299
- *
300
- * <motion.div transition={spring} animate={{ scale: 1.2 }} />
301
- * ```
186
+ * Out transitions of the states that values flagged in needsAnimating
187
+ * are leaving (#1725).
302
188
  */
303
- transition?: Transition;
189
+ out: {
190
+ [key: string]: any;
191
+ };
192
+ prevProp?: VariantLabels | TargetAndTransition;
304
193
  }
305
- interface MotionNodeEventOptions {
194
+
195
+ /**
196
+ * Set feature definitions for all VisualElements.
197
+ * This should be called by the framework layer (e.g., framer-motion) during initialization.
198
+ */
199
+ declare function setFeatureDefinitions(definitions: Partial<FeatureDefinitions>): void;
200
+ /**
201
+ * Get the current feature definitions
202
+ */
203
+ declare function getFeatureDefinitions(): Partial<FeatureDefinitions>;
204
+ /**
205
+ * Motion style type - a subset of CSS properties that can contain motion values
206
+ */
207
+ type MotionStyle = {
208
+ [K: string]: AnyResolvedKeyframe | MotionValue | undefined;
209
+ };
210
+ /**
211
+ * A VisualElement is an imperative abstraction around UI elements such as
212
+ * HTMLElement, SVGElement, Three.Object3D etc.
213
+ */
214
+ declare abstract class VisualElement<Instance = unknown, RenderState = unknown, Options extends {} = {}> {
306
215
  /**
307
- * Callback with latest motion values, fired max once per frame.
308
- *
309
- * ```jsx
310
- * function onUpdate(latest) {
311
- * console.log(latest.x, latest.opacity)
312
- * }
313
- *
314
- * <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
315
- * ```
216
+ * VisualElements are arranged in trees mirroring that of the React tree.
217
+ * Each type of VisualElement has a unique name, to detect when we're crossing
218
+ * type boundaries within that tree.
316
219
  */
317
- onUpdate?(latest: ResolvedValues$1): void;
220
+ abstract type: string;
318
221
  /**
319
- * Callback when animation defined in `animate` begins.
320
- *
321
- * The provided callback will be called with the triggering animation definition.
322
- * If this is a variant, it'll be the variant name, and if a target object
323
- * then it'll be the target object.
324
- *
325
- * This way, it's possible to figure out which animation has started.
326
- *
327
- * ```jsx
328
- * function onStart() {
329
- * console.log("Animation started")
330
- * }
331
- *
332
- * <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
333
- * ```
222
+ * An `Array.sort` compatible function that will compare two Instances and
223
+ * compare their respective positions within the tree.
334
224
  */
335
- onAnimationStart?(definition: AnimationDefinition): void;
225
+ abstract sortInstanceNodePosition(a: Instance, b: Instance): number;
336
226
  /**
337
- * Callback when animation defined in `animate` is complete.
338
- *
339
- * The provided callback will be called with the triggering animation definition.
340
- * If this is a variant, it'll be the variant name, and if a target object
341
- * then it'll be the target object.
342
- *
343
- * This way, it's possible to figure out which animation has completed.
344
- *
345
- * ```jsx
346
- * function onComplete() {
347
- * console.log("Animation completed")
348
- * }
349
- *
350
- * <motion.div
351
- * animate={{ x: 100 }}
352
- * onAnimationComplete={definition => {
353
- * console.log('Completed animating', definition)
354
- * }}
355
- * />
356
- * ```
227
+ * Measure the viewport-relative bounding box of the Instance.
357
228
  */
358
- onAnimationComplete?(definition: AnimationDefinition): void;
359
- onBeforeLayoutMeasure?(box: Box): void;
360
- onLayoutMeasure?(box: Box, prevBox: Box): void;
361
- onLayoutAnimationStart?(): void;
362
- onLayoutAnimationComplete?(): void;
363
- }
364
- interface MotionNodePanHandlers {
229
+ abstract measureInstanceViewportBox(instance: Instance, props: MotionNodeOptions & Partial<MotionConfigContextProps>): Box;
365
230
  /**
366
- * Callback function that fires when the pan gesture is recognised on this element.
367
- *
368
- * **Note:** For pan gestures to work correctly with touch input, the element needs
369
- * touch scrolling to be disabled on either x/y or both axis with the
370
- * [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
371
- *
372
- * ```jsx
373
- * function onPan(event, info) {
374
- * console.log(info.point.x, info.point.y)
375
- * }
376
- *
377
- * <motion.div onPan={onPan} />
378
- * ```
379
- *
380
- * @param event - The originating pointer event.
381
- * @param info - A {@link PanInfo} object containing `x` and `y` values for:
382
- *
383
- * - `point`: Relative to the device or page.
384
- * - `delta`: Distance moved since the last event.
385
- * - `offset`: Offset from the original pan event.
386
- * - `velocity`: Current velocity of the pointer.
387
- */
388
- onPan?(event: PointerEvent, info: PanInfo): void;
231
+ * When a value has been removed from all animation props we need to
232
+ * pick a target to animate back to. For instance, for HTMLElements
233
+ * we can look in the style prop.
234
+ */
235
+ abstract getBaseTargetFromProps(props: MotionNodeOptions, key: string): AnyResolvedKeyframe | undefined | MotionValue;
389
236
  /**
390
- * Callback function that fires when the pan gesture begins on this element.
391
- *
392
- * ```jsx
393
- * function onPanStart(event, info) {
394
- * console.log(info.point.x, info.point.y)
395
- * }
396
- *
397
- * <motion.div onPanStart={onPanStart} />
398
- * ```
399
- *
400
- * @param event - The originating pointer event.
401
- * @param info - A {@link PanInfo} object containing `x`/`y` values for:
402
- *
403
- * - `point`: Relative to the device or page.
404
- * - `delta`: Distance moved since the last event.
405
- * - `offset`: Offset from the original pan event.
406
- * - `velocity`: Current velocity of the pointer.
237
+ * When we first animate to a value we need to animate it *from* a value.
238
+ * Often this have been specified via the initial prop but it might be
239
+ * that the value needs to be read from the Instance.
407
240
  */
408
- onPanStart?(event: PointerEvent, info: PanInfo): void;
241
+ abstract readValueFromInstance(instance: Instance, key: string, options: Options): AnyResolvedKeyframe | null | undefined;
409
242
  /**
410
- * Callback function that fires when we begin detecting a pan gesture. This
411
- * is analogous to `onMouseStart` or `onTouchStart`.
412
- *
413
- * ```jsx
414
- * function onPanSessionStart(event, info) {
415
- * console.log(info.point.x, info.point.y)
416
- * }
417
- *
418
- * <motion.div onPanSessionStart={onPanSessionStart} />
419
- * ```
420
- *
421
- * @param event - The originating pointer event.
422
- * @param info - An {@link EventInfo} object containing `x`/`y` values for:
423
- *
424
- * - `point`: Relative to the device or page.
243
+ * When a value has been removed from the VisualElement we use this to remove
244
+ * it from the inheriting class' unique render state.
425
245
  */
426
- onPanSessionStart?(event: PointerEvent, info: EventInfo): void;
246
+ abstract removeValueFromRenderState(key: string, renderState: RenderState): void;
427
247
  /**
428
- * Callback function that fires when the pan gesture ends on this element.
429
- *
430
- * ```jsx
431
- * function onPanEnd(event, info) {
432
- * console.log(info.point.x, info.point.y)
433
- * }
434
- *
435
- * <motion.div onPanEnd={onPanEnd} />
436
- * ```
437
- *
438
- * @param event - The originating pointer event.
439
- * @param info - A {@link PanInfo} object containing `x`/`y` values for:
440
- *
441
- * - `point`: Relative to the device or page.
442
- * - `delta`: Distance moved since the last event.
443
- * - `offset`: Offset from the original pan event.
444
- * - `velocity`: Current velocity of the pointer.
248
+ * Run before a React or VisualElement render, builds the latest motion
249
+ * values into an Instance-specific format. For example, HTMLVisualElement
250
+ * will use this step to build `style` and `var` values.
445
251
  */
446
- onPanEnd?(event: PointerEvent, info: PanInfo): void;
447
- }
448
- interface MotionNodeHoverHandlers {
252
+ abstract build(renderState: RenderState, latestValues: ResolvedValues$1, props: MotionNodeOptions): void;
449
253
  /**
450
- * Properties or variant label to animate to while the hover gesture is recognised.
451
- *
452
- * ```jsx
453
- * <motion.div whileHover={{ scale: 1.2 }} />
454
- * ```
254
+ * Apply the built values to the Instance. For example, HTMLElements will have
255
+ * styles applied via `setProperty` and the style attribute, whereas SVGElements
256
+ * will have values applied to attributes.
455
257
  */
456
- whileHover?: VariantLabels | TargetAndTransition;
258
+ abstract renderInstance(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: any): void;
457
259
  /**
458
- * Callback function that fires when pointer starts hovering over the component.
459
- *
460
- * ```jsx
461
- * <motion.div onHoverStart={() => console.log('Hover starts')} />
462
- * ```
260
+ * This method is called when a transform property is bound to a motion value.
261
+ * It's currently used to measure SVG elements when a new transform property is bound.
463
262
  */
464
- onHoverStart?(event: PointerEvent, info: EventInfo): void;
263
+ onBindTransform?(): void;
465
264
  /**
466
- * Callback function that fires when pointer stops hovering over the component.
467
- *
468
- * ```jsx
469
- * <motion.div onHoverEnd={() => console.log("Hover ends")} />
470
- * ```
265
+ * The value getValue starts a new motion value from when it isn't given
266
+ * a default. Without it, values start unread and the keyframe resolver
267
+ * reads their origin.
471
268
  */
472
- onHoverEnd?(event: PointerEvent, info: EventInfo): void;
473
- }
474
- /**
475
- * Passed in to tap event handlers like `onTap` the `TapInfo` object contains
476
- * information about the tap gesture such as it‘s location.
477
- *
478
- * ```jsx
479
- * function onTap(event, info) {
480
- * console.log(info.point.x, info.point.y)
481
- * }
482
- *
483
- * <motion.div onTap={onTap} />
484
- * ```
485
- *
486
- * @public
487
- */
488
- interface TapInfo {
269
+ getDefaultValue?(key: string): AnyResolvedKeyframe | undefined;
489
270
  /**
490
- * Contains `x` and `y` values for the tap gesture relative to the
491
- * device or page.
492
- *
493
- * ```jsx
494
- * function onTapStart(event, info) {
495
- * console.log(info.point.x, info.point.y)
496
- * }
497
- *
498
- * <motion.div onTapStart={onTapStart} />
499
- * ```
500
- *
501
- * @public
271
+ * If the component child is provided as a motion value, handle subscriptions
272
+ * with the renderer-specific VisualElement.
502
273
  */
503
- point: Point;
504
- }
505
- interface MotionNodeTapHandlers {
274
+ handleChildMotionValue?(): void;
506
275
  /**
507
- * Callback when the tap gesture successfully ends on this element.
508
- *
509
- * ```jsx
510
- * function onTap(event, info) {
511
- * console.log(info.point.x, info.point.y)
512
- * }
513
- *
514
- * <motion.div onTap={onTap} />
515
- * ```
276
+ * This method takes React props and returns found MotionValues. For example, HTML
277
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
516
278
  *
517
- * @param event - The originating pointer event.
518
- * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
279
+ * This isn't an abstract method as it needs calling in the constructor, but it is
280
+ * intended to be one.
519
281
  */
520
- onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
282
+ scrapeMotionValuesFromProps(_props: MotionNodeOptions, _prevProps: MotionNodeOptions, _visualElement: VisualElement): {
283
+ [key: string]: MotionValue | AnyResolvedKeyframe;
284
+ };
521
285
  /**
522
- * Callback when the tap gesture starts on this element.
523
- *
524
- * ```jsx
525
- * function onTapStart(event, info) {
526
- * console.log(info.point.x, info.point.y)
527
- * }
528
- *
529
- * <motion.div onTapStart={onTapStart} />
530
- * ```
531
- *
532
- * @param event - The originating pointer event.
533
- * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
286
+ * A reference to the current underlying Instance, e.g. a HTMLElement
287
+ * or Three.Mesh etc.
534
288
  */
535
- onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
289
+ current: Instance | null;
536
290
  /**
537
- * Callback when the tap gesture ends outside this element.
538
- *
539
- * ```jsx
540
- * function onTapCancel(event, info) {
541
- * console.log(info.point.x, info.point.y)
542
- * }
543
- *
544
- * <motion.div onTapCancel={onTapCancel} />
545
- * ```
546
- *
547
- * @param event - The originating pointer event.
548
- * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
291
+ * A reference to the parent VisualElement (if exists).
549
292
  */
550
- onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
293
+ parent: VisualElement | undefined;
551
294
  /**
552
- * Properties or variant label to animate to while the component is pressed.
553
- *
554
- * ```jsx
555
- * <motion.div whileTap={{ scale: 0.8 }} />
556
- * ```
295
+ * A set containing references to this VisualElement's children.
557
296
  */
558
- whileTap?: VariantLabels | TargetAndTransition;
297
+ children: Set<VisualElement<unknown, unknown, {}>>;
559
298
  /**
560
- * If `true`, the tap gesture will attach its start listener to window.
561
- *
562
- * Note: This is not supported publicly.
299
+ * A set containing the latest children of this VisualElement. This is flushed
300
+ * at the start of every commit. We use it to calculate the stagger delay
301
+ * for newly-added children.
563
302
  */
564
- globalTapTarget?: boolean;
565
- }
566
- /**
567
- * @deprecated - Use MotionNodeTapHandlers
568
- */
569
- interface TapHandlers extends MotionNodeTapHandlers {
570
- }
571
- interface MotionNodeFocusHandlers {
303
+ enteringChildren?: Set<VisualElement>;
572
304
  /**
573
- * Properties or variant label to animate to while the focus gesture is recognised.
574
- *
575
- * ```jsx
576
- * <motion.input whileFocus={{ scale: 1.2 }} />
577
- * ```
305
+ * The depth of this VisualElement within the overall VisualElement tree.
578
306
  */
579
- whileFocus?: VariantLabels | TargetAndTransition;
580
- }
581
- /**
582
- * TODO: Replace with types from inView()
583
- */
584
- type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
585
- interface ViewportOptions {
586
- root?: {
587
- current: Element | null;
588
- };
589
- once?: boolean;
590
- margin?: string;
591
- amount?: "some" | "all" | number;
592
- }
593
- interface MotionNodeViewportOptions {
594
- whileInView?: VariantLabels | TargetAndTransition;
595
- onViewportEnter?: ViewportEventHandler;
596
- onViewportLeave?: ViewportEventHandler;
597
- viewport?: ViewportOptions;
598
- }
599
- interface MotionNodeDraggableOptions {
307
+ depth: number;
600
308
  /**
601
- * Enable dragging for this element. Set to `false` by default.
602
- * Set `true` to drag in both directions.
603
- * Set `"x"` or `"y"` to only drag in a specific direction.
604
- *
605
- * ```jsx
606
- * <motion.div drag="x" />
607
- * ```
309
+ * The current render state of this VisualElement. Defined by inheriting VisualElements.
608
310
  */
609
- drag?: boolean | "x" | "y";
311
+ renderState: RenderState;
610
312
  /**
611
- * Properties or variant label to animate to while the drag gesture is recognised.
612
- *
613
- * ```jsx
614
- * <motion.div whileDrag={{ scale: 1.2 }} />
615
- * ```
313
+ * An object containing the latest static values for each of this VisualElement's
314
+ * MotionValues.
616
315
  */
617
- whileDrag?: VariantLabels | TargetAndTransition;
316
+ latestValues: ResolvedValues$1;
618
317
  /**
619
- * If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
620
- *
621
- * ```jsx
622
- * <motion.div drag dragDirectionLock />
623
- * ```
318
+ * Determine what role this visual element should take in the variant tree.
624
319
  */
625
- dragDirectionLock?: boolean;
320
+ isVariantNode: boolean;
321
+ isControllingVariants: boolean;
626
322
  /**
627
- * Allows drag gesture propagation to child components. Set to `false` by
628
- * default.
629
- *
630
- * ```jsx
631
- * <motion.div drag="x" dragPropagation />
632
- * ```
323
+ * If this component is part of the variant tree, it should track
324
+ * any children that are also part of the tree. This is essentially
325
+ * a shadow tree to simplify logic around how to stagger over children.
633
326
  */
634
- dragPropagation?: boolean;
327
+ variantChildren?: Set<VisualElement>;
635
328
  /**
636
- * Applies constraints on the permitted draggable area.
637
- *
638
- * It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
639
- * This will define a distance from the named edge of the draggable component.
640
- *
641
- * Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
642
- * This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
643
- * of the component you want to use as constraints. The element itself can also be passed.
644
- *
645
- * ```jsx
646
- * // In pixels
647
- * <motion.div
648
- * drag="x"
649
- * dragConstraints={{ left: 0, right: 300 }}
650
- * />
651
- *
652
- * // As a ref to another component
653
- * const MyComponent = () => {
654
- * const constraintsRef = useRef(null)
329
+ * Decides whether this VisualElement should animate in reduced motion
330
+ * mode.
655
331
  *
656
- * return (
657
- * <motion.div ref={constraintsRef}>
658
- * <motion.div drag dragConstraints={constraintsRef} />
659
- * </motion.div>
660
- * )
661
- * }
662
- * ```
332
+ * TODO: This is currently set on every individual VisualElement but feels
333
+ * like it could be set globally.
663
334
  */
664
- dragConstraints?: false | Partial<BoundingBox> | Element | {
665
- current: Element | null;
666
- };
335
+ shouldReduceMotion: boolean | null;
667
336
  /**
668
- * The degree of movement allowed outside constraints. 0 = no movement, 1 =
669
- * full movement.
670
- *
671
- * Set to `0.5` by default. Can also be set as `false` to disable movement.
672
- *
673
- * By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
674
- * per constraint. Any missing values will be set to `0`.
675
- *
676
- * ```jsx
677
- * <motion.div
678
- * drag
679
- * dragConstraints={{ left: 0, right: 300 }}
680
- * dragElastic={0.2}
681
- * />
682
- * ```
337
+ * Decides whether animations should be skipped for this VisualElement.
338
+ * Useful for E2E tests and visual regression testing.
683
339
  */
684
- dragElastic?: DragElastic;
340
+ shouldSkipAnimations: boolean;
685
341
  /**
686
- * Apply momentum from the pan gesture to the component when dragging
687
- * finishes. Set to `true` by default.
342
+ * Normally, if a component is controlled by a parent's variants, it can
343
+ * rely on that ancestor to trigger animations further down the tree.
344
+ * However, if a component is created after its parent is mounted, the parent
345
+ * won't trigger that mount animation so the child needs to.
688
346
  *
689
- * ```jsx
690
- * <motion.div
691
- * drag
692
- * dragConstraints={{ left: 0, right: 300 }}
693
- * dragMomentum={false}
694
- * />
695
- * ```
347
+ * TODO: This might be better replaced with a method isParentMounted
696
348
  */
697
- dragMomentum?: boolean;
349
+ manuallyAnimateOnMount: boolean;
698
350
  /**
699
- * Allows you to change dragging inertia parameters.
700
- * 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.
701
- * See {@link https://motion.dev/docs/react-motion-component#dragtransition | Inertia} for all properties you can use.
702
- *
703
- * ```jsx
704
- * <motion.div
705
- * drag
706
- * dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
707
- * />
708
- * ```
351
+ * This can be set by AnimatePresence to force components that mount
352
+ * at the same time as it to mount as if they have initial={false} set.
709
353
  */
710
- dragTransition?: InertiaOptions;
354
+ blockInitialAnimation: boolean;
711
355
  /**
712
- * Usually, dragging is initiated by pressing down on a component and moving it. For some
713
- * use-cases, for instance clicking at an arbitrary point on a video scrubber, we
714
- * might want to initiate dragging from a different component than the draggable one.
715
- *
716
- * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
717
- * the draggable component's `dragControls` prop. It exposes a `start` method
718
- * that can start dragging from pointer events on other components.
719
- *
720
- * ```jsx
721
- * const dragControls = useDragControls()
722
- *
723
- * function startDrag(event) {
724
- * dragControls.start(event, { snapToCursor: true })
725
- * }
726
- *
727
- * return (
728
- * <>
729
- * <div onPointerDown={startDrag} />
730
- * <motion.div drag="x" dragControls={dragControls} />
731
- * </>
732
- * )
733
- * ```
356
+ * A reference to this VisualElement's projection node, used in layout animations.
734
357
  */
735
- dragControls?: any;
358
+ projection?: any;
736
359
  /**
737
- * If `true`, element will snap back to its origin when dragging ends.
738
- * Set to `"x"` or `"y"` to only snap back on a specific axis.
739
- *
740
- * Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
741
- * with `dragElastic={1}`, but when used together `dragConstraints` can define
742
- * a wider draggable area and `dragSnapToOrigin` will ensure the element
743
- * animates back to its origin on release.
360
+ * A map of all motion values attached to this visual element. Motion
361
+ * values are source of truth for any given animated value. A motion
362
+ * value might be provided externally by the component via props.
744
363
  */
745
- dragSnapToOrigin?: boolean | "x" | "y";
364
+ values: Map<string, MotionValue<any>>;
746
365
  /**
747
- * By default, if `drag` is defined on a component then an event listener will be attached
748
- * to automatically initiate dragging when a user presses down on it.
749
- *
750
- * By setting `dragListener` to `false`, this event listener will not be created.
751
- *
752
- * ```jsx
753
- * const dragControls = useDragControls()
754
- *
755
- * function startDrag(event) {
756
- * dragControls.start(event, { snapToCursor: true })
757
- * }
758
- *
759
- * return (
760
- * <>
761
- * <div onPointerDown={startDrag} />
762
- * <motion.div
763
- * drag="x"
764
- * dragControls={dragControls}
765
- * dragListener={false}
766
- * />
767
- * </>
768
- * )
769
- * ```
366
+ * The AnimationState, this is hydrated by the animation Feature.
770
367
  */
771
- dragListener?: boolean;
368
+ animationState?: AnimationState$1;
369
+ KeyframeResolver: typeof KeyframeResolver;
772
370
  /**
773
- * If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
774
- *
775
- * @public
371
+ * The options used to create this VisualElement. The Options type is defined
372
+ * by the inheriting VisualElement and is passed straight through to the render functions.
776
373
  */
777
- onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
374
+ readonly options: Options;
778
375
  /**
779
- * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
780
- * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
781
- * This allows you to manually control how updates from a drag gesture on an element is applied.
782
- *
783
- * @public
376
+ * A reference to the latest props provided to the VisualElement's host React component.
784
377
  */
785
- _dragX?: MotionValue<number>;
378
+ props: MotionNodeOptions;
379
+ prevProps?: MotionNodeOptions;
380
+ presenceContext: PresenceContextProps | null;
381
+ prevPresenceContext?: PresenceContextProps | null;
786
382
  /**
787
- * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
788
- * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
789
- * This allows you to manually control how updates from a drag gesture on an element is applied.
790
- *
791
- * @public
383
+ * Cleanup functions for active features (hover/tap/exit etc)
792
384
  */
793
- _dragY?: MotionValue<number>;
794
- }
795
- interface MotionNodeDragHandlers {
385
+ private features;
796
386
  /**
797
- * Callback function that fires when dragging starts.
798
- *
799
- * ```jsx
800
- * <motion.div
801
- * drag
802
- * onDragStart={
803
- * (event, info) => console.log(info.point.x, info.point.y)
804
- * }
805
- * />
806
- * ```
807
- *
808
- * @public
387
+ * A map of every subscription that binds the provided or generated
388
+ * motion values onChange listeners to this visual element.
809
389
  */
810
- onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
390
+ private valueSubscriptions;
811
391
  /**
812
- * Callback function that fires when dragging ends.
813
- *
814
- * ```jsx
815
- * <motion.div
816
- * drag
817
- * onDragEnd={
818
- * (event, info) => console.log(info.point.x, info.point.y)
819
- * }
820
- * />
821
- * ```
822
- *
823
- * @public
392
+ * A reference to the ReducedMotionConfig passed to the VisualElement's host React component.
824
393
  */
825
- onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
394
+ private reducedMotionConfig;
826
395
  /**
827
- * Callback function that fires when the component is dragged.
828
- *
829
- * ```jsx
830
- * <motion.div
831
- * drag
832
- * onDrag={
833
- * (event, info) => console.log(info.point.x, info.point.y)
834
- * }
835
- * />
836
- * ```
837
- *
838
- * @public
396
+ * A reference to the skipAnimations config passed to the VisualElement's host React component.
839
397
  */
840
- onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
398
+ private skipAnimationsConfig;
841
399
  /**
842
- * Callback function that fires a drag direction is determined.
843
- *
844
- * ```jsx
845
- * <motion.div
846
- * drag
847
- * dragDirectionLock
848
- * onDirectionLock={axis => console.log(axis)}
849
- * />
850
- * ```
851
- *
852
- * @public
400
+ * On mount, this will be hydrated with a callback to disconnect
401
+ * this visual element from its parent on unmount.
853
402
  */
854
- onDirectionLock?(axis: "x" | "y"): void;
403
+ private removeFromVariantTree;
855
404
  /**
856
- * Callback function that fires when drag momentum/bounce transition finishes.
857
- *
858
- * ```jsx
859
- * <motion.div
860
- * drag
861
- * onDragTransitionEnd={() => console.log('Drag transition complete')}
862
- * />
863
- * ```
864
- *
865
- * @public
405
+ * A reference to the previously-provided motion values as returned
406
+ * from scrapeMotionValuesFromProps. We use the keys in here to determine
407
+ * if any motion values need to be removed after props are updated.
866
408
  */
867
- onDragTransitionEnd?(): void;
868
- }
869
- interface MotionNodeLayoutOptions {
409
+ private prevMotionValues;
870
410
  /**
871
- * If `true`, this component will automatically animate to its new position when
872
- * its layout changes.
873
- *
874
- * ```jsx
875
- * <motion.div layout />
876
- * ```
877
- *
878
- * This will perform a layout animation using performant transforms. Part of this technique
879
- * involved animating an element's scale. This can introduce visual distortions on children,
880
- * `boxShadow` and `borderRadius`.
881
- *
882
- * To correct distortion on immediate children, add `layout` to those too.
883
- *
884
- * `boxShadow` and `borderRadius` will automatically be corrected if they are already being
885
- * animated on this component. Otherwise, set them directly via the `initial` prop.
886
- *
887
- * If `layout` is set to `"position"`, the size of the component will change instantly and
888
- * only its position will animate.
889
- *
890
- * If `layout` is set to `"size"`, the position of the component will change instantly and
891
- * only its size will animate.
892
- *
893
- * If `layout` is set to `"preserve-aspect"`, the component will animate size & position if
894
- * the aspect ratio remains the same between renders, and just position if the ratio changes.
895
- *
896
- * @public
411
+ * Track whether this element has been mounted before, to detect
412
+ * remounts after Suspense unmount/remount cycles.
897
413
  */
898
- layout?: boolean | "position" | "size" | "preserve-aspect" | "x" | "y";
414
+ private hasBeenMounted;
899
415
  /**
900
- * Enable shared layout transitions between different components with the same `layoutId`.
901
- *
902
- * When a component with a layoutId is removed from the React tree, and then
903
- * added elsewhere, it will visually animate from the previous component's bounding box
904
- * and its latest animated values.
905
- *
906
- * ```jsx
907
- * {items.map(item => (
908
- * <motion.li layout>
909
- * {item.name}
910
- * {item.isSelected && <motion.div layoutId="underline" />}
911
- * </motion.li>
912
- * ))}
913
- * ```
914
- *
915
- * If the previous component remains in the tree it will crossfade with the new component.
916
- *
917
- * @public
416
+ * An object containing a SubscriptionManager for each active event.
918
417
  */
919
- layoutId?: string;
418
+ private events;
920
419
  /**
921
- * A callback that will fire when a layout animation on this component starts.
922
- *
923
- * @public
420
+ * An object containing an unsubscribe function for each prop event subscription.
421
+ * For example, every "Update" event can have multiple subscribers via
422
+ * VisualElement.on(), but only one of those can be defined via the onUpdate prop.
924
423
  */
925
- onLayoutAnimationStart?(): void;
424
+ private propEventSubscriptions;
425
+ constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, RenderState>, options?: Options);
426
+ mount(instance: Instance): void;
427
+ unmount(): void;
428
+ addChild(child: VisualElement): void;
429
+ removeChild(child: VisualElement): void;
430
+ private bindToMotionValue;
431
+ sortNodePosition(other: VisualElement<Instance>): number;
432
+ updateFeatures(): void;
433
+ notifyUpdate: () => void;
434
+ triggerBuild(): void;
435
+ render: () => void;
436
+ private renderScheduledAt;
437
+ scheduleRender: () => void;
926
438
  /**
927
- * A callback that will fire when a layout animation on this component completes.
928
- *
929
- * @public
439
+ * Measure the current viewport box with or without transforms.
440
+ * Only measures axis-aligned boxes, rotate and skew must be manually
441
+ * removed with a re-render to work.
930
442
  */
931
- onLayoutAnimationComplete?(): void;
443
+ measureViewportBox(): Box;
444
+ getStaticValue(key: string): AnyResolvedKeyframe;
445
+ setStaticValue(key: string, value: AnyResolvedKeyframe): void;
932
446
  /**
933
- * @public
447
+ * Update the provided props. Ensure any newly-added motion values are
448
+ * added to our map, old ones removed, and listeners updated.
934
449
  */
935
- layoutDependency?: any;
450
+ update(props: MotionNodeOptions, presenceContext: PresenceContextProps | null): void;
451
+ getProps(): MotionNodeOptions;
936
452
  /**
937
- * Whether a projection node should measure its scroll when it or its descendants update their layout.
938
- *
939
- * @public
453
+ * Returns the variant definition with a given name.
940
454
  */
941
- layoutScroll?: boolean;
455
+ getVariant(name: string): Variant | undefined;
942
456
  /**
943
- * Whether an element should be considered a "layout root", where
944
- * all children will be forced to resolve relatively to it. This
945
- * includes shared `layoutId` elements, which animate within the root
946
- * when the previous element was also inside it.
947
- * Currently used for `position: sticky` elements in Framer.
457
+ * Returns the defined default transition on this component.
948
458
  */
949
- layoutRoot?: boolean;
459
+ getDefaultTransition(): Transition | undefined;
460
+ getTransformPagePoint(): any;
950
461
  /**
951
- * The anchor point for relative layout projection. This defines which
952
- * point on the parent is used as the reference for the child's position.
953
- *
954
- * `{ x: 0, y: 0 }` (default) anchors to the top-left corner.
955
- * `{ x: 0.5, y: 0.5 }` anchors to the center, useful for centered layouts
956
- * (e.g., flexbox) to prevent drift during parent layout animations.
957
- * `false` disables relative projection entirely.
462
+ * Add a motion value and bind it to this visual element.
958
463
  */
959
- layoutAnchor?: {
960
- x: number;
961
- y: number;
962
- } | false;
464
+ addValue(key: string, value: MotionValue): void;
963
465
  /**
964
- * Attached to a portal root to ensure we attach the child to the document root and don't
965
- * perform scale correction on it.
466
+ * Remove a motion value and unbind any active subscriptions.
966
467
  */
967
- "data-framer-portal-id"?: string;
468
+ removeValue(key: string): void;
968
469
  /**
969
- * By default, shared layout elements will crossfade. By setting this
970
- * to `false`, this element will take its default opacity throughout the animation.
470
+ * Check whether we have a motion value for this key
971
471
  */
972
- layoutCrossfade?: boolean;
472
+ hasValue(key: string): boolean;
473
+ /**
474
+ * Get a motion value for this key. If called with a default
475
+ * value, we'll create one if none exists.
476
+ */
477
+ getValue(key: string): MotionValue | undefined;
478
+ getValue(key: string, defaultValue: AnyResolvedKeyframe | null): MotionValue;
479
+ /**
480
+ * If we're trying to animate to a previously unencountered value,
481
+ * we need to check for it in our state and as a last resort read it
482
+ * directly from the instance (which might have performance implications).
483
+ */
484
+ readValue(key: string, target?: AnyResolvedKeyframe | null): any;
485
+ /**
486
+ * Set the base target to later animate back to. This is currently
487
+ * only hydrated on creation and when we first read a value.
488
+ */
489
+ setBaseTarget(key: string, value: AnyResolvedKeyframe): void;
490
+ on<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, callback: VisualElementEventCallbacks[EventName]): VoidFunction;
491
+ notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
492
+ scheduleRenderMicrotask(): void;
973
493
  }
494
+
974
495
  /**
975
- * @deprecated - Use MotionNodeDragHandlers/MotionNodeDraggableOptions
496
+ * Passed in to pan event handlers like `onPan` the `PanInfo` object contains
497
+ * information about the current state of the tap gesture such as its
498
+ * `point`, `delta`, `offset` and `velocity`.
499
+ *
500
+ * ```jsx
501
+ * <motion.div onPan={(event, info) => {
502
+ * console.log(info.point.x, info.point.y)
503
+ * }} />
504
+ * ```
505
+ *
506
+ * @public
976
507
  */
977
- interface DraggableProps extends MotionNodeDragHandlers, MotionNodeDraggableOptions {
978
- }
979
- type TransformTemplate = (transform: TransformProperties, generatedTransform: string) => string;
980
- interface MotionNodeAdvancedOptions {
508
+ interface PanInfo {
981
509
  /**
982
- * Custom data to use to resolve dynamic variants differently for each animating component.
510
+ * Contains `x` and `y` values for the current pan position relative
511
+ * to the device or page.
983
512
  *
984
513
  * ```jsx
985
- * const variants = {
986
- * visible: (custom) => ({
987
- * opacity: 1,
988
- * transition: { delay: custom * 0.2 }
989
- * })
514
+ * function onPan(event, info) {
515
+ * console.log(info.point.x, info.point.y)
990
516
  * }
991
517
  *
992
- * <motion.div custom={0} animate="visible" variants={variants} />
993
- * <motion.div custom={1} animate="visible" variants={variants} />
994
- * <motion.div custom={2} animate="visible" variants={variants} />
518
+ * <motion.div onPan={onPan} />
995
519
  * ```
996
520
  *
997
521
  * @public
998
522
  */
999
- custom?: any;
523
+ point: Point;
1000
524
  /**
525
+ * Contains `x` and `y` values for the distance moved since
526
+ * the last event.
527
+ *
528
+ * ```jsx
529
+ * function onPan(event, info) {
530
+ * console.log(info.delta.x, info.delta.y)
531
+ * }
532
+ *
533
+ * <motion.div onPan={onPan} />
534
+ * ```
535
+ *
1001
536
  * @public
1002
- * Set to `false` to prevent inheriting variant changes from its parent.
1003
537
  */
1004
- inherit?: boolean;
538
+ delta: Point;
1005
539
  /**
540
+ * Contains `x` and `y` values for the distance moved from
541
+ * the first pan event.
542
+ *
543
+ * ```jsx
544
+ * function onPan(event, info) {
545
+ * console.log(info.offset.x, info.offset.y)
546
+ * }
547
+ *
548
+ * <motion.div onPan={onPan} />
549
+ * ```
550
+ *
1006
551
  * @public
1007
- * Set to `false` to prevent throwing an error when a `motion` component is used within a `LazyMotion` set to strict.
1008
- */
1009
- ignoreStrict?: boolean;
1010
- /**
1011
- * Provide a set of motion values to perform animations on.
1012
552
  */
1013
- values?: {
1014
- [key: string]: MotionValue<number> | MotionValue<string>;
1015
- };
553
+ offset: Point;
1016
554
  /**
1017
- * By default, Motion generates a `transform` property with a sensible transform order. `transformTemplate`
1018
- * can be used to create a different order, or to append/prepend the automatically generated `transform` property.
555
+ * Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
1019
556
  *
1020
557
  * ```jsx
1021
- * <motion.div
1022
- * style={{ x: 0, rotate: 180 }}
1023
- * transformTemplate={
1024
- * ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
1025
- * }
1026
- * />
1027
- * ```
558
+ * function onPan(event, info) {
559
+ * console.log(info.velocity.x, info.velocity.y)
560
+ * }
1028
561
  *
1029
- * @param transform - The latest animated transform props.
1030
- * @param generatedTransform - The transform string as automatically generated by Motion
562
+ * <motion.div onPan={onPan} />
563
+ * ```
1031
564
  *
1032
565
  * @public
1033
566
  */
1034
- transformTemplate?: TransformTemplate;
1035
- "data-framer-appear-id"?: string;
567
+ velocity: Point;
1036
568
  }
1037
- interface PropagateOptions {
569
+ type PanHandler = (event: Event, info: PanInfo) => void;
570
+
571
+ declare const elementDragControls: WeakMap<VisualElement<unknown, unknown, {}>, VisualElementDragControls>;
572
+ interface DragControlOptions {
1038
573
  /**
1039
- * If `false`, this element's tap gesture will prevent any parent
1040
- * element's tap gesture handlers (`onTap`, `onTapStart`, `whileTap`)
1041
- * from firing. Defaults to `true`.
574
+ * This distance after which dragging starts and a direction is locked in.
575
+ *
576
+ * @public
1042
577
  */
1043
- tap?: boolean;
1044
- }
1045
- interface MotionNodeOptions extends MotionNodeAnimationOptions, MotionNodeEventOptions, MotionNodePanHandlers, MotionNodeTapHandlers, MotionNodeHoverHandlers, MotionNodeFocusHandlers, MotionNodeViewportOptions, MotionNodeDragHandlers, MotionNodeDraggableOptions, MotionNodeLayoutOptions, MotionNodeAdvancedOptions {
578
+ distanceThreshold?: number;
1046
579
  /**
1047
- * Controls whether gesture events propagate to parent motion components.
1048
- * By default all gestures propagate. Set individual gestures to `false`
1049
- * to prevent parent handlers from firing.
580
+ * Whether to immediately snap to the cursor when dragging starts.
1050
581
  *
1051
- * ```jsx
1052
- * <motion.div onTap={onParentTap}>
1053
- * <motion.div onTap={onChildTap} propagate={{ tap: false }} />
1054
- * </motion.div>
1055
- * ```
582
+ * @public
1056
583
  */
1057
- propagate?: PropagateOptions;
584
+ snapToCursor?: boolean;
1058
585
  }
1059
-
1060
- /**
1061
- * @public
1062
- */
1063
- interface PresenceContextProps {
1064
- id: string;
1065
- isPresent: boolean;
586
+ type DragDirection = "x" | "y";
587
+ declare class VisualElementDragControls {
588
+ visualElement: VisualElement<HTMLElement>;
589
+ private panSession?;
590
+ private openDragLock;
591
+ isDragging: boolean;
592
+ private currentDirection;
593
+ originPoint: Point;
1066
594
  /**
1067
- * Registers a child with this presence. Motion components also pass
1068
- * their VisualElement, so `mode="popLayout"` can find the child's
1069
- * element when the child can't be given a ref.
595
+ * The permitted boundaries of travel, in pixels.
1070
596
  */
1071
- register: (id: string | number, node?: any) => () => void;
1072
- onExitComplete?: (id: string | number) => void;
1073
- initial?: false | VariantLabels;
1074
- custom?: any;
1075
- }
1076
- /**
1077
- * @public
1078
- */
1079
- type ReducedMotionConfig = "always" | "never" | "user";
1080
- /**
1081
- * @public
1082
- */
1083
- interface MotionConfigContextProps {
597
+ private constraints;
598
+ private hasMutatedConstraints;
1084
599
  /**
1085
- * Internal, exported only for usage in Framer
600
+ * A constraint, from a `dragConstraints` function, that moves the
601
+ * element itself, from the drag's latest pointer position.
1086
602
  */
1087
- transformPagePoint: TransformPoint;
603
+ private point?;
1088
604
  /**
1089
- * Internal. Determines whether this is a static context ie the Framer canvas. If so,
1090
- * it'll disable all dynamic functionality.
605
+ * The `layoutScroll` ancestors' scroll (see measureScroll) when ref
606
+ * constraints were last measured.
1091
607
  */
1092
- isStatic: boolean;
608
+ private scroll?;
1093
609
  /**
1094
- * Defines a new default transition for the entire tree.
1095
- *
1096
- * @public
610
+ * The per-axis resolved elastic values.
1097
611
  */
1098
- transition?: Transition;
612
+ elastic: motion_utils.Box;
1099
613
  /**
1100
- * If true, will respect the device prefersReducedMotion setting by switching
1101
- * transform animations off.
1102
- *
1103
- * @public
614
+ * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.
1104
615
  */
1105
- reducedMotion?: ReducedMotionConfig;
616
+ private latestPointerEvent;
1106
617
  /**
1107
- * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).
1108
- * For more details see:
1109
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
1110
- *
1111
- * @public
618
+ * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.
1112
619
  */
1113
- nonce?: string;
620
+ private latestPanInfo;
1114
621
  /**
1115
- * If true, all animations will be skipped and values will be set instantly.
1116
- * Useful for E2E tests and visual regression testing.
622
+ * Where drag options are read from. By default these are the
623
+ * VisualElement's props (as with a React `motion` component), but the
624
+ * vanilla `drag()` API provides its own.
625
+ */
626
+ private readProps;
627
+ constructor(visualElement: VisualElement<HTMLElement>, readProps?: () => MotionNodeOptions);
628
+ start(originEvent: PointerEvent, { snapToCursor, distanceThreshold }?: DragControlOptions): void;
629
+ /**
630
+ * @param dragAxes - The axes to animate on release, if not the `drag`
631
+ * prop's, e.g. when drag was disabled mid-gesture.
632
+ */
633
+ stop(event?: PointerEvent, panInfo?: PanInfo, dragAxes?: MotionNodeOptions["drag"]): void;
634
+ cancel(): void;
635
+ /**
636
+ * Clean up the pan session without modifying other drag state.
637
+ * This is used during unmount to ensure event listeners are removed
638
+ * without affecting projection animations or drag locks.
639
+ */
640
+ endPanSession(): void;
641
+ private updateAxis;
642
+ private resolveConstraints;
643
+ private resolveRefConstraints;
644
+ private startAnimation;
645
+ private startAxisValueAnimation;
646
+ stopAnimation(): void;
647
+ /**
648
+ * Drag works differently depending on which props are provided.
1117
649
  *
1118
- * @public
650
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
651
+ * - Otherwise, we apply the delta to the x/y motion values.
1119
652
  */
1120
- skipAnimations?: boolean;
1121
- }
1122
- interface VisualState<_Instance, RenderState> {
1123
- latestValues: ResolvedValues$1;
1124
- renderState: RenderState;
1125
- }
1126
- interface VisualElementOptions<Instance, RenderState = any> {
1127
- visualState: VisualState<Instance, RenderState>;
1128
- parent?: any;
1129
- variantParent?: any;
1130
- presenceContext: PresenceContextProps | null;
1131
- props: MotionNodeOptions;
1132
- blockInitialAnimation?: boolean;
1133
- reducedMotionConfig?: ReducedMotionConfig;
653
+ getAxisMotionValue(axis: DragDirection): MotionValue<any>;
1134
654
  /**
1135
- * If true, all animations will be skipped and values will be set instantly.
1136
- * Useful for E2E tests and visual regression testing.
655
+ * Measure the live box - projection.layout may or may not include the
656
+ * drag transform, depending on when it was measured.
1137
657
  */
1138
- skipAnimations?: boolean;
658
+ private snapToCursor;
1139
659
  /**
1140
- * Explicit override for SVG detection. When true, uses SVG rendering;
1141
- * when false, uses HTML rendering. If undefined, auto-detects.
660
+ * When the viewport resizes we want to check if the measured constraints
661
+ * have changed and, if so, reposition the element within those new constraints
662
+ * relative to where it was before the resize.
1142
663
  */
1143
- isSVG?: boolean;
664
+ scalePositionWithinConstraints(): void;
665
+ addListeners(): (() => void) | undefined;
666
+ getProps(): MotionNodeOptions;
1144
667
  }
1145
- interface VisualElementEventCallbacks {
1146
- BeforeLayoutMeasure: () => void;
1147
- LayoutMeasure: (layout: Box, prevLayout?: Box) => void;
1148
- LayoutUpdate: (layout: Axis, prevLayout: Axis) => void;
1149
- Update: (latest: ResolvedValues$1) => void;
1150
- AnimationStart: (definition: AnimationDefinition) => void;
1151
- AnimationComplete: (definition: AnimationDefinition) => void;
1152
- LayoutAnimationStart: () => void;
1153
- LayoutAnimationComplete: () => void;
1154
- SetAxisTarget: () => void;
1155
- Unmount: () => void;
668
+ declare function expectsResolvedDragConstraints({ dragConstraints, onMeasureDragConstraints, }: MotionNodeOptions): boolean;
669
+
670
+ type DragHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
671
+ type DragElastic = boolean | number | Partial<BoundingBox>;
672
+ interface ResolvedConstraints {
673
+ x: Partial<Axis>;
674
+ y: Partial<Axis>;
1156
675
  }
1157
- interface LayoutLifecycles {
1158
- onBeforeLayoutMeasure?(box: Box): void;
1159
- onLayoutMeasure?(box: Box, prevBox: Box): void;
676
+ interface ResolvedElastic {
677
+ x: Axis;
678
+ y: Axis;
1160
679
  }
1161
- type ScrapeMotionValuesFromProps = (props: MotionNodeOptions, prevProps: MotionNodeOptions, visualElement?: any) => {
1162
- [key: string]: MotionValue | AnyResolvedKeyframe;
1163
- };
1164
- type UseRenderState<RenderState = any> = () => RenderState;
1165
680
  /**
1166
- * Animation type for variant state management
681
+ * A constraint drag hands the pointer to, rather than clamping each axis
682
+ * to a box. Drag writes the pointer's position (in `x`/`y` motion value
683
+ * space) to `x` and `y`, then calls `move()`, which sets the motion values.
684
+ * On release, `release()` takes over with the release velocity (masked by
685
+ * the drag axes, direction lock and `dragMomentum`) and the inertia
686
+ * options, and drag fires `onDragTransitionEnd` once it resolves.
1167
687
  */
1168
- type AnimationType = "animate" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "exit";
1169
- interface FeatureClass<Props = unknown> {
1170
- new (props: Props): any;
1171
- }
1172
- interface FeatureDefinition {
1173
- isEnabled: (props: MotionNodeOptions) => boolean;
1174
- Feature?: FeatureClass<unknown>;
1175
- ProjectionNode?: any;
1176
- MeasureLayout?: any;
1177
- }
1178
- type FeatureDefinitions = {
1179
- animation?: FeatureDefinition;
1180
- exit?: FeatureDefinition;
1181
- drag?: FeatureDefinition;
1182
- tap?: FeatureDefinition;
1183
- focus?: FeatureDefinition;
1184
- hover?: FeatureDefinition;
1185
- pan?: FeatureDefinition;
1186
- inView?: FeatureDefinition;
1187
- layout?: FeatureDefinition;
1188
- };
1189
-
1190
- interface TransformOrigin {
1191
- originX?: number | string;
1192
- originY?: number | string;
1193
- originZ?: number | string;
688
+ interface DragPointConstraint extends Point {
689
+ move(): void;
690
+ release(velocity: Point, transition: InertiaOptions): Promise<unknown>;
1194
691
  }
1195
- interface HTMLRenderState {
1196
- /**
1197
- * A mutable record of transforms we want to apply directly to the rendered Element
1198
- * every frame. We use a mutable data structure to reduce GC during animations.
1199
- */
1200
- transform: ResolvedValues$1;
1201
- /**
1202
- * A mutable record of transform origins we want to apply directly to the rendered Element
1203
- * every frame. We use a mutable data structure to reduce GC during animations.
1204
- */
1205
- transformOrigin: TransformOrigin;
692
+ /**
693
+ * What a drag gives a `DragConstraintsFunction` when it starts.
694
+ */
695
+ interface DragConstraintsContext {
696
+ visualElement: VisualElementDragControls["visualElement"];
1206
697
  /**
1207
- * A mutable record of styles we want to apply directly to the rendered Element
1208
- * every frame. We use a mutable data structure to reduce GC during animations.
698
+ * The `x`/`y` values the drag started from. A layout change mid-drag
699
+ * shifts them to keep the element where it's drawn.
1209
700
  */
1210
- style: ResolvedValues$1;
701
+ originPoint: Point;
1211
702
  /**
1212
- * A mutable record of CSS variables we want to apply directly to the rendered Element
1213
- * every frame. We use a mutable data structure to reduce GC during animations.
703
+ * The per-axis, per-side elastic.
1214
704
  */
1215
- vars: ResolvedValues$1;
705
+ elastic: VisualElementDragControls["elastic"];
706
+ getAxisMotionValue: VisualElementDragControls["getAxisMotionValue"];
1216
707
  }
708
+ /**
709
+ * Called when a drag starts, after the drag's origin and elastic are
710
+ * resolved.
711
+ */
712
+ type DragConstraintsFunction = (controls: DragConstraintsContext) => DragPointConstraint;
1217
713
 
1218
- interface SVGRenderState extends HTMLRenderState {
1219
- /**
1220
- * A mutable record of attributes we want to apply directly to the rendered Element
1221
- * every frame. We use a mutable data structure to reduce GC during animations.
1222
- */
1223
- attrs: ResolvedValues$1;
714
+ interface EventInfo {
715
+ point: Point;
1224
716
  }
1225
- interface SVGAttributes {
1226
- accentHeight?: AnyResolvedKeyframe | undefined;
1227
- accumulate?: "none" | "sum" | undefined;
1228
- additive?: "replace" | "sum" | undefined;
1229
- alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
1230
- allowReorder?: "no" | "yes" | undefined;
1231
- alphabetic?: AnyResolvedKeyframe | undefined;
1232
- amplitude?: AnyResolvedKeyframe | undefined;
1233
- arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
1234
- ascent?: AnyResolvedKeyframe | undefined;
1235
- attributeName?: string | undefined;
1236
- attributeType?: string | undefined;
1237
- autoReverse?: boolean | undefined;
1238
- azimuth?: AnyResolvedKeyframe | undefined;
1239
- baseFrequency?: AnyResolvedKeyframe | undefined;
1240
- baselineShift?: AnyResolvedKeyframe | undefined;
1241
- baseProfile?: AnyResolvedKeyframe | undefined;
1242
- bbox?: AnyResolvedKeyframe | undefined;
1243
- begin?: AnyResolvedKeyframe | undefined;
1244
- bias?: AnyResolvedKeyframe | undefined;
1245
- by?: AnyResolvedKeyframe | undefined;
1246
- calcMode?: AnyResolvedKeyframe | undefined;
1247
- capHeight?: AnyResolvedKeyframe | undefined;
1248
- clip?: AnyResolvedKeyframe | undefined;
1249
- clipPath?: string | undefined;
1250
- clipPathUnits?: AnyResolvedKeyframe | undefined;
1251
- clipRule?: AnyResolvedKeyframe | undefined;
1252
- colorInterpolation?: AnyResolvedKeyframe | undefined;
1253
- colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
1254
- colorProfile?: AnyResolvedKeyframe | undefined;
1255
- colorRendering?: AnyResolvedKeyframe | undefined;
1256
- contentScriptType?: AnyResolvedKeyframe | undefined;
1257
- contentStyleType?: AnyResolvedKeyframe | undefined;
1258
- cursor?: AnyResolvedKeyframe | undefined;
1259
- cx?: AnyResolvedKeyframe | undefined;
1260
- cy?: AnyResolvedKeyframe | undefined;
1261
- d?: string | undefined;
1262
- decelerate?: AnyResolvedKeyframe | undefined;
1263
- descent?: AnyResolvedKeyframe | undefined;
1264
- diffuseConstant?: AnyResolvedKeyframe | undefined;
1265
- direction?: AnyResolvedKeyframe | undefined;
1266
- display?: AnyResolvedKeyframe | undefined;
1267
- divisor?: AnyResolvedKeyframe | undefined;
1268
- dominantBaseline?: AnyResolvedKeyframe | undefined;
1269
- dur?: AnyResolvedKeyframe | undefined;
1270
- dx?: AnyResolvedKeyframe | undefined;
1271
- dy?: AnyResolvedKeyframe | undefined;
1272
- edgeMode?: AnyResolvedKeyframe | undefined;
1273
- elevation?: AnyResolvedKeyframe | undefined;
1274
- enableBackground?: AnyResolvedKeyframe | undefined;
1275
- end?: AnyResolvedKeyframe | undefined;
1276
- exponent?: AnyResolvedKeyframe | undefined;
1277
- externalResourcesRequired?: boolean | undefined;
1278
- fill?: string | undefined;
1279
- fillOpacity?: AnyResolvedKeyframe | undefined;
1280
- fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
1281
- filter?: string | undefined;
1282
- filterRes?: AnyResolvedKeyframe | undefined;
1283
- filterUnits?: AnyResolvedKeyframe | undefined;
1284
- floodColor?: AnyResolvedKeyframe | undefined;
1285
- floodOpacity?: AnyResolvedKeyframe | undefined;
1286
- focusable?: boolean | "auto" | undefined;
1287
- fontFamily?: string | undefined;
1288
- fontSize?: AnyResolvedKeyframe | undefined;
1289
- fontSizeAdjust?: AnyResolvedKeyframe | undefined;
1290
- fontStretch?: AnyResolvedKeyframe | undefined;
1291
- fontStyle?: AnyResolvedKeyframe | undefined;
1292
- fontVariant?: AnyResolvedKeyframe | undefined;
1293
- fontWeight?: AnyResolvedKeyframe | undefined;
1294
- format?: AnyResolvedKeyframe | undefined;
1295
- fr?: AnyResolvedKeyframe | undefined;
1296
- from?: AnyResolvedKeyframe | undefined;
1297
- fx?: AnyResolvedKeyframe | undefined;
1298
- fy?: AnyResolvedKeyframe | undefined;
1299
- g1?: AnyResolvedKeyframe | undefined;
1300
- g2?: AnyResolvedKeyframe | undefined;
1301
- glyphName?: AnyResolvedKeyframe | undefined;
1302
- glyphOrientationHorizontal?: AnyResolvedKeyframe | undefined;
1303
- glyphOrientationVertical?: AnyResolvedKeyframe | undefined;
1304
- glyphRef?: AnyResolvedKeyframe | undefined;
1305
- gradientTransform?: string | undefined;
1306
- gradientUnits?: string | undefined;
1307
- hanging?: AnyResolvedKeyframe | undefined;
1308
- horizAdvX?: AnyResolvedKeyframe | undefined;
1309
- horizOriginX?: AnyResolvedKeyframe | undefined;
1310
- href?: string | undefined;
1311
- ideographic?: AnyResolvedKeyframe | undefined;
1312
- imageRendering?: AnyResolvedKeyframe | undefined;
1313
- in2?: AnyResolvedKeyframe | undefined;
1314
- in?: string | undefined;
1315
- intercept?: AnyResolvedKeyframe | undefined;
1316
- k1?: AnyResolvedKeyframe | undefined;
1317
- k2?: AnyResolvedKeyframe | undefined;
1318
- k3?: AnyResolvedKeyframe | undefined;
1319
- k4?: AnyResolvedKeyframe | undefined;
1320
- k?: AnyResolvedKeyframe | undefined;
1321
- kernelMatrix?: AnyResolvedKeyframe | undefined;
1322
- kernelUnitLength?: AnyResolvedKeyframe | undefined;
1323
- kerning?: AnyResolvedKeyframe | undefined;
1324
- keyPoints?: AnyResolvedKeyframe | undefined;
1325
- keySplines?: AnyResolvedKeyframe | undefined;
1326
- keyTimes?: AnyResolvedKeyframe | undefined;
1327
- lengthAdjust?: AnyResolvedKeyframe | undefined;
1328
- letterSpacing?: AnyResolvedKeyframe | undefined;
1329
- lightingColor?: AnyResolvedKeyframe | undefined;
1330
- limitingConeAngle?: AnyResolvedKeyframe | undefined;
1331
- local?: AnyResolvedKeyframe | undefined;
1332
- markerEnd?: string | undefined;
1333
- markerHeight?: AnyResolvedKeyframe | undefined;
1334
- markerMid?: string | undefined;
1335
- markerStart?: string | undefined;
1336
- markerUnits?: AnyResolvedKeyframe | undefined;
1337
- markerWidth?: AnyResolvedKeyframe | undefined;
1338
- mask?: string | undefined;
1339
- maskContentUnits?: AnyResolvedKeyframe | undefined;
1340
- maskUnits?: AnyResolvedKeyframe | undefined;
1341
- mathematical?: AnyResolvedKeyframe | undefined;
1342
- mode?: AnyResolvedKeyframe | undefined;
1343
- numOctaves?: AnyResolvedKeyframe | undefined;
1344
- offset?: AnyResolvedKeyframe | undefined;
1345
- opacity?: AnyResolvedKeyframe | undefined;
1346
- operator?: AnyResolvedKeyframe | undefined;
1347
- order?: AnyResolvedKeyframe | undefined;
1348
- orient?: AnyResolvedKeyframe | undefined;
1349
- orientation?: AnyResolvedKeyframe | undefined;
1350
- origin?: AnyResolvedKeyframe | undefined;
1351
- overflow?: AnyResolvedKeyframe | undefined;
1352
- overlinePosition?: AnyResolvedKeyframe | undefined;
1353
- overlineThickness?: AnyResolvedKeyframe | undefined;
1354
- paintOrder?: AnyResolvedKeyframe | undefined;
1355
- panose1?: AnyResolvedKeyframe | undefined;
1356
- path?: string | undefined;
1357
- pathLength?: AnyResolvedKeyframe | undefined;
1358
- patternContentUnits?: string | undefined;
1359
- patternTransform?: AnyResolvedKeyframe | undefined;
1360
- patternUnits?: string | undefined;
1361
- pointerEvents?: AnyResolvedKeyframe | undefined;
1362
- points?: string | undefined;
1363
- pointsAtX?: AnyResolvedKeyframe | undefined;
1364
- pointsAtY?: AnyResolvedKeyframe | undefined;
1365
- pointsAtZ?: AnyResolvedKeyframe | undefined;
1366
- preserveAlpha?: boolean | undefined;
1367
- preserveAspectRatio?: string | undefined;
1368
- primitiveUnits?: AnyResolvedKeyframe | undefined;
1369
- r?: AnyResolvedKeyframe | undefined;
1370
- radius?: AnyResolvedKeyframe | undefined;
1371
- refX?: AnyResolvedKeyframe | undefined;
1372
- refY?: AnyResolvedKeyframe | undefined;
1373
- renderingIntent?: AnyResolvedKeyframe | undefined;
1374
- repeatCount?: AnyResolvedKeyframe | undefined;
1375
- repeatDur?: AnyResolvedKeyframe | undefined;
1376
- requiredExtensions?: AnyResolvedKeyframe | undefined;
1377
- requiredFeatures?: AnyResolvedKeyframe | undefined;
1378
- restart?: AnyResolvedKeyframe | undefined;
1379
- result?: string | undefined;
1380
- rotate?: AnyResolvedKeyframe | undefined;
1381
- rx?: AnyResolvedKeyframe | undefined;
1382
- ry?: AnyResolvedKeyframe | undefined;
1383
- scale?: AnyResolvedKeyframe | undefined;
1384
- seed?: AnyResolvedKeyframe | undefined;
1385
- shapeRendering?: AnyResolvedKeyframe | undefined;
1386
- slope?: AnyResolvedKeyframe | undefined;
1387
- spacing?: AnyResolvedKeyframe | undefined;
1388
- specularConstant?: AnyResolvedKeyframe | undefined;
1389
- specularExponent?: AnyResolvedKeyframe | undefined;
1390
- speed?: AnyResolvedKeyframe | undefined;
1391
- spreadMethod?: string | undefined;
1392
- startOffset?: AnyResolvedKeyframe | undefined;
1393
- stdDeviation?: AnyResolvedKeyframe | undefined;
1394
- stemh?: AnyResolvedKeyframe | undefined;
1395
- stemv?: AnyResolvedKeyframe | undefined;
1396
- stitchTiles?: AnyResolvedKeyframe | undefined;
1397
- stopColor?: string | undefined;
1398
- stopOpacity?: AnyResolvedKeyframe | undefined;
1399
- strikethroughPosition?: AnyResolvedKeyframe | undefined;
1400
- strikethroughThickness?: AnyResolvedKeyframe | undefined;
1401
- string?: AnyResolvedKeyframe | undefined;
1402
- stroke?: string | undefined;
1403
- strokeDasharray?: AnyResolvedKeyframe | undefined;
1404
- strokeDashoffset?: AnyResolvedKeyframe | undefined;
1405
- strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
1406
- strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
1407
- strokeMiterlimit?: AnyResolvedKeyframe | undefined;
1408
- strokeOpacity?: AnyResolvedKeyframe | undefined;
1409
- strokeWidth?: AnyResolvedKeyframe | undefined;
1410
- surfaceScale?: AnyResolvedKeyframe | undefined;
1411
- systemLanguage?: AnyResolvedKeyframe | undefined;
1412
- tableValues?: AnyResolvedKeyframe | undefined;
1413
- targetX?: AnyResolvedKeyframe | undefined;
1414
- targetY?: AnyResolvedKeyframe | undefined;
1415
- textAnchor?: string | undefined;
1416
- textDecoration?: AnyResolvedKeyframe | undefined;
1417
- textLength?: AnyResolvedKeyframe | undefined;
1418
- textRendering?: AnyResolvedKeyframe | undefined;
1419
- to?: AnyResolvedKeyframe | undefined;
1420
- transform?: string | undefined;
1421
- u1?: AnyResolvedKeyframe | undefined;
1422
- u2?: AnyResolvedKeyframe | undefined;
1423
- underlinePosition?: AnyResolvedKeyframe | undefined;
1424
- underlineThickness?: AnyResolvedKeyframe | undefined;
1425
- unicode?: AnyResolvedKeyframe | undefined;
1426
- unicodeBidi?: AnyResolvedKeyframe | undefined;
1427
- unicodeRange?: AnyResolvedKeyframe | undefined;
1428
- unitsPerEm?: AnyResolvedKeyframe | undefined;
1429
- vAlphabetic?: AnyResolvedKeyframe | undefined;
1430
- values?: string | undefined;
1431
- vectorEffect?: AnyResolvedKeyframe | undefined;
1432
- version?: string | undefined;
1433
- vertAdvY?: AnyResolvedKeyframe | undefined;
1434
- vertOriginX?: AnyResolvedKeyframe | undefined;
1435
- vertOriginY?: AnyResolvedKeyframe | undefined;
1436
- vHanging?: AnyResolvedKeyframe | undefined;
1437
- vIdeographic?: AnyResolvedKeyframe | undefined;
1438
- viewBox?: string | undefined;
1439
- viewTarget?: AnyResolvedKeyframe | undefined;
1440
- visibility?: AnyResolvedKeyframe | undefined;
1441
- vMathematical?: AnyResolvedKeyframe | undefined;
1442
- widths?: AnyResolvedKeyframe | undefined;
1443
- wordSpacing?: AnyResolvedKeyframe | undefined;
1444
- writingMode?: AnyResolvedKeyframe | undefined;
1445
- x1?: AnyResolvedKeyframe | undefined;
1446
- x2?: AnyResolvedKeyframe | undefined;
1447
- x?: AnyResolvedKeyframe | undefined;
1448
- xChannelSelector?: string | undefined;
1449
- xHeight?: AnyResolvedKeyframe | undefined;
1450
- xlinkActuate?: string | undefined;
1451
- xlinkArcrole?: string | undefined;
1452
- xlinkHref?: string | undefined;
1453
- xlinkRole?: string | undefined;
1454
- xlinkShow?: string | undefined;
1455
- xlinkTitle?: string | undefined;
1456
- xlinkType?: string | undefined;
1457
- xmlBase?: string | undefined;
1458
- xmlLang?: string | undefined;
1459
- xmlns?: string | undefined;
1460
- xmlnsXlink?: string | undefined;
1461
- xmlSpace?: string | undefined;
1462
- y1?: AnyResolvedKeyframe | undefined;
1463
- y2?: AnyResolvedKeyframe | undefined;
1464
- y?: AnyResolvedKeyframe | undefined;
1465
- yChannelSelector?: string | undefined;
1466
- z?: AnyResolvedKeyframe | undefined;
1467
- zoomAndPan?: string | undefined;
717
+ /**
718
+ * A generic set of string/number values
719
+ */
720
+ interface ResolvedValues$1 {
721
+ [key: string]: AnyResolvedKeyframe;
1468
722
  }
723
+ type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
724
+ /**
725
+ * An object that specifies values to animate to. Each value may be set either as
726
+ * a single value, or an array of values.
727
+ *
728
+ * It may also option contain these properties:
729
+ *
730
+ * - `transition`: Specifies transitions for all or individual values.
731
+ * - `transitionEnd`: Specifies values to set when the animation finishes.
732
+ *
733
+ * ```jsx
734
+ * const target = {
735
+ * x: "0%",
736
+ * opacity: 0,
737
+ * transition: { duration: 1 },
738
+ * transitionEnd: { display: "none" }
739
+ * }
740
+ * ```
741
+ *
742
+ * @public
743
+ */
744
+ type TargetAndTransition = Target & {
745
+ transition?: Transition;
746
+ transitionEnd?: ResolvedValues$1;
747
+ };
748
+ type TargetResolver = (custom: any, current: ResolvedValues$1, velocity: ResolvedValues$1) => TargetAndTransition | string;
749
+ /**
750
+ * Either a string, or array of strings, that reference variants defined via the `variants` prop.
751
+ * @public
752
+ */
753
+ type VariantLabels = string | string[];
754
+ type Variant = TargetAndTransition | TargetResolver;
755
+ interface Variants {
756
+ [key: string]: Variant;
757
+ }
758
+ /**
759
+ * @deprecated
760
+ */
761
+ type LegacyAnimationControls = {
762
+ /**
763
+ * Subscribes a component's animation controls to this.
764
+ *
765
+ * @param controls - The controls to subscribe
766
+ * @returns An unsubscribe function.
767
+ */
768
+ subscribe(visualElement: any): () => void;
769
+ /**
770
+ * Starts an animation on all linked components.
771
+ *
772
+ * @remarks
773
+ *
774
+ * ```jsx
775
+ * controls.start("variantLabel")
776
+ * controls.start({
777
+ * x: 0,
778
+ * transition: { duration: 1 }
779
+ * })
780
+ * ```
781
+ *
782
+ * @param definition - Properties or variant label to animate to
783
+ * @param transition - Optional `transition` to apply to a variant
784
+ * @returns - A `Promise` that resolves when all animations have completed.
785
+ *
786
+ * @public
787
+ */
788
+ start(definition: AnimationDefinition, transitionOverride?: Transition): Promise<any>;
789
+ /**
790
+ * Instantly set to a set of properties or a variant.
791
+ *
792
+ * ```jsx
793
+ * // With properties
794
+ * controls.set({ opacity: 0 })
795
+ *
796
+ * // With variants
797
+ * controls.set("hidden")
798
+ * ```
799
+ *
800
+ * @privateRemarks
801
+ * We could perform a similar trick to `.start` where this can be called before mount
802
+ * and we maintain a list of pending actions that get applied on mount. But the
803
+ * expectation of `set` is that it happens synchronously and this would be difficult
804
+ * to do before any children have even attached themselves. It's also poor practice
805
+ * and we should discourage render-synchronous `.start` calls rather than lean into this.
806
+ *
807
+ * @public
808
+ */
809
+ set(definition: AnimationDefinition): void;
810
+ /**
811
+ * Stops animations on all linked components.
812
+ *
813
+ * ```jsx
814
+ * controls.stop()
815
+ * ```
816
+ *
817
+ * @public
818
+ */
819
+ stop(): void;
820
+ mount(): () => void;
821
+ };
822
+ interface MotionNodeAnimationOptions {
823
+ /**
824
+ * Properties, variant label or array of variant labels to start in.
825
+ *
826
+ * Set to `false` to initialise with the values in `animate` (disabling the mount animation)
827
+ *
828
+ * ```jsx
829
+ * // As values
830
+ * <motion.div initial={{ opacity: 1 }} />
831
+ *
832
+ * // As variant
833
+ * <motion.div initial="visible" variants={variants} />
834
+ *
835
+ * // Multiple variants
836
+ * <motion.div initial={["visible", "active"]} variants={variants} />
837
+ *
838
+ * // As false (disable mount animation)
839
+ * <motion.div initial={false} animate={{ opacity: 0 }} />
840
+ * ```
841
+ */
842
+ initial?: TargetAndTransition | VariantLabels | boolean;
843
+ /**
844
+ * Values to animate to, variant label(s), or `LegacyAnimationControls`.
845
+ *
846
+ * ```jsx
847
+ * // As values
848
+ * <motion.div animate={{ opacity: 1 }} />
849
+ *
850
+ * // As variant
851
+ * <motion.div animate="visible" variants={variants} />
852
+ *
853
+ * // Multiple variants
854
+ * <motion.div animate={["visible", "active"]} variants={variants} />
855
+ *
856
+ * // LegacyAnimationControls
857
+ * <motion.div animate={animation} />
858
+ * ```
859
+ */
860
+ animate?: TargetAndTransition | VariantLabels | boolean | LegacyAnimationControls;
861
+ /**
862
+ * A target to animate to when this component is removed from the tree.
863
+ *
864
+ * This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
865
+ *
866
+ * This limitation exists because React doesn't allow components to defer unmounting until after
867
+ * an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
868
+ *
869
+ * ```jsx
870
+ * import { AnimatePresence, motion } from 'framer-motion'
871
+ *
872
+ * export const MyComponent = ({ isVisible }) => {
873
+ * return (
874
+ * <AnimatePresence>
875
+ * {isVisible && (
876
+ * <motion.div
877
+ * initial={{ opacity: 0 }}
878
+ * animate={{ opacity: 1 }}
879
+ * exit={{ opacity: 0 }}
880
+ * />
881
+ * )}
882
+ * </AnimatePresence>
883
+ * )
884
+ * }
885
+ * ```
886
+ */
887
+ exit?: TargetAndTransition | VariantLabels;
888
+ /**
889
+ * Variants allow you to define animation states and organise them by name. They allow
890
+ * you to control animations throughout a component tree by switching a single `animate` prop.
891
+ *
892
+ * Using `transition` options like `delayChildren` and `when`, you can orchestrate
893
+ * when children animations play relative to their parent.
1469
894
 
1470
- interface VisualElementAnimationOptions {
1471
- delay?: number;
1472
- transitionOverride?: Transition;
1473
- custom?: any;
1474
- type?: AnimationType;
895
+ *
896
+ * After passing variants to one or more `motion` component's `variants` prop, these variants
897
+ * can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
898
+ *
899
+ * ```jsx
900
+ * const variants = {
901
+ * active: {
902
+ * backgroundColor: "#f00"
903
+ * },
904
+ * inactive: {
905
+ * backgroundColor: "#fff",
906
+ * transition: { duration: 2 }
907
+ * }
908
+ * }
909
+ *
910
+ * <motion.div variants={variants} animate="active" />
911
+ * ```
912
+ */
913
+ variants?: Variants;
914
+ /**
915
+ * Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
916
+ * ```jsx
917
+ * const spring = {
918
+ * type: "spring",
919
+ * damping: 10,
920
+ * stiffness: 100
921
+ * }
922
+ *
923
+ * <motion.div transition={spring} animate={{ scale: 1.2 }} />
924
+ * ```
925
+ */
926
+ transition?: Transition;
1475
927
  }
1476
-
1477
- interface AnimationState$1 {
1478
- animateChanges: (type?: AnimationType) => Promise<any>;
1479
- setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
1480
- setAnimateFunction: (fn: any) => void;
1481
- getState: () => {
1482
- [key: string]: AnimationTypeState;
1483
- };
1484
- reset: () => void;
928
+ interface MotionNodeEventOptions {
929
+ /**
930
+ * Callback with latest motion values, fired max once per frame.
931
+ *
932
+ * ```jsx
933
+ * function onUpdate(latest) {
934
+ * console.log(latest.x, latest.opacity)
935
+ * }
936
+ *
937
+ * <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
938
+ * ```
939
+ */
940
+ onUpdate?(latest: ResolvedValues$1): void;
941
+ /**
942
+ * Callback when animation defined in `animate` begins.
943
+ *
944
+ * The provided callback will be called with the triggering animation definition.
945
+ * If this is a variant, it'll be the variant name, and if a target object
946
+ * then it'll be the target object.
947
+ *
948
+ * This way, it's possible to figure out which animation has started.
949
+ *
950
+ * ```jsx
951
+ * function onStart() {
952
+ * console.log("Animation started")
953
+ * }
954
+ *
955
+ * <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
956
+ * ```
957
+ */
958
+ onAnimationStart?(definition: AnimationDefinition): void;
959
+ /**
960
+ * Callback when animation defined in `animate` is complete.
961
+ *
962
+ * The provided callback will be called with the triggering animation definition.
963
+ * If this is a variant, it'll be the variant name, and if a target object
964
+ * then it'll be the target object.
965
+ *
966
+ * This way, it's possible to figure out which animation has completed.
967
+ *
968
+ * ```jsx
969
+ * function onComplete() {
970
+ * console.log("Animation completed")
971
+ * }
972
+ *
973
+ * <motion.div
974
+ * animate={{ x: 100 }}
975
+ * onAnimationComplete={definition => {
976
+ * console.log('Completed animating', definition)
977
+ * }}
978
+ * />
979
+ * ```
980
+ */
981
+ onAnimationComplete?(definition: AnimationDefinition): void;
982
+ onBeforeLayoutMeasure?(box: Box): void;
983
+ onLayoutMeasure?(box: Box, prevBox: Box): void;
984
+ onLayoutAnimationStart?(): void;
985
+ onLayoutAnimationComplete?(): void;
986
+ }
987
+ interface MotionNodePanHandlers {
988
+ /**
989
+ * Callback function that fires when the pan gesture is recognised on this element.
990
+ *
991
+ * **Note:** For pan gestures to work correctly with touch input, the element needs
992
+ * touch scrolling to be disabled on either x/y or both axis with the
993
+ * [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
994
+ *
995
+ * ```jsx
996
+ * function onPan(event, info) {
997
+ * console.log(info.point.x, info.point.y)
998
+ * }
999
+ *
1000
+ * <motion.div onPan={onPan} />
1001
+ * ```
1002
+ *
1003
+ * @param event - The originating pointer event.
1004
+ * @param info - A {@link PanInfo} object containing `x` and `y` values for:
1005
+ *
1006
+ * - `point`: Relative to the device or page.
1007
+ * - `delta`: Distance moved since the last event.
1008
+ * - `offset`: Offset from the original pan event.
1009
+ * - `velocity`: Current velocity of the pointer.
1010
+ */
1011
+ onPan?(event: PointerEvent, info: PanInfo): void;
1012
+ /**
1013
+ * Callback function that fires when the pan gesture begins on this element.
1014
+ *
1015
+ * ```jsx
1016
+ * function onPanStart(event, info) {
1017
+ * console.log(info.point.x, info.point.y)
1018
+ * }
1019
+ *
1020
+ * <motion.div onPanStart={onPanStart} />
1021
+ * ```
1022
+ *
1023
+ * @param event - The originating pointer event.
1024
+ * @param info - A {@link PanInfo} object containing `x`/`y` values for:
1025
+ *
1026
+ * - `point`: Relative to the device or page.
1027
+ * - `delta`: Distance moved since the last event.
1028
+ * - `offset`: Offset from the original pan event.
1029
+ * - `velocity`: Current velocity of the pointer.
1030
+ */
1031
+ onPanStart?(event: PointerEvent, info: PanInfo): void;
1032
+ /**
1033
+ * Callback function that fires when we begin detecting a pan gesture. This
1034
+ * is analogous to `onMouseStart` or `onTouchStart`.
1035
+ *
1036
+ * ```jsx
1037
+ * function onPanSessionStart(event, info) {
1038
+ * console.log(info.point.x, info.point.y)
1039
+ * }
1040
+ *
1041
+ * <motion.div onPanSessionStart={onPanSessionStart} />
1042
+ * ```
1043
+ *
1044
+ * @param event - The originating pointer event.
1045
+ * @param info - An {@link EventInfo} object containing `x`/`y` values for:
1046
+ *
1047
+ * - `point`: Relative to the device or page.
1048
+ */
1049
+ onPanSessionStart?(event: PointerEvent, info: EventInfo): void;
1050
+ /**
1051
+ * Callback function that fires when the pan gesture ends on this element.
1052
+ *
1053
+ * ```jsx
1054
+ * function onPanEnd(event, info) {
1055
+ * console.log(info.point.x, info.point.y)
1056
+ * }
1057
+ *
1058
+ * <motion.div onPanEnd={onPanEnd} />
1059
+ * ```
1060
+ *
1061
+ * @param event - The originating pointer event.
1062
+ * @param info - A {@link PanInfo} object containing `x`/`y` values for:
1063
+ *
1064
+ * - `point`: Relative to the device or page.
1065
+ * - `delta`: Distance moved since the last event.
1066
+ * - `offset`: Offset from the original pan event.
1067
+ * - `velocity`: Current velocity of the pointer.
1068
+ */
1069
+ onPanEnd?(event: PointerEvent, info: PanInfo): void;
1485
1070
  }
1486
- type AnimationList = string[] | TargetAndTransition[];
1487
- /**
1488
- * Diffs the element's animation props (one layer per AnimationType, highest
1489
- * priority wins each value) against the previous call and starts animations
1490
- * for what changed.
1491
- *
1492
- * Uses `any` type for visualElement to avoid circular dependencies. It reads
1493
- * props, parent, presenceContext, variantChildren, enteringChildren,
1494
- * manuallyAnimateOnMount, blockInitialAnimation, getValue(),
1495
- * getBaseTargetFromProps(), baseTarget and initialValues.
1496
- */
1497
- declare function createAnimationState(visualElement: any): AnimationState$1;
1498
- declare function checkVariantsDidChange(prev: any, next: any): boolean;
1499
- interface AnimationTypeState {
1500
- isActive: boolean;
1501
- protectedKeys: {
1502
- [key: string]: true;
1503
- };
1504
- needsAnimating: {
1505
- [key: string]: boolean;
1506
- };
1507
- prevResolvedValues: {
1508
- [key: string]: any;
1509
- };
1071
+ interface MotionNodeHoverHandlers {
1510
1072
  /**
1511
- * The out transition of prevProp (#1725).
1073
+ * Properties or variant label to animate to while the hover gesture is recognised.
1074
+ *
1075
+ * ```jsx
1076
+ * <motion.div whileHover={{ scale: 1.2 }} />
1077
+ * ```
1512
1078
  */
1513
- prevOut?: any;
1079
+ whileHover?: VariantLabels | TargetAndTransition;
1514
1080
  /**
1515
- * Out transitions of the states that values flagged in needsAnimating
1516
- * are leaving (#1725).
1081
+ * Callback function that fires when pointer starts hovering over the component.
1082
+ *
1083
+ * ```jsx
1084
+ * <motion.div onHoverStart={() => console.log('Hover starts')} />
1085
+ * ```
1517
1086
  */
1518
- out: {
1519
- [key: string]: any;
1520
- };
1521
- prevProp?: VariantLabels | TargetAndTransition;
1087
+ onHoverStart?(event: PointerEvent, info: EventInfo): void;
1088
+ /**
1089
+ * Callback function that fires when pointer stops hovering over the component.
1090
+ *
1091
+ * ```jsx
1092
+ * <motion.div onHoverEnd={() => console.log("Hover ends")} />
1093
+ * ```
1094
+ */
1095
+ onHoverEnd?(event: PointerEvent, info: EventInfo): void;
1522
1096
  }
1523
-
1524
- /**
1525
- * Set feature definitions for all VisualElements.
1526
- * This should be called by the framework layer (e.g., framer-motion) during initialization.
1527
- */
1528
- declare function setFeatureDefinitions(definitions: Partial<FeatureDefinitions>): void;
1529
- /**
1530
- * Get the current feature definitions
1531
- */
1532
- declare function getFeatureDefinitions(): Partial<FeatureDefinitions>;
1533
- /**
1534
- * Motion style type - a subset of CSS properties that can contain motion values
1535
- */
1536
- type MotionStyle = {
1537
- [K: string]: AnyResolvedKeyframe | MotionValue | undefined;
1538
- };
1539
1097
  /**
1540
- * A VisualElement is an imperative abstraction around UI elements such as
1541
- * HTMLElement, SVGElement, Three.Object3D etc.
1098
+ * Passed in to tap event handlers like `onTap` the `TapInfo` object contains
1099
+ * information about the tap gesture such as it‘s location.
1100
+ *
1101
+ * ```jsx
1102
+ * function onTap(event, info) {
1103
+ * console.log(info.point.x, info.point.y)
1104
+ * }
1105
+ *
1106
+ * <motion.div onTap={onTap} />
1107
+ * ```
1108
+ *
1109
+ * @public
1542
1110
  */
1543
- declare abstract class VisualElement<Instance = unknown, RenderState = unknown, Options extends {} = {}> {
1111
+ interface TapInfo {
1544
1112
  /**
1545
- * VisualElements are arranged in trees mirroring that of the React tree.
1546
- * Each type of VisualElement has a unique name, to detect when we're crossing
1547
- * type boundaries within that tree.
1113
+ * Contains `x` and `y` values for the tap gesture relative to the
1114
+ * device or page.
1115
+ *
1116
+ * ```jsx
1117
+ * function onTapStart(event, info) {
1118
+ * console.log(info.point.x, info.point.y)
1119
+ * }
1120
+ *
1121
+ * <motion.div onTapStart={onTapStart} />
1122
+ * ```
1123
+ *
1124
+ * @public
1548
1125
  */
1549
- abstract type: string;
1126
+ point: Point;
1127
+ }
1128
+ interface MotionNodeTapHandlers {
1550
1129
  /**
1551
- * An `Array.sort` compatible function that will compare two Instances and
1552
- * compare their respective positions within the tree.
1130
+ * Callback when the tap gesture successfully ends on this element.
1131
+ *
1132
+ * ```jsx
1133
+ * function onTap(event, info) {
1134
+ * console.log(info.point.x, info.point.y)
1135
+ * }
1136
+ *
1137
+ * <motion.div onTap={onTap} />
1138
+ * ```
1139
+ *
1140
+ * @param event - The originating pointer event.
1141
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
1553
1142
  */
1554
- abstract sortInstanceNodePosition(a: Instance, b: Instance): number;
1143
+ onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
1555
1144
  /**
1556
- * Measure the viewport-relative bounding box of the Instance.
1145
+ * Callback when the tap gesture starts on this element.
1146
+ *
1147
+ * ```jsx
1148
+ * function onTapStart(event, info) {
1149
+ * console.log(info.point.x, info.point.y)
1150
+ * }
1151
+ *
1152
+ * <motion.div onTapStart={onTapStart} />
1153
+ * ```
1154
+ *
1155
+ * @param event - The originating pointer event.
1156
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
1557
1157
  */
1558
- abstract measureInstanceViewportBox(instance: Instance, props: MotionNodeOptions & Partial<MotionConfigContextProps>): Box;
1158
+ onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
1559
1159
  /**
1560
- * When a value has been removed from all animation props we need to
1561
- * pick a target to animate back to. For instance, for HTMLElements
1562
- * we can look in the style prop.
1160
+ * Callback when the tap gesture ends outside this element.
1161
+ *
1162
+ * ```jsx
1163
+ * function onTapCancel(event, info) {
1164
+ * console.log(info.point.x, info.point.y)
1165
+ * }
1166
+ *
1167
+ * <motion.div onTapCancel={onTapCancel} />
1168
+ * ```
1169
+ *
1170
+ * @param event - The originating pointer event.
1171
+ * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
1563
1172
  */
1564
- abstract getBaseTargetFromProps(props: MotionNodeOptions, key: string): AnyResolvedKeyframe | undefined | MotionValue;
1173
+ onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
1565
1174
  /**
1566
- * When we first animate to a value we need to animate it *from* a value.
1567
- * Often this have been specified via the initial prop but it might be
1568
- * that the value needs to be read from the Instance.
1175
+ * Properties or variant label to animate to while the component is pressed.
1176
+ *
1177
+ * ```jsx
1178
+ * <motion.div whileTap={{ scale: 0.8 }} />
1179
+ * ```
1569
1180
  */
1570
- abstract readValueFromInstance(instance: Instance, key: string, options: Options): AnyResolvedKeyframe | null | undefined;
1181
+ whileTap?: VariantLabels | TargetAndTransition;
1571
1182
  /**
1572
- * When a value has been removed from the VisualElement we use this to remove
1573
- * it from the inheriting class' unique render state.
1183
+ * If `true`, the tap gesture will attach its start listener to window.
1184
+ *
1185
+ * Note: This is not supported publicly.
1574
1186
  */
1575
- abstract removeValueFromRenderState(key: string, renderState: RenderState): void;
1187
+ globalTapTarget?: boolean;
1188
+ }
1189
+ /**
1190
+ * @deprecated - Use MotionNodeTapHandlers
1191
+ */
1192
+ interface TapHandlers extends MotionNodeTapHandlers {
1193
+ }
1194
+ interface MotionNodeFocusHandlers {
1576
1195
  /**
1577
- * Run before a React or VisualElement render, builds the latest motion
1578
- * values into an Instance-specific format. For example, HTMLVisualElement
1579
- * will use this step to build `style` and `var` values.
1196
+ * Properties or variant label to animate to while the focus gesture is recognised.
1197
+ *
1198
+ * ```jsx
1199
+ * <motion.input whileFocus={{ scale: 1.2 }} />
1200
+ * ```
1580
1201
  */
1581
- abstract build(renderState: RenderState, latestValues: ResolvedValues$1, props: MotionNodeOptions): void;
1202
+ whileFocus?: VariantLabels | TargetAndTransition;
1203
+ }
1204
+ /**
1205
+ * TODO: Replace with types from inView()
1206
+ */
1207
+ type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
1208
+ interface ViewportOptions {
1209
+ root?: {
1210
+ current: Element | null;
1211
+ };
1212
+ once?: boolean;
1213
+ margin?: string;
1214
+ amount?: "some" | "all" | number;
1215
+ }
1216
+ interface MotionNodeViewportOptions {
1217
+ whileInView?: VariantLabels | TargetAndTransition;
1218
+ onViewportEnter?: ViewportEventHandler;
1219
+ onViewportLeave?: ViewportEventHandler;
1220
+ viewport?: ViewportOptions;
1221
+ }
1222
+ interface MotionNodeDraggableOptions {
1582
1223
  /**
1583
- * Apply the built values to the Instance. For example, HTMLElements will have
1584
- * styles applied via `setProperty` and the style attribute, whereas SVGElements
1585
- * will have values applied to attributes.
1224
+ * Enable dragging for this element. Set to `false` by default.
1225
+ * Set `true` to drag in both directions.
1226
+ * Set `"x"` or `"y"` to only drag in a specific direction.
1227
+ *
1228
+ * ```jsx
1229
+ * <motion.div drag="x" />
1230
+ * ```
1231
+ */
1232
+ drag?: boolean | "x" | "y";
1233
+ /**
1234
+ * Properties or variant label to animate to while the drag gesture is recognised.
1235
+ *
1236
+ * ```jsx
1237
+ * <motion.div whileDrag={{ scale: 1.2 }} />
1238
+ * ```
1586
1239
  */
1587
- abstract renderInstance(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: any): void;
1240
+ whileDrag?: VariantLabels | TargetAndTransition;
1588
1241
  /**
1589
- * This method is called when a transform property is bound to a motion value.
1590
- * It's currently used to measure SVG elements when a new transform property is bound.
1242
+ * If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
1243
+ *
1244
+ * ```jsx
1245
+ * <motion.div drag dragDirectionLock />
1246
+ * ```
1591
1247
  */
1592
- onBindTransform?(): void;
1248
+ dragDirectionLock?: boolean;
1593
1249
  /**
1594
- * The value getValue starts a new motion value from when it isn't given
1595
- * a default. Without it, values start unread and the keyframe resolver
1596
- * reads their origin.
1250
+ * Allows drag gesture propagation to child components. Set to `false` by
1251
+ * default.
1252
+ *
1253
+ * ```jsx
1254
+ * <motion.div drag="x" dragPropagation />
1255
+ * ```
1597
1256
  */
1598
- getDefaultValue?(key: string): AnyResolvedKeyframe | undefined;
1257
+ dragPropagation?: boolean;
1599
1258
  /**
1600
- * If the component child is provided as a motion value, handle subscriptions
1601
- * with the renderer-specific VisualElement.
1259
+ * Applies constraints on the permitted draggable area.
1260
+ *
1261
+ * It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
1262
+ * This will define a distance from the named edge of the draggable component.
1263
+ *
1264
+ * Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
1265
+ * This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
1266
+ * of the component you want to use as constraints. The element itself can also be passed.
1267
+ *
1268
+ * ```jsx
1269
+ * // In pixels
1270
+ * <motion.div
1271
+ * drag="x"
1272
+ * dragConstraints={{ left: 0, right: 300 }}
1273
+ * />
1274
+ *
1275
+ * // As a ref to another component
1276
+ * const MyComponent = () => {
1277
+ * const constraintsRef = useRef(null)
1278
+ *
1279
+ * return (
1280
+ * <motion.div ref={constraintsRef}>
1281
+ * <motion.div drag dragConstraints={constraintsRef} />
1282
+ * </motion.div>
1283
+ * )
1284
+ * }
1285
+ * ```
1286
+ *
1287
+ * Or a function, called when each drag starts, that returns a
1288
+ * `DragPointConstraint`. Drag then hands it the pointer's position and
1289
+ * release velocity, and it moves the element itself.
1602
1290
  */
1603
- handleChildMotionValue?(): void;
1291
+ dragConstraints?: false | Partial<BoundingBox> | Element | {
1292
+ current: Element | null;
1293
+ } | DragConstraintsFunction;
1604
1294
  /**
1605
- * This method takes React props and returns found MotionValues. For example, HTML
1606
- * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
1295
+ * The degree of movement allowed outside constraints. 0 = no movement, 1 =
1296
+ * full movement.
1607
1297
  *
1608
- * This isn't an abstract method as it needs calling in the constructor, but it is
1609
- * intended to be one.
1298
+ * Set to `0.5` by default. Can also be set as `false` to disable movement.
1299
+ *
1300
+ * By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
1301
+ * per constraint. Any missing values will be set to `0`.
1302
+ *
1303
+ * ```jsx
1304
+ * <motion.div
1305
+ * drag
1306
+ * dragConstraints={{ left: 0, right: 300 }}
1307
+ * dragElastic={0.2}
1308
+ * />
1309
+ * ```
1610
1310
  */
1611
- scrapeMotionValuesFromProps(_props: MotionNodeOptions, _prevProps: MotionNodeOptions, _visualElement: VisualElement): {
1612
- [key: string]: MotionValue | AnyResolvedKeyframe;
1613
- };
1311
+ dragElastic?: DragElastic;
1614
1312
  /**
1615
- * A reference to the current underlying Instance, e.g. a HTMLElement
1616
- * or Three.Mesh etc.
1313
+ * Apply momentum from the pan gesture to the component when dragging
1314
+ * finishes. Set to `true` by default.
1315
+ *
1316
+ * ```jsx
1317
+ * <motion.div
1318
+ * drag
1319
+ * dragConstraints={{ left: 0, right: 300 }}
1320
+ * dragMomentum={false}
1321
+ * />
1322
+ * ```
1617
1323
  */
1618
- current: Instance | null;
1324
+ dragMomentum?: boolean;
1619
1325
  /**
1620
- * A reference to the parent VisualElement (if exists).
1326
+ * Allows you to change dragging inertia parameters.
1327
+ * 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.
1328
+ * See {@link https://motion.dev/docs/react-motion-component#dragtransition | Inertia} for all properties you can use.
1329
+ *
1330
+ * ```jsx
1331
+ * <motion.div
1332
+ * drag
1333
+ * dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
1334
+ * />
1335
+ * ```
1621
1336
  */
1622
- parent: VisualElement | undefined;
1337
+ dragTransition?: InertiaOptions;
1623
1338
  /**
1624
- * A set containing references to this VisualElement's children.
1339
+ * Usually, dragging is initiated by pressing down on a component and moving it. For some
1340
+ * use-cases, for instance clicking at an arbitrary point on a video scrubber, we
1341
+ * might want to initiate dragging from a different component than the draggable one.
1342
+ *
1343
+ * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
1344
+ * the draggable component's `dragControls` prop. It exposes a `start` method
1345
+ * that can start dragging from pointer events on other components.
1346
+ *
1347
+ * ```jsx
1348
+ * const dragControls = useDragControls()
1349
+ *
1350
+ * function startDrag(event) {
1351
+ * dragControls.start(event, { snapToCursor: true })
1352
+ * }
1353
+ *
1354
+ * return (
1355
+ * <>
1356
+ * <div onPointerDown={startDrag} />
1357
+ * <motion.div drag="x" dragControls={dragControls} />
1358
+ * </>
1359
+ * )
1360
+ * ```
1625
1361
  */
1626
- children: Set<VisualElement<unknown, unknown, {}>>;
1362
+ dragControls?: any;
1627
1363
  /**
1628
- * A set containing the latest children of this VisualElement. This is flushed
1629
- * at the start of every commit. We use it to calculate the stagger delay
1630
- * for newly-added children.
1364
+ * If `true`, element will snap back to its origin when dragging ends.
1365
+ * Set to `"x"` or `"y"` to only snap back on a specific axis.
1366
+ *
1367
+ * Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
1368
+ * with `dragElastic={1}`, but when used together `dragConstraints` can define
1369
+ * a wider draggable area and `dragSnapToOrigin` will ensure the element
1370
+ * animates back to its origin on release.
1631
1371
  */
1632
- enteringChildren?: Set<VisualElement>;
1372
+ dragSnapToOrigin?: boolean | "x" | "y";
1633
1373
  /**
1634
- * The depth of this VisualElement within the overall VisualElement tree.
1374
+ * By default, if `drag` is defined on a component then an event listener will be attached
1375
+ * to automatically initiate dragging when a user presses down on it.
1376
+ *
1377
+ * By setting `dragListener` to `false`, this event listener will not be created.
1378
+ *
1379
+ * ```jsx
1380
+ * const dragControls = useDragControls()
1381
+ *
1382
+ * function startDrag(event) {
1383
+ * dragControls.start(event, { snapToCursor: true })
1384
+ * }
1385
+ *
1386
+ * return (
1387
+ * <>
1388
+ * <div onPointerDown={startDrag} />
1389
+ * <motion.div
1390
+ * drag="x"
1391
+ * dragControls={dragControls}
1392
+ * dragListener={false}
1393
+ * />
1394
+ * </>
1395
+ * )
1396
+ * ```
1635
1397
  */
1636
- depth: number;
1398
+ dragListener?: boolean;
1637
1399
  /**
1638
- * The current render state of this VisualElement. Defined by inheriting VisualElements.
1400
+ * If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
1401
+ *
1402
+ * @public
1639
1403
  */
1640
- renderState: RenderState;
1404
+ onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
1641
1405
  /**
1642
- * An object containing the latest static values for each of this VisualElement's
1643
- * MotionValues.
1406
+ * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
1407
+ * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
1408
+ * This allows you to manually control how updates from a drag gesture on an element is applied.
1409
+ *
1410
+ * @public
1644
1411
  */
1645
- latestValues: ResolvedValues$1;
1412
+ _dragX?: MotionValue<number>;
1646
1413
  /**
1647
- * Determine what role this visual element should take in the variant tree.
1414
+ * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
1415
+ * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
1416
+ * This allows you to manually control how updates from a drag gesture on an element is applied.
1417
+ *
1418
+ * @public
1648
1419
  */
1649
- isVariantNode: boolean;
1650
- isControllingVariants: boolean;
1420
+ _dragY?: MotionValue<number>;
1421
+ }
1422
+ interface MotionNodeDragHandlers {
1651
1423
  /**
1652
- * If this component is part of the variant tree, it should track
1653
- * any children that are also part of the tree. This is essentially
1654
- * a shadow tree to simplify logic around how to stagger over children.
1424
+ * Callback function that fires when dragging starts.
1425
+ *
1426
+ * ```jsx
1427
+ * <motion.div
1428
+ * drag
1429
+ * onDragStart={
1430
+ * (event, info) => console.log(info.point.x, info.point.y)
1431
+ * }
1432
+ * />
1433
+ * ```
1434
+ *
1435
+ * @public
1655
1436
  */
1656
- variantChildren?: Set<VisualElement>;
1437
+ onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
1657
1438
  /**
1658
- * Decides whether this VisualElement should animate in reduced motion
1659
- * mode.
1439
+ * Callback function that fires when dragging ends.
1660
1440
  *
1661
- * TODO: This is currently set on every individual VisualElement but feels
1662
- * like it could be set globally.
1441
+ * ```jsx
1442
+ * <motion.div
1443
+ * drag
1444
+ * onDragEnd={
1445
+ * (event, info) => console.log(info.point.x, info.point.y)
1446
+ * }
1447
+ * />
1448
+ * ```
1449
+ *
1450
+ * @public
1663
1451
  */
1664
- shouldReduceMotion: boolean | null;
1452
+ onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
1665
1453
  /**
1666
- * Decides whether animations should be skipped for this VisualElement.
1667
- * Useful for E2E tests and visual regression testing.
1454
+ * Callback function that fires when the component is dragged.
1455
+ *
1456
+ * ```jsx
1457
+ * <motion.div
1458
+ * drag
1459
+ * onDrag={
1460
+ * (event, info) => console.log(info.point.x, info.point.y)
1461
+ * }
1462
+ * />
1463
+ * ```
1464
+ *
1465
+ * @public
1668
1466
  */
1669
- shouldSkipAnimations: boolean;
1467
+ onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
1670
1468
  /**
1671
- * Normally, if a component is controlled by a parent's variants, it can
1672
- * rely on that ancestor to trigger animations further down the tree.
1673
- * However, if a component is created after its parent is mounted, the parent
1674
- * won't trigger that mount animation so the child needs to.
1469
+ * Callback function that fires a drag direction is determined.
1470
+ *
1471
+ * ```jsx
1472
+ * <motion.div
1473
+ * drag
1474
+ * dragDirectionLock
1475
+ * onDirectionLock={axis => console.log(axis)}
1476
+ * />
1477
+ * ```
1675
1478
  *
1676
- * TODO: This might be better replaced with a method isParentMounted
1677
- */
1678
- manuallyAnimateOnMount: boolean;
1679
- /**
1680
- * This can be set by AnimatePresence to force components that mount
1681
- * at the same time as it to mount as if they have initial={false} set.
1682
- */
1683
- blockInitialAnimation: boolean;
1684
- /**
1685
- * A reference to this VisualElement's projection node, used in layout animations.
1479
+ * @public
1686
1480
  */
1687
- projection?: any;
1481
+ onDirectionLock?(axis: "x" | "y"): void;
1688
1482
  /**
1689
- * A map of all motion values attached to this visual element. Motion
1690
- * values are source of truth for any given animated value. A motion
1691
- * value might be provided externally by the component via props.
1483
+ * Callback function that fires when drag momentum/bounce transition finishes.
1484
+ *
1485
+ * ```jsx
1486
+ * <motion.div
1487
+ * drag
1488
+ * onDragTransitionEnd={() => console.log('Drag transition complete')}
1489
+ * />
1490
+ * ```
1491
+ *
1492
+ * @public
1692
1493
  */
1693
- values: Map<string, MotionValue<any>>;
1494
+ onDragTransitionEnd?(): void;
1495
+ }
1496
+ interface MotionNodeLayoutOptions {
1694
1497
  /**
1695
- * The AnimationState, this is hydrated by the animation Feature.
1498
+ * If `true`, this component will automatically animate to its new position when
1499
+ * its layout changes.
1500
+ *
1501
+ * ```jsx
1502
+ * <motion.div layout />
1503
+ * ```
1504
+ *
1505
+ * This will perform a layout animation using performant transforms. Part of this technique
1506
+ * involved animating an element's scale. This can introduce visual distortions on children,
1507
+ * `boxShadow` and `borderRadius`.
1508
+ *
1509
+ * To correct distortion on immediate children, add `layout` to those too.
1510
+ *
1511
+ * `boxShadow` and `borderRadius` will automatically be corrected if they are already being
1512
+ * animated on this component. Otherwise, set them directly via the `initial` prop.
1513
+ *
1514
+ * If `layout` is set to `"position"`, the size of the component will change instantly and
1515
+ * only its position will animate.
1516
+ *
1517
+ * If `layout` is set to `"size"`, the position of the component will change instantly and
1518
+ * only its size will animate.
1519
+ *
1520
+ * If `layout` is set to `"preserve-aspect"`, the component will animate size & position if
1521
+ * the aspect ratio remains the same between renders, and just position if the ratio changes.
1522
+ *
1523
+ * @public
1696
1524
  */
1697
- animationState?: AnimationState$1;
1698
- KeyframeResolver: typeof KeyframeResolver;
1525
+ layout?: boolean | "position" | "size" | "preserve-aspect" | "x" | "y";
1699
1526
  /**
1700
- * The options used to create this VisualElement. The Options type is defined
1701
- * by the inheriting VisualElement and is passed straight through to the render functions.
1527
+ * Enable shared layout transitions between different components with the same `layoutId`.
1528
+ *
1529
+ * When a component with a layoutId is removed from the React tree, and then
1530
+ * added elsewhere, it will visually animate from the previous component's bounding box
1531
+ * and its latest animated values.
1532
+ *
1533
+ * ```jsx
1534
+ * {items.map(item => (
1535
+ * <motion.li layout>
1536
+ * {item.name}
1537
+ * {item.isSelected && <motion.div layoutId="underline" />}
1538
+ * </motion.li>
1539
+ * ))}
1540
+ * ```
1541
+ *
1542
+ * If the previous component remains in the tree it will crossfade with the new component.
1543
+ *
1544
+ * @public
1702
1545
  */
1703
- readonly options: Options;
1546
+ layoutId?: string;
1704
1547
  /**
1705
- * A reference to the latest props provided to the VisualElement's host React component.
1548
+ * A callback that will fire when a layout animation on this component starts.
1549
+ *
1550
+ * @public
1706
1551
  */
1707
- props: MotionNodeOptions;
1708
- prevProps?: MotionNodeOptions;
1709
- presenceContext: PresenceContextProps | null;
1710
- prevPresenceContext?: PresenceContextProps | null;
1552
+ onLayoutAnimationStart?(): void;
1711
1553
  /**
1712
- * Cleanup functions for active features (hover/tap/exit etc)
1554
+ * A callback that will fire when a layout animation on this component completes.
1555
+ *
1556
+ * @public
1713
1557
  */
1714
- private features;
1558
+ onLayoutAnimationComplete?(): void;
1715
1559
  /**
1716
- * A map of every subscription that binds the provided or generated
1717
- * motion values onChange listeners to this visual element.
1560
+ * @public
1718
1561
  */
1719
- private valueSubscriptions;
1562
+ layoutDependency?: any;
1720
1563
  /**
1721
- * A reference to the ReducedMotionConfig passed to the VisualElement's host React component.
1564
+ * Whether a projection node should measure its scroll when it or its descendants update their layout.
1565
+ *
1566
+ * @public
1722
1567
  */
1723
- private reducedMotionConfig;
1568
+ layoutScroll?: boolean;
1724
1569
  /**
1725
- * A reference to the skipAnimations config passed to the VisualElement's host React component.
1570
+ * Whether an element should be considered a "layout root", where
1571
+ * all children will be forced to resolve relatively to it. This
1572
+ * includes shared `layoutId` elements, which animate within the root
1573
+ * when the previous element was also inside it.
1574
+ * Currently used for `position: sticky` elements in Framer.
1726
1575
  */
1727
- private skipAnimationsConfig;
1576
+ layoutRoot?: boolean;
1728
1577
  /**
1729
- * On mount, this will be hydrated with a callback to disconnect
1730
- * this visual element from its parent on unmount.
1578
+ * The anchor point for relative layout projection. This defines which
1579
+ * point on the parent is used as the reference for the child's position.
1580
+ *
1581
+ * `{ x: 0, y: 0 }` (default) anchors to the top-left corner.
1582
+ * `{ x: 0.5, y: 0.5 }` anchors to the center, useful for centered layouts
1583
+ * (e.g., flexbox) to prevent drift during parent layout animations.
1584
+ * `false` disables relative projection entirely.
1731
1585
  */
1732
- private removeFromVariantTree;
1586
+ layoutAnchor?: {
1587
+ x: number;
1588
+ y: number;
1589
+ } | false;
1733
1590
  /**
1734
- * A reference to the previously-provided motion values as returned
1735
- * from scrapeMotionValuesFromProps. We use the keys in here to determine
1736
- * if any motion values need to be removed after props are updated.
1591
+ * Attached to a portal root to ensure we attach the child to the document root and don't
1592
+ * perform scale correction on it.
1737
1593
  */
1738
- private prevMotionValues;
1594
+ "data-framer-portal-id"?: string;
1739
1595
  /**
1740
- * Track whether this element has been mounted before, to detect
1741
- * remounts after Suspense unmount/remount cycles.
1596
+ * By default, shared layout elements will crossfade. By setting this
1597
+ * to `false`, this element will take its default opacity throughout the animation.
1742
1598
  */
1743
- private hasBeenMounted;
1599
+ layoutCrossfade?: boolean;
1600
+ }
1601
+ /**
1602
+ * @deprecated - Use MotionNodeDragHandlers/MotionNodeDraggableOptions
1603
+ */
1604
+ interface DraggableProps extends MotionNodeDragHandlers, MotionNodeDraggableOptions {
1605
+ }
1606
+ type TransformTemplate = (transform: TransformProperties, generatedTransform: string) => string;
1607
+ interface MotionNodeAdvancedOptions {
1744
1608
  /**
1745
- * An object containing a SubscriptionManager for each active event.
1609
+ * Custom data to use to resolve dynamic variants differently for each animating component.
1610
+ *
1611
+ * ```jsx
1612
+ * const variants = {
1613
+ * visible: (custom) => ({
1614
+ * opacity: 1,
1615
+ * transition: { delay: custom * 0.2 }
1616
+ * })
1617
+ * }
1618
+ *
1619
+ * <motion.div custom={0} animate="visible" variants={variants} />
1620
+ * <motion.div custom={1} animate="visible" variants={variants} />
1621
+ * <motion.div custom={2} animate="visible" variants={variants} />
1622
+ * ```
1623
+ *
1624
+ * @public
1746
1625
  */
1747
- private events;
1626
+ custom?: any;
1748
1627
  /**
1749
- * An object containing an unsubscribe function for each prop event subscription.
1750
- * For example, every "Update" event can have multiple subscribers via
1751
- * VisualElement.on(), but only one of those can be defined via the onUpdate prop.
1628
+ * @public
1629
+ * Set to `false` to prevent inheriting variant changes from its parent.
1752
1630
  */
1753
- private propEventSubscriptions;
1754
- constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, RenderState>, options?: Options);
1755
- mount(instance: Instance): void;
1756
- unmount(): void;
1757
- addChild(child: VisualElement): void;
1758
- removeChild(child: VisualElement): void;
1759
- private bindToMotionValue;
1760
- sortNodePosition(other: VisualElement<Instance>): number;
1761
- updateFeatures(): void;
1762
- notifyUpdate: () => void;
1763
- triggerBuild(): void;
1764
- render: () => void;
1765
- private renderScheduledAt;
1766
- scheduleRender: () => void;
1631
+ inherit?: boolean;
1767
1632
  /**
1768
- * Measure the current viewport box with or without transforms.
1769
- * Only measures axis-aligned boxes, rotate and skew must be manually
1770
- * removed with a re-render to work.
1633
+ * @public
1634
+ * Set to `false` to prevent throwing an error when a `motion` component is used within a `LazyMotion` set to strict.
1771
1635
  */
1772
- measureViewportBox(): Box;
1773
- getStaticValue(key: string): AnyResolvedKeyframe;
1774
- setStaticValue(key: string, value: AnyResolvedKeyframe): void;
1636
+ ignoreStrict?: boolean;
1775
1637
  /**
1776
- * Update the provided props. Ensure any newly-added motion values are
1777
- * added to our map, old ones removed, and listeners updated.
1638
+ * Provide a set of motion values to perform animations on.
1778
1639
  */
1779
- update(props: MotionNodeOptions, presenceContext: PresenceContextProps | null): void;
1780
- getProps(): MotionNodeOptions;
1640
+ values?: {
1641
+ [key: string]: MotionValue<number> | MotionValue<string>;
1642
+ };
1781
1643
  /**
1782
- * Returns the variant definition with a given name.
1644
+ * By default, Motion generates a `transform` property with a sensible transform order. `transformTemplate`
1645
+ * can be used to create a different order, or to append/prepend the automatically generated `transform` property.
1646
+ *
1647
+ * ```jsx
1648
+ * <motion.div
1649
+ * style={{ x: 0, rotate: 180 }}
1650
+ * transformTemplate={
1651
+ * ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
1652
+ * }
1653
+ * />
1654
+ * ```
1655
+ *
1656
+ * @param transform - The latest animated transform props.
1657
+ * @param generatedTransform - The transform string as automatically generated by Motion
1658
+ *
1659
+ * @public
1783
1660
  */
1784
- getVariant(name: string): Variant | undefined;
1661
+ transformTemplate?: TransformTemplate;
1662
+ "data-framer-appear-id"?: string;
1663
+ }
1664
+ interface PropagateOptions {
1785
1665
  /**
1786
- * Returns the defined default transition on this component.
1666
+ * If `false`, this element's tap gesture will prevent any parent
1667
+ * element's tap gesture handlers (`onTap`, `onTapStart`, `whileTap`)
1668
+ * from firing. Defaults to `true`.
1787
1669
  */
1788
- getDefaultTransition(): Transition | undefined;
1789
- getTransformPagePoint(): any;
1670
+ tap?: boolean;
1671
+ }
1672
+ interface MotionNodeOptions extends MotionNodeAnimationOptions, MotionNodeEventOptions, MotionNodePanHandlers, MotionNodeTapHandlers, MotionNodeHoverHandlers, MotionNodeFocusHandlers, MotionNodeViewportOptions, MotionNodeDragHandlers, MotionNodeDraggableOptions, MotionNodeLayoutOptions, MotionNodeAdvancedOptions {
1790
1673
  /**
1791
- * Add a motion value and bind it to this visual element.
1674
+ * Controls whether gesture events propagate to parent motion components.
1675
+ * By default all gestures propagate. Set individual gestures to `false`
1676
+ * to prevent parent handlers from firing.
1677
+ *
1678
+ * ```jsx
1679
+ * <motion.div onTap={onParentTap}>
1680
+ * <motion.div onTap={onChildTap} propagate={{ tap: false }} />
1681
+ * </motion.div>
1682
+ * ```
1792
1683
  */
1793
- addValue(key: string, value: MotionValue): void;
1684
+ propagate?: PropagateOptions;
1685
+ }
1686
+
1687
+ interface TransformOrigin {
1688
+ originX?: number | string;
1689
+ originY?: number | string;
1690
+ originZ?: number | string;
1691
+ }
1692
+ interface HTMLRenderState {
1794
1693
  /**
1795
- * Remove a motion value and unbind any active subscriptions.
1694
+ * A mutable record of transforms we want to apply directly to the rendered Element
1695
+ * every frame. We use a mutable data structure to reduce GC during animations.
1796
1696
  */
1797
- removeValue(key: string): void;
1697
+ transform: ResolvedValues$1;
1798
1698
  /**
1799
- * Check whether we have a motion value for this key
1699
+ * A mutable record of transform origins we want to apply directly to the rendered Element
1700
+ * every frame. We use a mutable data structure to reduce GC during animations.
1800
1701
  */
1801
- hasValue(key: string): boolean;
1702
+ transformOrigin: TransformOrigin;
1802
1703
  /**
1803
- * Get a motion value for this key. If called with a default
1804
- * value, we'll create one if none exists.
1704
+ * A mutable record of styles we want to apply directly to the rendered Element
1705
+ * every frame. We use a mutable data structure to reduce GC during animations.
1805
1706
  */
1806
- getValue(key: string): MotionValue | undefined;
1807
- getValue(key: string, defaultValue: AnyResolvedKeyframe | null): MotionValue;
1707
+ style: ResolvedValues$1;
1808
1708
  /**
1809
- * If we're trying to animate to a previously unencountered value,
1810
- * we need to check for it in our state and as a last resort read it
1811
- * directly from the instance (which might have performance implications).
1709
+ * A mutable record of CSS variables we want to apply directly to the rendered Element
1710
+ * every frame. We use a mutable data structure to reduce GC during animations.
1812
1711
  */
1813
- readValue(key: string, target?: AnyResolvedKeyframe | null): any;
1712
+ vars: ResolvedValues$1;
1713
+ }
1714
+
1715
+ interface SVGRenderState extends HTMLRenderState {
1814
1716
  /**
1815
- * Set the base target to later animate back to. This is currently
1816
- * only hydrated on creation and when we first read a value.
1717
+ * A mutable record of attributes we want to apply directly to the rendered Element
1718
+ * every frame. We use a mutable data structure to reduce GC during animations.
1817
1719
  */
1818
- setBaseTarget(key: string, value: AnyResolvedKeyframe): void;
1819
- on<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, callback: VisualElementEventCallbacks[EventName]): VoidFunction;
1820
- notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
1821
- scheduleRenderMicrotask(): void;
1720
+ attrs: ResolvedValues$1;
1721
+ }
1722
+ interface SVGAttributes {
1723
+ accentHeight?: AnyResolvedKeyframe | undefined;
1724
+ accumulate?: "none" | "sum" | undefined;
1725
+ additive?: "replace" | "sum" | undefined;
1726
+ alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
1727
+ allowReorder?: "no" | "yes" | undefined;
1728
+ alphabetic?: AnyResolvedKeyframe | undefined;
1729
+ amplitude?: AnyResolvedKeyframe | undefined;
1730
+ arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
1731
+ ascent?: AnyResolvedKeyframe | undefined;
1732
+ attributeName?: string | undefined;
1733
+ attributeType?: string | undefined;
1734
+ autoReverse?: boolean | undefined;
1735
+ azimuth?: AnyResolvedKeyframe | undefined;
1736
+ baseFrequency?: AnyResolvedKeyframe | undefined;
1737
+ baselineShift?: AnyResolvedKeyframe | undefined;
1738
+ baseProfile?: AnyResolvedKeyframe | undefined;
1739
+ bbox?: AnyResolvedKeyframe | undefined;
1740
+ begin?: AnyResolvedKeyframe | undefined;
1741
+ bias?: AnyResolvedKeyframe | undefined;
1742
+ by?: AnyResolvedKeyframe | undefined;
1743
+ calcMode?: AnyResolvedKeyframe | undefined;
1744
+ capHeight?: AnyResolvedKeyframe | undefined;
1745
+ clip?: AnyResolvedKeyframe | undefined;
1746
+ clipPath?: string | undefined;
1747
+ clipPathUnits?: AnyResolvedKeyframe | undefined;
1748
+ clipRule?: AnyResolvedKeyframe | undefined;
1749
+ colorInterpolation?: AnyResolvedKeyframe | undefined;
1750
+ colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
1751
+ colorProfile?: AnyResolvedKeyframe | undefined;
1752
+ colorRendering?: AnyResolvedKeyframe | undefined;
1753
+ contentScriptType?: AnyResolvedKeyframe | undefined;
1754
+ contentStyleType?: AnyResolvedKeyframe | undefined;
1755
+ cursor?: AnyResolvedKeyframe | undefined;
1756
+ cx?: AnyResolvedKeyframe | undefined;
1757
+ cy?: AnyResolvedKeyframe | undefined;
1758
+ d?: string | undefined;
1759
+ decelerate?: AnyResolvedKeyframe | undefined;
1760
+ descent?: AnyResolvedKeyframe | undefined;
1761
+ diffuseConstant?: AnyResolvedKeyframe | undefined;
1762
+ direction?: AnyResolvedKeyframe | undefined;
1763
+ display?: AnyResolvedKeyframe | undefined;
1764
+ divisor?: AnyResolvedKeyframe | undefined;
1765
+ dominantBaseline?: AnyResolvedKeyframe | undefined;
1766
+ dur?: AnyResolvedKeyframe | undefined;
1767
+ dx?: AnyResolvedKeyframe | undefined;
1768
+ dy?: AnyResolvedKeyframe | undefined;
1769
+ edgeMode?: AnyResolvedKeyframe | undefined;
1770
+ elevation?: AnyResolvedKeyframe | undefined;
1771
+ enableBackground?: AnyResolvedKeyframe | undefined;
1772
+ end?: AnyResolvedKeyframe | undefined;
1773
+ exponent?: AnyResolvedKeyframe | undefined;
1774
+ externalResourcesRequired?: boolean | undefined;
1775
+ fill?: string | undefined;
1776
+ fillOpacity?: AnyResolvedKeyframe | undefined;
1777
+ fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
1778
+ filter?: string | undefined;
1779
+ filterRes?: AnyResolvedKeyframe | undefined;
1780
+ filterUnits?: AnyResolvedKeyframe | undefined;
1781
+ floodColor?: AnyResolvedKeyframe | undefined;
1782
+ floodOpacity?: AnyResolvedKeyframe | undefined;
1783
+ focusable?: boolean | "auto" | undefined;
1784
+ fontFamily?: string | undefined;
1785
+ fontSize?: AnyResolvedKeyframe | undefined;
1786
+ fontSizeAdjust?: AnyResolvedKeyframe | undefined;
1787
+ fontStretch?: AnyResolvedKeyframe | undefined;
1788
+ fontStyle?: AnyResolvedKeyframe | undefined;
1789
+ fontVariant?: AnyResolvedKeyframe | undefined;
1790
+ fontWeight?: AnyResolvedKeyframe | undefined;
1791
+ format?: AnyResolvedKeyframe | undefined;
1792
+ fr?: AnyResolvedKeyframe | undefined;
1793
+ from?: AnyResolvedKeyframe | undefined;
1794
+ fx?: AnyResolvedKeyframe | undefined;
1795
+ fy?: AnyResolvedKeyframe | undefined;
1796
+ g1?: AnyResolvedKeyframe | undefined;
1797
+ g2?: AnyResolvedKeyframe | undefined;
1798
+ glyphName?: AnyResolvedKeyframe | undefined;
1799
+ glyphOrientationHorizontal?: AnyResolvedKeyframe | undefined;
1800
+ glyphOrientationVertical?: AnyResolvedKeyframe | undefined;
1801
+ glyphRef?: AnyResolvedKeyframe | undefined;
1802
+ gradientTransform?: string | undefined;
1803
+ gradientUnits?: string | undefined;
1804
+ hanging?: AnyResolvedKeyframe | undefined;
1805
+ horizAdvX?: AnyResolvedKeyframe | undefined;
1806
+ horizOriginX?: AnyResolvedKeyframe | undefined;
1807
+ href?: string | undefined;
1808
+ ideographic?: AnyResolvedKeyframe | undefined;
1809
+ imageRendering?: AnyResolvedKeyframe | undefined;
1810
+ in2?: AnyResolvedKeyframe | undefined;
1811
+ in?: string | undefined;
1812
+ intercept?: AnyResolvedKeyframe | undefined;
1813
+ k1?: AnyResolvedKeyframe | undefined;
1814
+ k2?: AnyResolvedKeyframe | undefined;
1815
+ k3?: AnyResolvedKeyframe | undefined;
1816
+ k4?: AnyResolvedKeyframe | undefined;
1817
+ k?: AnyResolvedKeyframe | undefined;
1818
+ kernelMatrix?: AnyResolvedKeyframe | undefined;
1819
+ kernelUnitLength?: AnyResolvedKeyframe | undefined;
1820
+ kerning?: AnyResolvedKeyframe | undefined;
1821
+ keyPoints?: AnyResolvedKeyframe | undefined;
1822
+ keySplines?: AnyResolvedKeyframe | undefined;
1823
+ keyTimes?: AnyResolvedKeyframe | undefined;
1824
+ lengthAdjust?: AnyResolvedKeyframe | undefined;
1825
+ letterSpacing?: AnyResolvedKeyframe | undefined;
1826
+ lightingColor?: AnyResolvedKeyframe | undefined;
1827
+ limitingConeAngle?: AnyResolvedKeyframe | undefined;
1828
+ local?: AnyResolvedKeyframe | undefined;
1829
+ markerEnd?: string | undefined;
1830
+ markerHeight?: AnyResolvedKeyframe | undefined;
1831
+ markerMid?: string | undefined;
1832
+ markerStart?: string | undefined;
1833
+ markerUnits?: AnyResolvedKeyframe | undefined;
1834
+ markerWidth?: AnyResolvedKeyframe | undefined;
1835
+ mask?: string | undefined;
1836
+ maskContentUnits?: AnyResolvedKeyframe | undefined;
1837
+ maskUnits?: AnyResolvedKeyframe | undefined;
1838
+ mathematical?: AnyResolvedKeyframe | undefined;
1839
+ mode?: AnyResolvedKeyframe | undefined;
1840
+ numOctaves?: AnyResolvedKeyframe | undefined;
1841
+ offset?: AnyResolvedKeyframe | undefined;
1842
+ opacity?: AnyResolvedKeyframe | undefined;
1843
+ operator?: AnyResolvedKeyframe | undefined;
1844
+ order?: AnyResolvedKeyframe | undefined;
1845
+ orient?: AnyResolvedKeyframe | undefined;
1846
+ orientation?: AnyResolvedKeyframe | undefined;
1847
+ origin?: AnyResolvedKeyframe | undefined;
1848
+ overflow?: AnyResolvedKeyframe | undefined;
1849
+ overlinePosition?: AnyResolvedKeyframe | undefined;
1850
+ overlineThickness?: AnyResolvedKeyframe | undefined;
1851
+ paintOrder?: AnyResolvedKeyframe | undefined;
1852
+ panose1?: AnyResolvedKeyframe | undefined;
1853
+ path?: string | undefined;
1854
+ pathLength?: AnyResolvedKeyframe | undefined;
1855
+ patternContentUnits?: string | undefined;
1856
+ patternTransform?: AnyResolvedKeyframe | undefined;
1857
+ patternUnits?: string | undefined;
1858
+ pointerEvents?: AnyResolvedKeyframe | undefined;
1859
+ points?: string | undefined;
1860
+ pointsAtX?: AnyResolvedKeyframe | undefined;
1861
+ pointsAtY?: AnyResolvedKeyframe | undefined;
1862
+ pointsAtZ?: AnyResolvedKeyframe | undefined;
1863
+ preserveAlpha?: boolean | undefined;
1864
+ preserveAspectRatio?: string | undefined;
1865
+ primitiveUnits?: AnyResolvedKeyframe | undefined;
1866
+ r?: AnyResolvedKeyframe | undefined;
1867
+ radius?: AnyResolvedKeyframe | undefined;
1868
+ refX?: AnyResolvedKeyframe | undefined;
1869
+ refY?: AnyResolvedKeyframe | undefined;
1870
+ renderingIntent?: AnyResolvedKeyframe | undefined;
1871
+ repeatCount?: AnyResolvedKeyframe | undefined;
1872
+ repeatDur?: AnyResolvedKeyframe | undefined;
1873
+ requiredExtensions?: AnyResolvedKeyframe | undefined;
1874
+ requiredFeatures?: AnyResolvedKeyframe | undefined;
1875
+ restart?: AnyResolvedKeyframe | undefined;
1876
+ result?: string | undefined;
1877
+ rotate?: AnyResolvedKeyframe | undefined;
1878
+ rx?: AnyResolvedKeyframe | undefined;
1879
+ ry?: AnyResolvedKeyframe | undefined;
1880
+ scale?: AnyResolvedKeyframe | undefined;
1881
+ seed?: AnyResolvedKeyframe | undefined;
1882
+ shapeRendering?: AnyResolvedKeyframe | undefined;
1883
+ slope?: AnyResolvedKeyframe | undefined;
1884
+ spacing?: AnyResolvedKeyframe | undefined;
1885
+ specularConstant?: AnyResolvedKeyframe | undefined;
1886
+ specularExponent?: AnyResolvedKeyframe | undefined;
1887
+ speed?: AnyResolvedKeyframe | undefined;
1888
+ spreadMethod?: string | undefined;
1889
+ startOffset?: AnyResolvedKeyframe | undefined;
1890
+ stdDeviation?: AnyResolvedKeyframe | undefined;
1891
+ stemh?: AnyResolvedKeyframe | undefined;
1892
+ stemv?: AnyResolvedKeyframe | undefined;
1893
+ stitchTiles?: AnyResolvedKeyframe | undefined;
1894
+ stopColor?: string | undefined;
1895
+ stopOpacity?: AnyResolvedKeyframe | undefined;
1896
+ strikethroughPosition?: AnyResolvedKeyframe | undefined;
1897
+ strikethroughThickness?: AnyResolvedKeyframe | undefined;
1898
+ string?: AnyResolvedKeyframe | undefined;
1899
+ stroke?: string | undefined;
1900
+ strokeDasharray?: AnyResolvedKeyframe | undefined;
1901
+ strokeDashoffset?: AnyResolvedKeyframe | undefined;
1902
+ strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
1903
+ strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
1904
+ strokeMiterlimit?: AnyResolvedKeyframe | undefined;
1905
+ strokeOpacity?: AnyResolvedKeyframe | undefined;
1906
+ strokeWidth?: AnyResolvedKeyframe | undefined;
1907
+ surfaceScale?: AnyResolvedKeyframe | undefined;
1908
+ systemLanguage?: AnyResolvedKeyframe | undefined;
1909
+ tableValues?: AnyResolvedKeyframe | undefined;
1910
+ targetX?: AnyResolvedKeyframe | undefined;
1911
+ targetY?: AnyResolvedKeyframe | undefined;
1912
+ textAnchor?: string | undefined;
1913
+ textDecoration?: AnyResolvedKeyframe | undefined;
1914
+ textLength?: AnyResolvedKeyframe | undefined;
1915
+ textRendering?: AnyResolvedKeyframe | undefined;
1916
+ to?: AnyResolvedKeyframe | undefined;
1917
+ transform?: string | undefined;
1918
+ u1?: AnyResolvedKeyframe | undefined;
1919
+ u2?: AnyResolvedKeyframe | undefined;
1920
+ underlinePosition?: AnyResolvedKeyframe | undefined;
1921
+ underlineThickness?: AnyResolvedKeyframe | undefined;
1922
+ unicode?: AnyResolvedKeyframe | undefined;
1923
+ unicodeBidi?: AnyResolvedKeyframe | undefined;
1924
+ unicodeRange?: AnyResolvedKeyframe | undefined;
1925
+ unitsPerEm?: AnyResolvedKeyframe | undefined;
1926
+ vAlphabetic?: AnyResolvedKeyframe | undefined;
1927
+ values?: string | undefined;
1928
+ vectorEffect?: AnyResolvedKeyframe | undefined;
1929
+ version?: string | undefined;
1930
+ vertAdvY?: AnyResolvedKeyframe | undefined;
1931
+ vertOriginX?: AnyResolvedKeyframe | undefined;
1932
+ vertOriginY?: AnyResolvedKeyframe | undefined;
1933
+ vHanging?: AnyResolvedKeyframe | undefined;
1934
+ vIdeographic?: AnyResolvedKeyframe | undefined;
1935
+ viewBox?: string | undefined;
1936
+ viewTarget?: AnyResolvedKeyframe | undefined;
1937
+ visibility?: AnyResolvedKeyframe | undefined;
1938
+ vMathematical?: AnyResolvedKeyframe | undefined;
1939
+ widths?: AnyResolvedKeyframe | undefined;
1940
+ wordSpacing?: AnyResolvedKeyframe | undefined;
1941
+ writingMode?: AnyResolvedKeyframe | undefined;
1942
+ x1?: AnyResolvedKeyframe | undefined;
1943
+ x2?: AnyResolvedKeyframe | undefined;
1944
+ x?: AnyResolvedKeyframe | undefined;
1945
+ xChannelSelector?: string | undefined;
1946
+ xHeight?: AnyResolvedKeyframe | undefined;
1947
+ xlinkActuate?: string | undefined;
1948
+ xlinkArcrole?: string | undefined;
1949
+ xlinkHref?: string | undefined;
1950
+ xlinkRole?: string | undefined;
1951
+ xlinkShow?: string | undefined;
1952
+ xlinkTitle?: string | undefined;
1953
+ xlinkType?: string | undefined;
1954
+ xmlBase?: string | undefined;
1955
+ xmlLang?: string | undefined;
1956
+ xmlns?: string | undefined;
1957
+ xmlnsXlink?: string | undefined;
1958
+ xmlSpace?: string | undefined;
1959
+ y1?: AnyResolvedKeyframe | undefined;
1960
+ y2?: AnyResolvedKeyframe | undefined;
1961
+ y?: AnyResolvedKeyframe | undefined;
1962
+ yChannelSelector?: string | undefined;
1963
+ z?: AnyResolvedKeyframe | undefined;
1964
+ zoomAndPan?: string | undefined;
1822
1965
  }
1823
1966
 
1824
1967
  /**
@@ -1867,6 +2010,9 @@ interface AnimationElement extends Omit<WithRender, "current">, Owner {
1867
2010
  shouldReduceMotion?: boolean | null;
1868
2011
  }
1869
2012
 
2013
+ type Mixer<T> = (p: number) => T;
2014
+ type MixerFactory<T> = (a: T, b: T) => Mixer<T>;
2015
+
1870
2016
  type AnyResolvedKeyframe = string | number;
1871
2017
  interface ProgressTimeline {
1872
2018
  currentTime: null | {
@@ -2314,6 +2460,32 @@ interface ValueTransition extends AnimationOrchestrationOptions, AnimationPlayba
2314
2460
  * @public
2315
2461
  */
2316
2462
  path?: MotionPath;
2463
+ /**
2464
+ * Replaces the function that blends between each pair of keyframes
2465
+ * that aren't numbers. It receives the two keyframes and returns a
2466
+ * function that maps progress (`0`-`1`, or beyond with springs and
2467
+ * overshooting easing) to a value, or `undefined` to blend them as
2468
+ * usual. For example, a mixer that morphs paths can animate `d`
2469
+ * between paths of different shapes, and return `undefined` for values
2470
+ * that aren't paths, like `fill`, so they blend as usual:
2471
+ *
2472
+ * ```jsx
2473
+ * <motion.path animate={{ d, fill }} transition={{ mixer: morph }} />
2474
+ * ```
2475
+ *
2476
+ * Animations between numbers (not strings with units, like `"100px"`),
2477
+ * and those where the mixer returns `undefined` for every pair, run as
2478
+ * they would without it. The rest run on the main thread, where the
2479
+ * mixer can be called. Animations that only run in the browser, like
2480
+ * those from `motion/mini`, don't use it. Values Motion can't animate,
2481
+ * like text without numbers, still change at once.
2482
+ *
2483
+ * A mixer can be asked for the same pair more than once, so keep any
2484
+ * costly setup for when its function is first called.
2485
+ *
2486
+ * @public
2487
+ */
2488
+ mixer?: (from: any, to: any) => Mixer<any> | undefined;
2317
2489
  }
2318
2490
  /**
2319
2491
  * @deprecated Use KeyframeOptions instead
@@ -3202,7 +3374,7 @@ declare function getOptimisedAppearId(visualElement: WithAppearProps): string |
3202
3374
  declare function inertia({ keyframes, velocity, power, timeConstant, bounceDamping, bounceStiffness, modifyTarget, min, max, restDelta, restSpeed, }: ValueAnimationOptions<number>): KeyframeGenerator<number>;
3203
3375
 
3204
3376
  declare function defaultEasing(values: any[], easing?: EasingFunction): EasingFunction[];
3205
- declare function keyframes<T extends AnyResolvedKeyframe>({ duration, keyframes: keyframeValues, times, ease, }: ValueAnimationOptions<T>): KeyframeGenerator<T>;
3377
+ declare function keyframes<T extends AnyResolvedKeyframe>({ duration, keyframes: keyframeValues, times, ease, mixer: transitionMixer, }: ValueAnimationOptions<T>): KeyframeGenerator<T>;
3206
3378
 
3207
3379
  declare function springGenerator(optionsOrVisualDuration?: ValueAnimationOptions<number> | number, bounce?: number): KeyframeGenerator<number>;
3208
3380
  declare const spring: typeof springGenerator & {
@@ -3526,80 +3698,319 @@ interface PropSubject {
3526
3698
  [key: string]: any;
3527
3699
  }
3528
3700
  /**
3529
- * Writes motion values to the properties of any object. This is
3530
- * animate()'s fallback for subjects no registered effect claims.
3531
- */
3532
- declare const propEffect: AnimateEffect<PropSubject>;
3533
-
3534
- declare const addSVGValue: (element: SVGElement, state: MotionValueState, key: string, value: MotionValue) => VoidFunction;
3535
- /**
3536
- * Reads the current value of `key` from an SVG element as the origin of
3537
- * an animation, as the SVG VisualElement does: transforms start from
3538
- * their defaults, CSS variables and the few CSS-only properties come from
3539
- * computed style, falling back to the attribute when that's empty (e.g.
3540
- * the element isn't rendered), and everything else is read from the
3541
- * attribute, dash-cased (`strokeWidth` -> `stroke-width`) or, failing
3542
- * that, as written (`baseFrequency`).
3543
- */
3544
- declare const readSVGValue: (element: SVGElement, key: string) => any;
3545
- /**
3546
- * The per-element effect `animate()` binds through, so SVG values share
3547
- * state with a direct `svgEffect()` call.
3548
- */
3549
- declare const svgSubjectEffect: AnimateEffect<SVGElement>;
3550
- declare const svgEffect: SelectorAnimateEffect<SVGElement>;
3551
-
3552
- declare const frame: Batcher;
3553
- declare const cancelFrame: (process: Process) => void;
3554
- declare const frameSteps: Steps;
3555
-
3556
- /**
3557
- * The frameloop's state, kept apart from the frameloop itself so that
3558
- * reading it doesn't bundle the scheduler.
3701
+ * Writes motion values to the properties of any object. This is
3702
+ * animate()'s fallback for subjects no registered effect claims.
3703
+ */
3704
+ declare const propEffect: AnimateEffect<PropSubject>;
3705
+
3706
+ declare const addSVGValue: (element: SVGElement, state: MotionValueState, key: string, value: MotionValue) => VoidFunction;
3707
+ /**
3708
+ * Reads the current value of `key` from an SVG element as the origin of
3709
+ * an animation, as the SVG VisualElement does: transforms start from
3710
+ * their defaults, CSS variables and the few CSS-only properties come from
3711
+ * computed style, falling back to the attribute when that's empty (e.g.
3712
+ * the element isn't rendered), and everything else is read from the
3713
+ * attribute, dash-cased (`strokeWidth` -> `stroke-width`) or, failing
3714
+ * that, as written (`baseFrequency`).
3715
+ */
3716
+ declare const readSVGValue: (element: SVGElement, key: string) => any;
3717
+ /**
3718
+ * The per-element effect `animate()` binds through, so SVG values share
3719
+ * state with a direct `svgEffect()` call.
3720
+ */
3721
+ declare const svgSubjectEffect: AnimateEffect<SVGElement>;
3722
+ declare const svgEffect: SelectorAnimateEffect<SVGElement>;
3723
+
3724
+ declare const frame: Batcher;
3725
+ declare const cancelFrame: (process: Process) => void;
3726
+ declare const frameSteps: Steps;
3727
+
3728
+ /**
3729
+ * The frameloop's state, kept apart from the frameloop itself so that
3730
+ * reading it doesn't bundle the scheduler.
3731
+ */
3732
+ declare const frameData: FrameData;
3733
+
3734
+ declare function createRenderBatcher(scheduleNextBatch: (callback: Function) => void, allowKeepAlive: boolean, state?: FrameData): {
3735
+ schedule: Batcher;
3736
+ cancel: (process: Process) => void;
3737
+ state: FrameData;
3738
+ steps: Steps;
3739
+ };
3740
+
3741
+ declare const microtask: Batcher;
3742
+ declare const cancelMicrotask: (process: Process) => void;
3743
+
3744
+ /**
3745
+ * Process a frame now, for driving Motion from a loop other than
3746
+ * window.requestAnimationFrame, like an XRSession's during an immersive
3747
+ * WebXR session. Wherever window.requestAnimationFrame does fire, Motion
3748
+ * keeps processing frames from it too.
3749
+ *
3750
+ * `timestamp` defaults to now. For a timeline you control, set
3751
+ * `MotionGlobalConfig.useManualTiming = true` and pass each frame's time in
3752
+ * milliseconds.
3753
+ *
3754
+ * Animations Motion hands to the browser (WAAPI), like `opacity` or
3755
+ * `transform` on an HTML or SVG element, follow the browser's clock. With
3756
+ * `useManualTiming` on, Motion runs those in JS instead, except for
3757
+ * `motion/mini`, view transitions and optimized appear animations, and
3758
+ * colours only the browser can mix, like `oklch()`, which jump to their end.
3759
+ *
3760
+ * Ignored when called inside a frame.
3761
+ */
3762
+ declare const processFrame: (timestamp?: number) => void;
3763
+
3764
+ /**
3765
+ * An eventloop-synchronous alternative to performance.now().
3766
+ *
3767
+ * Ensures that time measurements remain consistent within a synchronous context.
3768
+ * Usually calling performance.now() twice within the same synchronous context
3769
+ * will return different values which isn't useful for animations when we're usually
3770
+ * trying to sync animations to the same frame.
3771
+ */
3772
+ declare const time: {
3773
+ now: () => number;
3774
+ set: (newTime: number) => void;
3775
+ };
3776
+
3777
+ interface WithDepth {
3778
+ depth: number;
3779
+ }
3780
+ declare const compareByDepth: (a: VisualElement, b: VisualElement) => number;
3781
+
3782
+ declare class FlatTree {
3783
+ private children;
3784
+ private isDirty;
3785
+ add(child: WithDepth): void;
3786
+ remove(child: WithDepth): void;
3787
+ forEach(callback: (child: WithDepth) => void): void;
3788
+ }
3789
+
3790
+ declare class NodeStack {
3791
+ lead?: IProjectionNode;
3792
+ prevLead?: IProjectionNode;
3793
+ members: IProjectionNode[];
3794
+ add(node: IProjectionNode): void;
3795
+ remove(node: IProjectionNode): void;
3796
+ relegate(node: IProjectionNode): boolean;
3797
+ promote(node: IProjectionNode, preserveFollowOpacity?: boolean): void;
3798
+ exitAnimationComplete(): void;
3799
+ scheduleRender(): void;
3800
+ removeLeadSnapshot(): void;
3801
+ }
3802
+
3803
+ interface Measurements {
3804
+ animationId: number;
3805
+ measuredBox: Box;
3806
+ layoutBox: Box;
3807
+ latestValues: ResolvedValues$1;
3808
+ source: number;
3809
+ }
3810
+ type Phase = "snapshot" | "measure";
3811
+ interface ScrollMeasurements {
3812
+ animationId: number;
3813
+ phase: Phase;
3814
+ offset: Point;
3815
+ isRoot: boolean;
3816
+ wasRoot: boolean;
3817
+ }
3818
+ type LayoutEvents = "willUpdate" | "didUpdate" | "beforeMeasure" | "measure" | "projectionUpdate" | "animationStart" | "animationComplete";
3819
+ interface IProjectionNode<I = unknown> {
3820
+ id: number;
3821
+ animationId: number;
3822
+ animationCommitId: number;
3823
+ parent?: IProjectionNode;
3824
+ relativeParent?: IProjectionNode;
3825
+ root?: IProjectionNode;
3826
+ children: Set<IProjectionNode>;
3827
+ path: IProjectionNode[];
3828
+ nodes?: FlatTree;
3829
+ depth: number;
3830
+ instance: I | undefined;
3831
+ mount: (node: I, isLayoutDirty?: boolean) => void;
3832
+ unmount: () => void;
3833
+ options: ProjectionNodeOptions;
3834
+ setOptions(options: ProjectionNodeOptions): void;
3835
+ layout?: Measurements;
3836
+ dragSnapshot?: Measurements;
3837
+ dragAncestor?: IProjectionNode;
3838
+ snapshot?: Measurements;
3839
+ target?: Box;
3840
+ relativeTarget?: Box;
3841
+ relativeTargetOrigin?: Box;
3842
+ targetDelta?: Delta;
3843
+ targetWithTransforms?: Box;
3844
+ scroll?: ScrollMeasurements;
3845
+ treeScale?: Point;
3846
+ projectionDelta?: Delta;
3847
+ projectionDeltaWithTransform?: Delta;
3848
+ latestValues: ResolvedValues$1;
3849
+ isLayoutDirty: boolean;
3850
+ isProjectionDirty: boolean;
3851
+ isSharedProjectionDirty: boolean;
3852
+ isTransformDirty: boolean;
3853
+ resolvedRelativeTargetAt?: number;
3854
+ shouldResetTransform: boolean;
3855
+ prevTransformTemplateValue: string | undefined;
3856
+ isUpdateBlocked(): boolean;
3857
+ updateManuallyBlocked: boolean;
3858
+ updateBlockedByResize: boolean;
3859
+ blockUpdate(): void;
3860
+ unblockUpdate(): void;
3861
+ isUpdating: boolean;
3862
+ needsReset: boolean;
3863
+ needsShow?: boolean;
3864
+ startUpdate(): void;
3865
+ willUpdate(notifyListeners?: boolean): void;
3866
+ didUpdate(): void;
3867
+ measure(removeTransform?: boolean): Measurements;
3868
+ measurePageBox(): Box;
3869
+ updateLayout(): void;
3870
+ updateSnapshot(): void;
3871
+ clearSnapshot(): void;
3872
+ updateScroll(phase?: Phase): void;
3873
+ scheduleUpdateProjection(): void;
3874
+ scheduleCheckAfterUnmount(): void;
3875
+ checkUpdateFailed(): void;
3876
+ sharedNodes: Map<string, NodeStack>;
3877
+ registerSharedNode(id: string, node: IProjectionNode): void;
3878
+ getStack(): NodeStack | undefined;
3879
+ isVisible: boolean;
3880
+ hide(): void;
3881
+ show(): void;
3882
+ scheduleRender(notifyAll?: boolean): void;
3883
+ getClosestProjectingParent(): IProjectionNode | undefined;
3884
+ setTargetDelta(delta: Delta): void;
3885
+ resetTransform(): void;
3886
+ resetSkewAndRotation(): void;
3887
+ applyTransform(box: Box, transformOnly?: boolean, output?: Box, skipOwnTransform?: boolean, start?: number): Box;
3888
+ resolveTargetDelta(force?: boolean): void;
3889
+ removeRelativeTarget(): void;
3890
+ calcProjection(): void;
3891
+ applyProjectionStyles(targetStyle: CSSStyleDeclaration, styleProp?: MotionStyle): void;
3892
+ clearMeasurements(): void;
3893
+ resetTree(): void;
3894
+ isProjecting(): boolean;
3895
+ animationValues?: ResolvedValues$1;
3896
+ currentAnimation?: JSAnimation<number>;
3897
+ isTreeAnimating?: boolean;
3898
+ isAnimationBlocked?: boolean;
3899
+ setAnimationOrigin(delta: Delta, hasOnlyRelativeTargetChanged?: boolean, pathFn?: MotionPath): void;
3900
+ startAnimation(transition: ValueTransition): void;
3901
+ finishAnimation(): void;
3902
+ hasCheckedOptimisedAppear: boolean;
3903
+ isLead(): boolean;
3904
+ promote(options?: {
3905
+ needsReset?: boolean;
3906
+ transition?: Transition;
3907
+ preserveFollowOpacity?: boolean;
3908
+ }): void;
3909
+ relegate(): boolean;
3910
+ resumeFrom?: IProjectionNode;
3911
+ resumingFrom?: IProjectionNode;
3912
+ isPresent?: boolean;
3913
+ addEventListener(name: LayoutEvents, handler: any): VoidFunction;
3914
+ notifyListeners(name: LayoutEvents, ...args: any): void;
3915
+ hasListeners(name: LayoutEvents): boolean;
3916
+ hasTreeAnimated: boolean;
3917
+ preserveOpacity?: boolean;
3918
+ }
3919
+ interface LayoutUpdateData {
3920
+ layout: Box;
3921
+ snapshot: Measurements;
3922
+ delta: Delta;
3923
+ layoutDelta: Delta;
3924
+ hasLayoutChanged: boolean;
3925
+ hasRelativeLayoutChanged: boolean;
3926
+ }
3927
+ type LayoutUpdateHandler = (data: LayoutUpdateData) => void;
3928
+ interface ProjectionNodeConfig<I> {
3929
+ defaultParent?: () => IProjectionNode;
3930
+ attachResizeListener?: (instance: I, notifyResize: VoidFunction) => VoidFunction;
3931
+ measureScroll: (instance: I) => Point;
3932
+ checkIsScrollRoot: (instance: I) => boolean;
3933
+ resetTransform?: (instance: I, value?: string) => void;
3934
+ }
3935
+ /**
3936
+ * Configuration for initial promotion of shared layout elements.
3937
+ * This was originally in React's SwitchLayoutGroupContext but is now
3938
+ * framework-agnostic to support vanilla JS usage.
3559
3939
  */
3560
- declare const frameData: FrameData;
3561
-
3562
- declare function createRenderBatcher(scheduleNextBatch: (callback: Function) => void, allowKeepAlive: boolean, state?: FrameData): {
3563
- schedule: Batcher;
3564
- cancel: (process: Process) => void;
3565
- state: FrameData;
3566
- steps: Steps;
3567
- };
3568
-
3569
- declare const microtask: Batcher;
3570
- declare const cancelMicrotask: (process: Process) => void;
3940
+ interface InitialPromotionConfig {
3941
+ /**
3942
+ * The initial transition to use when the elements in this group mount (and automatically promoted).
3943
+ * Subsequent updates should provide a transition in the promote method.
3944
+ */
3945
+ transition?: Transition;
3946
+ /**
3947
+ * If the follow tree should preserve its opacity when the lead is promoted on mount
3948
+ */
3949
+ shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean;
3950
+ }
3951
+ interface ProjectionNodeOptions {
3952
+ animate?: boolean;
3953
+ layoutScroll?: boolean;
3954
+ layoutRoot?: boolean;
3955
+ alwaysMeasureLayout?: boolean;
3956
+ onExitComplete?: VoidFunction;
3957
+ animationType?: "size" | "position" | "both" | "preserve-aspect" | "x" | "y";
3958
+ layoutId?: string;
3959
+ layout?: boolean | string;
3960
+ visualElement?: VisualElement;
3961
+ crossfade?: boolean;
3962
+ transition?: Transition;
3963
+ initialPromotionConfig?: InitialPromotionConfig;
3964
+ layoutDependency?: unknown;
3965
+ layoutAnchor?: Point | false;
3966
+ }
3967
+ type ProjectionEventName = "layoutUpdate" | "projectionUpdate";
3571
3968
 
3969
+ type LayoutAnimationScope = Element | Document;
3970
+ type LayoutBuilderResolve = (animation: GroupAnimation) => void;
3971
+ type LayoutBuilderReject = (error: unknown) => void;
3572
3972
  /**
3573
- * Process a frame now, for driving Motion from a loop other than
3574
- * window.requestAnimationFrame, like an XRSession's during an immersive
3575
- * WebXR session. Wherever window.requestAnimationFrame does fire, Motion
3576
- * keeps processing frames from it too.
3577
- *
3578
- * `timestamp` defaults to now. For a timeline you control, set
3579
- * `MotionGlobalConfig.useManualTiming = true` and pass each frame's time in
3580
- * milliseconds.
3581
- *
3582
- * Animations Motion hands to the browser (WAAPI), like `opacity` or
3583
- * `transform` on an HTML or SVG element, follow the browser's clock. With
3584
- * `useManualTiming` on, Motion runs those in JS instead, except for
3585
- * `motion/mini`, view transitions and optimized appear animations, and
3586
- * colours only the browser can mix, like `oklch()`, which jump to their end.
3587
- *
3588
- * Ignored when called inside a frame.
3973
+ * Get a projection node for an element, so motion/remix can measure and
3974
+ * animate its layout. Reuses a node owned by a `motion` component or
3975
+ * animateLayout(), otherwise creates one in the shared imperative tree.
3976
+ * Returns the node and a function that releases it.
3589
3977
  */
3590
- declare const processFrame: (timestamp?: number) => void;
3591
-
3978
+ declare function acquireProjectionNode(element: HTMLElement): [IProjectionNode, VoidFunction];
3979
+ declare function flushPendingBuilders(): void;
3592
3980
  /**
3593
- * An eventloop-synchronous alternative to performance.now().
3594
- *
3595
- * Ensures that time measurements remain consistent within a synchronous context.
3596
- * Usually calling performance.now() twice within the same synchronous context
3597
- * will return different values which isn't useful for animations when we're usually
3598
- * trying to sync animations to the same frame.
3981
+ * Snapshot every pending animateLayout() now, rather than on the next
3982
+ * microtask. For renderers that tell us a DOM update is about to happen
3983
+ * and then make it synchronously (e.g. a beforeUpdate/commit pair), with
3984
+ * updateDom returning a promise that resolves on commit.
3599
3985
  */
3600
- declare const time: {
3601
- now: () => number;
3602
- set: (newTime: number) => void;
3986
+ declare const flushLayoutSnapshots: typeof flushPendingBuilders;
3987
+ declare class LayoutAnimationBuilder {
3988
+ private scope;
3989
+ private updateDom;
3990
+ private defaultOptions?;
3991
+ private sharedTransitions;
3992
+ private notifyReady;
3993
+ private rejectReady;
3994
+ private readyPromise;
3995
+ private tracked;
3996
+ private restorePoints;
3997
+ private updateError;
3998
+ constructor(scope: LayoutAnimationScope, updateDom: () => void | Promise<void>, defaultOptions?: AnimationOptions | undefined);
3999
+ shared(id: string, transition: AnimationOptions): this;
4000
+ then(resolve: LayoutBuilderResolve, reject?: LayoutBuilderReject): Promise<void>;
4001
+ transitionFor(element: HTMLElement): Transition | undefined;
4002
+ adopt(element: HTMLElement, node: IProjectionNode): void;
4003
+ collectTargets(): HTMLElement[];
4004
+ runUpdate(): Promise<void> | undefined;
4005
+ reconcileAdditions(newMemberIds: Set<string>): void;
4006
+ reconcileRemovals(newMemberIds: Set<string>): void;
4007
+ getRoot(): IProjectionNode | undefined;
4008
+ finalize(): void;
4009
+ }
4010
+ declare function parseAnimateLayoutArgs(scopeOrUpdateDom: ElementOrSelector | (() => void), updateDomOrOptions?: (() => void) | AnimationOptions, options?: AnimationOptions): {
4011
+ scope: Element | Document;
4012
+ updateDom: () => void;
4013
+ defaultOptions?: AnimationOptions;
3603
4014
  };
3604
4015
 
3605
4016
  /**
@@ -3613,10 +4024,11 @@ interface DragOptions {
3613
4024
  axis?: "x" | "y";
3614
4025
  /**
3615
4026
  * The permitted draggable area. Either `top`/`left`/`right`/`bottom`
3616
- * distances in pixels, relative to the element's origin, or an element
3617
- * the draggable element must stay within.
4027
+ * distances in pixels, relative to the element's origin, an element
4028
+ * the draggable element must stay within, or a function that returns
4029
+ * a `DragPointConstraint` to move the element itself.
3618
4030
  */
3619
- constraints?: Partial<BoundingBox> | Element;
4031
+ constraints?: Partial<BoundingBox> | Element | DragConstraintsFunction;
3620
4032
  /**
3621
4033
  * How far, from `0` to `1`, the element can move outside its
3622
4034
  * constraints. Can be set per edge. Defaults to `0.35`.
@@ -3653,122 +4065,29 @@ interface DragOptions {
3653
4065
  * Called when element constraints are measured. Return a new
3654
4066
  * `BoundingBox` to override them.
3655
4067
  */
3656
- onMeasureConstraints?: (constraints: BoundingBox) => BoundingBox | void;
3657
- }
3658
- /**
3659
- * Make elements draggable. Returns a function that removes the gesture.
3660
- *
3661
- * ```javascript
3662
- * const stop = drag("#box", { axis: "x", constraints: { left: 0, right: 300 } })
3663
- * ```
3664
- *
3665
- * The element's `x` and `y` are motion values shared with `animate()`
3666
- * and `animateLayout()`, so these can animate the element after a drag.
3667
- *
3668
- * @public
3669
- */
3670
- declare function drag(elementOrSelector: ElementOrSelector, options?: DragOptions): VoidFunction;
3671
-
3672
- declare const isDragging: {
3673
- x: boolean;
3674
- y: boolean;
3675
- };
3676
- declare function isDragActive(): boolean;
3677
-
3678
- declare function setDragLock(axis: boolean | "x" | "y" | "lockDirection"): (() => void) | null;
3679
-
3680
- declare const elementDragControls: WeakMap<VisualElement<unknown, unknown, {}>, VisualElementDragControls>;
3681
- interface DragControlOptions {
3682
- /**
3683
- * This distance after which dragging starts and a direction is locked in.
3684
- *
3685
- * @public
3686
- */
3687
- distanceThreshold?: number;
3688
- /**
3689
- * Whether to immediately snap to the cursor when dragging starts.
3690
- *
3691
- * @public
3692
- */
3693
- snapToCursor?: boolean;
3694
- }
3695
- declare class VisualElementDragControls {
3696
- private visualElement;
3697
- private panSession?;
3698
- private openDragLock;
3699
- isDragging: boolean;
3700
- private currentDirection;
3701
- private originPoint;
3702
- /**
3703
- * The permitted boundaries of travel, in pixels.
3704
- */
3705
- private constraints;
3706
- private hasMutatedConstraints;
3707
- /**
3708
- * The `layoutScroll` ancestors' scroll (see measureScroll) when ref
3709
- * constraints were last measured.
3710
- */
3711
- private scroll?;
3712
- /**
3713
- * The per-axis resolved elastic values.
3714
- */
3715
- private elastic;
3716
- /**
3717
- * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.
3718
- */
3719
- private latestPointerEvent;
3720
- /**
3721
- * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.
3722
- */
3723
- private latestPanInfo;
3724
- /**
3725
- * Where drag options are read from. By default these are the
3726
- * VisualElement's props (as with a React `motion` component), but the
3727
- * vanilla `drag()` API provides its own.
3728
- */
3729
- private readProps;
3730
- constructor(visualElement: VisualElement<HTMLElement>, readProps?: () => MotionNodeOptions);
3731
- start(originEvent: PointerEvent, { snapToCursor, distanceThreshold }?: DragControlOptions): void;
3732
- /**
3733
- * @param dragAxes - The axes to animate on release, if not the `drag`
3734
- * prop's, e.g. when drag was disabled mid-gesture.
3735
- */
3736
- stop(event?: PointerEvent, panInfo?: PanInfo, dragAxes?: MotionNodeOptions["drag"]): void;
3737
- cancel(): void;
3738
- /**
3739
- * Clean up the pan session without modifying other drag state.
3740
- * This is used during unmount to ensure event listeners are removed
3741
- * without affecting projection animations or drag locks.
3742
- */
3743
- endPanSession(): void;
3744
- private updateAxis;
3745
- private resolveConstraints;
3746
- private resolveRefConstraints;
3747
- private startAnimation;
3748
- private startAxisValueAnimation;
3749
- stopAnimation(): void;
3750
- /**
3751
- * Drag works differently depending on which props are provided.
3752
- *
3753
- * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
3754
- * - Otherwise, we apply the delta to the x/y motion values.
3755
- */
3756
- private getAxisMotionValue;
3757
- /**
3758
- * Measure the live box - projection.layout may or may not include the
3759
- * drag transform, depending on when it was measured.
3760
- */
3761
- private snapToCursor;
3762
- /**
3763
- * When the viewport resizes we want to check if the measured constraints
3764
- * have changed and, if so, reposition the element within those new constraints
3765
- * relative to where it was before the resize.
3766
- */
3767
- scalePositionWithinConstraints(): void;
3768
- addListeners(): (() => void) | undefined;
3769
- getProps(): MotionNodeOptions;
4068
+ onMeasureConstraints?: (constraints: BoundingBox) => BoundingBox | void;
3770
4069
  }
3771
- declare function expectsResolvedDragConstraints({ dragConstraints, onMeasureDragConstraints, }: MotionNodeOptions): boolean;
4070
+ /**
4071
+ * Make elements draggable. Returns a function that removes the gesture.
4072
+ *
4073
+ * ```javascript
4074
+ * const stop = drag("#box", { axis: "x", constraints: { left: 0, right: 300 } })
4075
+ * ```
4076
+ *
4077
+ * The element's `x` and `y` are motion values shared with `animate()`
4078
+ * and `animateLayout()`, so these can animate the element after a drag.
4079
+ *
4080
+ * @public
4081
+ */
4082
+ declare function drag(elementOrSelector: ElementOrSelector, options?: DragOptions): VoidFunction;
4083
+
4084
+ declare const isDragging: {
4085
+ x: boolean;
4086
+ y: boolean;
4087
+ };
4088
+ declare function isDragActive(): boolean;
4089
+
4090
+ declare function setDragLock(axis: boolean | "x" | "y" | "lockDirection"): (() => void) | null;
3772
4091
 
3773
4092
  /**
3774
4093
  * Options for event listeners.
@@ -4135,20 +4454,29 @@ interface StatsRecording {
4135
4454
  type InactiveStatsBuffer = {
4136
4455
  value: null;
4137
4456
  addProjectionMetrics: null;
4457
+ countProjection?: undefined;
4138
4458
  };
4139
4459
  type ActiveStatsBuffer = {
4140
4460
  value: StatsRecording;
4141
4461
  addProjectionMetrics: (metrics: LayoutProjectionMetrics) => void;
4462
+ /**
4463
+ * Counts one projection metric, by its index in recordStats()'s
4464
+ * projectionMetrics.
4465
+ * Called without one at the end of a projection frame, it records the
4466
+ * frame's counts and starts the next.
4467
+ */
4468
+ countProjection: (metric?: number) => void;
4142
4469
  };
4143
4470
  declare const statsBuffer: InactiveStatsBuffer | ActiveStatsBuffer;
4144
4471
 
4145
- type Mixer<T> = (p: number) => T;
4146
- type MixerFactory<T> = (a: T, b: T) => Mixer<T>;
4147
-
4148
4472
  interface InterpolateOptions<T> {
4149
4473
  clamp?: boolean;
4150
4474
  ease?: EasingFunction | EasingFunction[];
4151
- mixer?: MixerFactory<T>;
4475
+ /**
4476
+ * Returns a mixer for a pair of values, or `undefined` to mix them
4477
+ * as usual.
4478
+ */
4479
+ mixer?: (from: T, to: T) => Mixer<T> | undefined;
4152
4480
  }
4153
4481
  /**
4154
4482
  * Create a function that maps from a numerical input array to a generic output array.
@@ -4311,11 +4639,12 @@ interface TransformOptions<T> {
4311
4639
  */
4312
4640
  ease?: EasingFunction | EasingFunction[];
4313
4641
  /**
4314
- * Provide a function that can interpolate between any two values in the provided range.
4642
+ * Provide a function that can interpolate between any two values in the provided range,
4643
+ * or return `undefined` to interpolate them as usual.
4315
4644
  *
4316
4645
  * @public
4317
4646
  */
4318
- mixer?: (from: T, to: T) => (v: number) => any;
4647
+ mixer?: (from: T, to: T) => ((v: number) => any) | undefined;
4319
4648
  }
4320
4649
  /**
4321
4650
  * Transforms numbers into other values by mapping them from an input range to an output range.
@@ -5183,19 +5512,6 @@ declare function addPointerEvent(target: EventTarget, eventName: string, handler
5183
5512
  declare const distance: (a: number, b: number) => number;
5184
5513
  declare function distance2D(a: Point, b: Point): number;
5185
5514
 
5186
- interface WithDepth {
5187
- depth: number;
5188
- }
5189
- declare const compareByDepth: (a: VisualElement, b: VisualElement) => number;
5190
-
5191
- declare class FlatTree {
5192
- private children;
5193
- private isDirty;
5194
- add(child: WithDepth): void;
5195
- remove(child: WithDepth): void;
5196
- forEach(callback: (child: WithDepth) => void): void;
5197
- }
5198
-
5199
5515
  type DelayedFunction = (overshoot: number) => void;
5200
5516
  /**
5201
5517
  * Timeout defined in ms
@@ -5208,185 +5524,6 @@ declare function delayInSeconds(callback: DelayedFunction, timeout: number): ()
5208
5524
  */
5209
5525
  declare function resolveMotionValue(value?: AnyResolvedKeyframe | MotionValue): AnyResolvedKeyframe;
5210
5526
 
5211
- interface Measurements {
5212
- animationId: number;
5213
- measuredBox: Box;
5214
- layoutBox: Box;
5215
- latestValues: ResolvedValues$1;
5216
- source: number;
5217
- }
5218
- type Phase = "snapshot" | "measure";
5219
- interface ScrollMeasurements {
5220
- animationId: number;
5221
- phase: Phase;
5222
- offset: Point;
5223
- isRoot: boolean;
5224
- wasRoot: boolean;
5225
- }
5226
- type LayoutEvents = "willUpdate" | "didUpdate" | "beforeMeasure" | "measure" | "projectionUpdate" | "animationStart" | "animationComplete";
5227
- interface IProjectionNode<I = unknown> {
5228
- id: number;
5229
- animationId: number;
5230
- animationCommitId: number;
5231
- parent?: IProjectionNode;
5232
- relativeParent?: IProjectionNode;
5233
- root?: IProjectionNode;
5234
- children: Set<IProjectionNode>;
5235
- path: IProjectionNode[];
5236
- nodes?: FlatTree;
5237
- depth: number;
5238
- instance: I | undefined;
5239
- mount: (node: I, isLayoutDirty?: boolean) => void;
5240
- unmount: () => void;
5241
- options: ProjectionNodeOptions;
5242
- setOptions(options: ProjectionNodeOptions): void;
5243
- layout?: Measurements;
5244
- dragSnapshot?: Measurements;
5245
- dragAncestor?: IProjectionNode;
5246
- snapshot?: Measurements;
5247
- target?: Box;
5248
- relativeTarget?: Box;
5249
- relativeTargetOrigin?: Box;
5250
- targetDelta?: Delta;
5251
- targetWithTransforms?: Box;
5252
- scroll?: ScrollMeasurements;
5253
- treeScale?: Point;
5254
- projectionDelta?: Delta;
5255
- projectionDeltaWithTransform?: Delta;
5256
- latestValues: ResolvedValues$1;
5257
- isLayoutDirty: boolean;
5258
- isProjectionDirty: boolean;
5259
- isSharedProjectionDirty: boolean;
5260
- isTransformDirty: boolean;
5261
- resolvedRelativeTargetAt?: number;
5262
- shouldResetTransform: boolean;
5263
- prevTransformTemplateValue: string | undefined;
5264
- isUpdateBlocked(): boolean;
5265
- updateManuallyBlocked: boolean;
5266
- updateBlockedByResize: boolean;
5267
- blockUpdate(): void;
5268
- unblockUpdate(): void;
5269
- isUpdating: boolean;
5270
- needsReset: boolean;
5271
- needsShow?: boolean;
5272
- startUpdate(): void;
5273
- willUpdate(notifyListeners?: boolean): void;
5274
- didUpdate(): void;
5275
- measure(removeTransform?: boolean): Measurements;
5276
- measurePageBox(): Box;
5277
- updateLayout(): void;
5278
- updateSnapshot(): void;
5279
- clearSnapshot(): void;
5280
- updateScroll(phase?: Phase): void;
5281
- scheduleUpdateProjection(): void;
5282
- scheduleCheckAfterUnmount(): void;
5283
- checkUpdateFailed(): void;
5284
- sharedNodes: Map<string, NodeStack>;
5285
- registerSharedNode(id: string, node: IProjectionNode): void;
5286
- getStack(): NodeStack | undefined;
5287
- isVisible: boolean;
5288
- hide(): void;
5289
- show(): void;
5290
- scheduleRender(notifyAll?: boolean): void;
5291
- getClosestProjectingParent(): IProjectionNode | undefined;
5292
- setTargetDelta(delta: Delta): void;
5293
- resetTransform(): void;
5294
- resetSkewAndRotation(): void;
5295
- applyTransform(box: Box, transformOnly?: boolean, output?: Box, skipOwnTransform?: boolean, start?: number): Box;
5296
- resolveTargetDelta(force?: boolean): void;
5297
- removeRelativeTarget(): void;
5298
- calcProjection(): void;
5299
- applyProjectionStyles(targetStyle: CSSStyleDeclaration, styleProp?: MotionStyle): void;
5300
- clearMeasurements(): void;
5301
- resetTree(): void;
5302
- isProjecting(): boolean;
5303
- animationValues?: ResolvedValues$1;
5304
- currentAnimation?: JSAnimation<number>;
5305
- isTreeAnimating?: boolean;
5306
- isAnimationBlocked?: boolean;
5307
- setAnimationOrigin(delta: Delta, hasOnlyRelativeTargetChanged?: boolean, pathFn?: MotionPath): void;
5308
- startAnimation(transition: ValueTransition): void;
5309
- finishAnimation(): void;
5310
- hasCheckedOptimisedAppear: boolean;
5311
- isLead(): boolean;
5312
- promote(options?: {
5313
- needsReset?: boolean;
5314
- transition?: Transition;
5315
- preserveFollowOpacity?: boolean;
5316
- }): void;
5317
- relegate(): boolean;
5318
- resumeFrom?: IProjectionNode;
5319
- resumingFrom?: IProjectionNode;
5320
- isPresent?: boolean;
5321
- addEventListener(name: LayoutEvents, handler: any): VoidFunction;
5322
- notifyListeners(name: LayoutEvents, ...args: any): void;
5323
- hasListeners(name: LayoutEvents): boolean;
5324
- hasTreeAnimated: boolean;
5325
- preserveOpacity?: boolean;
5326
- }
5327
- interface LayoutUpdateData {
5328
- layout: Box;
5329
- snapshot: Measurements;
5330
- delta: Delta;
5331
- layoutDelta: Delta;
5332
- hasLayoutChanged: boolean;
5333
- hasRelativeLayoutChanged: boolean;
5334
- }
5335
- type LayoutUpdateHandler = (data: LayoutUpdateData) => void;
5336
- interface ProjectionNodeConfig<I> {
5337
- defaultParent?: () => IProjectionNode;
5338
- attachResizeListener?: (instance: I, notifyResize: VoidFunction) => VoidFunction;
5339
- measureScroll: (instance: I) => Point;
5340
- checkIsScrollRoot: (instance: I) => boolean;
5341
- resetTransform?: (instance: I, value?: string) => void;
5342
- }
5343
- /**
5344
- * Configuration for initial promotion of shared layout elements.
5345
- * This was originally in React's SwitchLayoutGroupContext but is now
5346
- * framework-agnostic to support vanilla JS usage.
5347
- */
5348
- interface InitialPromotionConfig {
5349
- /**
5350
- * The initial transition to use when the elements in this group mount (and automatically promoted).
5351
- * Subsequent updates should provide a transition in the promote method.
5352
- */
5353
- transition?: Transition;
5354
- /**
5355
- * If the follow tree should preserve its opacity when the lead is promoted on mount
5356
- */
5357
- shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean;
5358
- }
5359
- interface ProjectionNodeOptions {
5360
- animate?: boolean;
5361
- layoutScroll?: boolean;
5362
- layoutRoot?: boolean;
5363
- alwaysMeasureLayout?: boolean;
5364
- onExitComplete?: VoidFunction;
5365
- animationType?: "size" | "position" | "both" | "preserve-aspect" | "x" | "y";
5366
- layoutId?: string;
5367
- layout?: boolean | string;
5368
- visualElement?: VisualElement;
5369
- crossfade?: boolean;
5370
- transition?: Transition;
5371
- initialPromotionConfig?: InitialPromotionConfig;
5372
- layoutDependency?: unknown;
5373
- layoutAnchor?: Point | false;
5374
- }
5375
- type ProjectionEventName = "layoutUpdate" | "projectionUpdate";
5376
-
5377
- declare class NodeStack {
5378
- lead?: IProjectionNode;
5379
- prevLead?: IProjectionNode;
5380
- members: IProjectionNode[];
5381
- add(node: IProjectionNode): void;
5382
- remove(node: IProjectionNode): void;
5383
- relegate(node: IProjectionNode): boolean;
5384
- promote(node: IProjectionNode, preserveFollowOpacity?: boolean): void;
5385
- exitAnimationComplete(): void;
5386
- scheduleRender(): void;
5387
- removeLeadSnapshot(): void;
5388
- }
5389
-
5390
5527
  declare function createProjectionNode<I>({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }: ProjectionNodeConfig<I>): {
5391
5528
  new (latestValues?: ResolvedValues$1, parent?: IProjectionNode | undefined): {
5392
5529
  /**
@@ -5720,6 +5857,16 @@ declare function createProjectionNode<I>({ attachResizeListener, defaultParent,
5720
5857
  clearSnapshot(): void;
5721
5858
  resetTree(): void;
5722
5859
  };
5860
+ /**
5861
+ * Create the projection node of a `motion` component's VisualElement,
5862
+ * from its props. This runs while the component renders, before its
5863
+ * children. It's here rather than in the component so React
5864
+ * bundles only include it with the features that supply a
5865
+ * ProjectionNode. Vanilla bundles that use the projection node
5866
+ * (drag(), animateLayout()) include it too, as a class static
5867
+ * can't be tree-shaken.
5868
+ */
5869
+ create(visualElement: VisualElement<any>, props: MotionNodeOptions, initialPromotionConfig?: InitialPromotionConfig): void;
5723
5870
  };
5724
5871
  declare function propagateDirtyNodes(node: IProjectionNode): void;
5725
5872
  declare function cleanDirtyNodes(node: IProjectionNode): void;
@@ -5859,6 +6006,7 @@ declare const DocumentProjectionNode: {
5859
6006
  clearSnapshot(): void;
5860
6007
  resetTree(): void;
5861
6008
  };
6009
+ create(visualElement: VisualElement<any, unknown, {}>, props: MotionNodeOptions, initialPromotionConfig?: InitialPromotionConfig | undefined): void;
5862
6010
  };
5863
6011
 
5864
6012
  interface NodeGroup {
@@ -6003,6 +6151,7 @@ declare const HTMLProjectionNode: {
6003
6151
  clearSnapshot(): void;
6004
6152
  resetTree(): void;
6005
6153
  };
6154
+ create(visualElement: VisualElement<any, unknown, {}>, props: MotionNodeOptions, initialPromotionConfig?: InitialPromotionConfig | undefined): void;
6006
6155
  };
6007
6156
 
6008
6157
  declare const rootProjectionNode: {
@@ -6073,38 +6222,6 @@ declare function scrapeMotionValuesFromProps(props: MotionNodeOptions, prevProps
6073
6222
  [key: string]: any;
6074
6223
  };
6075
6224
 
6076
- type LayoutAnimationScope = Element | Document;
6077
- type LayoutBuilderResolve = (animation: GroupAnimation) => void;
6078
- type LayoutBuilderReject = (error: unknown) => void;
6079
- declare class LayoutAnimationBuilder {
6080
- private scope;
6081
- private updateDom;
6082
- private defaultOptions?;
6083
- private sharedTransitions;
6084
- private notifyReady;
6085
- private rejectReady;
6086
- private readyPromise;
6087
- private tracked;
6088
- private restorePoints;
6089
- private updateError;
6090
- constructor(scope: LayoutAnimationScope, updateDom: () => void | Promise<void>, defaultOptions?: AnimationOptions | undefined);
6091
- shared(id: string, transition: AnimationOptions): this;
6092
- then(resolve: LayoutBuilderResolve, reject?: LayoutBuilderReject): Promise<void>;
6093
- transitionFor(element: HTMLElement): Transition | undefined;
6094
- adopt(element: HTMLElement, node: IProjectionNode): void;
6095
- collectTargets(): HTMLElement[];
6096
- runUpdate(): Promise<void> | undefined;
6097
- reconcileAdditions(newMemberIds: Set<string>): void;
6098
- reconcileRemovals(newMemberIds: Set<string>): void;
6099
- getRoot(): IProjectionNode | undefined;
6100
- finalize(): void;
6101
- }
6102
- declare function parseAnimateLayoutArgs(scopeOrUpdateDom: ElementOrSelector | (() => void), updateDomOrOptions?: (() => void) | AnimationOptions, options?: AnimationOptions): {
6103
- scope: Element | Document;
6104
- updateDom: () => void;
6105
- defaultOptions?: AnimationOptions;
6106
- };
6107
-
6108
6225
  /**
6109
6226
  * Animate layout changes made within `updateDom` on elements tagged
6110
6227
  * with `data-layout` or `data-layout-id`.
@@ -6130,4 +6247,4 @@ declare const sync: Batcher;
6130
6247
  */
6131
6248
  declare const cancelSync: Record<string, (process: Process) => void>;
6132
6249
 
6133
- export { type AccelerateConfig, type AcceptedAnimations, type ActiveStatsBuffer, type AddEffectValue, type AnimateEffect, type AnimationDefinition, type AnimationGeneratorName, type AnimationGeneratorType, type AnimationList, type AnimationOptions, type AnimationOrchestrationOptions, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState$1 as AnimationState, type AnimationType, type AnimationTypeState, type AnyResolvedKeyframe, type ArcOptions, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, DOMVisualElement, type DOMVisualElementOptions, type DecayOptions, type DelayedFunction, DocumentProjectionNode, type DragControlOptions, type DragElastic, type DragHandler, type DragOptions, type DraggableProps, type DurationSpringOptions, type DynamicOption, type Effect, type EffectKeyframes, type EffectOptions, type EffectRead, type EffectTest, type EffectTransition, type ElementOrSelector, type EventInfo, type EventListenerWithPointInfo, type EventOptions, Feature, type FeatureClass, FlatTree, type FollowValueOptions, type FrameData, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, HTMLProjectionNode, type HTMLRenderState, HTMLVisualElement, type HandoffFunction, type IProjectionNode, type InactiveStatsBuffer, type InertiaOptions, type InitialPromotionConfig, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, LayoutAnimationBuilder, type LayoutEvents, type LayoutLifecycles, type LayoutProjectionMetrics, type LayoutProjectionStats, type LayoutUpdateData, type LayoutUpdateHandler, type LegacyAnimationControls, type MapInputRange, type Measurements, type MediaConditions, type Mixer, type MixerFactory, type MotionConfigContextProps, type MotionNodeAdvancedOptions, type MotionNodeAnimationOptions, type MotionNodeDragHandlers, type MotionNodeDraggableOptions, type MotionNodeEventOptions, type MotionNodeFocusHandlers, type MotionNodeHoverHandlers, type MotionNodeLayoutOptions, type MotionNodeOptions, type MotionNodePanHandlers, type MotionNodeTapHandlers, type MotionNodeViewportOptions, type MotionPath, type MotionScope, type MotionStyle, MotionValue, type MotionValueAnimation, type MotionValueEventCallbacks, type MotionValueOptions, MotionValueState, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NodeGroup, NodeStack, type NumberMap, ObjectVisualElement, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PanHandler, type PanInfo, PanSession, type PassiveEffect, type PathInterpolator, type PathState, type Phase, type Point2D, type PointerEventOptions, type PresenceContextProps, type PressGestureInfo, type Process, type ProgressTimeline, type ProjectionEventName, type ProjectionNodeConfig, type ProjectionNodeOptions, type PropagateOptions, type RGBA, type ReducedMotionConfig, type RepeatType, type ResolvedConstraints, type ResolvedElastic, type ResolvedKeyframes, type ResolvedValueKeyframe, type ResolvedValues$1 as ResolvedValues, type SVGAttributes, type SVGForcedAttrKeyframesDefinition, type SVGForcedAttrProperties, type SVGForcedAttrTransitions, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGRenderState, type SVGTransitions, SVGVisualElement, type ScaleCorrectionNode, type ScaleCorrector, type ScaleCorrectorDefinition, type ScaleCorrectorMap, type Schedule, type ScopeOptions, type ScopeSetup, type ScopeState, type ScrapeMotionValuesFromProps, type ScrollMeasurements, type SelectorCache, type SingleTransformer, type Spring, type SpringOptions, type StaggerOptions, type StaggerOrigin, type StartAnimation, type StatsRecording, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleSubject, type StyleTransitions, type Subscriber, type TapHandlers, type TapInfo, type Target, type TargetAndTransition, type TargetResolver, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformOrigin, type TransformProperties, type TransformTemplate, type Transformer, type Transition, type TransitionWithValueOverrides, type Tween, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type UseRenderState, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueAnimationWithDynamicDelay, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueTransition, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type Variant, type VariantLabels, type Variants, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type ViewTransitionTargetDefinition, type ViewportEventHandler, type ViewportOptions, VisualElement, type VisualElementAnimationOptions, VisualElementDragControls, type VisualElementEventCallbacks, type VisualElementOptions, type VisualState, type WillChange, type WithAppearProps, type WithDepth, type WithQuerySelectorAll, acceleratedValues, activeScope, addAttrValue, addBuilderToScope, addDomEvent, addEffect, addPointerEvent, addPointerInfo, addSVGValue, addScaleCorrector, addStyleValue, addToScope, addValueToWillChange, alpha, analyseComplexValue, animateEffectSubject, animateElement, animateLayout, animateMotionValue, animateSingleValue, animateTarget, animateValue, animateValues, animateVariant, animateView, animateVisualElement, animationMapKey, applyAxisDelta, applyBoxDelta, applyGeneratorOptions, applyPointDelta, applyPxDefaults, applyTreeDeltas, arc, aspectRatio, attachFollow, attachSpring, attrEffect, axisDeltaEquals, axisEquals, axisEqualsRounded, bindToScope, boxEquals, boxEqualsRounded, buildHTMLStyles, buildProjectionTransform, buildSVGAttrs, buildSVGPath, buildTransform, buildTransformer, calcAxisDelta, calcBoxDelta, calcChildStagger, calcGeneratorDuration, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, camelCaseAttributes, camelToDash, cancelFrame, cancelMicrotask, cancelSync, checkVariantsDidChange, cleanDirtyNodes, collectMotionValues, color, compareByDepth, complex, containsCSSVariable, convertBoundingBoxToBox, convertBoxToBoundingBox, convertOffsetToTimes, copyAxisDeltaInto, copyAxisInto, copyBoxInto, correctBorderRadius, correctBoxShadow, createAnimationState, createAxis, createAxisDelta, createBox, createDelta, createEffect, createGeneratorEasing, createProjectionNode, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, delay, delayInSeconds, dimensionValueTypes, distance, distance2D, drag, eachAxis, elementDragControls, expectsResolvedDragConstraints, extractEventInfo, fillOffset, fillWildcards, findDimensionValueType, findEffect, findValueType, flushKeyframeResolvers, followValue, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultTransition, getDefaultValueType, getFeatureDefinitions, getFinalKeyframe, getMixer, getOptimisedAppearId, getOriginIndex, getValueAsType, getValueTransition, getVariableValue, getVariantContext, getViewAnimationLayerInfo, getViewAnimations, globalProjectionState, handOffElementState, has2DTranslate, hasComplexValues, hasReducedMotionListener, hasScale, hasTransform, hex, hover, hsla, hslaToRgba, inertia, initPrefersReducedMotion, interpolate, invisibleValues, isAnimationControls, isCSSVariableName, isCSSVariableToken, isControllingVariants, isDeltaZero, isDragActive, isDragging, isElementKeyboardAccessible, isElementTextInput, isForcedMotionValue, isGenerator, isHTMLElement, isKeyframesTarget, isMotionValue, isNear, isNodeOrChild, isPrimaryPointer, isSVGElement, isSVGSVGElement, isSVGTag, isTransitionDefined, isVariantLabel, isVariantNode, isWaapiSupportedEasing, isWillChangeMotionValue, keyframes, makeAnimationInstant, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, measurePageBox, measureViewportBox, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixValues, mixVisibility, motionValue, nodeGroup, number, numberValueTypes, optimizedAppearDataAttribute, optimizedAppearDataId, originProps, parseAnimateLayoutArgs, parseCSSVariable, parseValueFromTransform, percent, pixelsToPercent, positionalKeys, prefersReducedMotion, press, processFrame, progressPercentage, propEffect, propagateDirtyNodes, px, readSVGValue, readStyleValue, readTransformValue, recordStats, releaseElement, removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removeEffect, removePointDelta, renderHTML, renderSVG, resize, resolveElements, resolveMotionValue, resolveTransition, resolveVariant, resolveVariantFromProps, rgbUnit, rgba, rootProjectionNode, round, sampleDelta, scale, scaleCorrectors, scalePoint, scopeMotion, scrapeMotionValuesFromProps$1 as scrapeHTMLMotionValuesFromProps, scrapeMotionValuesFromProps as scrapeSVGMotionValuesFromProps, setDragLock, setFeatureDefinitions, setStyle, setTarget, spring, springValue, stagger, startWaapiAnimation, statsBuffer, styleEffect, styleSubjectEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, supportsViewTimeline, supportsWaapi, svgEffect, svgSubjectEffect, sync, testValueType, time, toMediaQuery, transform, transformAxis, transformBox, transformBoxPoints, transformPropOrder, transformProps, transformValue, transformValueTypes, translateAxis, updateMotionValuesFromProps, variantPriorityOrder, variantProps, vh, visualElementStore, vw };
6250
+ export { type AccelerateConfig, type AcceptedAnimations, type ActiveStatsBuffer, type AddEffectValue, type AnimateEffect, type AnimationDefinition, type AnimationGeneratorName, type AnimationGeneratorType, type AnimationList, type AnimationOptions, type AnimationOrchestrationOptions, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState$1 as AnimationState, type AnimationType, type AnimationTypeState, type AnyResolvedKeyframe, type ArcOptions, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, DOMVisualElement, type DOMVisualElementOptions, type DecayOptions, type DelayedFunction, DocumentProjectionNode, type DragConstraintsContext, type DragConstraintsFunction, type DragControlOptions, type DragElastic, type DragHandler, type DragOptions, type DragPointConstraint, type DraggableProps, type DurationSpringOptions, type DynamicOption, type Effect, type EffectKeyframes, type EffectOptions, type EffectRead, type EffectTest, type EffectTransition, type ElementOrSelector, type EventInfo, type EventListenerWithPointInfo, type EventOptions, Feature, type FeatureClass, FlatTree, type FollowValueOptions, type FrameData, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, HTMLProjectionNode, type HTMLRenderState, HTMLVisualElement, type HandoffFunction, type IProjectionNode, type InactiveStatsBuffer, type InertiaOptions, type InitialPromotionConfig, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, LayoutAnimationBuilder, type LayoutEvents, type LayoutLifecycles, type LayoutProjectionMetrics, type LayoutProjectionStats, type LayoutUpdateData, type LayoutUpdateHandler, type LegacyAnimationControls, type MapInputRange, type Measurements, type MediaConditions, type Mixer, type MixerFactory, type MotionConfigContextProps, type MotionNodeAdvancedOptions, type MotionNodeAnimationOptions, type MotionNodeDragHandlers, type MotionNodeDraggableOptions, type MotionNodeEventOptions, type MotionNodeFocusHandlers, type MotionNodeHoverHandlers, type MotionNodeLayoutOptions, type MotionNodeOptions, type MotionNodePanHandlers, type MotionNodeTapHandlers, type MotionNodeViewportOptions, type MotionPath, type MotionScope, type MotionStyle, MotionValue, type MotionValueAnimation, type MotionValueEventCallbacks, type MotionValueOptions, MotionValueState, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NodeGroup, NodeStack, type NumberMap, ObjectVisualElement, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PanHandler, type PanInfo, PanSession, type PassiveEffect, type PathInterpolator, type PathState, type Phase, type Point2D, type PointerEventOptions, type PresenceContextProps, type PressGestureInfo, type Process, type ProgressTimeline, type ProjectionEventName, type ProjectionNodeConfig, type ProjectionNodeOptions, type PropagateOptions, type RGBA, type ReducedMotionConfig, type RepeatType, type ResolvedConstraints, type ResolvedElastic, type ResolvedKeyframes, type ResolvedValueKeyframe, type ResolvedValues$1 as ResolvedValues, type SVGAttributes, type SVGForcedAttrKeyframesDefinition, type SVGForcedAttrProperties, type SVGForcedAttrTransitions, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGRenderState, type SVGTransitions, SVGVisualElement, type ScaleCorrectionNode, type ScaleCorrector, type ScaleCorrectorDefinition, type ScaleCorrectorMap, type Schedule, type ScopeOptions, type ScopeSetup, type ScopeState, type ScrapeMotionValuesFromProps, type ScrollMeasurements, type SelectorCache, type SingleTransformer, type Spring, type SpringOptions, type StaggerOptions, type StaggerOrigin, type StartAnimation, type StatsRecording, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleSubject, type StyleTransitions, type Subscriber, type TapHandlers, type TapInfo, type Target, type TargetAndTransition, type TargetResolver, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformOrigin, type TransformProperties, type TransformTemplate, type Transformer, type Transition, type TransitionWithValueOverrides, type Tween, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type UseRenderState, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueAnimationWithDynamicDelay, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueTransition, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type Variant, type VariantLabels, type Variants, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type ViewTransitionTargetDefinition, type ViewportEventHandler, type ViewportOptions, VisualElement, type VisualElementAnimationOptions, VisualElementDragControls, type VisualElementEventCallbacks, type VisualElementOptions, type VisualState, type WillChange, type WithAppearProps, type WithDepth, type WithQuerySelectorAll, acceleratedValues, acquireProjectionNode, activeScope, addAttrValue, addBuilderToScope, addDomEvent, addEffect, addPointerEvent, addPointerInfo, addSVGValue, addScaleCorrector, addStyleValue, addToScope, addValueToWillChange, alpha, analyseComplexValue, animateEffectSubject, animateElement, animateLayout, animateMotionValue, animateSingleValue, animateTarget, animateValue, animateValues, animateVariant, animateView, animateVisualElement, animationMapKey, applyAxisDelta, applyBoxDelta, applyGeneratorOptions, applyPointDelta, applyPxDefaults, applyTreeDeltas, arc, aspectRatio, attachFollow, attachSpring, attrEffect, axisDeltaEquals, axisEquals, axisEqualsRounded, bindToScope, boxEquals, boxEqualsRounded, buildHTMLStyles, buildProjectionTransform, buildSVGAttrs, buildSVGPath, buildTransform, buildTransformer, calcAxisDelta, calcBoxDelta, calcChildStagger, calcGeneratorDuration, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, camelCaseAttributes, camelToDash, cancelFrame, cancelMicrotask, cancelSync, checkVariantsDidChange, cleanDirtyNodes, collectMotionValues, color, compareByDepth, complex, containsCSSVariable, convertBoundingBoxToBox, convertBoxToBoundingBox, convertOffsetToTimes, copyAxisDeltaInto, copyAxisInto, copyBoxInto, correctBorderRadius, correctBoxShadow, createAnimationState, createAxis, createAxisDelta, createBox, createDelta, createEffect, createGeneratorEasing, createProjectionNode, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, delay, delayInSeconds, dimensionValueTypes, distance, distance2D, drag, eachAxis, elementDragControls, expectsResolvedDragConstraints, extractEventInfo, fillOffset, fillWildcards, findDimensionValueType, findEffect, findValueType, flushKeyframeResolvers, flushLayoutSnapshots, followValue, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultTransition, getDefaultValueType, getFeatureDefinitions, getFinalKeyframe, getMixer, getOptimisedAppearId, getOriginIndex, getValueAsType, getValueTransition, getVariableValue, getVariantContext, getViewAnimationLayerInfo, getViewAnimations, globalProjectionState, handOffElementState, has2DTranslate, hasComplexValues, hasReducedMotionListener, hasScale, hasTransform, hex, hover, hsla, hslaToRgba, inertia, initPrefersReducedMotion, interpolate, invisibleValues, isAnimationControls, isCSSVariableName, isCSSVariableToken, isControllingVariants, isDeltaZero, isDragActive, isDragging, isElementKeyboardAccessible, isElementTextInput, isForcedMotionValue, isGenerator, isHTMLElement, isKeyframesTarget, isMotionValue, isNear, isNodeOrChild, isPrimaryPointer, isSVGElement, isSVGSVGElement, isSVGTag, isTransitionDefined, isVariantLabel, isVariantNode, isWaapiSupportedEasing, isWillChangeMotionValue, keyframes, makeAnimationInstant, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, measurePageBox, measureViewportBox, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixValues, mixVisibility, motionValue, nodeGroup, number, numberValueTypes, optimizedAppearDataAttribute, optimizedAppearDataId, originProps, parseAnimateLayoutArgs, parseCSSVariable, parseValueFromTransform, percent, pixelsToPercent, positionalKeys, prefersReducedMotion, press, processFrame, progressPercentage, propEffect, propagateDirtyNodes, px, readSVGValue, readStyleValue, readTransformValue, recordStats, releaseElement, removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removeEffect, removePointDelta, renderHTML, renderSVG, resize, resolveElements, resolveMotionValue, resolveTransition, resolveVariant, resolveVariantFromProps, rgbUnit, rgba, rootProjectionNode, round, sampleDelta, scale, scaleCorrectors, scalePoint, scopeMotion, scrapeMotionValuesFromProps$1 as scrapeHTMLMotionValuesFromProps, scrapeMotionValuesFromProps as scrapeSVGMotionValuesFromProps, setDragLock, setFeatureDefinitions, setStyle, setTarget, spring, springValue, stagger, startWaapiAnimation, statsBuffer, styleEffect, styleSubjectEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, supportsViewTimeline, supportsWaapi, svgEffect, svgSubjectEffect, sync, testValueType, time, toMediaQuery, transform, transformAxis, transformBox, transformBoxPoints, transformPropOrder, transformProps, transformValue, transformValueTypes, translateAxis, updateMotionValuesFromProps, variantPriorityOrder, variantProps, vh, visualElementStore, vw };