motion 12.18.1 → 12.19.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 (410) hide show
  1. package/dist/cjs/mini.js +7 -1063
  2. package/dist/es/debug.mjs +1 -0
  3. package/dist/es/index.mjs +1 -0
  4. package/dist/es/mini.mjs +1 -0
  5. package/dist/es/react-client.mjs +2 -0
  6. package/dist/es/react-m.mjs +2 -0
  7. package/dist/es/react-mini.mjs +2 -0
  8. package/dist/es/react.mjs +2 -0
  9. package/dist/motion.dev.js +2 -2
  10. package/dist/motion.js +1 -1
  11. package/mini/package.json +1 -1
  12. package/package.json +11 -11
  13. package/react/package.json +1 -1
  14. package/react-client/package.json +1 -1
  15. package/react-m/package.json +1 -1
  16. package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +0 -34
  17. package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +0 -19
  18. package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +0 -14
  19. package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +0 -11
  20. package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +0 -52
  21. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +0 -112
  22. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +0 -13
  23. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +0 -12
  24. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -12
  25. package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +0 -80
  26. package/dist/es/framer-motion/dist/es/animation/hooks/use-animate-style.mjs +0 -17
  27. package/dist/es/framer-motion/dist/es/animation/hooks/use-animate.mjs +0 -17
  28. package/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs +0 -64
  29. package/dist/es/framer-motion/dist/es/animation/hooks/use-animation.mjs +0 -41
  30. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +0 -102
  31. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +0 -85
  32. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +0 -65
  33. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element.mjs +0 -26
  34. package/dist/es/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -6
  35. package/dist/es/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -7
  36. package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +0 -38
  37. package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +0 -171
  38. package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +0 -8
  39. package/dist/es/framer-motion/dist/es/animation/optimized-appear/store.mjs +0 -4
  40. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +0 -256
  41. package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +0 -5
  42. package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -23
  43. package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +0 -31
  44. package/dist/es/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +0 -13
  45. package/dist/es/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -14
  46. package/dist/es/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -45
  47. package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -40
  48. package/dist/es/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -7
  49. package/dist/es/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -5
  50. package/dist/es/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -5
  51. package/dist/es/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -10
  52. package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +0 -26
  53. package/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs +0 -87
  54. package/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +0 -64
  55. package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +0 -166
  56. package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence-data.mjs +0 -9
  57. package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs +0 -70
  58. package/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs +0 -14
  59. package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +0 -15
  60. package/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs +0 -32
  61. package/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs +0 -68
  62. package/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs +0 -48
  63. package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +0 -53
  64. package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +0 -34
  65. package/dist/es/framer-motion/dist/es/components/Reorder/namespace.mjs +0 -2
  66. package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +0 -24
  67. package/dist/es/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs +0 -10
  68. package/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs +0 -6
  69. package/dist/es/framer-motion/dist/es/context/LazyContext.mjs +0 -6
  70. package/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs +0 -13
  71. package/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs +0 -13
  72. package/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs +0 -6
  73. package/dist/es/framer-motion/dist/es/context/MotionContext/utils.mjs +0 -17
  74. package/dist/es/framer-motion/dist/es/context/PresenceContext.mjs +0 -10
  75. package/dist/es/framer-motion/dist/es/context/ReorderContext.mjs +0 -6
  76. package/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs +0 -9
  77. package/dist/es/framer-motion/dist/es/events/add-dom-event.mjs +0 -6
  78. package/dist/es/framer-motion/dist/es/events/add-pointer-event.mjs +0 -8
  79. package/dist/es/framer-motion/dist/es/events/event-info.mjs +0 -15
  80. package/dist/es/framer-motion/dist/es/events/use-dom-event.mjs +0 -34
  81. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +0 -479
  82. package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +0 -27
  83. package/dist/es/framer-motion/dist/es/gestures/drag/use-drag-controls.mjs +0 -88
  84. package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +0 -129
  85. package/dist/es/framer-motion/dist/es/gestures/focus.mjs +0 -41
  86. package/dist/es/framer-motion/dist/es/gestures/hover.mjs +0 -30
  87. package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +0 -156
  88. package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +0 -50
  89. package/dist/es/framer-motion/dist/es/gestures/press.mjs +0 -33
  90. package/dist/es/framer-motion/dist/es/motion/features/Feature.mjs +0 -9
  91. package/dist/es/framer-motion/dist/es/motion/features/animation/exit.mjs +0 -36
  92. package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +0 -40
  93. package/dist/es/framer-motion/dist/es/motion/features/animations.mjs +0 -13
  94. package/dist/es/framer-motion/dist/es/motion/features/definitions.mjs +0 -28
  95. package/dist/es/framer-motion/dist/es/motion/features/drag.mjs +0 -17
  96. package/dist/es/framer-motion/dist/es/motion/features/gestures.mjs +0 -21
  97. package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +0 -135
  98. package/dist/es/framer-motion/dist/es/motion/features/layout.mjs +0 -11
  99. package/dist/es/framer-motion/dist/es/motion/features/load-features.mjs +0 -12
  100. package/dist/es/framer-motion/dist/es/motion/features/viewport/index.mjs +0 -72
  101. package/dist/es/framer-motion/dist/es/motion/features/viewport/observers.mjs +0 -49
  102. package/dist/es/framer-motion/dist/es/motion/index.mjs +0 -101
  103. package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -11
  104. package/dist/es/framer-motion/dist/es/motion/utils/is-motion-component.mjs +0 -12
  105. package/dist/es/framer-motion/dist/es/motion/utils/symbol.mjs +0 -3
  106. package/dist/es/framer-motion/dist/es/motion/utils/unwrap-motion-component.mjs +0 -17
  107. package/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs +0 -38
  108. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +0 -133
  109. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs +0 -79
  110. package/dist/es/framer-motion/dist/es/motion/utils/valid-prop.mjs +0 -57
  111. package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +0 -91
  112. package/dist/es/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -33
  113. package/dist/es/framer-motion/dist/es/projection/geometry/copy.mjs +0 -31
  114. package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +0 -119
  115. package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +0 -52
  116. package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +0 -54
  117. package/dist/es/framer-motion/dist/es/projection/geometry/models.mjs +0 -17
  118. package/dist/es/framer-motion/dist/es/projection/geometry/utils.mjs +0 -31
  119. package/dist/es/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +0 -13
  120. package/dist/es/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +0 -27
  121. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +0 -1605
  122. package/dist/es/framer-motion/dist/es/projection/node/group.mjs +0 -24
  123. package/dist/es/framer-motion/dist/es/projection/node/state.mjs +0 -19
  124. package/dist/es/framer-motion/dist/es/projection/shared/stack.mjs +0 -112
  125. package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +0 -41
  126. package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +0 -35
  127. package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -13
  128. package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +0 -49
  129. package/dist/es/framer-motion/dist/es/projection/use-instant-layout-transition.mjs +0 -14
  130. package/dist/es/framer-motion/dist/es/projection/use-reset-projection.mjs +0 -14
  131. package/dist/es/framer-motion/dist/es/projection/utils/each-axis.mjs +0 -5
  132. package/dist/es/framer-motion/dist/es/projection/utils/has-transform.mjs +0 -26
  133. package/dist/es/framer-motion/dist/es/projection/utils/measure.mjs +0 -17
  134. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +0 -478
  135. package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +0 -23
  136. package/dist/es/framer-motion/dist/es/render/components/create-proxy.mjs +0 -38
  137. package/dist/es/framer-motion/dist/es/render/components/m/create.mjs +0 -6
  138. package/dist/es/framer-motion/dist/es/render/components/m/elements.mjs +0 -227
  139. package/dist/es/framer-motion/dist/es/render/components/m/proxy.mjs +0 -6
  140. package/dist/es/framer-motion/dist/es/render/components/motion/create.mjs +0 -15
  141. package/dist/es/framer-motion/dist/es/render/components/motion/elements.mjs +0 -194
  142. package/dist/es/framer-motion/dist/es/render/components/motion/proxy.mjs +0 -6
  143. package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +0 -43
  144. package/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs +0 -14
  145. package/dist/es/framer-motion/dist/es/render/dom/features-animation.mjs +0 -14
  146. package/dist/es/framer-motion/dist/es/render/dom/features-max.mjs +0 -14
  147. package/dist/es/framer-motion/dist/es/render/dom/features-min.mjs +0 -12
  148. package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +0 -17
  149. package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +0 -23
  150. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +0 -14
  151. package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +0 -56
  152. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -45
  153. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -60
  154. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -47
  155. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -35
  156. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -20
  157. package/dist/es/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +0 -48
  158. package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +0 -81
  159. package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +0 -30
  160. package/dist/es/framer-motion/dist/es/render/dom/use-render.mjs +0 -33
  161. package/dist/es/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -6
  162. package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +0 -59
  163. package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs +0 -30
  164. package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +0 -43
  165. package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -44
  166. package/dist/es/framer-motion/dist/es/render/html/config-motion.mjs +0 -12
  167. package/dist/es/framer-motion/dist/es/render/html/use-props.mjs +0 -57
  168. package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -65
  169. package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -62
  170. package/dist/es/framer-motion/dist/es/render/html/utils/create-render-state.mjs +0 -8
  171. package/dist/es/framer-motion/dist/es/render/html/utils/render.mjs +0 -9
  172. package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -19
  173. package/dist/es/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -41
  174. package/dist/es/framer-motion/dist/es/render/store.mjs +0 -3
  175. package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +0 -45
  176. package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +0 -12
  177. package/dist/es/framer-motion/dist/es/render/svg/lowercase-elements.mjs +0 -33
  178. package/dist/es/framer-motion/dist/es/render/svg/use-props.mjs +0 -24
  179. package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -57
  180. package/dist/es/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -30
  181. package/dist/es/framer-motion/dist/es/render/svg/utils/create-render-state.mjs +0 -8
  182. package/dist/es/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -3
  183. package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +0 -32
  184. package/dist/es/framer-motion/dist/es/render/svg/utils/render.mjs +0 -12
  185. package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -19
  186. package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +0 -342
  187. package/dist/es/framer-motion/dist/es/render/utils/compare-by-depth.mjs +0 -3
  188. package/dist/es/framer-motion/dist/es/render/utils/flat-tree.mjs +0 -24
  189. package/dist/es/framer-motion/dist/es/render/utils/get-variant-context.mjs +0 -28
  190. package/dist/es/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -13
  191. package/dist/es/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -8
  192. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +0 -51
  193. package/dist/es/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -8
  194. package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -36
  195. package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +0 -31
  196. package/dist/es/framer-motion/dist/es/render/utils/variant-props.mjs +0 -12
  197. package/dist/es/framer-motion/dist/es/utils/delay.mjs +0 -24
  198. package/dist/es/framer-motion/dist/es/utils/distance.mjs +0 -9
  199. package/dist/es/framer-motion/dist/es/utils/get-context-window.mjs +0 -6
  200. package/dist/es/framer-motion/dist/es/utils/is-browser.mjs +0 -3
  201. package/dist/es/framer-motion/dist/es/utils/is-ref-object.mjs +0 -7
  202. package/dist/es/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -19
  203. package/dist/es/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -5
  204. package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +0 -19
  205. package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs +0 -47
  206. package/dist/es/framer-motion/dist/es/utils/shallow-compare.mjs +0 -14
  207. package/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs +0 -21
  208. package/dist/es/framer-motion/dist/es/utils/use-constant.mjs +0 -18
  209. package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +0 -47
  210. package/dist/es/framer-motion/dist/es/utils/use-force-update.mjs +0 -19
  211. package/dist/es/framer-motion/dist/es/utils/use-in-view.mjs +0 -23
  212. package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +0 -41
  213. package/dist/es/framer-motion/dist/es/utils/use-is-mounted.mjs +0 -15
  214. package/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs +0 -6
  215. package/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs +0 -13
  216. package/dist/es/framer-motion/dist/es/utils/use-unmount-effect.mjs +0 -7
  217. package/dist/es/framer-motion/dist/es/value/scroll/use-element-scroll.mjs +0 -14
  218. package/dist/es/framer-motion/dist/es/value/scroll/use-viewport-scroll.mjs +0 -14
  219. package/dist/es/framer-motion/dist/es/value/use-combine-values.mjs +0 -37
  220. package/dist/es/framer-motion/dist/es/value/use-computed.mjs +0 -19
  221. package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +0 -52
  222. package/dist/es/framer-motion/dist/es/value/use-motion-template.mjs +0 -45
  223. package/dist/es/framer-motion/dist/es/value/use-motion-value.mjs +0 -38
  224. package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +0 -39
  225. package/dist/es/framer-motion/dist/es/value/use-spring.mjs +0 -22
  226. package/dist/es/framer-motion/dist/es/value/use-time.mjs +0 -10
  227. package/dist/es/framer-motion/dist/es/value/use-transform.mjs +0 -29
  228. package/dist/es/framer-motion/dist/es/value/use-velocity.mjs +0 -35
  229. package/dist/es/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs +0 -21
  230. package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -20
  231. package/dist/es/framer-motion/dist/es/value/use-will-change/index.mjs +0 -8
  232. package/dist/es/framer-motion/dist/es/value/use-will-change/is.mjs +0 -7
  233. package/dist/es/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +0 -12
  234. package/dist/es/motion/lib/debug.mjs +0 -1
  235. package/dist/es/motion/lib/index.mjs +0 -131
  236. package/dist/es/motion/lib/mini.mjs +0 -2
  237. package/dist/es/motion/lib/react-client.mjs +0 -3
  238. package/dist/es/motion/lib/react-m.mjs +0 -3
  239. package/dist/es/motion/lib/react-mini.mjs +0 -2
  240. package/dist/es/motion/lib/react.mjs +0 -204
  241. package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +0 -175
  242. package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +0 -72
  243. package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +0 -9
  244. package/dist/es/motion-dom/dist/es/animation/JSAnimation.mjs +0 -348
  245. package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +0 -158
  246. package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +0 -65
  247. package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +0 -14
  248. package/dist/es/motion-dom/dist/es/animation/drivers/frame.mjs +0 -17
  249. package/dist/es/motion-dom/dist/es/animation/generators/inertia.mjs +0 -87
  250. package/dist/es/motion-dom/dist/es/animation/generators/keyframes.mjs +0 -51
  251. package/dist/es/motion-dom/dist/es/animation/generators/spring/defaults.mjs +0 -27
  252. package/dist/es/motion-dom/dist/es/animation/generators/spring/find.mjs +0 -86
  253. package/dist/es/motion-dom/dist/es/animation/generators/spring/index.mjs +0 -176
  254. package/dist/es/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +0 -17
  255. package/dist/es/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +0 -19
  256. package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +0 -5
  257. package/dist/es/motion-dom/dist/es/animation/generators/utils/velocity.mjs +0 -9
  258. package/dist/es/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs +0 -131
  259. package/dist/es/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs +0 -147
  260. package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +0 -11
  261. package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/default.mjs +0 -9
  262. package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/fill.mjs +0 -12
  263. package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/time.mjs +0 -5
  264. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +0 -11
  265. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +0 -7
  266. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/is-none.mjs +0 -15
  267. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.mjs +0 -30
  268. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.mjs +0 -36
  269. package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +0 -26
  270. package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +0 -9
  271. package/dist/es/motion-dom/dist/es/animation/utils/can-animate.mjs +0 -42
  272. package/dist/es/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs +0 -42
  273. package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +0 -7
  274. package/dist/es/motion-dom/dist/es/animation/utils/is-animatable.mjs +0 -30
  275. package/dist/es/motion-dom/dist/es/animation/utils/is-css-variable.mjs +0 -15
  276. package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +0 -18
  277. package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +0 -3
  278. package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +0 -14
  279. package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +0 -28
  280. package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +0 -15
  281. package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +0 -39
  282. package/dist/es/motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs +0 -13
  283. package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +0 -37
  284. package/dist/es/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs +0 -14
  285. package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +0 -15
  286. package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +0 -12
  287. package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +0 -39
  288. package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +0 -20
  289. package/dist/es/motion-dom/dist/es/effects/MotionValueState.mjs +0 -47
  290. package/dist/es/motion-dom/dist/es/effects/attr/index.mjs +0 -41
  291. package/dist/es/motion-dom/dist/es/effects/prop/index.mjs +0 -9
  292. package/dist/es/motion-dom/dist/es/effects/style/index.mjs +0 -52
  293. package/dist/es/motion-dom/dist/es/effects/style/transform.mjs +0 -38
  294. package/dist/es/motion-dom/dist/es/effects/svg/index.mjs +0 -41
  295. package/dist/es/motion-dom/dist/es/effects/utils/create-dom-effect.mjs +0 -18
  296. package/dist/es/motion-dom/dist/es/effects/utils/create-effect.mjs +0 -21
  297. package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +0 -71
  298. package/dist/es/motion-dom/dist/es/frameloop/frame.mjs +0 -6
  299. package/dist/es/motion-dom/dist/es/frameloop/index-legacy.mjs +0 -20
  300. package/dist/es/motion-dom/dist/es/frameloop/microtask.mjs +0 -6
  301. package/dist/es/motion-dom/dist/es/frameloop/order.mjs +0 -12
  302. package/dist/es/motion-dom/dist/es/frameloop/render-step.mjs +0 -92
  303. package/dist/es/motion-dom/dist/es/frameloop/sync-time.mjs +0 -31
  304. package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +0 -9
  305. package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +0 -28
  306. package/dist/es/motion-dom/dist/es/gestures/hover.mjs +0 -37
  307. package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +0 -83
  308. package/dist/es/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +0 -13
  309. package/dist/es/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +0 -38
  310. package/dist/es/motion-dom/dist/es/gestures/press/utils/state.mjs +0 -3
  311. package/dist/es/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +0 -20
  312. package/dist/es/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +0 -18
  313. package/dist/es/motion-dom/dist/es/gestures/utils/setup.mjs +0 -15
  314. package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +0 -3
  315. package/dist/es/motion-dom/dist/es/render/dom/parse-transform.mjs +0 -83
  316. package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +0 -10
  317. package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +0 -9
  318. package/dist/es/motion-dom/dist/es/render/dom/utils/camel-to-dash.mjs +0 -5
  319. package/dist/es/motion-dom/dist/es/render/utils/keys-position.mjs +0 -13
  320. package/dist/es/motion-dom/dist/es/render/utils/keys-transform.mjs +0 -28
  321. package/dist/es/motion-dom/dist/es/resize/handle-element.mjs +0 -63
  322. package/dist/es/motion-dom/dist/es/resize/handle-window.mjs +0 -31
  323. package/dist/es/motion-dom/dist/es/resize/index.mjs +0 -8
  324. package/dist/es/motion-dom/dist/es/scroll/observe.mjs +0 -18
  325. package/dist/es/motion-dom/dist/es/stats/animation-count.mjs +0 -7
  326. package/dist/es/motion-dom/dist/es/stats/buffer.mjs +0 -6
  327. package/dist/es/motion-dom/dist/es/stats/index.mjs +0 -117
  328. package/dist/es/motion-dom/dist/es/utils/interpolate.mjs +0 -79
  329. package/dist/es/motion-dom/dist/es/utils/is-html-element.mjs +0 -11
  330. package/dist/es/motion-dom/dist/es/utils/is-svg-element.mjs +0 -11
  331. package/dist/es/motion-dom/dist/es/utils/is-svg-svg-element.mjs +0 -11
  332. package/dist/es/motion-dom/dist/es/utils/mix/color.mjs +0 -47
  333. package/dist/es/motion-dom/dist/es/utils/mix/complex.mjs +0 -93
  334. package/dist/es/motion-dom/dist/es/utils/mix/immediate.mjs +0 -5
  335. package/dist/es/motion-dom/dist/es/utils/mix/index.mjs +0 -14
  336. package/dist/es/motion-dom/dist/es/utils/mix/number.mjs +0 -26
  337. package/dist/es/motion-dom/dist/es/utils/mix/visibility.mjs +0 -16
  338. package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +0 -17
  339. package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +0 -7
  340. package/dist/es/motion-dom/dist/es/utils/supports/linear-easing.mjs +0 -15
  341. package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +0 -9
  342. package/dist/es/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +0 -5
  343. package/dist/es/motion-dom/dist/es/utils/transform.mjs +0 -14
  344. package/dist/es/motion-dom/dist/es/value/index.mjs +0 -329
  345. package/dist/es/motion-dom/dist/es/value/map-value.mjs +0 -46
  346. package/dist/es/motion-dom/dist/es/value/spring-value.mjs +0 -72
  347. package/dist/es/motion-dom/dist/es/value/subscribe-value.mjs +0 -13
  348. package/dist/es/motion-dom/dist/es/value/transform-value.mjs +0 -35
  349. package/dist/es/motion-dom/dist/es/value/types/auto.mjs +0 -9
  350. package/dist/es/motion-dom/dist/es/value/types/color/hex.mjs +0 -40
  351. package/dist/es/motion-dom/dist/es/value/types/color/hsla-to-rgba.mjs +0 -42
  352. package/dist/es/motion-dom/dist/es/value/types/color/hsla.mjs +0 -22
  353. package/dist/es/motion-dom/dist/es/value/types/color/index.mjs +0 -32
  354. package/dist/es/motion-dom/dist/es/value/types/color/rgba.mjs +0 -25
  355. package/dist/es/motion-dom/dist/es/value/types/color/utils.mjs +0 -29
  356. package/dist/es/motion-dom/dist/es/value/types/complex/filter.mjs +0 -30
  357. package/dist/es/motion-dom/dist/es/value/types/complex/index.mjs +0 -91
  358. package/dist/es/motion-dom/dist/es/value/types/dimensions.mjs +0 -15
  359. package/dist/es/motion-dom/dist/es/value/types/int.mjs +0 -8
  360. package/dist/es/motion-dom/dist/es/value/types/maps/defaults.mjs +0 -30
  361. package/dist/es/motion-dom/dist/es/value/types/maps/number.mjs +0 -50
  362. package/dist/es/motion-dom/dist/es/value/types/maps/transform.mjs +0 -31
  363. package/dist/es/motion-dom/dist/es/value/types/numbers/index.mjs +0 -17
  364. package/dist/es/motion-dom/dist/es/value/types/numbers/units.mjs +0 -18
  365. package/dist/es/motion-dom/dist/es/value/types/test.mjs +0 -6
  366. package/dist/es/motion-dom/dist/es/value/types/utils/animatable-none.mjs +0 -15
  367. package/dist/es/motion-dom/dist/es/value/types/utils/color-regex.mjs +0 -3
  368. package/dist/es/motion-dom/dist/es/value/types/utils/find.mjs +0 -15
  369. package/dist/es/motion-dom/dist/es/value/types/utils/float-regex.mjs +0 -3
  370. package/dist/es/motion-dom/dist/es/value/types/utils/get-as-type.mjs +0 -10
  371. package/dist/es/motion-dom/dist/es/value/types/utils/is-nullish.mjs +0 -5
  372. package/dist/es/motion-dom/dist/es/value/types/utils/sanitize.mjs +0 -5
  373. package/dist/es/motion-dom/dist/es/value/types/utils/single-color-regex.mjs +0 -3
  374. package/dist/es/motion-dom/dist/es/value/utils/is-motion-value.mjs +0 -3
  375. package/dist/es/motion-dom/dist/es/view/index.mjs +0 -64
  376. package/dist/es/motion-dom/dist/es/view/queue.mjs +0 -52
  377. package/dist/es/motion-dom/dist/es/view/start.mjs +0 -155
  378. package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +0 -11
  379. package/dist/es/motion-dom/dist/es/view/utils/css.mjs +0 -32
  380. package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +0 -8
  381. package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +0 -12
  382. package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +0 -5
  383. package/dist/es/motion-utils/dist/es/array.mjs +0 -21
  384. package/dist/es/motion-utils/dist/es/clamp.mjs +0 -9
  385. package/dist/es/motion-utils/dist/es/easing/anticipate.mjs +0 -5
  386. package/dist/es/motion-utils/dist/es/easing/back.mjs +0 -9
  387. package/dist/es/motion-utils/dist/es/easing/circ.mjs +0 -8
  388. package/dist/es/motion-utils/dist/es/easing/cubic-bezier.mjs +0 -51
  389. package/dist/es/motion-utils/dist/es/easing/ease.mjs +0 -7
  390. package/dist/es/motion-utils/dist/es/easing/modifiers/mirror.mjs +0 -5
  391. package/dist/es/motion-utils/dist/es/easing/modifiers/reverse.mjs +0 -5
  392. package/dist/es/motion-utils/dist/es/easing/steps.mjs +0 -15
  393. package/dist/es/motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs +0 -8
  394. package/dist/es/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs +0 -3
  395. package/dist/es/motion-utils/dist/es/easing/utils/is-easing-array.mjs +0 -5
  396. package/dist/es/motion-utils/dist/es/easing/utils/map.mjs +0 -41
  397. package/dist/es/motion-utils/dist/es/errors.mjs +0 -16
  398. package/dist/es/motion-utils/dist/es/global-config.mjs +0 -3
  399. package/dist/es/motion-utils/dist/es/is-numerical-string.mjs +0 -6
  400. package/dist/es/motion-utils/dist/es/is-object.mjs +0 -5
  401. package/dist/es/motion-utils/dist/es/is-zero-value-string.mjs +0 -6
  402. package/dist/es/motion-utils/dist/es/memo.mjs +0 -11
  403. package/dist/es/motion-utils/dist/es/noop.mjs +0 -4
  404. package/dist/es/motion-utils/dist/es/pipe.mjs +0 -11
  405. package/dist/es/motion-utils/dist/es/progress.mjs +0 -19
  406. package/dist/es/motion-utils/dist/es/subscription-manager.mjs +0 -40
  407. package/dist/es/motion-utils/dist/es/time-conversion.mjs +0 -12
  408. package/dist/es/motion-utils/dist/es/velocity-per-second.mjs +0 -11
  409. package/dist/es/motion-utils/dist/es/warn-once.mjs +0 -14
  410. package/dist/es/motion-utils/dist/es/wrap.mjs +0 -6
