framer-motion 5.0.0-beta.4 → 5.0.0-beta.43

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 (242) hide show
  1. package/dist/es/animation/{animate.js → animate.mjs} +3 -3
  2. package/dist/es/animation/{animation-controls.js → animation-controls.mjs} +3 -3
  3. package/dist/es/animation/{use-animated-state.js → use-animated-state.mjs} +6 -6
  4. package/dist/es/animation/{use-animation.js → use-animation.mjs} +2 -22
  5. package/dist/es/animation/utils/{default-transitions.js → default-transitions.mjs} +1 -1
  6. package/dist/es/animation/utils/{easing.js → easing.mjs} +0 -0
  7. package/dist/es/animation/utils/{is-animatable.js → is-animatable.mjs} +0 -0
  8. package/dist/es/animation/utils/{is-animation-controls.js → is-animation-controls.mjs} +0 -0
  9. package/dist/es/animation/utils/{is-keyframes-target.js → is-keyframes-target.mjs} +0 -0
  10. package/dist/es/animation/utils/{transitions.js → transitions.mjs} +6 -6
  11. package/dist/es/components/AnimatePresence/{PresenceChild.js → PresenceChild.mjs} +2 -2
  12. package/dist/es/components/AnimatePresence/{index.js → index.mjs} +5 -35
  13. package/dist/es/components/AnimatePresence/{use-presence.js → use-presence.mjs} +2 -2
  14. package/dist/es/components/AnimateSharedLayout.mjs +11 -0
  15. package/dist/es/components/LayoutGroup/index.mjs +32 -0
  16. package/dist/es/components/LazyMotion/{index.js → index.mjs} +2 -2
  17. package/dist/es/components/MotionConfig/{index.js → index.mjs} +2 -2
  18. package/dist/es/components/Reorder/Group.mjs +46 -0
  19. package/dist/es/components/Reorder/Item.mjs +42 -0
  20. package/dist/es/components/Reorder/index.mjs +9 -0
  21. package/dist/es/components/Reorder/utils/check-reorder.mjs +24 -0
  22. package/dist/es/context/DeprecatedLayoutGroupContext.mjs +9 -0
  23. package/dist/es/context/{LayoutGroupContext.js → LayoutGroupContext.mjs} +0 -0
  24. package/dist/es/context/{LazyContext.js → LazyContext.mjs} +0 -0
  25. package/dist/es/context/{MotionConfigContext.js → MotionConfigContext.mjs} +0 -0
  26. package/dist/es/context/MotionContext/{create.js → create.mjs} +2 -2
  27. package/dist/es/context/MotionContext/{index.js → index.mjs} +0 -0
  28. package/dist/es/context/MotionContext/{utils.js → utils.mjs} +1 -1
  29. package/dist/es/context/{PresenceContext.js → PresenceContext.mjs} +0 -0
  30. package/dist/es/context/ReorderContext.mjs +5 -0
  31. package/dist/es/context/SwitchLayoutGroupContext.mjs +8 -0
  32. package/dist/es/events/{event-info.js → event-info.mjs} +1 -1
  33. package/dist/es/events/{use-dom-event.js → use-dom-event.mjs} +0 -0
  34. package/dist/es/events/{use-pointer-event.js → use-pointer-event.mjs} +3 -3
  35. package/dist/es/events/{utils.js → utils.mjs} +1 -1
  36. package/dist/es/gestures/{PanSession.js → PanSession.mjs} +4 -4
  37. package/dist/es/gestures/drag/{VisualElementDragControls.js → VisualElementDragControls.mjs} +115 -29
  38. package/dist/es/gestures/drag/{use-drag-controls.js → use-drag-controls.mjs} +1 -39
  39. package/dist/es/gestures/drag/{use-drag.js → use-drag.mjs} +4 -4
  40. package/dist/es/gestures/drag/utils/{constraints.js → constraints.mjs} +20 -6
  41. package/dist/es/gestures/drag/utils/{lock.js → lock.mjs} +0 -0
  42. package/dist/es/gestures/{use-focus-gesture.js → use-focus-gesture.mjs} +2 -2
  43. package/dist/es/gestures/{use-hover-gesture.js → use-hover-gesture.mjs} +4 -4
  44. package/dist/es/gestures/{use-pan-gesture.js → use-pan-gesture.mjs} +4 -4
  45. package/dist/es/gestures/{use-tap-gesture.js → use-tap-gesture.mjs} +5 -5
  46. package/dist/es/gestures/utils/{event-type.js → event-type.mjs} +0 -0
  47. package/dist/es/gestures/utils/{is-node-or-child.js → is-node-or-child.mjs} +0 -0
  48. package/dist/es/index.mjs +43 -0
  49. package/dist/es/motion/features/{animations.js → animations.mjs} +6 -6
  50. package/dist/es/motion/features/{definitions.js → definitions.mjs} +0 -0
  51. package/dist/es/motion/features/{drag.js → drag.mjs} +3 -3
  52. package/dist/es/motion/features/{gestures.js → gestures.mjs} +4 -4
  53. package/dist/es/motion/features/layout/{MeasureLayout.js → MeasureLayout.mjs} +34 -21
  54. package/dist/es/motion/features/layout/{index.js → index.mjs} +1 -1
  55. package/dist/es/motion/features/{use-features.js → use-features.mjs} +2 -2
  56. package/dist/es/motion/features/{use-projection.js → use-projection.mjs} +7 -20
  57. package/dist/es/motion/{index.js → index.mjs} +19 -16
  58. package/dist/es/motion/utils/{VisualElementHandler.js → VisualElementHandler.mjs} +0 -0
  59. package/dist/es/motion/utils/{is-forced-motion-value.js → is-forced-motion-value.mjs} +2 -2
  60. package/dist/es/motion/utils/{make-renderless-component.js → make-renderless-component.mjs} +0 -0
  61. package/dist/es/motion/utils/{use-motion-ref.js → use-motion-ref.mjs} +1 -1
  62. package/dist/es/motion/utils/{use-visual-element.js → use-visual-element.mjs} +4 -4
  63. package/dist/es/motion/utils/{use-visual-state.js → use-visual-state.mjs} +6 -6
  64. package/dist/es/motion/utils/{valid-prop.js → valid-prop.mjs} +1 -1
  65. package/dist/es/projection/animation/{mix-values.js → mix-values.mjs} +0 -0
  66. package/dist/es/projection/geometry/{conversion.js → conversion.mjs} +0 -0
  67. package/dist/es/projection/geometry/{copy.js → copy.mjs} +0 -0
  68. package/dist/es/projection/geometry/{delta-apply.js → delta-apply.mjs} +45 -9
  69. package/dist/es/projection/geometry/{delta-calc.js → delta-calc.mjs} +17 -1
  70. package/dist/es/projection/geometry/{delta-remove.js → delta-remove.mjs} +10 -9
  71. package/dist/es/projection/geometry/{models.js → models.mjs} +0 -0
  72. package/dist/es/projection/geometry/{utils.js → utils.mjs} +0 -0
  73. package/dist/es/projection/node/{DocumentProjectionNode.js → DocumentProjectionNode.mjs} +1 -1
  74. package/dist/es/projection/node/{HTMLProjectionNode.js → HTMLProjectionNode.mjs} +6 -8
  75. package/dist/es/projection/node/{create-projection-node.js → create-projection-node.mjs} +487 -151
  76. package/dist/es/projection/node/{group.js → group.mjs} +0 -0
  77. package/dist/es/projection/node/{id.js → id.mjs} +2 -2
  78. package/dist/es/projection/shared/{stack.js → stack.mjs} +40 -8
  79. package/dist/es/projection/styles/{scale-border-radius.js → scale-border-radius.mjs} +2 -0
  80. package/dist/es/projection/styles/{scale-box-shadow.js → scale-box-shadow.mjs} +1 -1
  81. package/dist/es/projection/styles/{scale-correction.js → scale-correction.mjs} +0 -0
  82. package/dist/es/projection/styles/{transform.js → transform.mjs} +0 -0
  83. package/dist/es/projection/use-instant-layout-transition.mjs +14 -0
  84. package/dist/es/projection/{use-reset-projection.js → use-reset-projection.mjs} +2 -3
  85. package/dist/es/projection/utils/{each-axis.js → each-axis.mjs} +0 -0
  86. package/dist/es/projection/utils/{has-transform.js → has-transform.mjs} +0 -0
  87. package/dist/es/projection/utils/measure.mjs +17 -0
  88. package/dist/es/render/dom/{create-visual-element.js → create-visual-element.mjs} +3 -3
  89. package/dist/es/render/dom/{features-animation.js → features-animation.mjs} +3 -3
  90. package/dist/es/render/dom/{features-max.js → features-max.mjs} +3 -3
  91. package/dist/es/render/dom/motion-minimal.mjs +9 -0
  92. package/dist/es/render/dom/{motion-proxy.js → motion-proxy.mjs} +1 -1
  93. package/dist/es/render/dom/{motion.js → motion.mjs} +8 -8
  94. package/dist/es/render/dom/{use-render.js → use-render.mjs} +4 -4
  95. package/dist/es/render/dom/utils/{camel-to-dash.js → camel-to-dash.mjs} +0 -0
  96. package/dist/es/render/dom/utils/{create-config.js → create-config.mjs} +5 -6
  97. package/dist/es/render/dom/utils/{css-variables-conversion.js → css-variables-conversion.mjs} +0 -0
  98. package/dist/es/render/dom/utils/{filter-props.js → filter-props.mjs} +1 -1
  99. package/dist/es/render/dom/utils/{is-css-variable.js → is-css-variable.mjs} +0 -0
  100. package/dist/es/render/dom/utils/{is-svg-component.js → is-svg-component.mjs} +1 -1
  101. package/dist/es/render/dom/utils/{parse-dom-variant.js → parse-dom-variant.mjs} +2 -2
  102. package/dist/es/render/dom/utils/{unit-conversion.js → unit-conversion.mjs} +3 -3
  103. package/dist/es/render/dom/value-types/{animatable-none.js → animatable-none.mjs} +1 -1
  104. package/dist/es/render/dom/value-types/{defaults.js → defaults.mjs} +1 -1
  105. package/dist/es/render/dom/value-types/{dimensions.js → dimensions.mjs} +2 -2
  106. package/dist/es/render/dom/value-types/{find.js → find.mjs} +3 -3
  107. package/dist/es/render/dom/value-types/{get-as-type.js → get-as-type.mjs} +0 -0
  108. package/dist/es/render/dom/value-types/{number.js → number.mjs} +1 -1
  109. package/dist/es/render/dom/value-types/{test.js → test.mjs} +0 -0
  110. package/dist/es/render/dom/value-types/{type-auto.js → type-auto.mjs} +0 -0
  111. package/dist/es/render/dom/value-types/{type-int.js → type-int.mjs} +0 -0
  112. package/dist/es/render/html/{config-motion.js → config-motion.mjs} +3 -3
  113. package/dist/es/render/html/{use-props.js → use-props.mjs} +4 -4
  114. package/dist/es/render/html/utils/{build-styles.js → build-styles.mjs} +5 -5
  115. package/dist/es/render/html/utils/{build-transform.js → build-transform.mjs} +1 -1
  116. package/dist/es/render/html/utils/{create-render-state.js → create-render-state.mjs} +0 -0
  117. package/dist/es/render/html/utils/{render.js → render.mjs} +1 -1
  118. package/dist/es/render/html/utils/{scrape-motion-values.js → scrape-motion-values.mjs} +2 -2
  119. package/dist/es/render/html/utils/{transform.js → transform.mjs} +0 -0
  120. package/dist/es/render/html/{visual-element.js → visual-element.mjs} +11 -12
  121. package/dist/es/render/{index.js → index.mjs} +24 -20
  122. package/dist/es/render/svg/{config-motion.js → config-motion.mjs} +5 -5
  123. package/dist/es/render/svg/{lowercase-elements.js → lowercase-elements.mjs} +0 -0
  124. package/dist/es/render/svg/{use-props.js → use-props.mjs} +3 -3
  125. package/dist/es/render/svg/utils/{build-attrs.js → build-attrs.mjs} +3 -3
  126. package/dist/es/render/svg/utils/{camel-case-attrs.js → camel-case-attrs.mjs} +0 -0
  127. package/dist/es/render/svg/utils/{create-render-state.js → create-render-state.mjs} +1 -1
  128. package/dist/es/render/svg/utils/{path.js → path.mjs} +0 -0
  129. package/dist/es/render/svg/utils/{render.js → render.mjs} +3 -3
  130. package/dist/es/render/svg/utils/{scrape-motion-values.js → scrape-motion-values.mjs} +2 -2
  131. package/dist/es/render/svg/utils/{transform-origin.js → transform-origin.mjs} +0 -0
  132. package/dist/es/render/svg/{visual-element.js → visual-element.mjs} +11 -14
  133. package/dist/es/render/utils/{animation-state.js → animation-state.mjs} +8 -8
  134. package/dist/es/render/utils/{animation.js → animation.mjs} +3 -3
  135. package/dist/es/render/utils/{compare-by-depth.js → compare-by-depth.mjs} +0 -0
  136. package/dist/es/render/utils/{flat-tree.js → flat-tree.mjs} +2 -2
  137. package/dist/es/render/utils/{lifecycles.js → lifecycles.mjs} +4 -3
  138. package/dist/es/render/utils/{motion-values.js → motion-values.mjs} +2 -2
  139. package/dist/es/render/utils/{setters.js → setters.mjs} +8 -8
  140. package/dist/es/render/utils/{types.js → types.mjs} +0 -0
  141. package/dist/es/render/utils/{variants.js → variants.mjs} +0 -0
  142. package/dist/es/utils/array.mjs +22 -0
  143. package/dist/es/utils/{is-browser.js → is-browser.mjs} +0 -0
  144. package/dist/es/utils/{is-numerical-string.js → is-numerical-string.mjs} +0 -0
  145. package/dist/es/utils/{is-ref-object.js → is-ref-object.mjs} +0 -0
  146. package/dist/es/utils/{is-zero-value-string.js → is-zero-value-string.mjs} +0 -0
  147. package/dist/es/utils/{resolve-value.js → resolve-value.mjs} +1 -1
  148. package/dist/es/utils/{shallow-compare.js → shallow-compare.mjs} +0 -0
  149. package/dist/es/utils/{subscription-manager.js → subscription-manager.mjs} +1 -1
  150. package/dist/es/utils/{time-conversion.js → time-conversion.mjs} +0 -0
  151. package/dist/es/utils/{transform.js → transform.mjs} +0 -0
  152. package/dist/es/utils/{use-constant.js → use-constant.mjs} +0 -0
  153. package/dist/es/utils/{use-cycle.js → use-cycle.mjs} +0 -20
  154. package/dist/es/utils/{use-force-update.js → use-force-update.mjs} +1 -1
  155. package/dist/es/utils/{use-isomorphic-effect.js → use-isomorphic-effect.mjs} +1 -1
  156. package/dist/es/utils/{use-reduced-motion.js → use-reduced-motion.mjs} +2 -2
  157. package/dist/es/utils/{use-unmount-effect.js → use-unmount-effect.mjs} +0 -0
  158. package/dist/es/value/{index.js → index.mjs} +1 -31
  159. package/dist/es/value/scroll/{use-element-scroll.js → use-element-scroll.mjs} +4 -28
  160. package/dist/es/value/scroll/{use-viewport-scroll.js → use-viewport-scroll.mjs} +3 -21
  161. package/dist/es/value/scroll/{utils.js → utils.mjs} +1 -1
  162. package/dist/es/value/{use-combine-values.js → use-combine-values.mjs} +2 -2
  163. package/dist/es/value/{use-inverted-scale.js → use-inverted-scale.mjs} +3 -14
  164. package/dist/es/value/{use-motion-template.js → use-motion-template.mjs} +1 -1
  165. package/dist/es/value/{use-motion-value.js → use-motion-value.mjs} +3 -15
  166. package/dist/es/value/{use-on-change.js → use-on-change.mjs} +1 -1
  167. package/dist/es/value/{use-spring.js → use-spring.mjs} +4 -4
  168. package/dist/es/value/{use-transform.js → use-transform.mjs} +3 -3
  169. package/dist/es/value/{use-velocity.js → use-velocity.mjs} +1 -1
  170. package/dist/es/value/utils/{is-motion-value.js → is-motion-value.mjs} +0 -0
  171. package/dist/es/value/utils/{resolve-motion-value.js → resolve-motion-value.mjs} +2 -2
  172. package/dist/framer-motion.cjs.js +3953 -3535
  173. package/dist/framer-motion.dev.js +4412 -4051
  174. package/dist/framer-motion.js +1 -1
  175. package/dist/projection.dev.js +1117 -804
  176. package/dist/size-rollup-dom-animation-assets.js +1 -1
  177. package/dist/size-rollup-dom-animation-m.js +1 -1
  178. package/dist/size-rollup-dom-animation.js +1 -1
  179. package/dist/size-rollup-dom-max-assets.js +1 -1
  180. package/dist/size-rollup-dom-max-m.js +1 -1
  181. package/dist/size-rollup-dom-max.js +1 -1
  182. package/dist/size-rollup-m.js +1 -1
  183. package/package.json +20 -21
  184. package/types/animation/use-animation.d.ts +0 -20
  185. package/types/components/AnimatePresence/index.d.ts +0 -29
  186. package/types/components/AnimatePresence/types.d.ts +0 -31
  187. package/types/components/AnimateSharedLayout.d.ts +2 -0
  188. package/types/components/LayoutGroup/index.d.ts +3 -3
  189. package/types/components/Reorder/Group.d.ts +262 -0
  190. package/types/components/Reorder/Item.d.ts +261 -0
  191. package/types/components/Reorder/index.d.ts +509 -0
  192. package/types/components/Reorder/types.d.ts +10 -0
  193. package/types/components/Reorder/utils/check-reorder.d.ts +2 -0
  194. package/types/context/DeprecatedLayoutGroupContext.d.ts +6 -0
  195. package/types/context/LayoutGroupContext.d.ts +1 -1
  196. package/types/context/ReorderContext.d.ts +3 -0
  197. package/types/context/SwitchLayoutGroupContext.d.ts +23 -0
  198. package/types/gestures/PanSession.d.ts +0 -60
  199. package/types/gestures/drag/VisualElementDragControls.d.ts +7 -1
  200. package/types/gestures/drag/types.d.ts +9 -191
  201. package/types/gestures/drag/use-drag-controls.d.ts +0 -38
  202. package/types/gestures/types.d.ts +0 -150
  203. package/types/index.d.ts +5 -1
  204. package/types/motion/features/layout/types.d.ts +6 -0
  205. package/types/motion/features/use-projection.d.ts +2 -2
  206. package/types/motion/types.d.ts +1 -132
  207. package/types/projection/geometry/delta-apply.d.ts +13 -1
  208. package/types/projection/geometry/delta-calc.d.ts +4 -0
  209. package/types/projection/geometry/delta-remove.d.ts +3 -3
  210. package/types/projection/node/DocumentProjectionNode.d.ts +25 -6
  211. package/types/projection/node/HTMLProjectionNode.d.ts +38 -21
  212. package/types/projection/node/create-projection-node.d.ts +52 -8
  213. package/types/projection/node/types.d.ts +30 -7
  214. package/types/projection/shared/stack.d.ts +7 -1
  215. package/types/projection/utils/{measure-page-box.d.ts → measure.d.ts} +1 -0
  216. package/types/render/dom/value-types/find.d.ts +3 -3
  217. package/types/render/utils/lifecycles.d.ts +1 -50
  218. package/types/render/utils/setters.d.ts +5 -3
  219. package/types/types.d.ts +0 -602
  220. package/types/utils/array.d.ts +1 -0
  221. package/types/utils/transform.d.ts +0 -40
  222. package/types/utils/use-cycle.d.ts +0 -20
  223. package/types/value/index.d.ts +0 -30
  224. package/types/value/scroll/use-element-scroll.d.ts +0 -24
  225. package/types/value/scroll/use-viewport-scroll.d.ts +0 -18
  226. package/types/value/use-inverted-scale.d.ts +0 -11
  227. package/types/value/use-motion-value.d.ts +0 -12
  228. package/types/value/use-transform.d.ts +0 -48
  229. package/CHANGELOG.md +0 -1893
  230. package/dist/es/components/LayoutGroup/index.js +0 -22
  231. package/dist/es/context/PromoteContext.js +0 -8
  232. package/dist/es/index.js +0 -40
  233. package/dist/es/projection/geometry/operations.js +0 -34
  234. package/dist/es/projection/use-instant-layout-transition.js +0 -15
  235. package/dist/es/projection/utils/measure-page-box.js +0 -14
  236. package/dist/es/render/dom/motion-minimal.js +0 -9
  237. package/dist/es/utils/array.js +0 -9
  238. package/dist/framer-motion.api.json +0 -14658
  239. package/dist/framer-motion.d.ts +0 -8405
  240. package/types/context/PromoteContext.d.ts +0 -15
  241. package/types/projection/geometry/operations.d.ts +0 -13
  242. package/types/tsdoc-metadata.json +0 -11
