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,135 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useContext, Component } from 'react';
4
- import { usePresence } from '../../../components/AnimatePresence/use-presence.mjs';
5
- import { LayoutGroupContext } from '../../../context/LayoutGroupContext.mjs';
6
- import { SwitchLayoutGroupContext } from '../../../context/SwitchLayoutGroupContext.mjs';
7
- import { globalProjectionState } from '../../../projection/node/state.mjs';
8
- import { correctBorderRadius } from '../../../projection/styles/scale-border-radius.mjs';
9
- import { correctBoxShadow } from '../../../projection/styles/scale-box-shadow.mjs';
10
- import { addScaleCorrector } from '../../../projection/styles/scale-correction.mjs';
11
- import { frame } from '../../../../../../motion-dom/dist/es/frameloop/frame.mjs';
12
- import { microtask } from '../../../../../../motion-dom/dist/es/frameloop/microtask.mjs';
13
-
14
- class MeasureLayoutWithContext extends Component {
15
- /**
16
- * This only mounts projection nodes for components that
17
- * need measuring, we might want to do it for all components
18
- * in order to incorporate transforms
19
- */
20
- componentDidMount() {
21
- const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
22
- const { projection } = visualElement;
23
- addScaleCorrector(defaultScaleCorrectors);
24
- if (projection) {
25
- if (layoutGroup.group)
26
- layoutGroup.group.add(projection);
27
- if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {
28
- switchLayoutGroup.register(projection);
29
- }
30
- projection.root.didUpdate();
31
- projection.addEventListener("animationComplete", () => {
32
- this.safeToRemove();
33
- });
34
- projection.setOptions({
35
- ...projection.options,
36
- onExitComplete: () => this.safeToRemove(),
37
- });
38
- }
39
- globalProjectionState.hasEverUpdated = true;
40
- }
41
- getSnapshotBeforeUpdate(prevProps) {
42
- const { layoutDependency, visualElement, drag, isPresent } = this.props;
43
- const { projection } = visualElement;
44
- if (!projection)
45
- return null;
46
- /**
47
- * TODO: We use this data in relegate to determine whether to
48
- * promote a previous element. There's no guarantee its presence data
49
- * will have updated by this point - if a bug like this arises it will
50
- * have to be that we markForRelegation and then find a new lead some other way,
51
- * perhaps in didUpdate
52
- */
53
- projection.isPresent = isPresent;
54
- if (drag ||
55
- prevProps.layoutDependency !== layoutDependency ||
56
- layoutDependency === undefined ||
57
- prevProps.isPresent !== isPresent) {
58
- projection.willUpdate();
59
- }
60
- else {
61
- this.safeToRemove();
62
- }
63
- if (prevProps.isPresent !== isPresent) {
64
- if (isPresent) {
65
- projection.promote();
66
- }
67
- else if (!projection.relegate()) {
68
- /**
69
- * If there's another stack member taking over from this one,
70
- * it's in charge of the exit animation and therefore should
71
- * be in charge of the safe to remove. Otherwise we call it here.
72
- */
73
- frame.postRender(() => {
74
- const stack = projection.getStack();
75
- if (!stack || !stack.members.length) {
76
- this.safeToRemove();
77
- }
78
- });
79
- }
80
- }
81
- return null;
82
- }
83
- componentDidUpdate() {
84
- const { projection } = this.props.visualElement;
85
- if (projection) {
86
- projection.root.didUpdate();
87
- microtask.postRender(() => {
88
- if (!projection.currentAnimation && projection.isLead()) {
89
- this.safeToRemove();
90
- }
91
- });
92
- }
93
- }
94
- componentWillUnmount() {
95
- const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props;
96
- const { projection } = visualElement;
97
- if (projection) {
98
- projection.scheduleCheckAfterUnmount();
99
- if (layoutGroup && layoutGroup.group)
100
- layoutGroup.group.remove(projection);
101
- if (promoteContext && promoteContext.deregister)
102
- promoteContext.deregister(projection);
103
- }
104
- }
105
- safeToRemove() {
106
- const { safeToRemove } = this.props;
107
- safeToRemove && safeToRemove();
108
- }
109
- render() {
110
- return null;
111
- }
112
- }
113
- function MeasureLayout(props) {
114
- const [isPresent, safeToRemove] = usePresence();
115
- const layoutGroup = useContext(LayoutGroupContext);
116
- return (jsx(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove }));
117
- }
118
- const defaultScaleCorrectors = {
119
- borderRadius: {
120
- ...correctBorderRadius,
121
- applyTo: [
122
- "borderTopLeftRadius",
123
- "borderTopRightRadius",
124
- "borderBottomLeftRadius",
125
- "borderBottomRightRadius",
126
- ],
127
- },
128
- borderTopLeftRadius: correctBorderRadius,
129
- borderTopRightRadius: correctBorderRadius,
130
- borderBottomLeftRadius: correctBorderRadius,
131
- borderBottomRightRadius: correctBorderRadius,
132
- boxShadow: correctBoxShadow,
133
- };
134
-
135
- export { MeasureLayout };
@@ -1,11 +0,0 @@
1
- import { HTMLProjectionNode } from '../../projection/node/HTMLProjectionNode.mjs';
2
- import { MeasureLayout } from './layout/MeasureLayout.mjs';
3
-
4
- const layout = {
5
- layout: {
6
- ProjectionNode: HTMLProjectionNode,
7
- MeasureLayout,
8
- },
9
- };
10
-
11
- export { layout };
@@ -1,12 +0,0 @@
1
- import { featureDefinitions } from './definitions.mjs';
2
-
3
- function loadFeatures(features) {
4
- for (const key in features) {
5
- featureDefinitions[key] = {
6
- ...featureDefinitions[key],
7
- ...features[key],
8
- };
9
- }
10
- }
11
-
12
- export { loadFeatures };
@@ -1,72 +0,0 @@
1
- import { Feature } from '../Feature.mjs';
2
- import { observeIntersection } from './observers.mjs';
3
-
4
- const thresholdNames = {
5
- some: 0,
6
- all: 1,
7
- };
8
- class InViewFeature extends Feature {
9
- constructor() {
10
- super(...arguments);
11
- this.hasEnteredView = false;
12
- this.isInView = false;
13
- }
14
- startObserver() {
15
- this.unmount();
16
- const { viewport = {} } = this.node.getProps();
17
- const { root, margin: rootMargin, amount = "some", once } = viewport;
18
- const options = {
19
- root: root ? root.current : undefined,
20
- rootMargin,
21
- threshold: typeof amount === "number" ? amount : thresholdNames[amount],
22
- };
23
- const onIntersectionUpdate = (entry) => {
24
- const { isIntersecting } = entry;
25
- /**
26
- * If there's been no change in the viewport state, early return.
27
- */
28
- if (this.isInView === isIntersecting)
29
- return;
30
- this.isInView = isIntersecting;
31
- /**
32
- * Handle hasEnteredView. If this is only meant to run once, and
33
- * element isn't visible, early return. Otherwise set hasEnteredView to true.
34
- */
35
- if (once && !isIntersecting && this.hasEnteredView) {
36
- return;
37
- }
38
- else if (isIntersecting) {
39
- this.hasEnteredView = true;
40
- }
41
- if (this.node.animationState) {
42
- this.node.animationState.setActive("whileInView", isIntersecting);
43
- }
44
- /**
45
- * Use the latest committed props rather than the ones in scope
46
- * when this observer is created
47
- */
48
- const { onViewportEnter, onViewportLeave } = this.node.getProps();
49
- const callback = isIntersecting ? onViewportEnter : onViewportLeave;
50
- callback && callback(entry);
51
- };
52
- return observeIntersection(this.node.current, options, onIntersectionUpdate);
53
- }
54
- mount() {
55
- this.startObserver();
56
- }
57
- update() {
58
- if (typeof IntersectionObserver === "undefined")
59
- return;
60
- const { props, prevProps } = this.node;
61
- const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps));
62
- if (hasOptionsChanged) {
63
- this.startObserver();
64
- }
65
- }
66
- unmount() { }
67
- }
68
- function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
69
- return (name) => viewport[name] !== prevViewport[name];
70
- }
71
-
72
- export { InViewFeature };
@@ -1,49 +0,0 @@
1
- /**
2
- * Map an IntersectionHandler callback to an element. We only ever make one handler for one
3
- * element, so even though these handlers might all be triggered by different
4
- * observers, we can keep them in the same map.
5
- */
6
- const observerCallbacks = new WeakMap();
7
- /**
8
- * Multiple observers can be created for multiple element/document roots. Each with
9
- * different settings. So here we store dictionaries of observers to each root,
10
- * using serialised settings (threshold/margin) as lookup keys.
11
- */
12
- const observers = new WeakMap();
13
- const fireObserverCallback = (entry) => {
14
- const callback = observerCallbacks.get(entry.target);
15
- callback && callback(entry);
16
- };
17
- const fireAllObserverCallbacks = (entries) => {
18
- entries.forEach(fireObserverCallback);
19
- };
20
- function initIntersectionObserver({ root, ...options }) {
21
- const lookupRoot = root || document;
22
- /**
23
- * If we don't have an observer lookup map for this root, create one.
24
- */
25
- if (!observers.has(lookupRoot)) {
26
- observers.set(lookupRoot, {});
27
- }
28
- const rootObservers = observers.get(lookupRoot);
29
- const key = JSON.stringify(options);
30
- /**
31
- * If we don't have an observer for this combination of root and settings,
32
- * create one.
33
- */
34
- if (!rootObservers[key]) {
35
- rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options });
36
- }
37
- return rootObservers[key];
38
- }
39
- function observeIntersection(element, options, callback) {
40
- const rootInteresectionObserver = initIntersectionObserver(options);
41
- observerCallbacks.set(element, callback);
42
- rootInteresectionObserver.observe(element);
43
- return () => {
44
- observerCallbacks.delete(element);
45
- rootInteresectionObserver.unobserve(element);
46
- };
47
- }
48
-
49
- export { observeIntersection };
@@ -1,101 +0,0 @@
1
- "use client";
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { forwardRef, useContext } from 'react';
4
- import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
5
- import { LazyContext } from '../context/LazyContext.mjs';
6
- import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
7
- import { MotionContext } from '../context/MotionContext/index.mjs';
8
- import { useCreateMotionContext } from '../context/MotionContext/create.mjs';
9
- import { isBrowser } from '../utils/is-browser.mjs';
10
- import { featureDefinitions } from './features/definitions.mjs';
11
- import { loadFeatures } from './features/load-features.mjs';
12
- import { motionComponentSymbol } from './utils/symbol.mjs';
13
- import { useMotionRef } from './utils/use-motion-ref.mjs';
14
- import { useVisualElement } from './utils/use-visual-element.mjs';
15
- import { warning, invariant } from '../../../../motion-utils/dist/es/errors.mjs';
16
-
17
- /**
18
- * Create a `motion` component.
19
- *
20
- * This function accepts a Component argument, which can be either a string (ie "div"
21
- * for `motion.div`), or an actual React component.
22
- *
23
- * Alongside this is a config option which provides a way of rendering the provided
24
- * component "offline", or outside the React render cycle.
25
- */
26
- function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
27
- preloadedFeatures && loadFeatures(preloadedFeatures);
28
- function MotionComponent(props, externalRef) {
29
- /**
30
- * If we need to measure the element we load this functionality in a
31
- * separate class component in order to gain access to getSnapshotBeforeUpdate.
32
- */
33
- let MeasureLayout;
34
- const configAndProps = {
35
- ...useContext(MotionConfigContext),
36
- ...props,
37
- layoutId: useLayoutId(props),
38
- };
39
- const { isStatic } = configAndProps;
40
- const context = useCreateMotionContext(props);
41
- const visualState = useVisualState(props, isStatic);
42
- if (!isStatic && isBrowser) {
43
- useStrictMode(configAndProps, preloadedFeatures);
44
- const layoutProjection = getProjectionFunctionality(configAndProps);
45
- MeasureLayout = layoutProjection.MeasureLayout;
46
- /**
47
- * Create a VisualElement for this component. A VisualElement provides a common
48
- * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
49
- * providing a way of rendering to these APIs outside of the React render loop
50
- * for more performant animations and interactions
51
- */
52
- context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
53
- }
54
- /**
55
- * The mount order and hierarchy is specific to ensure our element ref
56
- * is hydrated by the time features fire their effects.
57
- */
58
- return (jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] }));
59
- }
60
- MotionComponent.displayName = `motion.${typeof Component === "string"
61
- ? Component
62
- : `create(${Component.displayName ?? Component.name ?? ""})`}`;
63
- const ForwardRefMotionComponent = forwardRef(MotionComponent);
64
- ForwardRefMotionComponent[motionComponentSymbol] = Component;
65
- return ForwardRefMotionComponent;
66
- }
67
- function useLayoutId({ layoutId }) {
68
- const layoutGroupId = useContext(LayoutGroupContext).id;
69
- return layoutGroupId && layoutId !== undefined
70
- ? layoutGroupId + "-" + layoutId
71
- : layoutId;
72
- }
73
- function useStrictMode(configAndProps, preloadedFeatures) {
74
- const isStrict = useContext(LazyContext).strict;
75
- /**
76
- * If we're in development mode, check to make sure we're not rendering a motion component
77
- * as a child of LazyMotion, as this will break the file-size benefits of using it.
78
- */
79
- if (process.env.NODE_ENV !== "production" &&
80
- preloadedFeatures &&
81
- isStrict) {
82
- const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
83
- configAndProps.ignoreStrict
84
- ? warning(false, strictMessage)
85
- : invariant(false, strictMessage);
86
- }
87
- }
88
- function getProjectionFunctionality(props) {
89
- const { drag, layout } = featureDefinitions;
90
- if (!drag && !layout)
91
- return {};
92
- const combined = { ...drag, ...layout };
93
- return {
94
- MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props)
95
- ? combined.MeasureLayout
96
- : undefined,
97
- ProjectionNode: combined.ProjectionNode,
98
- };
99
- }
100
-
101
- export { createRendererMotionComponent };
@@ -1,11 +0,0 @@
1
- import { scaleCorrectors } from '../../projection/styles/scale-correction.mjs';
2
- import { transformProps } from '../../../../../motion-dom/dist/es/render/utils/keys-transform.mjs';
3
-
4
- function isForcedMotionValue(key, { layout, layoutId }) {
5
- return (transformProps.has(key) ||
6
- key.startsWith("origin") ||
7
- ((layout || layoutId !== undefined) &&
8
- (!!scaleCorrectors[key] || key === "opacity")));
9
- }
10
-
11
- export { isForcedMotionValue };
@@ -1,12 +0,0 @@
1
- import { motionComponentSymbol } from './symbol.mjs';
2
-
3
- /**
4
- * Checks if a component is a `motion` component.
5
- */
6
- function isMotionComponent(component) {
7
- return (component !== null &&
8
- typeof component === "object" &&
9
- motionComponentSymbol in component);
10
- }
11
-
12
- export { isMotionComponent };
@@ -1,3 +0,0 @@
1
- const motionComponentSymbol = Symbol.for("motionComponentSymbol");
2
-
3
- export { motionComponentSymbol };
@@ -1,17 +0,0 @@
1
- import { isMotionComponent } from './is-motion-component.mjs';
2
- import { motionComponentSymbol } from './symbol.mjs';
3
-
4
- /**
5
- * Unwraps a `motion` component and returns either a string for `motion.div` or
6
- * the React component for `motion(Component)`.
7
- *
8
- * If the component is not a `motion` component it returns undefined.
9
- */
10
- function unwrapMotionComponent(component) {
11
- if (isMotionComponent(component)) {
12
- return component[motionComponentSymbol];
13
- }
14
- return undefined;
15
- }
16
-
17
- export { unwrapMotionComponent };
@@ -1,38 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { isRefObject } from '../../utils/is-ref-object.mjs';
3
-
4
- /**
5
- * Creates a ref function that, when called, hydrates the provided
6
- * external ref and VisualElement.
7
- */
8
- function useMotionRef(visualState, visualElement, externalRef) {
9
- return useCallback((instance) => {
10
- if (instance) {
11
- visualState.onMount && visualState.onMount(instance);
12
- }
13
- if (visualElement) {
14
- if (instance) {
15
- visualElement.mount(instance);
16
- }
17
- else {
18
- visualElement.unmount();
19
- }
20
- }
21
- if (externalRef) {
22
- if (typeof externalRef === "function") {
23
- externalRef(instance);
24
- }
25
- else if (isRefObject(externalRef)) {
26
- externalRef.current = instance;
27
- }
28
- }
29
- },
30
- /**
31
- * Only pass a new ref callback to React if we've received a visual element
32
- * factory. Otherwise we'll be mounting/remounting every time externalRef
33
- * or other dependencies change.
34
- */
35
- [visualElement]);
36
- }
37
-
38
- export { useMotionRef };
@@ -1,133 +0,0 @@
1
- import { useContext, useRef, useInsertionEffect, useEffect } from 'react';
2
- import { optimizedAppearDataAttribute } from '../../animation/optimized-appear/data-id.mjs';
3
- import { LazyContext } from '../../context/LazyContext.mjs';
4
- import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
5
- import { MotionContext } from '../../context/MotionContext/index.mjs';
6
- import { PresenceContext } from '../../context/PresenceContext.mjs';
7
- import { SwitchLayoutGroupContext } from '../../context/SwitchLayoutGroupContext.mjs';
8
- import { isRefObject } from '../../utils/is-ref-object.mjs';
9
- import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
10
- import { microtask } from '../../../../../motion-dom/dist/es/frameloop/microtask.mjs';
11
-
12
- function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
13
- const { visualElement: parent } = useContext(MotionContext);
14
- const lazyContext = useContext(LazyContext);
15
- const presenceContext = useContext(PresenceContext);
16
- const reducedMotionConfig = useContext(MotionConfigContext).reducedMotion;
17
- const visualElementRef = useRef(null);
18
- /**
19
- * If we haven't preloaded a renderer, check to see if we have one lazy-loaded
20
- */
21
- createVisualElement = createVisualElement || lazyContext.renderer;
22
- if (!visualElementRef.current && createVisualElement) {
23
- visualElementRef.current = createVisualElement(Component, {
24
- visualState,
25
- parent,
26
- props,
27
- presenceContext,
28
- blockInitialAnimation: presenceContext
29
- ? presenceContext.initial === false
30
- : false,
31
- reducedMotionConfig,
32
- });
33
- }
34
- const visualElement = visualElementRef.current;
35
- /**
36
- * Load Motion gesture and animation features. These are rendered as renderless
37
- * components so each feature can optionally make use of React lifecycle methods.
38
- */
39
- const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext);
40
- if (visualElement &&
41
- !visualElement.projection &&
42
- ProjectionNodeConstructor &&
43
- (visualElement.type === "html" || visualElement.type === "svg")) {
44
- createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
45
- }
46
- const isMounted = useRef(false);
47
- useInsertionEffect(() => {
48
- /**
49
- * Check the component has already mounted before calling
50
- * `update` unnecessarily. This ensures we skip the initial update.
51
- */
52
- if (visualElement && isMounted.current) {
53
- visualElement.update(props, presenceContext);
54
- }
55
- });
56
- /**
57
- * Cache this value as we want to know whether HandoffAppearAnimations
58
- * was present on initial render - it will be deleted after this.
59
- */
60
- const optimisedAppearId = props[optimizedAppearDataAttribute];
61
- const wantsHandoff = useRef(Boolean(optimisedAppearId) &&
62
- !window.MotionHandoffIsComplete?.(optimisedAppearId) &&
63
- window.MotionHasOptimisedAnimation?.(optimisedAppearId));
64
- useIsomorphicLayoutEffect(() => {
65
- if (!visualElement)
66
- return;
67
- isMounted.current = true;
68
- window.MotionIsMounted = true;
69
- visualElement.updateFeatures();
70
- microtask.render(visualElement.render);
71
- /**
72
- * Ideally this function would always run in a useEffect.
73
- *
74
- * However, if we have optimised appear animations to handoff from,
75
- * it needs to happen synchronously to ensure there's no flash of
76
- * incorrect styles in the event of a hydration error.
77
- *
78
- * So if we detect a situtation where optimised appear animations
79
- * are running, we use useLayoutEffect to trigger animations.
80
- */
81
- if (wantsHandoff.current && visualElement.animationState) {
82
- visualElement.animationState.animateChanges();
83
- }
84
- });
85
- useEffect(() => {
86
- if (!visualElement)
87
- return;
88
- if (!wantsHandoff.current && visualElement.animationState) {
89
- visualElement.animationState.animateChanges();
90
- }
91
- if (wantsHandoff.current) {
92
- // This ensures all future calls to animateChanges() in this component will run in useEffect
93
- queueMicrotask(() => {
94
- window.MotionHandoffMarkAsComplete?.(optimisedAppearId);
95
- });
96
- wantsHandoff.current = false;
97
- }
98
- });
99
- return visualElement;
100
- }
101
- function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
102
- const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, layoutCrossfade, } = props;
103
- visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"]
104
- ? undefined
105
- : getClosestProjectingNode(visualElement.parent));
106
- visualElement.projection.setOptions({
107
- layoutId,
108
- layout,
109
- alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),
110
- visualElement,
111
- /**
112
- * TODO: Update options in an effect. This could be tricky as it'll be too late
113
- * to update by the time layout animations run.
114
- * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
115
- * ensuring it gets called if there's no potential layout animations.
116
- *
117
- */
118
- animationType: typeof layout === "string" ? layout : "both",
119
- initialPromotionConfig,
120
- crossfade: layoutCrossfade,
121
- layoutScroll,
122
- layoutRoot,
123
- });
124
- }
125
- function getClosestProjectingNode(visualElement) {
126
- if (!visualElement)
127
- return undefined;
128
- return visualElement.options.allowProjection !== false
129
- ? visualElement.projection
130
- : getClosestProjectingNode(visualElement.parent);
131
- }
132
-
133
- export { useVisualElement };