@@ -1,5 +0,0 @@
1
- function calculateRepeatDuration(duration, repeat, _repeatDelay) {
2
- return duration * (repeat + 1);
3
- }
4
-
5
- export { calculateRepeatDuration };
@@ -1,23 +0,0 @@
1
- /**
2
- * Given a absolute or relative time definition and current/prev time state of the sequence,
3
- * calculate an absolute time for the next keyframes.
4
- */
5
- function calcNextTime(current, next, prev, labels) {
6
- if (typeof next === "number") {
7
- return next;
8
- }
9
- else if (next.startsWith("-") || next.startsWith("+")) {
10
- return Math.max(0, current + parseFloat(next));
11
- }
12
- else if (next === "<") {
13
- return prev;
14
- }
15
- else if (next.startsWith("<")) {
16
- return Math.max(0, prev + parseFloat(next.slice(1)));
17
- }
18
- else {
19
- return labels.get(next) ?? current;
20
- }
21
- }
22
-
23
- export { calcNextTime };
@@ -1,31 +0,0 @@
1
- import { mixNumber } from '../../../../../../motion-dom/dist/es/utils/mix/number.mjs';
2
- import { getEasingForSegment } from '../../../../../../motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs';
3
- import { removeItem } from '../../../../../../motion-utils/dist/es/array.mjs';
4
-
5
- function eraseKeyframes(sequence, startTime, endTime) {
6
- for (let i = 0; i < sequence.length; i++) {
7
- const keyframe = sequence[i];
8
- if (keyframe.at > startTime && keyframe.at < endTime) {
9
- removeItem(sequence, keyframe);
10
- // If we remove this item we have to push the pointer back one
11
- i--;
12
- }
13
- }
14
- }
15
- function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
16
- /**
17
- * Erase every existing value between currentTime and targetTime,
18
- * this will essentially splice this timeline into any currently
19
- * defined ones.
20
- */
21
- eraseKeyframes(sequence, startTime, endTime);
22
- for (let i = 0; i < keyframes.length; i++) {
23
- sequence.push({
24
- value: keyframes[i],
25
- at: mixNumber(startTime, endTime, offset[i]),
26
- easing: getEasingForSegment(easing, i),
27
- });
28
- }
29
- }
30
-
31
- export { addKeyframes, eraseKeyframes };
@@ -1,13 +0,0 @@
1
- /**
2
- * Take an array of times that represent repeated keyframes. For instance
3
- * if we have original times of [0, 0.5, 1] then our repeated times will
4
- * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back
5
- * down to a 0-1 scale.
6
- */
7
- function normalizeTimes(times, repeat) {
8
- for (let i = 0; i < times.length; i++) {
9
- times[i] = times[i] / (repeat + 1);
10
- }
11
- }
12
-
13
- export { normalizeTimes };
@@ -1,14 +0,0 @@
1
- function compareByTime(a, b) {
2
- if (a.at === b.at) {
3
- if (a.value === null)
4
- return 1;
5
- if (b.value === null)
6
- return -1;
7
- return 0;
8
- }
9
- else {
10
- return a.at - b.at;
11
- }
12
- }
13
-
14
- export { compareByTime };
@@ -1,45 +0,0 @@
1
- import { HTMLVisualElement } from '../../render/html/HTMLVisualElement.mjs';
2
- import { ObjectVisualElement } from '../../render/object/ObjectVisualElement.mjs';
3
- import { visualElementStore } from '../../render/store.mjs';
4
- import { SVGVisualElement } from '../../render/svg/SVGVisualElement.mjs';
5
- import { isSVGElement } from '../../../../../motion-dom/dist/es/utils/is-svg-element.mjs';
6
- import { isSVGSVGElement } from '../../../../../motion-dom/dist/es/utils/is-svg-svg-element.mjs';
7
-
8
- function createDOMVisualElement(element) {
9
- const options = {
10
- presenceContext: null,
11
- props: {},
12
- visualState: {
13
- renderState: {
14
- transform: {},
15
- transformOrigin: {},
16
- style: {},
17
- vars: {},
18
- attrs: {},
19
- },
20
- latestValues: {},
21
- },
22
- };
23
- const node = isSVGElement(element) && !isSVGSVGElement(element)
24
- ? new SVGVisualElement(options)
25
- : new HTMLVisualElement(options);
26
- node.mount(element);
27
- visualElementStore.set(element, node);
28
- }
29
- function createObjectVisualElement(subject) {
30
- const options = {
31
- presenceContext: null,
32
- props: {},
33
- visualState: {
34
- renderState: {
35
- output: {},
36
- },
37
- latestValues: {},
38
- },
39
- };
40
- const node = new ObjectVisualElement(options);
41
- node.mount(subject);
42
- visualElementStore.set(subject, node);
43
- }
44
-
45
- export { createDOMVisualElement, createObjectVisualElement };
@@ -1,40 +0,0 @@
1
- import { transformProps } from '../../../../../motion-dom/dist/es/render/utils/keys-transform.mjs';
2
-
3
- const underDampedSpring = {
4
- type: "spring",
5
- stiffness: 500,
6
- damping: 25,
7
- restSpeed: 10,
8
- };
9
- const criticallyDampedSpring = (target) => ({
10
- type: "spring",
11
- stiffness: 550,
12
- damping: target === 0 ? 2 * Math.sqrt(550) : 30,
13
- restSpeed: 10,
14
- });
15
- const keyframesTransition = {
16
- type: "keyframes",
17
- duration: 0.8,
18
- };
19
- /**
20
- * Default easing curve is a slightly shallower version of
21
- * the default browser easing curve.
22
- */
23
- const ease = {
24
- type: "keyframes",
25
- ease: [0.25, 0.1, 0.35, 1],
26
- duration: 0.3,
27
- };
28
- const getDefaultTransition = (valueKey, { keyframes }) => {
29
- if (keyframes.length > 2) {
30
- return keyframesTransition;
31
- }
32
- else if (transformProps.has(valueKey)) {
33
- return valueKey.startsWith("scale")
34
- ? criticallyDampedSpring(keyframes[1])
35
- : underDampedSpring;
36
- }
37
- return ease;
38
- };
39
-
40
- export { getDefaultTransition };
@@ -1,7 +0,0 @@
1
- function isAnimationControls(v) {
2
- return (v !== null &&
3
- typeof v === "object" &&
4
- typeof v.start === "function");
5
- }
6
-
7
- export { isAnimationControls };
@@ -1,5 +0,0 @@
1
- function isDOMKeyframes(keyframes) {
2
- return typeof keyframes === "object" && !Array.isArray(keyframes);
3
- }
4
-
5
- export { isDOMKeyframes };
@@ -1,5 +0,0 @@
1
- const isKeyframesTarget = (v) => {
2
- return Array.isArray(v);
3
- };
4
-
5
- export { isKeyframesTarget };
@@ -1,10 +0,0 @@
1
- /**
2
- * Decide whether a transition is defined on a given Transition.
3
- * This filters out orchestration options and returns true
4
- * if any options are left.
5
- */
6
- function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
7
- return !!Object.keys(transition).length;
8
- }
9
-
10
- export { isTransitionDefined };
@@ -1,26 +0,0 @@
1
- import { easingDefinitionToFunction } from '../../../../../motion-utils/dist/es/easing/utils/map.mjs';
2
-
3
- function getOriginIndex(from, total) {
4
- if (from === "first") {
5
- return 0;
6
- }
7
- else {
8
- const lastIndex = total - 1;
9
- return from === "last" ? lastIndex : lastIndex / 2;
10
- }
11
- }
12
- function stagger(duration = 0.1, { startDelay = 0, from = 0, ease } = {}) {
13
- return (i, total) => {
14
- const fromIndex = typeof from === "number" ? from : getOriginIndex(from, total);
15
- const distance = Math.abs(fromIndex - i);
16
- let delay = duration * distance;
17
- if (ease) {
18
- const maxDelay = total * duration;
19
- const easingFunction = easingDefinitionToFunction(ease);
20
- delay = easingFunction(delay / maxDelay) * maxDelay;
21
- }
22
- return startDelay + delay;
23
- };
24
- }
25
-
26
- export { getOriginIndex, stagger };
@@ -1,87 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import * as React from 'react';
4
- import { useId, useRef, useContext, useInsertionEffect } from 'react';
5
- import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
6
- import { isHTMLElement } from '../../../../../motion-dom/dist/es/utils/is-html-element.mjs';
7
-
8
- /**
9
- * Measurement functionality has to be within a separate component
10
- * to leverage snapshot lifecycle.
11
- */
12
- class PopChildMeasure extends React.Component {
13
- getSnapshotBeforeUpdate(prevProps) {
14
- const element = this.props.childRef.current;
15
- if (element && prevProps.isPresent && !this.props.isPresent) {
16
- const parent = element.offsetParent;
17
- const parentWidth = isHTMLElement(parent)
18
- ? parent.offsetWidth || 0
19
- : 0;
20
- const size = this.props.sizeRef.current;
21
- size.height = element.offsetHeight || 0;
22
- size.width = element.offsetWidth || 0;
23
- size.top = element.offsetTop;
24
- size.left = element.offsetLeft;
25
- size.right = parentWidth - size.width - size.left;
26
- }
27
- return null;
28
- }
29
- /**
30
- * Required with getSnapshotBeforeUpdate to stop React complaining.
31
- */
32
- componentDidUpdate() { }
33
- render() {
34
- return this.props.children;
35
- }
36
- }
37
- function PopChild({ children, isPresent, anchorX }) {
38
- const id = useId();
39
- const ref = useRef(null);
40
- const size = useRef({
41
- width: 0,
42
- height: 0,
43
- top: 0,
44
- left: 0,
45
- right: 0,
46
- });
47
- const { nonce } = useContext(MotionConfigContext);
48
- /**
49
- * We create and inject a style block so we can apply this explicit
50
- * sizing in a non-destructive manner by just deleting the style block.
51
- *
52
- * We can't apply size via render as the measurement happens
53
- * in getSnapshotBeforeUpdate (post-render), likewise if we apply the
54
- * styles directly on the DOM node, we might be overwriting
55
- * styles set via the style prop.
56
- */
57
- useInsertionEffect(() => {
58
- const { width, height, top, left, right } = size.current;
59
- if (isPresent || !ref.current || !width || !height)
60
- return;
61
- const x = anchorX === "left" ? `left: ${left}` : `right: ${right}`;
62
- ref.current.dataset.motionPopId = id;
63
- const style = document.createElement("style");
64
- if (nonce)
65
- style.nonce = nonce;
66
- document.head.appendChild(style);
67
- if (style.sheet) {
68
- style.sheet.insertRule(`
69
- [data-motion-pop-id="${id}"] {
70
- position: absolute !important;
71
- width: ${width}px !important;
72
- height: ${height}px !important;
73
- ${x}px !important;
74
- top: ${top}px !important;
75
- }
76
- `);
77
- }
78
- return () => {
79
- if (document.head.contains(style)) {
80
- document.head.removeChild(style);
81
- }
82
- };
83
- }, [isPresent]);
84
- return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: React.cloneElement(children, { ref }) }));
85
- }
86
-
87
- export { PopChild };
@@ -1,64 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import * as React from 'react';
4
- import { useId, useMemo } from 'react';
5
- import { PresenceContext } from '../../context/PresenceContext.mjs';
6
- import { useConstant } from '../../utils/use-constant.mjs';
7
- import { PopChild } from './PopChild.mjs';
8
-
9
- const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, }) => {
10
- const presenceChildren = useConstant(newChildrenMap);
11
- const id = useId();
12
- let isReusedContext = true;
13
- let context = useMemo(() => {
14
- isReusedContext = false;
15
- return {
16
- id,
17
- initial,
18
- isPresent,
19
- custom,
20
- onExitComplete: (childId) => {
21
- presenceChildren.set(childId, true);
22
- for (const isComplete of presenceChildren.values()) {
23
- if (!isComplete)
24
- return; // can stop searching when any is incomplete
25
- }
26
- onExitComplete && onExitComplete();
27
- },
28
- register: (childId) => {
29
- presenceChildren.set(childId, false);
30
- return () => presenceChildren.delete(childId);
31
- },
32
- };
33
- }, [isPresent, presenceChildren, onExitComplete]);
34
- /**
35
- * If the presence of a child affects the layout of the components around it,
36
- * we want to make a new context value to ensure they get re-rendered
37
- * so they can detect that layout change.
38
- */
39
- if (presenceAffectsLayout && isReusedContext) {
40
- context = { ...context };
41
- }
42
- useMemo(() => {
43
- presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
44
- }, [isPresent]);
45
- /**
46
- * If there's no `motion` components to fire exit animations, we want to remove this
47
- * component immediately.
48
- */
49
- React.useEffect(() => {
50
- !isPresent &&
51
- !presenceChildren.size &&
52
- onExitComplete &&
53
- onExitComplete();
54
- }, [isPresent]);
55
- if (mode === "popLayout") {
56
- children = (jsx(PopChild, { isPresent: isPresent, anchorX: anchorX, children: children }));
57
- }
58
- return (jsx(PresenceContext.Provider, { value: context, children: children }));
59
- };
60
- function newChildrenMap() {
61
- return new Map();
62
- }
63
-
64
- export { PresenceChild };
@@ -1,166 +0,0 @@
1
- "use client";
2
- import { jsx, Fragment } from 'react/jsx-runtime';
3
- import { useMemo, useRef, useState, useContext } from 'react';
4
- import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
5
- import { useConstant } from '../../utils/use-constant.mjs';
6
- import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
7
- import { PresenceChild } from './PresenceChild.mjs';
8
- import { usePresence } from './use-presence.mjs';
9
- import { onlyElements, getChildKey } from './utils.mjs';
10
-
11
- /**
12
- * `AnimatePresence` enables the animation of components that have been removed from the tree.
13
- *
14
- * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
15
- *
16
- * Any `motion` components that have an `exit` property defined will animate out when removed from
17
- * the tree.
18
- *
19
- * ```jsx
20
- * import { motion, AnimatePresence } from 'framer-motion'
21
- *
22
- * export const Items = ({ items }) => (
23
- * <AnimatePresence>
24
- * {items.map(item => (
25
- * <motion.div
26
- * key={item.id}
27
- * initial={{ opacity: 0 }}
28
- * animate={{ opacity: 1 }}
29
- * exit={{ opacity: 0 }}
30
- * />
31
- * ))}
32
- * </AnimatePresence>
33
- * )
34
- * ```
35
- *
36
- * You can sequence exit animations throughout a tree using variants.
37
- *
38
- * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
39
- * once all `motion` components have finished animating out. Likewise, any components using
40
- * `usePresence` all need to call `safeToRemove`.
41
- *
42
- * @public
43
- */
44
- const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", }) => {
45
- const [isParentPresent, safeToRemove] = usePresence(propagate);
46
- /**
47
- * Filter any children that aren't ReactElements. We can only track components
48
- * between renders with a props.key.
49
- */
50
- const presentChildren = useMemo(() => onlyElements(children), [children]);
51
- /**
52
- * Track the keys of the currently rendered children. This is used to
53
- * determine which children are exiting.
54
- */
55
- const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);
56
- /**
57
- * If `initial={false}` we only want to pass this to components in the first render.
58
- */
59
- const isInitialRender = useRef(true);
60
- /**
61
- * A ref containing the currently present children. When all exit animations
62
- * are complete, we use this to re-render the component with the latest children
63
- * *committed* rather than the latest children *rendered*.
64
- */
65
- const pendingPresentChildren = useRef(presentChildren);
66
- /**
67
- * Track which exiting children have finished animating out.
68
- */
69
- const exitComplete = useConstant(() => new Map());
70
- /**
71
- * Save children to render as React state. To ensure this component is concurrent-safe,
72
- * we check for exiting children via an effect.
73
- */
74
- const [diffedChildren, setDiffedChildren] = useState(presentChildren);
75
- const [renderedChildren, setRenderedChildren] = useState(presentChildren);
76
- useIsomorphicLayoutEffect(() => {
77
- isInitialRender.current = false;
78
- pendingPresentChildren.current = presentChildren;
79
- /**
80
- * Update complete status of exiting children.
81
- */
82
- for (let i = 0; i < renderedChildren.length; i++) {
83
- const key = getChildKey(renderedChildren[i]);
84
- if (!presentKeys.includes(key)) {
85
- if (exitComplete.get(key) !== true) {
86
- exitComplete.set(key, false);
87
- }
88
- }
89
- else {
90
- exitComplete.delete(key);
91
- }
92
- }
93
- }, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
94
- const exitingChildren = [];
95
- if (presentChildren !== diffedChildren) {
96
- let nextChildren = [...presentChildren];
97
- /**
98
- * Loop through all the currently rendered components and decide which
99
- * are exiting.
100
- */
101
- for (let i = 0; i < renderedChildren.length; i++) {
102
- const child = renderedChildren[i];
103
- const key = getChildKey(child);
104
- if (!presentKeys.includes(key)) {
105
- nextChildren.splice(i, 0, child);
106
- exitingChildren.push(child);
107
- }
108
- }
109
- /**
110
- * If we're in "wait" mode, and we have exiting children, we want to
111
- * only render these until they've all exited.
112
- */
113
- if (mode === "wait" && exitingChildren.length) {
114
- nextChildren = exitingChildren;
115
- }
116
- setRenderedChildren(onlyElements(nextChildren));
117
- setDiffedChildren(presentChildren);
118
- /**
119
- * Early return to ensure once we've set state with the latest diffed
120
- * children, we can immediately re-render.
121
- */
122
- return null;
123
- }
124
- if (process.env.NODE_ENV !== "production" &&
125
- mode === "wait" &&
126
- renderedChildren.length > 1) {
127
- console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
128
- }
129
- /**
130
- * If we've been provided a forceRender function by the LayoutGroupContext,
131
- * we can use it to force a re-render amongst all surrounding components once
132
- * all components have finished animating out.
133
- */
134
- const { forceRender } = useContext(LayoutGroupContext);
135
- return (jsx(Fragment, { children: renderedChildren.map((child) => {
136
- const key = getChildKey(child);
137
- const isPresent = propagate && !isParentPresent
138
- ? false
139
- : presentChildren === renderedChildren ||
140
- presentKeys.includes(key);
141
- const onExit = () => {
142
- if (exitComplete.has(key)) {
143
- exitComplete.set(key, true);
144
- }
145
- else {
146
- return;
147
- }
148
- let isEveryExitComplete = true;
149
- exitComplete.forEach((isExitComplete) => {
150
- if (!isExitComplete)
151
- isEveryExitComplete = false;
152
- });
153
- if (isEveryExitComplete) {
154
- forceRender?.();
155
- setRenderedChildren(pendingPresentChildren.current);
156
- propagate && safeToRemove?.();
157
- onExitComplete && onExitComplete();
158
- }
159
- };
160
- return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial
161
- ? undefined
162
- : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, children: child }, key));
163
- }) }));
164
- };
165
-
166
- export { AnimatePresence };
@@ -1,9 +0,0 @@
1
- import { useContext } from 'react';
2
- import { PresenceContext } from '../../context/PresenceContext.mjs';
3
-
4
- function usePresenceData() {
5
- const context = useContext(PresenceContext);
6
- return context ? context.custom : undefined;
7
- }
8
-
9
- export { usePresenceData };
@@ -1,70 +0,0 @@
1
- import { useContext, useId, useEffect, useCallback } from 'react';
2
- import { PresenceContext } from '../../context/PresenceContext.mjs';
3
-
4
- /**
5
- * When a component is the child of `AnimatePresence`, it can use `usePresence`
6
- * to access information about whether it's still present in the React tree.
7
- *
8
- * ```jsx
9
- * import { usePresence } from "framer-motion"
10
- *
11
- * export const Component = () => {
12
- * const [isPresent, safeToRemove] = usePresence()
13
- *
14
- * useEffect(() => {
15
- * !isPresent && setTimeout(safeToRemove, 1000)
16
- * }, [isPresent])
17
- *
18
- * return <div />
19
- * }
20
- * ```
21
- *
22
- * If `isPresent` is `false`, it means that a component has been removed the tree, but
23
- * `AnimatePresence` won't really remove it until `safeToRemove` has been called.
24
- *
25
- * @public
26
- */
27
- function usePresence(subscribe = true) {
28
- const context = useContext(PresenceContext);
29
- if (context === null)
30
- return [true, null];
31
- const { isPresent, onExitComplete, register } = context;
32
- // It's safe to call the following hooks conditionally (after an early return) because the context will always
33
- // either be null or non-null for the lifespan of the component.
34
- const id = useId();
35
- useEffect(() => {
36
- if (subscribe) {
37
- return register(id);
38
- }
39
- }, [subscribe]);
40
- const safeToRemove = useCallback(() => subscribe && onExitComplete && onExitComplete(id), [id, onExitComplete, subscribe]);
41
- return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
42
- }
43
- /**
44
- * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
45
- * There is no `safeToRemove` function.
46
- *
47
- * ```jsx
48
- * import { useIsPresent } from "framer-motion"
49
- *
50
- * export const Component = () => {
51
- * const isPresent = useIsPresent()
52
- *
53
- * useEffect(() => {
54
- * !isPresent && console.log("I've been removed!")
55
- * }, [isPresent])
56
- *
57
- * return <div />
58
- * }
59
- * ```
60
- *
61
- * @public
62
- */
63
- function useIsPresent() {
64
- return isPresent(useContext(PresenceContext));
65
- }
66
- function isPresent(context) {
67
- return context === null ? true : context.isPresent;
68
- }
69
-
70
- export { isPresent, useIsPresent, usePresence };
@@ -1,14 +0,0 @@
1
- import { Children, isValidElement } from 'react';
2
-
3
- const getChildKey = (child) => child.key || "";
4
- function onlyElements(children) {
5
- const filtered = [];
6
- // We use forEach here instead of map as map mutates the component key by preprending `.$`
7
- Children.forEach(children, (child) => {
8
- if (isValidElement(child))
9
- filtered.push(child);
10
- });
11
- return filtered;
12
- }
13
-
14
- export { getChildKey, onlyElements };
@@ -1,15 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import { useConstant } from '../utils/use-constant.mjs';
4
- import { LayoutGroup } from './LayoutGroup/index.mjs';
5
- import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
6
-
7
- let id = 0;
8
- const AnimateSharedLayout = ({ children }) => {
9
- React.useEffect(() => {
10
- invariant(false, "AnimateSharedLayout is deprecated: https://www.framer.com/docs/guide-upgrade/##shared-layout-animations");
11
- }, []);
12
- return (jsx(LayoutGroup, { id: useConstant(() => `asl-${id++}`), children: children }));
13
- };
14
-
15
- export { AnimateSharedLayout };