@@ -1,6 +1,6 @@
1
- import { motionValue } from '../value/index.js';
2
- import { isMotionValue } from '../value/utils/is-motion-value.js';
3
- import { startAnimation } from './utils/transitions.js';
1
+ import { motionValue } from '../value/index.mjs';
2
+ import { isMotionValue } from '../value/utils/is-motion-value.mjs';
3
+ import { startAnimation } from './utils/transitions.mjs';
4
4
 
5
5
  /**
6
6
  * Animate a single value or a `MotionValue`.
@@ -1,7 +1,7 @@
1
1
  import { __spreadArray, __read } from 'tslib';
2
2
  import { invariant } from 'hey-listen';
3
- import { stopAnimation, animateVisualElement } from '../render/utils/animation.js';
4
- import { setValues } from '../render/utils/setters.js';
3
+ import { stopAnimation, animateVisualElement } from '../render/utils/animation.mjs';
4
+ import { setValues } from '../render/utils/setters.mjs';
5
5
 
6
6
  /**
7
7
  * @public
@@ -65,7 +65,7 @@ function animationControls() {
65
65
  hasMounted = true;
66
66
  pendingAnimations.forEach(function (_a) {
67
67
  var animation = _a.animation, resolve = _a.resolve;
68
- controls.start.apply(controls, __spreadArray([], __read(animation))).then(resolve);
68
+ controls.start.apply(controls, __spreadArray([], __read(animation), false)).then(resolve);
69
69
  });
70
70
  return function () {
71
71
  hasMounted = false;
@@ -1,11 +1,11 @@
1
1
  import { __rest, __assign, __read } from 'tslib';
2
2
  import { useState, useEffect } from 'react';
3
- import { useConstant } from '../utils/use-constant.js';
4
- import { getOrigin, checkTargetForNewValues } from '../render/utils/setters.js';
5
- import { visualElement } from '../render/index.js';
6
- import { animateVisualElement } from '../render/utils/animation.js';
7
- import { makeUseVisualState } from '../motion/utils/use-visual-state.js';
8
- import { createBox } from '../projection/geometry/models.js';
3
+ import { useConstant } from '../utils/use-constant.mjs';
4
+ import { getOrigin, checkTargetForNewValues } from '../render/utils/setters.mjs';
5
+ import { visualElement } from '../render/index.mjs';
6
+ import { animateVisualElement } from '../render/utils/animation.mjs';
7
+ import { makeUseVisualState } from '../motion/utils/use-visual-state.mjs';
8
+ import { createBox } from '../projection/geometry/models.mjs';
9
9
 
10
10
  var createObject = function () { return ({}); };
11
11
  var stateVisualElement = visualElement({
@@ -1,6 +1,6 @@
1
- import { animationControls } from './animation-controls.js';
1
+ import { animationControls } from './animation-controls.mjs';
2
2
  import { useEffect } from 'react';
3
- import { useConstant } from '../utils/use-constant.js';
3
+ import { useConstant } from '../utils/use-constant.mjs';
4
4
 
5
5
  /**
6
6
  * Creates `AnimationControls`, which can be used to manually start, stop
@@ -11,26 +11,6 @@ import { useConstant } from '../utils/use-constant.js';
11
11
  *
12
12
  * These components can then be animated with the `start` method.
13
13
  *
14
- * @library
15
- *
16
- * ```jsx
17
- * import * as React from 'react'
18
- * import { Frame, useAnimation } from 'framer'
19
- *
20
- * export function MyComponent(props) {
21
- * const controls = useAnimation()
22
- *
23
- * controls.start({
24
- * x: 100,
25
- * transition: { duration: 0.5 },
26
- * })
27
- *
28
- * return <Frame animate={controls} />
29
- * }
30
- * ```
31
- *
32
- * @motion
33
- *
34
14
  * ```jsx
35
15
  * import * as React from 'react'
36
16
  * import { motion, useAnimation } from 'framer-motion'
@@ -1,5 +1,5 @@
1
1
  import { __assign } from 'tslib';
2
- import { isKeyframesTarget } from './is-keyframes-target.js';
2
+ import { isKeyframesTarget } from './is-keyframes-target.mjs';
3
3
 
4
4
  var underDampedSpring = function () { return ({
5
5
  type: "spring",
@@ -1,11 +1,11 @@
1
1
  import { __assign, __rest, __spreadArray, __read } from 'tslib';
2
2
  import { inertia, animate } from 'popmotion';
3
- import { secondsToMilliseconds } from '../../utils/time-conversion.js';
4
- import { isEasingArray, easingDefinitionToFunction } from './easing.js';
5
- import { isAnimatable } from './is-animatable.js';
6
- import { getDefaultTransition } from './default-transitions.js';
3
+ import { secondsToMilliseconds } from '../../utils/time-conversion.mjs';
4
+ import { isEasingArray, easingDefinitionToFunction } from './easing.mjs';
5
+ import { isAnimatable } from './is-animatable.mjs';
6
+ import { getDefaultTransition } from './default-transitions.mjs';
7
7
  import { warning } from 'hey-listen';
8
- import { getAnimatableNone } from '../../render/dom/value-types/animatable-none.js';
8
+ import { getAnimatableNone } from '../../render/dom/value-types/animatable-none.mjs';
9
9
 
10
10
  /**
11
11
  * Decide whether a transition is defined on a given Transition.
@@ -81,7 +81,7 @@ function getDelayFromTransition(transition, key) {
81
81
  }
82
82
  function hydrateKeyframes(options) {
83
83
  if (Array.isArray(options.to) && options.to[0] === null) {
84
- options.to = __spreadArray([], __read(options.to));
84
+ options.to = __spreadArray([], __read(options.to), false);
85
85
  options.to[0] = options.from;
86
86
  }
87
87
  return options;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useMemo } from 'react';
3
- import { PresenceContext } from '../../context/PresenceContext.js';
4
- import { useConstant } from '../../utils/use-constant.js';
3
+ import { PresenceContext } from '../../context/PresenceContext.mjs';
4
+ import { useConstant } from '../../utils/use-constant.mjs';
5
5
 
6
6
  var presenceId = 0;
7
7
  function getPresenceId() {
@@ -1,9 +1,9 @@
1
1
  import { __read, __spreadArray } from 'tslib';
2
2
  import * as React from 'react';
3
3
  import { useContext, useRef, cloneElement, Children, isValidElement } from 'react';
4
- import { useForceUpdate } from '../../utils/use-force-update.js';
5
- import { PresenceChild } from './PresenceChild.js';
6
- import { LayoutGroupContext } from '../../context/LayoutGroupContext.js';
4
+ import { useForceUpdate } from '../../utils/use-force-update.mjs';
5
+ import { PresenceChild } from './PresenceChild.mjs';
6
+ import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
7
7
 
8
8
  function getChildKey(child) {
9
9
  return child.key || "";
@@ -35,35 +35,6 @@ function onlyElements(children) {
35
35
  *
36
36
  * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
37
37
  *
38
- * @library
39
- *
40
- * Any `Frame` components that have an `exit` property defined will animate out when removed from
41
- * the tree.
42
- *
43
- * ```jsx
44
- * import { Frame, AnimatePresence } from 'framer'
45
- *
46
- * // As items are added and removed from `items`
47
- * export function Items({ items }) {
48
- * return (
49
- * <AnimatePresence>
50
- * {items.map(item => (
51
- * <Frame
52
- * key={item.id}
53
- * initial={{ opacity: 0 }}
54
- * animate={{ opacity: 1 }}
55
- * exit={{ opacity: 0 }}
56
- * />
57
- * ))}
58
- * </AnimatePresence>
59
- * )
60
- * }
61
- * ```
62
- *
63
- * You can sequence exit animations throughout a tree using variants.
64
- *
65
- * @motion
66
- *
67
38
  * Any `motion` components that have an `exit` property defined will animate out when removed from
68
39
  * the tree.
69
40
  *
@@ -107,8 +78,7 @@ var AnimatePresence = function (_a) {
107
78
  // can diff to figure out which are entering and exiting
108
79
  var presentChildren = useRef(filteredChildren);
109
80
  // A lookup table to quickly reference components by key
110
- var allChildren = useRef(new Map())
111
- .current;
81
+ var allChildren = useRef(new Map()).current;
112
82
  // A living record of all currently exiting components.
113
83
  var exiting = useRef(new Set()).current;
114
84
  updateChildLookup(filteredChildren, allChildren);
@@ -119,7 +89,7 @@ var AnimatePresence = function (_a) {
119
89
  return (React.createElement(React.Fragment, null, filteredChildren.map(function (child) { return (React.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout }, child)); })));
120
90
  }
121
91
  // If this is a subsequent render, deal with entering and exiting children
122
- var childrenToRender = __spreadArray([], __read(filteredChildren));
92
+ var childrenToRender = __spreadArray([], __read(filteredChildren), false);
123
93
  // Diff the keys of the currently-present and target children to update our
124
94
  // exiting list.
125
95
  var presentKeys = presentChildren.current.map(getChildKey);
@@ -1,6 +1,6 @@
1
1
  import { useContext, useEffect } from 'react';
2
- import { PresenceContext } from '../../context/PresenceContext.js';
3
- import { useConstant } from '../../utils/use-constant.js';
2
+ import { PresenceContext } from '../../context/PresenceContext.mjs';
3
+ import { useConstant } from '../../utils/use-constant.mjs';
4
4
 
5
5
  /**
6
6
  * When a component is the child of `AnimatePresence`, it can use `usePresence`
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { useConstant } from '../utils/use-constant.mjs';
3
+ import { LayoutGroup } from './LayoutGroup/index.mjs';
4
+
5
+ var id = 0;
6
+ var AnimateSharedLayout = function (_a) {
7
+ var children = _a.children;
8
+ return (React.createElement(LayoutGroup, { id: useConstant(function () { return "asl-" + id++; }) }, children));
9
+ };
10
+
11
+ export { AnimateSharedLayout };
@@ -0,0 +1,32 @@
1
+ import { __read, __assign } from 'tslib';
2
+ import * as React from 'react';
3
+ import { useContext, useRef, useMemo } from 'react';
4
+ import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
5
+ import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGroupContext.mjs';
6
+ import { useForceUpdate } from '../../utils/use-force-update.mjs';
7
+ import { nodeGroup } from '../../projection/node/group.mjs';
8
+
9
+ var LayoutGroup = function (_a) {
10
+ var _b, _c;
11
+ var children = _a.children, id = _a.id, _d = _a.inheritId, inheritId = _d === void 0 ? true : _d;
12
+ var layoutGroupContext = useContext(LayoutGroupContext);
13
+ var deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
14
+ var _e = __read(useForceUpdate(), 2), forceRender = _e[0], key = _e[1];
15
+ var context = useRef(null);
16
+ var upstreamId = (_b = layoutGroupContext.id) !== null && _b !== void 0 ? _b : deprecatedLayoutGroupContext;
17
+ if (context.current === null) {
18
+ if (inheritId && upstreamId) {
19
+ id = id ? upstreamId + "-" + id : upstreamId;
20
+ }
21
+ context.current = {
22
+ id: id,
23
+ group: inheritId
24
+ ? (_c = layoutGroupContext === null || layoutGroupContext === void 0 ? void 0 : layoutGroupContext.group) !== null && _c !== void 0 ? _c : nodeGroup()
25
+ : nodeGroup(),
26
+ };
27
+ }
28
+ var memoizedContext = useMemo(function () { return (__assign(__assign({}, context.current), { forceRender: forceRender })); }, [key]);
29
+ return (React.createElement(LayoutGroupContext.Provider, { value: memoizedContext }, children));
30
+ };
31
+
32
+ export { LayoutGroup };
@@ -1,8 +1,8 @@
1
1
  import { __read, __rest } from 'tslib';
2
2
  import * as React from 'react';
3
3
  import { useState, useRef, useEffect } from 'react';
4
- import { LazyContext } from '../../context/LazyContext.js';
5
- import { loadFeatures } from '../../motion/features/definitions.js';
4
+ import { LazyContext } from '../../context/LazyContext.mjs';
5
+ import { loadFeatures } from '../../motion/features/definitions.mjs';
6
6
 
7
7
  /**
8
8
  * Used in conjunction with the `m` component to reduce bundle size.
@@ -1,8 +1,8 @@
1
1
  import { __rest, __assign } from 'tslib';
2
2
  import * as React from 'react';
3
3
  import { useContext, useMemo } from 'react';
4
- import { MotionConfigContext } from '../../context/MotionConfigContext.js';
5
- import { useConstant } from '../../utils/use-constant.js';
4
+ import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
5
+ import { useConstant } from '../../utils/use-constant.mjs';
6
6
 
7
7
  /**
8
8
  * `MotionConfig` is used to set configuration options for all children `motion` components.
@@ -0,0 +1,46 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import * as React from 'react';
3
+ import { forwardRef, useRef, useEffect } from 'react';
4
+ import { ReorderContext } from '../../context/ReorderContext.mjs';
5
+ import { motion } from '../../render/dom/motion.mjs';
6
+ import { useConstant } from '../../utils/use-constant.mjs';
7
+ import { checkReorder } from './utils/check-reorder.mjs';
8
+
9
+ function ReorderGroup(_a, externalRef) {
10
+ var children = _a.children, _b = _a.as, as = _b === void 0 ? "ul" : _b, _c = _a.axis, axis = _c === void 0 ? "y" : _c, onReorder = _a.onReorder, props = __rest(_a, ["children", "as", "axis", "onReorder"]);
11
+ var Component = useConstant(function () { return motion(as); });
12
+ var order = [];
13
+ var isReordering = useRef(false);
14
+ var context = {
15
+ axis: axis,
16
+ registerItem: function (value, layout) {
17
+ /**
18
+ * Ensure entries can't add themselves more than once
19
+ */
20
+ if (layout &&
21
+ order.findIndex(function (entry) { return value === entry.value; }) === -1) {
22
+ order.push({ value: value, layout: layout[axis] });
23
+ }
24
+ },
25
+ updateOrder: function (id, offset, velocity) {
26
+ if (isReordering.current)
27
+ return;
28
+ var newOrder = checkReorder(order, id, offset, velocity);
29
+ if (order !== newOrder) {
30
+ isReordering.current = true;
31
+ onReorder(newOrder.map(getValue));
32
+ }
33
+ },
34
+ };
35
+ useEffect(function () {
36
+ isReordering.current = false;
37
+ });
38
+ return (React.createElement(Component, __assign({}, props, { ref: externalRef }),
39
+ React.createElement(ReorderContext.Provider, { value: context }, children)));
40
+ }
41
+ var Group = forwardRef(ReorderGroup);
42
+ function getValue(item) {
43
+ return item.value;
44
+ }
45
+
46
+ export { Group, ReorderGroup };
@@ -0,0 +1,42 @@
1
+ import { __rest, __read, __assign } from 'tslib';
2
+ import { invariant } from 'hey-listen';
3
+ import * as React from 'react';
4
+ import { forwardRef, useContext, useRef, useEffect } from 'react';
5
+ import { ReorderContext } from '../../context/ReorderContext.mjs';
6
+ import { motion } from '../../render/dom/motion.mjs';
7
+ import { useConstant } from '../../utils/use-constant.mjs';
8
+ import { useMotionValue } from '../../value/use-motion-value.mjs';
9
+ import { useTransform } from '../../value/use-transform.mjs';
10
+ import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
11
+
12
+ function useDefaultMotionValue(value, defaultValue) {
13
+ if (defaultValue === void 0) { defaultValue = 0; }
14
+ return isMotionValue(value) ? value : useMotionValue(defaultValue);
15
+ }
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"]);
18
+ var Component = useConstant(function () { return motion(as); });
19
+ var context = useContext(ReorderContext);
20
+ var point = {
21
+ x: useDefaultMotionValue(style === null || style === void 0 ? void 0 : style.x),
22
+ y: useDefaultMotionValue(style === null || style === void 0 ? void 0 : style.y),
23
+ };
24
+ var zIndex = useTransform([point.x, point.y], function (_a) {
25
+ var _b = __read(_a, 2), latestX = _b[0], latestY = _b[1];
26
+ return latestX || latestY ? 1 : 0;
27
+ });
28
+ var layout = useRef(null);
29
+ invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
30
+ var _c = context, axis = _c.axis, registerItem = _c.registerItem, updateOrder = _c.updateOrder;
31
+ useEffect(function () {
32
+ registerItem(value, layout.current);
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;
36
+ velocity[axis] &&
37
+ updateOrder(value, point[axis].get(), velocity[axis]);
38
+ }, onLayoutMeasure: function (measured) { return (layout.current = measured); }, ref: externalRef }), children));
39
+ }
40
+ var Item = forwardRef(ReorderItem);
41
+
42
+ export { Item, ReorderItem };
@@ -0,0 +1,9 @@
1
+ import { Group } from './Group.mjs';
2
+ import { Item } from './Item.mjs';
3
+
4
+ var Reorder = {
5
+ Group: Group,
6
+ Item: Item,
7
+ };
8
+
9
+ export { Reorder };
@@ -0,0 +1,24 @@
1
+ import { mix } from 'popmotion';
2
+ import { moveItem } from '../../../utils/array.mjs';
3
+
4
+ function checkReorder(order, value, offset, velocity) {
5
+ if (!velocity)
6
+ return order;
7
+ var index = order.findIndex(function (item) { return item.value === value; });
8
+ if (index === -1)
9
+ return order;
10
+ var nextOffset = velocity > 0 ? 1 : -1;
11
+ var nextItem = order[index + nextOffset];
12
+ if (!nextItem)
13
+ return order;
14
+ var item = order[index];
15
+ var nextLayout = nextItem.layout;
16
+ var nextItemCenter = mix(nextLayout.min, nextLayout.max, 0.5);
17
+ if ((nextOffset === 1 && item.layout.max + offset > nextItemCenter) ||
18
+ (nextOffset === -1 && item.layout.min + offset < nextItemCenter)) {
19
+ return moveItem(order, index, index + nextOffset);
20
+ }
21
+ return order;
22
+ }
23
+
24
+ export { checkReorder };
@@ -0,0 +1,9 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * @internal
5
+ * @deprecated
6
+ */
7
+ var DeprecatedLayoutGroupContext = createContext(null);
8
+
9
+ export { DeprecatedLayoutGroupContext };
@@ -1,6 +1,6 @@
1
1
  import { useMemo, useContext } from 'react';
