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,85 +0,0 @@
1
- import { setTarget } from '../../render/utils/setters.mjs';
2
- import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
3
- import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
4
- import { animateMotionValue } from './motion-value.mjs';
5
- import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
6
- import { frame } from '../../../../../motion-dom/dist/es/frameloop/frame.mjs';
7
- import { positionalKeys } from '../../../../../motion-dom/dist/es/render/utils/keys-position.mjs';
8
-
9
- /**
10
- * Decide whether we should block this animation. Previously, we achieved this
11
- * just by checking whether the key was listed in protectedKeys, but this
12
- * posed problems if an animation was triggered by afterChildren and protectedKeys
13
- * had been set to true in the meantime.
14
- */
15
- function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
16
- const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
17
- needsAnimating[key] = false;
18
- return shouldBlock;
19
- }
20
- function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
21
- let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
22
- if (transitionOverride)
23
- transition = transitionOverride;
24
- const animations = [];
25
- const animationTypeState = type &&
26
- visualElement.animationState &&
27
- visualElement.animationState.getState()[type];
28
- for (const key in target) {
29
- const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
30
- const valueTarget = target[key];
31
- if (valueTarget === undefined ||
32
- (animationTypeState &&
33
- shouldBlockAnimation(animationTypeState, key))) {
34
- continue;
35
- }
36
- const valueTransition = {
37
- delay,
38
- ...getValueTransition(transition || {}, key),
39
- };
40
- /**
41
- * If the value is already at the defined target, skip the animation.
42
- */
43
- const currentValue = value.get();
44
- if (currentValue !== undefined &&
45
- !value.isAnimating &&
46
- !Array.isArray(valueTarget) &&
47
- valueTarget === currentValue &&
48
- !valueTransition.velocity) {
49
- continue;
50
- }
51
- /**
52
- * If this is the first time a value is being animated, check
53
- * to see if we're handling off from an existing animation.
54
- */
55
- let isHandoff = false;
56
- if (window.MotionHandoffAnimation) {
57
- const appearId = getOptimisedAppearId(visualElement);
58
- if (appearId) {
59
- const startTime = window.MotionHandoffAnimation(appearId, key, frame);
60
- if (startTime !== null) {
61
- valueTransition.startTime = startTime;
62
- isHandoff = true;
63
- }
64
- }
65
- }
66
- addValueToWillChange(visualElement, key);
67
- value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && positionalKeys.has(key)
68
- ? { type: false }
69
- : valueTransition, visualElement, isHandoff));
70
- const animation = value.animation;
71
- if (animation) {
72
- animations.push(animation);
73
- }
74
- }
75
- if (transitionEnd) {
76
- Promise.all(animations).then(() => {
77
- frame.update(() => {
78
- transitionEnd && setTarget(visualElement, transitionEnd);
79
- });
80
- });
81
- }
82
- return animations;
83
- }
84
-
85
- export { animateTarget };
@@ -1,65 +0,0 @@
1
- import { resolveVariant } from '../../render/utils/resolve-dynamic-variants.mjs';
2
- import { animateTarget } from './visual-element-target.mjs';
3
-
4
- function animateVariant(visualElement, variant, options = {}) {
5
- const resolved = resolveVariant(visualElement, variant, options.type === "exit"
6
- ? visualElement.presenceContext?.custom
7
- : undefined);
8
- let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
9
- if (options.transitionOverride) {
10
- transition = options.transitionOverride;
11
- }
12
- /**
13
- * If we have a variant, create a callback that runs it as an animation.
14
- * Otherwise, we resolve a Promise immediately for a composable no-op.
15
- */
16
- const getAnimation = resolved
17
- ? () => Promise.all(animateTarget(visualElement, resolved, options))
18
- : () => Promise.resolve();
19
- /**
20
- * If we have children, create a callback that runs all their animations.
21
- * Otherwise, we resolve a Promise immediately for a composable no-op.
22
- */
23
- const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size
24
- ? (forwardDelay = 0) => {
25
- const { delayChildren = 0, staggerChildren, staggerDirection, } = transition;
26
- return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
27
- }
28
- : () => Promise.resolve();
29
- /**
30
- * If the transition explicitly defines a "when" option, we need to resolve either
31
- * this animation or all children animations before playing the other.
32
- */
33
- const { when } = transition;
34
- if (when) {
35
- const [first, last] = when === "beforeChildren"
36
- ? [getAnimation, getChildAnimations]
37
- : [getChildAnimations, getAnimation];
38
- return first().then(() => last());
39
- }
40
- else {
41
- return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
42
- }
43
- }
44
- function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
45
- const animations = [];
46
- const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
47
- const generateStaggerDuration = staggerDirection === 1
48
- ? (i = 0) => i * staggerChildren
49
- : (i = 0) => maxStaggerDuration - i * staggerChildren;
50
- Array.from(visualElement.variantChildren)
51
- .sort(sortByTreeOrder)
52
- .forEach((child, i) => {
53
- child.notify("AnimationStart", variant);
54
- animations.push(animateVariant(child, variant, {
55
- ...options,
56
- delay: delayChildren + generateStaggerDuration(i),
57
- }).then(() => child.notify("AnimationComplete", variant)));
58
- });
59
- return Promise.all(animations);
60
- }
61
- function sortByTreeOrder(a, b) {
62
- return a.sortNodePosition(b);
63
- }
64
-
65
- export { animateVariant, sortByTreeOrder };
@@ -1,26 +0,0 @@
1
- import { resolveVariant } from '../../render/utils/resolve-dynamic-variants.mjs';
2
- import { animateTarget } from './visual-element-target.mjs';
3
- import { animateVariant } from './visual-element-variant.mjs';
4
-
5
- function animateVisualElement(visualElement, definition, options = {}) {
6
- visualElement.notify("AnimationStart", definition);
7
- let animation;
8
- if (Array.isArray(definition)) {
9
- const animations = definition.map((variant) => animateVariant(visualElement, variant, options));
10
- animation = Promise.all(animations);
11
- }
12
- else if (typeof definition === "string") {
13
- animation = animateVariant(visualElement, definition, options);
14
- }
15
- else {
16
- const resolvedDefinition = typeof definition === "function"
17
- ? resolveVariant(visualElement, definition, options.custom)
18
- : definition;
19
- animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
20
- }
21
- return animation.then(() => {
22
- visualElement.notify("AnimationComplete", definition);
23
- });
24
- }
25
-
26
- export { animateVisualElement };
@@ -1,6 +0,0 @@
1
- import { camelToDash } from '../../render/dom/utils/camel-to-dash.mjs';
2
-
3
- const optimizedAppearDataId = "framerAppearId";
4
- const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
5
-
6
- export { optimizedAppearDataAttribute, optimizedAppearDataId };
@@ -1,7 +0,0 @@
1
- import { optimizedAppearDataAttribute } from './data-id.mjs';
2
-
3
- function getOptimisedAppearId(visualElement) {
4
- return visualElement.props[optimizedAppearDataAttribute];
5
- }
6
-
7
- export { getOptimisedAppearId };
@@ -1,38 +0,0 @@
1
- import { appearAnimationStore } from './store.mjs';
2
- import { appearStoreId } from './store-id.mjs';
3
-
4
- function handoffOptimizedAppearAnimation(elementId, valueName, frame) {
5
- const storeId = appearStoreId(elementId, valueName);
6
- const optimisedAnimation = appearAnimationStore.get(storeId);
7
- if (!optimisedAnimation) {
8
- return null;
9
- }
10
- const { animation, startTime } = optimisedAnimation;
11
- function cancelAnimation() {
12
- window.MotionCancelOptimisedAnimation?.(elementId, valueName, frame);
13
- }
14
- /**
15
- * We can cancel the animation once it's finished now that we've synced
16
- * with Motion.
17
- *
18
- * Prefer onfinish over finished as onfinish is backwards compatible with
19
- * older browsers.
20
- */
21
- animation.onfinish = cancelAnimation;
22
- if (startTime === null || window.MotionHandoffIsComplete?.(elementId)) {
23
- /**
24
- * If the startTime is null, this animation is the Paint Ready detection animation
25
- * and we can cancel it immediately without handoff.
26
- *
27
- * Or if we've already handed off the animation then we're now interrupting it.
28
- * In which case we need to cancel it.
29
- */
30
- cancelAnimation();
31
- return null;
32
- }
33
- else {
34
- return startTime;
35
- }
36
- }
37
-
38
- export { handoffOptimizedAppearAnimation };
@@ -1,171 +0,0 @@
1
- import { optimizedAppearDataId } from './data-id.mjs';
2
- import { getOptimisedAppearId } from './get-appear-id.mjs';
3
- import { handoffOptimizedAppearAnimation } from './handoff.mjs';
4
- import { appearAnimationStore, appearComplete } from './store.mjs';
5
- import { appearStoreId } from './store-id.mjs';
6
- import { startWaapiAnimation } from '../../../../../motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs';
7
- import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
8
-
9
- /**
10
- * A single time to use across all animations to manually set startTime
11
- * and ensure they're all in sync.
12
- */
13
- let startFrameTime;
14
- /**
15
- * A dummy animation to detect when Chrome is ready to start
16
- * painting the page and hold off from triggering the real animation
17
- * until then. We only need one animation to detect paint ready.
18
- *
19
- * https://bugs.chromium.org/p/chromium/issues/detail?id=1406850
20
- */
21
- let readyAnimation;
22
- /**
23
- * Keep track of animations that were suspended vs cancelled so we
24
- * can easily resume them when we're done measuring layout.
25
- */
26
- const suspendedAnimations = new Set();
27
- function resumeSuspendedAnimations() {
28
- suspendedAnimations.forEach((data) => {
29
- data.animation.play();
30
- data.animation.startTime = data.startTime;
31
- });
32
- suspendedAnimations.clear();
33
- }
34
- function startOptimizedAppearAnimation(element, name, keyframes, options, onReady) {
35
- // Prevent optimised appear animations if Motion has already started animating.
36
- if (window.MotionIsMounted) {
37
- return;
38
- }
39
- const id = element.dataset[optimizedAppearDataId];
40
- if (!id)
41
- return;
42
- window.MotionHandoffAnimation = handoffOptimizedAppearAnimation;
43
- const storeId = appearStoreId(id, name);
44
- if (!readyAnimation) {
45
- readyAnimation = startWaapiAnimation(element, name, [keyframes[0], keyframes[0]],
46
- /**
47
- * 10 secs is basically just a super-safe duration to give Chrome
48
- * long enough to get the animation ready.
49
- */
50
- { duration: 10000, ease: "linear" });
51
- appearAnimationStore.set(storeId, {
52
- animation: readyAnimation,
53
- startTime: null,
54
- });
55
- /**
56
- * If there's no readyAnimation then there's been no instantiation
57
- * of handoff animations.
58
- */
59
- window.MotionHandoffAnimation = handoffOptimizedAppearAnimation;
60
- window.MotionHasOptimisedAnimation = (elementId, valueName) => {
61
- if (!elementId)
62
- return false;
63
- /**
64
- * Keep a map of elementIds that have started animating. We check
65
- * via ID instead of Element because of hydration errors and
66
- * pre-hydration checks. We also actively record IDs as they start
67
- * animating rather than simply checking for data-appear-id as
68
- * this attrbute might be present but not lead to an animation, for
69
- * instance if the element's appear animation is on a different
70
- * breakpoint.
71
- */
72
- if (!valueName) {
73
- return appearComplete.has(elementId);
74
- }
75
- const animationId = appearStoreId(elementId, valueName);
76
- return Boolean(appearAnimationStore.get(animationId));
77
- };
78
- window.MotionHandoffMarkAsComplete = (elementId) => {
79
- if (appearComplete.has(elementId)) {
80
- appearComplete.set(elementId, true);
81
- }
82
- };
83
- window.MotionHandoffIsComplete = (elementId) => {
84
- return appearComplete.get(elementId) === true;
85
- };
86
- /**
87
- * We only need to cancel transform animations as
88
- * they're the ones that will interfere with the
89
- * layout animation measurements.
90
- */
91
- window.MotionCancelOptimisedAnimation = (elementId, valueName, frame, canResume) => {
92
- const animationId = appearStoreId(elementId, valueName);
93
- const data = appearAnimationStore.get(animationId);
94
- if (!data)
95
- return;
96
- if (frame && canResume === undefined) {
97
- /**
98
- * Wait until the end of the subsequent frame to cancel the animation
99
- * to ensure we don't remove the animation before the main thread has
100
- * had a chance to resolve keyframes and render.
101
- */
102
- frame.postRender(() => {
103
- frame.postRender(() => {
104
- data.animation.cancel();
105
- });
106
- });
107
- }
108
- else {
109
- data.animation.cancel();
110
- }
111
- if (frame && canResume) {
112
- suspendedAnimations.add(data);
113
- frame.render(resumeSuspendedAnimations);
114
- }
115
- else {
116
- appearAnimationStore.delete(animationId);
117
- /**
118
- * If there are no more animations left, we can remove the cancel function.
119
- * This will let us know when we can stop checking for conflicting layout animations.
120
- */
121
- if (!appearAnimationStore.size) {
122
- window.MotionCancelOptimisedAnimation = undefined;
123
- }
124
- }
125
- };
126
- window.MotionCheckAppearSync = (visualElement, valueName, value) => {
127
- const appearId = getOptimisedAppearId(visualElement);
128
- if (!appearId)
129
- return;
130
- const valueIsOptimised = window.MotionHasOptimisedAnimation?.(appearId, valueName);
131
- const externalAnimationValue = visualElement.props.values?.[valueName];
132
- if (!valueIsOptimised || !externalAnimationValue)
133
- return;
134
- const removeSyncCheck = value.on("change", (latestValue) => {
135
- if (externalAnimationValue.get() !== latestValue) {
136
- window.MotionCancelOptimisedAnimation?.(appearId, valueName);
137
- removeSyncCheck();
138
- }
139
- });
140
- return removeSyncCheck;
141
- };
142
- }
143
- const startAnimation = () => {
144
- readyAnimation.cancel();
145
- const appearAnimation = startWaapiAnimation(element, name, keyframes, options);
146
- /**
147
- * Record the time of the first started animation. We call performance.now() once
148
- * here and once in handoff to ensure we're getting
149
- * close to a frame-locked time. This keeps all animations in sync.
150
- */
151
- if (startFrameTime === undefined) {
152
- startFrameTime = performance.now();
153
- }
154
- appearAnimation.startTime = startFrameTime;
155
- appearAnimationStore.set(storeId, {
156
- animation: appearAnimation,
157
- startTime: startFrameTime,
158
- });
159
- if (onReady)
160
- onReady(appearAnimation);
161
- };
162
- appearComplete.set(id, false);
163
- if (readyAnimation.ready) {
164
- readyAnimation.ready.then(startAnimation).catch(noop);
165
- }
166
- else {
167
- startAnimation();
168
- }
169
- }
170
-
171
- export { startOptimizedAppearAnimation };
@@ -1,8 +0,0 @@
1
- import { transformProps } from '../../../../../motion-dom/dist/es/render/utils/keys-transform.mjs';
2
-
3
- const appearStoreId = (elementId, valueName) => {
4
- const key = transformProps.has(valueName) ? "transform" : valueName;
5
- return `${elementId}: ${key}`;
6
- };
7
-
8
- export { appearStoreId };
@@ -1,4 +0,0 @@
1
- const appearAnimationStore = new Map();
2
- const appearComplete = new Map();
3
-
4
- export { appearAnimationStore, appearComplete };
@@ -1,256 +0,0 @@
1
- import { resolveSubjects } from '../animate/resolve-subjects.mjs';
2
- import { calculateRepeatDuration } from './utils/calc-repeat-duration.mjs';
3
- import { calcNextTime } from './utils/calc-time.mjs';
4
- import { addKeyframes } from './utils/edit.mjs';
5
- import { normalizeTimes } from './utils/normalize-times.mjs';
6
- import { compareByTime } from './utils/sort.mjs';
7
- import { isMotionValue } from '../../../../../motion-dom/dist/es/value/utils/is-motion-value.mjs';
8
- import { defaultOffset } from '../../../../../motion-dom/dist/es/animation/keyframes/offsets/default.mjs';
9
- import { isGenerator } from '../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
10
- import { createGeneratorEasing } from '../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
11
- import { fillOffset } from '../../../../../motion-dom/dist/es/animation/keyframes/offsets/fill.mjs';
12
- import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
13
- import { getEasingForSegment } from '../../../../../motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs';
14
- import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
15
- import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
16
-
17
- const defaultSegmentEasing = "easeInOut";
18
- const MAX_REPEAT = 20;
19
- function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...sequenceTransition } = {}, scope, generators) {
20
- const defaultDuration = defaultTransition.duration || 0.3;
21
- const animationDefinitions = new Map();
22
- const sequences = new Map();
23
- const elementCache = {};
24
- const timeLabels = new Map();
25
- let prevTime = 0;
26
- let currentTime = 0;
27
- let totalDuration = 0;
28
- /**
29
- * Build the timeline by mapping over the sequence array and converting
30
- * the definitions into keyframes and offsets with absolute time values.
31
- * These will later get converted into relative offsets in a second pass.
32
- */
33
- for (let i = 0; i < sequence.length; i++) {
34
- const segment = sequence[i];
35
- /**
36
- * If this is a timeline label, mark it and skip the rest of this iteration.
37
- */
38
- if (typeof segment === "string") {
39
- timeLabels.set(segment, currentTime);
40
- continue;
41
- }
42
- else if (!Array.isArray(segment)) {
43
- timeLabels.set(segment.name, calcNextTime(currentTime, segment.at, prevTime, timeLabels));
44
- continue;
45
- }
46
- let [subject, keyframes, transition = {}] = segment;
47
- /**
48
- * If a relative or absolute time value has been specified we need to resolve
49
- * it in relation to the currentTime.
50
- */
51
- if (transition.at !== undefined) {
52
- currentTime = calcNextTime(currentTime, transition.at, prevTime, timeLabels);
53
- }
54
- /**
55
- * Keep track of the maximum duration in this definition. This will be
56
- * applied to currentTime once the definition has been parsed.
57
- */
58
- let maxDuration = 0;
59
- const resolveValueSequence = (valueKeyframes, valueTransition, valueSequence, elementIndex = 0, numSubjects = 0) => {
60
- const valueKeyframesAsList = keyframesAsList(valueKeyframes);
61
- const { delay = 0, times = defaultOffset(valueKeyframesAsList), type = "keyframes", repeat, repeatType, repeatDelay = 0, ...remainingTransition } = valueTransition;
62
- let { ease = defaultTransition.ease || "easeOut", duration } = valueTransition;
63
- /**
64
- * Resolve stagger() if defined.
65
- */
66
- const calculatedDelay = typeof delay === "function"
67
- ? delay(elementIndex, numSubjects)
68
- : delay;
69
- /**
70
- * If this animation should and can use a spring, generate a spring easing function.
71
- */
72
- const numKeyframes = valueKeyframesAsList.length;
73
- const createGenerator = isGenerator(type)
74
- ? type
75
- : generators?.[type || "keyframes"];
76
- if (numKeyframes <= 2 && createGenerator) {
77
- /**
78
- * As we're creating an easing function from a spring,
79
- * ideally we want to generate it using the real distance
80
- * between the two keyframes. However this isn't always
81
- * possible - in these situations we use 0-100.
82
- */
83
- let absoluteDelta = 100;
84
- if (numKeyframes === 2 &&
85
- isNumberKeyframesArray(valueKeyframesAsList)) {
86
- const delta = valueKeyframesAsList[1] - valueKeyframesAsList[0];
87
- absoluteDelta = Math.abs(delta);
88
- }
89
- const springTransition = { ...remainingTransition };
90
- if (duration !== undefined) {
91
- springTransition.duration = secondsToMilliseconds(duration);
92
- }
93
- const springEasing = createGeneratorEasing(springTransition, absoluteDelta, createGenerator);
94
- ease = springEasing.ease;
95
- duration = springEasing.duration;
96
- }
97
- duration ?? (duration = defaultDuration);
98
- const startTime = currentTime + calculatedDelay;
99
- /**
100
- * If there's only one time offset of 0, fill in a second with length 1
101
- */
102
- if (times.length === 1 && times[0] === 0) {
103
- times[1] = 1;
104
- }
105
- /**
106
- * Fill out if offset if fewer offsets than keyframes
107
- */
108
- const remainder = times.length - valueKeyframesAsList.length;
109
- remainder > 0 && fillOffset(times, remainder);
110
- /**
111
- * If only one value has been set, ie [1], push a null to the start of
112
- * the keyframe array. This will let us mark a keyframe at this point
113
- * that will later be hydrated with the previous value.
114
- */
115
- valueKeyframesAsList.length === 1 &&
116
- valueKeyframesAsList.unshift(null);
117
- /**
118
- * Handle repeat options
119
- */
120
- if (repeat) {
121
- invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
122
- duration = calculateRepeatDuration(duration, repeat);
123
- const originalKeyframes = [...valueKeyframesAsList];
124
- const originalTimes = [...times];
125
- ease = Array.isArray(ease) ? [...ease] : [ease];
126
- const originalEase = [...ease];
127
- for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {
128
- valueKeyframesAsList.push(...originalKeyframes);
129
- for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) {
130
- times.push(originalTimes[keyframeIndex] + (repeatIndex + 1));
131
- ease.push(keyframeIndex === 0
132
- ? "linear"
133
- : getEasingForSegment(originalEase, keyframeIndex - 1));
134
- }
135
- }
136
- normalizeTimes(times, repeat);
137
- }
138
- const targetTime = startTime + duration;
139
- /**
140
- * Add keyframes, mapping offsets to absolute time.
141
- */
142
- addKeyframes(valueSequence, valueKeyframesAsList, ease, times, startTime, targetTime);
143
- maxDuration = Math.max(calculatedDelay + duration, maxDuration);
144
- totalDuration = Math.max(targetTime, totalDuration);
145
- };
146
- if (isMotionValue(subject)) {
147
- const subjectSequence = getSubjectSequence(subject, sequences);
148
- resolveValueSequence(keyframes, transition, getValueSequence("default", subjectSequence));
149
- }
150
- else {
151
- const subjects = resolveSubjects(subject, keyframes, scope, elementCache);
152
- const numSubjects = subjects.length;
153
- /**
154
- * For every element in this segment, process the defined values.
155
- */
156
- for (let subjectIndex = 0; subjectIndex < numSubjects; subjectIndex++) {
157
- /**
158
- * Cast necessary, but we know these are of this type
159
- */
160
- keyframes = keyframes;
161
- transition = transition;
162
- const thisSubject = subjects[subjectIndex];
163
- const subjectSequence = getSubjectSequence(thisSubject, sequences);
164
- for (const key in keyframes) {
165
- resolveValueSequence(keyframes[key], getValueTransition(transition, key), getValueSequence(key, subjectSequence), subjectIndex, numSubjects);
166
- }
167
- }
168
- }
169
- prevTime = currentTime;
170
- currentTime += maxDuration;
171
- }
172
- /**
173
- * For every element and value combination create a new animation.
174
- */
175
- sequences.forEach((valueSequences, element) => {
176
- for (const key in valueSequences) {
177
- const valueSequence = valueSequences[key];
178
- /**
179
- * Arrange all the keyframes in ascending time order.
180
- */
181
- valueSequence.sort(compareByTime);
182
- const keyframes = [];
183
- const valueOffset = [];
184
- const valueEasing = [];
185
- /**
186
- * For each keyframe, translate absolute times into
187
- * relative offsets based on the total duration of the timeline.
188
- */
189
- for (let i = 0; i < valueSequence.length; i++) {
190
- const { at, value, easing } = valueSequence[i];
191
- keyframes.push(value);
192
- valueOffset.push(progress(0, totalDuration, at));
193
- valueEasing.push(easing || "easeOut");
194
- }
195
- /**
196
- * If the first keyframe doesn't land on offset: 0
197
- * provide one by duplicating the initial keyframe. This ensures
198
- * it snaps to the first keyframe when the animation starts.
199
- */
200
- if (valueOffset[0] !== 0) {
201
- valueOffset.unshift(0);
202
- keyframes.unshift(keyframes[0]);
203
- valueEasing.unshift(defaultSegmentEasing);
204
- }
205
- /**
206
- * If the last keyframe doesn't land on offset: 1
207
- * provide one with a null wildcard value. This will ensure it
208
- * stays static until the end of the animation.
209
- */
210
- if (valueOffset[valueOffset.length - 1] !== 1) {
211
- valueOffset.push(1);
212
- keyframes.push(null);
213
- }
214
- if (!animationDefinitions.has(element)) {
215
- animationDefinitions.set(element, {
216
- keyframes: {},
217
- transition: {},
218
- });
219
- }
220
- const definition = animationDefinitions.get(element);
221
- definition.keyframes[key] = keyframes;
222
- definition.transition[key] = {
223
- ...defaultTransition,
224
- duration: totalDuration,
225
- ease: valueEasing,
226
- times: valueOffset,
227
- ...sequenceTransition,
228
- };
229
- }
230
- });
231
- return animationDefinitions;
232
- }
233
- function getSubjectSequence(subject, sequences) {
234
- !sequences.has(subject) && sequences.set(subject, {});
235
- return sequences.get(subject);
236
- }
237
- function getValueSequence(name, sequences) {
238
- if (!sequences[name])
239
- sequences[name] = [];
240
- return sequences[name];
241
- }
242
- function keyframesAsList(keyframes) {
243
- return Array.isArray(keyframes) ? keyframes : [keyframes];
244
- }
245
- function getValueTransition(transition, key) {
246
- return transition && transition[key]
247
- ? {
248
- ...transition,
249
- ...transition[key],
250
- }
251
- : { ...transition };
252
- }
253
- const isNumber = (keyframe) => typeof keyframe === "number";
254
- const isNumberKeyframesArray = (keyframes) => keyframes.every(isNumber);
255
-
256
- export { createAnimationsFromSequence, getValueTransition };