framer-motion 5.3.0 → 5.3.1

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.
@@ -6,6 +6,8 @@ import { isAnimatable } from './is-animatable.mjs';
6
6
  import { getDefaultTransition } from './default-transitions.mjs';
7
7
  import { warning } from 'hey-listen';
8
8
  import { getAnimatableNone } from '../../render/dom/value-types/animatable-none.mjs';
9
+ import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
10
+ import { resolveFinalValueInKeyframes } from '../../utils/resolve-value.mjs';
9
11
 
10
12
  /**
11
13
  * Decide whether a transition is defined on a given Transition.
@@ -148,9 +150,10 @@ function getAnimation(key, value, target, transition, onComplete) {
148
150
  }
149
151
  function set() {
150
152
  var _a, _b;
151
- value.set(target);
153
+ var finalTarget = resolveFinalValueInKeyframes(target);
154
+ value.set(finalTarget);
152
155
  onComplete();
153
- (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, target);
156
+ (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, finalTarget);
154
157
  (_b = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _b === void 0 ? void 0 : _b.call(valueTransition);
155
158
  return { stop: function () { } };
156
159
  }
@@ -182,6 +185,9 @@ function getValueTransition(transition, key) {
182
185
  */
183
186
  function startAnimation(key, value, target, transition) {
184
187
  if (transition === void 0) { transition = {}; }
188
+ if (instantAnimationState.current) {
189
+ transition = { type: false };
190
+ }
185
191
  return value.start(function (onComplete) {
186
192
  var delayTimer;
187
193
  var controls;
@@ -14,7 +14,7 @@ function useDefaultMotionValue(value, defaultValue) {
14
14
  return isMotionValue(value) ? value : useMotionValue(defaultValue);
15
15
  }
16
16
  function ReorderItem(_a, externalRef) {
17
- var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, props = __rest(_a, ["children", "style", "value", "as"]);
17
+ var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, props = __rest(_a, ["children", "style", "value", "as", "onDrag"]);
18
18
  var Component = useConstant(function () { return motion(as); });
19
19
  var context = useContext(ReorderContext);
20
20
  var point = {
@@ -31,10 +31,11 @@ function ReorderItem(_a, externalRef) {
31
31
  useEffect(function () {
32
32
  registerItem(value, layout.current);
33
33
  }, [context]);
34
- return (React.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: true, onDrag: function (_event, _a) {
35
- var velocity = _a.velocity;
34
+ return (React.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: true, onDrag: function (event, gesturePoint) {
35
+ var velocity = gesturePoint.velocity;
36
36
  velocity[axis] &&
37
37
  updateOrder(value, point[axis].get(), velocity[axis]);
38
+ onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, gesturePoint);
38
39
  }, onLayoutMeasure: function (measured) {
39
40
  layout.current = measured;
40
41
  }, ref: externalRef }), children));
@@ -8,8 +8,11 @@ function createHoverEvent(visualElement, isActive, callback) {
8
8
  var _a;
9
9
  if (!isMouseEvent(event) || isDragActive())
10
10
  return;
11
- callback === null || callback === void 0 ? void 0 : callback(event, info);
11
+ /**
12
+ * Ensure we trigger animations before firing event callback
13
+ */
12
14
  (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);
15
+ callback === null || callback === void 0 ? void 0 : callback(event, info);
13
16
  };
14
17
  }
15
18
  function useHoverGesture(_a) {
@@ -50,8 +50,11 @@ function useTapGesture(_a) {
50
50
  return;
51
51
  isPressing.current = true;
52
52
  cancelPointerEndListeners.current = pipe(addPointerEvent(window, "pointerup", onPointerUp), addPointerEvent(window, "pointercancel", onPointerCancel));
53
- onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
53
+ /**
54
+ * Ensure we trigger animations before firing event callback
55
+ */
54
56
  (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);
57
+ onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
55
58
  }
56
59
  usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined);
57
60
  useUnmountEffect(removePointerEndListener);
package/dist/es/index.mjs CHANGED
@@ -31,6 +31,7 @@ export { useDomEvent } from './events/use-dom-event.mjs';
31
31
  export { createMotionComponent } from './motion/index.mjs';
32
32
  export { visualElement } from './render/index.mjs';
33
33
  export { addScaleCorrector } from './projection/styles/scale-correction.mjs';
34
+ export { useInstantTransition } from './utils/use-instant-transition.mjs';
34
35
  export { useInstantLayoutTransition } from './projection/use-instant-layout-transition.mjs';
35
36
  export { useResetProjection } from './projection/use-reset-projection.mjs';
36
37
  export { MotionConfigContext } from './context/MotionConfigContext.mjs';
@@ -18,13 +18,17 @@ function makeState(_a, props, context, presenceContext) {
18
18
  }
19
19
  return state;
20
20
  }
21
- var makeUseVisualState = function (config) { return function (props, isStatic) {
22
- var context = useContext(MotionContext);
23
- var presenceContext = useContext(PresenceContext);
24
- return isStatic
25
- ? makeState(config, props, context, presenceContext)
26
- : useConstant(function () { return makeState(config, props, context, presenceContext); });
27
- }; };
21
+ var makeUseVisualState = function (config) {
22
+ return function (props, isStatic) {
23
+ var context = useContext(MotionContext);
24
+ var presenceContext = useContext(PresenceContext);
25
+ return isStatic
26
+ ? makeState(config, props, context, presenceContext)
27
+ : useConstant(function () {
28
+ return makeState(config, props, context, presenceContext);
29
+ });
30
+ };
31
+ };
28
32
  function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
29
33
  var values = {};
30
34
  var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
@@ -42,7 +46,8 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
42
46
  initial !== null && initial !== void 0 ? initial : (initial = context.initial);
43
47
  animate !== null && animate !== void 0 ? animate : (animate = context.animate);
44
48
  }
45
- var variantToSet = blockInitialAnimation || initial === false ? animate : initial;
49
+ var initialAnimationIsBlocked = blockInitialAnimation || initial === false;
50
+ var variantToSet = initialAnimationIsBlocked ? animate : initial;
46
51
  if (variantToSet &&
47
52
  typeof variantToSet !== "boolean" &&
48
53
  !isAnimationControls(variantToSet)) {
@@ -52,8 +57,22 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
52
57
  if (!resolved)
53
58
  return;
54
59
  var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest(resolved, ["transitionEnd", "transition"]);
55
- for (var key in target)
56
- values[key] = target[key];
60
+ for (var key in target) {
61
+ var valueTarget = target[key];
62
+ if (Array.isArray(valueTarget)) {
63
+ /**
64
+ * Take final keyframe if the initial animation is blocked because
65
+ * we want to initialise at the end of that blocked animation.
66
+ */
67
+ var index = initialAnimationIsBlocked
68
+ ? valueTarget.length - 1
69
+ : 0;
70
+ valueTarget = valueTarget[index];
71
+ }
72
+ if (valueTarget !== null) {
73
+ values[key] = valueTarget;
74
+ }
75
+ }
57
76
  for (var key in transitionEnd)
58
77
  values[key] = transitionEnd[key];
59
78
  });