2
- import { MotionContext } from './index.js';
3
- import { getCurrentTreeVariants } from './utils.js';
2
+ import { MotionContext } from './index.mjs';
3
+ import { getCurrentTreeVariants } from './utils.mjs';
4
4
 
5
5
  function useCreateMotionContext(props, isStatic) {
6
6
  var _a = getCurrentTreeVariants(props, useContext(MotionContext)), initial = _a.initial, animate = _a.animate;
@@ -1,4 +1,4 @@
1
- import { checkIfControllingVariants, isVariantLabel } from '../../render/utils/variants.js';
1
+ import { checkIfControllingVariants, isVariantLabel } from '../../render/utils/variants.mjs';
2
2
 
3
3
  function getCurrentTreeVariants(props, context) {
4
4
  if (checkIfControllingVariants(props)) {
@@ -0,0 +1,5 @@
1
+ import { createContext } from 'react';
2
+
3
+ var ReorderContext = createContext(null);
4
+
5
+ export { ReorderContext };
@@ -0,0 +1,8 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * @internal
5
+ */
6
+ var SwitchLayoutGroupContext = createContext({});
7
+
8
+ export { SwitchLayoutGroupContext };
@@ -1,4 +1,4 @@
1
- import { isTouchEvent } from '../gestures/utils/event-type.js';
1
+ import { isTouchEvent } from '../gestures/utils/event-type.mjs';
2
2
 
3
3
  /**
4
4
  * Filters out events not attached to the primary pointer (currently left mouse button)
@@ -1,6 +1,6 @@
1
- import { useDomEvent, addDomEvent } from './use-dom-event.js';
2
- import { wrapHandler } from './event-info.js';
3
- import { supportsPointerEvents, supportsTouchEvents, supportsMouseEvents } from './utils.js';
1
+ import { useDomEvent, addDomEvent } from './use-dom-event.mjs';
2
+ import { wrapHandler } from './event-info.mjs';
3
+ import { supportsPointerEvents, supportsTouchEvents, supportsMouseEvents } from './utils.mjs';
4
4
 
5
5
  var mouseEventNames = {
6
6
  pointerdown: "mousedown",
@@ -1,4 +1,4 @@
1
- import { isBrowser } from '../utils/is-browser.js';
1
+ import { isBrowser } from '../utils/is-browser.mjs';
2
2
 
3
3
  // We check for event support via functions in case they've been mocked by a testing suite.
4
4
  var supportsPointerEvents = function () {
@@ -1,9 +1,9 @@
1
1
  import { __assign } from 'tslib';
2
- import { isMouseEvent, isTouchEvent } from './utils/event-type.js';
3
- import { extractEventInfo } from '../events/event-info.js';
2
+ import { isMouseEvent, isTouchEvent } from './utils/event-type.mjs';
3
+ import { extractEventInfo } from '../events/event-info.mjs';
4
4
  import sync, { getFrameData, cancelSync } from 'framesync';
5
- import { secondsToMilliseconds } from '../utils/time-conversion.js';
6
- import { addPointerEvent } from '../events/use-pointer-event.js';
5
+ import { secondsToMilliseconds } from '../utils/time-conversion.mjs';
6
+ import { addPointerEvent } from '../events/use-pointer-event.mjs';
7
7
  import { distance, pipe } from 'popmotion';
8
8
 
9
9
  /**