@@ -17,6 +17,7 @@ var validMotionProps = new Set([
17
17
  "inherit",
18
18
  "layout",
19
19
  "layoutId",
20
+ "layoutDependency",
20
21
  "onLayoutAnimationComplete",
21
22
  "onLayoutMeasure",
22
23
  "onBeforeLayoutMeasure",
@@ -135,7 +135,8 @@ function createAnimationState(visualElement) {
135
135
  * a changed value or a value that was removed in a higher priority, we set
136
136
  * this to true and add this prop to the animation list.
137
137
  */
138
- var shouldAnimateType = variantsHaveChanged(typeState.prevProp, prop) ||
138
+ var variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
139
+ var shouldAnimateType = variantDidChange ||
139
140
  // If we're making this variant active, we want to always make it active
140
141
  (type === changedActiveType &&
141
142
  typeState.isActive &&
@@ -186,7 +187,7 @@ function createAnimationState(visualElement) {
186
187
  * detect whether any value has changed. If it has, we animate it.
187
188
  */
188
189
  if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
189
- if (!shallowCompare(next, prev)) {
190
+ if (!shallowCompare(next, prev) || variantDidChange) {
190
191
  markToAnimate(key);
191
192
  }
192
193
  else {
@@ -303,7 +304,7 @@ function createAnimationState(visualElement) {
303
304
  getState: function () { return state; },
304
305
  };
305
306
  }
306
- function variantsHaveChanged(prev, next) {
307
+ function checkVariantsDidChange(prev, next) {
307
308
  if (typeof next === "string") {
308
309
  return next !== prev;
309
310
  }
@@ -334,4 +335,4 @@ function createState() {
334
335
  _a;
335
336
  }
336
337
 
337
- export { createAnimationState, variantPriorityOrder, variantsHaveChanged };
338
+ export { checkVariantsDidChange, createAnimationState, variantPriorityOrder };
@@ -22,9 +22,7 @@ function setMotionValue(visualElement, key, value) {
22
22
  }
23
23
  function setTarget(visualElement, definition) {
24
24
  var resolved = resolveVariant(visualElement, definition);
25
- var _a = resolved
26
- ? visualElement.makeTargetAnimatable(resolved, false)
27
- : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
25
+ var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
28
26
  target = __assign(__assign({}, target), transitionEnd);
29
27
  for (var key in target) {
30
28
  var value = resolveFinalValueInKeyframes(target[key]);
@@ -0,0 +1,5 @@
1
+ var instantAnimationState = {
2
+ current: false,
3
+ };
4
+
5
+ export { instantAnimationState };
@@ -0,0 +1,28 @@
1
+ import { __read } from 'tslib';
2
+ import sync from 'framesync';
3
+ import { useEffect } from 'react';
4
+ import { useInstantLayoutTransition } from '../projection/use-instant-layout-transition.mjs';
5
+ import { useForceUpdate } from './use-force-update.mjs';
6
+ import { instantAnimationState } from './use-instant-transition-state.mjs';
7
+
8
+ function useInstantTransition() {
9
+ var _a = __read(useForceUpdate(), 2), forceUpdate = _a[0], forcedRenderCount = _a[1];
10
+ var startInstantLayoutTransition = useInstantLayoutTransition();
11
+ useEffect(function () {
12
+ /**
13
+ * Unblock after two animation frames, otherwise this will unblock too soon.
14
+ */
15
+ sync.postRender(function () {
16
+ return sync.postRender(function () { return (instantAnimationState.current = false); });
17
+ });
18
+ }, [forcedRenderCount]);
19
+ return function (callback) {
20
+ startInstantLayoutTransition(function () {
21
+ instantAnimationState.current = true;
22
+ forceUpdate();
23
+ callback();
24
+ });
25
+ };
26
+ }
27
+
28
+ export { useInstantTransition };
@@ -896,6 +896,18 @@ function getAnimatableNone(key, value) {
896
896
  return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
897
897
  }
898
898
 
899
+ var instantAnimationState = {
900
+ current: false,
901
+ };
902
+
903
+ var isCustomValue = function (v) {
904
+ return Boolean(v && typeof v === "object" && v.mix && v.toValue);
905
+ };
906
+ var resolveFinalValueInKeyframes = function (v) {
907
+ // TODO maybe throw if v.length - 1 is placeholder token?
908
+ return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
909
+ };
910
+
899
911
  /**
900
912
  * Decide whether a transition is defined on a given Transition.
901
913
  * This filters out orchestration options and returns true
@@ -1037,9 +1049,10 @@ function getAnimation(key, value, target, transition, onComplete) {
1037
1049
  }
1038
1050
  function set() {
1039
1051
  var _a, _b;
1040
- value.set(target);
1052
+ var finalTarget = resolveFinalValueInKeyframes(target);
1053
+ value.set(finalTarget);
1041
1054
  onComplete();
1042
- (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, target);
1055
+ (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, finalTarget);
1043
1056
  (_b = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _b === void 0 ? void 0 : _b.call(valueTransition);
1044
1057
  return { stop: function () { } };
1045
1058
  }
@@ -1071,6 +1084,9 @@ function getValueTransition(transition, key) {
1071
1084
  */
1072
1085
  function startAnimation(key, value, target, transition) {
1073
1086
  if (transition === void 0) { transition = {}; }
1087
+ if (instantAnimationState.current) {
1088
+ transition = { type: false };
1089
+ }
1074
1090
  return value.start(function (onComplete) {
1075
1091
  var delayTimer;
1076
1092
  var controls;
@@ -1685,14 +1701,6 @@ var FlatTree = /** @class */ (function () {
1685
1701
  return FlatTree;
1686
1702
  }());
1687
1703
 
1688
- var isCustomValue = function (v) {
1689
- return Boolean(v && typeof v === "object" && v.mix && v.toValue);
1690
- };
1691
- var resolveFinalValueInKeyframes = function (v) {
1692
- // TODO maybe throw if v.length - 1 is placeholder token?
1693
- return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
1694
- };
1695
-
1696
1704
  /**
1697
1705
  * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
1698
1706
  *
@@ -3337,6 +3345,7 @@ var validMotionProps = new Set([
3337
3345
  "inherit",
3338
3346
  "layout",
3339
3347
  "layoutId",
3348
+ "layoutDependency",
3340
3349
  "onLayoutAnimationComplete",
3341
3350
  "onLayoutMeasure",
3342
3351
  "onBeforeLayoutMeasure",
@@ -3638,13 +3647,17 @@ function makeState(_a, props, context, presenceContext) {
3638
3647
  }
3639
3648
  return state;
3640
3649
  }
3641
- var makeUseVisualState = function (config) { return function (props, isStatic) {
3642
- var context = React.useContext(MotionContext);
3643
- var presenceContext = React.useContext(PresenceContext);
3644
- return isStatic
3645
- ? makeState(config, props, context, presenceContext)
3646
- : useConstant(function () { return makeState(config, props, context, presenceContext); });
3647
- }; };
3650
+ var makeUseVisualState = function (config) {
3651
+ return function (props, isStatic) {
3652
+ var context = React.useContext(MotionContext);
3653
+ var presenceContext = React.useContext(PresenceContext);
3654
+ return isStatic
3655
+ ? makeState(config, props, context, presenceContext)
3656
+ : useConstant(function () {
3657
+ return makeState(config, props, context, presenceContext);
3658
+ });
3659
+ };
3660
+ };
3648
3661
  function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
3649
3662
  var values = {};
3650
3663
  var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
@@ -3662,7 +3675,8 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
3662
3675
  initial !== null && initial !== void 0 ? initial : (initial = context.initial);
3663
3676
  animate !== null && animate !== void 0 ? animate : (animate = context.animate);
3664
3677
  }
3665
- var variantToSet = blockInitialAnimation || initial === false ? animate : initial;
3678
+ var initialAnimationIsBlocked = blockInitialAnimation || initial === false;
3679
+ var variantToSet = initialAnimationIsBlocked ? animate : initial;
3666
3680
  if (variantToSet &&
3667
3681
  typeof variantToSet !== "boolean" &&
3668
3682
  !isAnimationControls(variantToSet)) {
@@ -3672,8 +3686,22 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
3672
3686
  if (!resolved)
3673
3687
  return;
3674
3688
  var transitionEnd = resolved.transitionEnd; resolved.transition; var target = tslib.__rest(resolved, ["transitionEnd", "transition"]);
3675
- for (var key in target)
3676
- values[key] = target[key];
3689
+ for (var key in target) {
3690
+ var valueTarget = target[key];
3691
+ if (Array.isArray(valueTarget)) {
3692
+ /**
3693
+ * Take final keyframe if the initial animation is blocked because
3694
+ * we want to initialise at the end of that blocked animation.
3695
+ */
3696
+ var index = initialAnimationIsBlocked
3697
+ ? valueTarget.length - 1
3698
+ : 0;
3699
+ valueTarget = valueTarget[index];
3700
+ }
3701
+ if (valueTarget !== null) {
3702
+ values[key] = valueTarget;
3703
+ }
3704
+ }
3677
3705
  for (var key in transitionEnd)
3678
3706
  values[key] = transitionEnd[key];
3679
3707
  });
@@ -3954,8 +3982,11 @@ function createHoverEvent(visualElement, isActive, callback) {
3954
3982
  var _a;
3955
3983
  if (!isMouseEvent(event) || isDragActive())
3956
3984
  return;
3957
- callback === null || callback === void 0 ? void 0 : callback(event, info);
3985
+ /**
3986
+ * Ensure we trigger animations before firing event callback
3987
+ */
3958
3988
  (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);
3989
+ callback === null || callback === void 0 ? void 0 : callback(event, info);
3959
3990
  };
3960
3991
  }
3961
3992
  function useHoverGesture(_a) {
@@ -4035,8 +4066,11 @@ function useTapGesture(_a) {
4035
4066
  return;
4036
4067
  isPressing.current = true;
4037
4068
  cancelPointerEndListeners.current = popmotion.pipe(addPointerEvent(window, "pointerup", onPointerUp), addPointerEvent(window, "pointercancel", onPointerCancel));
4038
- onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
4069
+ /**
4070
+ * Ensure we trigger animations before firing event callback
4071
+ */
4039
4072
  (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);
4073
+ onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
4040
4074
  }
4041
4075
  usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined);
4042
4076
  useUnmountEffect(removePointerEndListener);
@@ -4340,9 +4374,7 @@ function setMotionValue(visualElement, key, value) {
4340
4374
  }
4341
4375
  function setTarget(visualElement, definition) {
4342
4376
  var resolved = resolveVariant(visualElement, definition);
4343
- var _a = resolved
4344
- ? visualElement.makeTargetAnimatable(resolved, false)
4345
- : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = tslib.__rest(_a, ["transitionEnd", "transition"]);
4377
+ var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = tslib.__rest(_a, ["transitionEnd", "transition"]);
4346
4378
  target = tslib.__assign(tslib.__assign({}, target), transitionEnd);
4347
4379
  for (var key in target) {
4348
4380
  var value = resolveFinalValueInKeyframes(target[key]);
@@ -4696,7 +4728,8 @@ function createAnimationState(visualElement) {
4696
4728
  * a changed value or a value that was removed in a higher priority, we set
4697
4729
  * this to true and add this prop to the animation list.
4698
4730
  */
4699
- var shouldAnimateType = variantsHaveChanged(typeState.prevProp, prop) ||
4731
+ var variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
4732
+ var shouldAnimateType = variantDidChange ||
4700
4733
  // If we're making this variant active, we want to always make it active
4701
4734
  (type === changedActiveType &&
4702
4735
  typeState.isActive &&
@@ -4747,7 +4780,7 @@ function createAnimationState(visualElement) {
4747
4780
  * detect whether any value has changed. If it has, we animate it.
4748
4781
  */
4749
4782
  if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
4750
- if (!shallowCompare(next, prev)) {
4783
+ if (!shallowCompare(next, prev) || variantDidChange) {
4751
4784
  markToAnimate(key);
4752
4785
  }
4753
4786
  else {
@@ -4864,7 +4897,7 @@ function createAnimationState(visualElement) {
4864
4897
  getState: function () { return state; },
4865
4898
  };
4866
4899
  }
4867
- function variantsHaveChanged(prev, next) {
4900
+ function checkVariantsDidChange(prev, next) {
4868
4901
  if (typeof next === "string") {
4869
4902
  return next !== prev;
4870
4903
  }
@@ -7518,7 +7551,7 @@ function useDefaultMotionValue(value, defaultValue) {
7518
7551
  return isMotionValue(value) ? value : useMotionValue(defaultValue);
7519
7552
  }
7520
7553
  function ReorderItem(_a, externalRef) {
7521
- var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, props = tslib.__rest(_a, ["children", "style", "value", "as"]);
7554
+ var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, props = tslib.__rest(_a, ["children", "style", "value", "as", "onDrag"]);
7522
7555
  var Component = useConstant(function () { return motion(as); });
7523
7556
  var context = React.useContext(ReorderContext);
7524
7557
  var point = {
@@ -7535,10 +7568,11 @@ function ReorderItem(_a, externalRef) {
7535
7568
  React.useEffect(function () {
7536
7569
  registerItem(value, layout.current);
7537
7570
  }, [context]);
7538
- return (React__namespace.createElement(Component, tslib.__assign({ drag: axis }, props, { dragSnapToOrigin: true, style: tslib.__assign(tslib.__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: true, onDrag: function (_event, _a) {
7539
- var velocity = _a.velocity;
7571
+ return (React__namespace.createElement(Component, tslib.__assign({ drag: axis }, props, { dragSnapToOrigin: true, style: tslib.__assign(tslib.__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: true, onDrag: function (event, gesturePoint) {
7572
+ var velocity = gesturePoint.velocity;
7540
7573
  velocity[axis] &&
7541
7574
  updateOrder(value, point[axis].get(), velocity[axis]);
7575
+ onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, gesturePoint);
7542
7576
  }, onLayoutMeasure: function (measured) {
7543
7577
  layout.current = measured;
7544
7578
  }, ref: externalRef }), children));
@@ -8100,6 +8134,26 @@ function startTransition(cb) {
8100
8134
  cb === null || cb === void 0 ? void 0 : cb();
8101
8135
  }
8102
8136
 
8137
+ function useInstantTransition() {
8138
+ var _a = tslib.__read(useForceUpdate(), 2), forceUpdate = _a[0], forcedRenderCount = _a[1];
8139
+ var startInstantLayoutTransition = useInstantLayoutTransition();
8140
+ React.useEffect(function () {
8141
+ /**
8142
+ * Unblock after two animation frames, otherwise this will unblock too soon.
8143
+ */
8144
+ sync__default['default'].postRender(function () {
8145
+ return sync__default['default'].postRender(function () { return (instantAnimationState.current = false); });
8146
+ });
8147
+ }, [forcedRenderCount]);
8148
+ return function (callback) {
8149
+ startInstantLayoutTransition(function () {
8150
+ instantAnimationState.current = true;
8151
+ forceUpdate();
8152
+ callback();
8153
+ });
8154
+ };
8155
+ }
8156
+
8103
8157
  function useResetProjection() {
8104
8158
  var reset = React__namespace.useCallback(function () {
8105
8159
  var root = rootProjectionNode.current;
@@ -8243,6 +8297,7 @@ exports.useDomEvent = useDomEvent;
8243
8297
  exports.useDragControls = useDragControls;
8244
8298
  exports.useElementScroll = useElementScroll;
8245
8299
  exports.useInstantLayoutTransition = useInstantLayoutTransition;
8300
+ exports.useInstantTransition = useInstantTransition;
8246
8301
  exports.useIsPresent = useIsPresent;
8247
8302
  exports.useMotionTemplate = useMotionTemplate;
8248
8303
  exports.useMotionValue = useMotionValue;