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,329 +0,0 @@
1
- import { time } from '../frameloop/sync-time.mjs';
2
- import { frame } from '../frameloop/frame.mjs';
3
- import { warnOnce } from '../../../../motion-utils/dist/es/warn-once.mjs';
4
- import { SubscriptionManager } from '../../../../motion-utils/dist/es/subscription-manager.mjs';
5
- import { velocityPerSecond } from '../../../../motion-utils/dist/es/velocity-per-second.mjs';
6
-
7
- /**
8
- * Maximum time between the value of two frames, beyond which we
9
- * assume the velocity has since been 0.
10
- */
11
- const MAX_VELOCITY_DELTA = 30;
12
- const isFloat = (value) => {
13
- return !isNaN(parseFloat(value));
14
- };
15
- const collectMotionValues = {
16
- current: undefined,
17
- };
18
- /**
19
- * `MotionValue` is used to track the state and velocity of motion values.
20
- *
21
- * @public
22
- */
23
- class MotionValue {
24
- /**
25
- * @param init - The initiating value
26
- * @param config - Optional configuration options
27
- *
28
- * - `transformer`: A function to transform incoming values with.
29
- */
30
- constructor(init, options = {}) {
31
- /**
32
- * Tracks whether this value can output a velocity. Currently this is only true
33
- * if the value is numerical, but we might be able to widen the scope here and support
34
- * other value types.
35
- *
36
- * @internal
37
- */
38
- this.canTrackVelocity = null;
39
- /**
40
- * An object containing a SubscriptionManager for each active event.
41
- */
42
- this.events = {};
43
- this.updateAndNotify = (v, render = true) => {
44
- const currentTime = time.now();
45
- /**
46
- * If we're updating the value during another frame or eventloop
47
- * than the previous frame, then the we set the previous frame value
48
- * to current.
49
- */
50
- if (this.updatedAt !== currentTime) {
51
- this.setPrevFrameValue();
52
- }
53
- this.prev = this.current;
54
- this.setCurrent(v);
55
- // Update update subscribers
56
- if (this.current !== this.prev) {
57
- this.events.change?.notify(this.current);
58
- if (this.dependents) {
59
- for (const dependent of this.dependents) {
60
- dependent.dirty();
61
- }
62
- }
63
- }
64
- // Update render subscribers
65
- if (render) {
66
- this.events.renderRequest?.notify(this.current);
67
- }
68
- };
69
- this.hasAnimated = false;
70
- this.setCurrent(init);
71
- this.owner = options.owner;
72
- }
73
- setCurrent(current) {
74
- this.current = current;
75
- this.updatedAt = time.now();
76
- if (this.canTrackVelocity === null && current !== undefined) {
77
- this.canTrackVelocity = isFloat(this.current);
78
- }
79
- }
80
- setPrevFrameValue(prevFrameValue = this.current) {
81
- this.prevFrameValue = prevFrameValue;
82
- this.prevUpdatedAt = this.updatedAt;
83
- }
84
- /**
85
- * Adds a function that will be notified when the `MotionValue` is updated.
86
- *
87
- * It returns a function that, when called, will cancel the subscription.
88
- *
89
- * When calling `onChange` inside a React component, it should be wrapped with the
90
- * `useEffect` hook. As it returns an unsubscribe function, this should be returned
91
- * from the `useEffect` function to ensure you don't add duplicate subscribers..
92
- *
93
- * ```jsx
94
- * export const MyComponent = () => {
95
- * const x = useMotionValue(0)
96
- * const y = useMotionValue(0)
97
- * const opacity = useMotionValue(1)
98
- *
99
- * useEffect(() => {
100
- * function updateOpacity() {
101
- * const maxXY = Math.max(x.get(), y.get())
102
- * const newOpacity = transform(maxXY, [0, 100], [1, 0])
103
- * opacity.set(newOpacity)
104
- * }
105
- *
106
- * const unsubscribeX = x.on("change", updateOpacity)
107
- * const unsubscribeY = y.on("change", updateOpacity)
108
- *
109
- * return () => {
110
- * unsubscribeX()
111
- * unsubscribeY()
112
- * }
113
- * }, [])
114
- *
115
- * return <motion.div style={{ x }} />
116
- * }
117
- * ```
118
- *
119
- * @param subscriber - A function that receives the latest value.
120
- * @returns A function that, when called, will cancel this subscription.
121
- *
122
- * @deprecated
123
- */
124
- onChange(subscription) {
125
- if (process.env.NODE_ENV !== "production") {
126
- warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
127
- }
128
- return this.on("change", subscription);
129
- }
130
- on(eventName, callback) {
131
- if (!this.events[eventName]) {
132
- this.events[eventName] = new SubscriptionManager();
133
- }
134
- const unsubscribe = this.events[eventName].add(callback);
135
- if (eventName === "change") {
136
- return () => {
137
- unsubscribe();
138
- /**
139
- * If we have no more change listeners by the start
140
- * of the next frame, stop active animations.
141
- */
142
- frame.read(() => {
143
- if (!this.events.change.getSize()) {
144
- this.stop();
145
- }
146
- });
147
- };
148
- }
149
- return unsubscribe;
150
- }
151
- clearListeners() {
152
- for (const eventManagers in this.events) {
153
- this.events[eventManagers].clear();
154
- }
155
- }
156
- /**
157
- * Attaches a passive effect to the `MotionValue`.
158
- */
159
- attach(passiveEffect, stopPassiveEffect) {
160
- this.passiveEffect = passiveEffect;
161
- this.stopPassiveEffect = stopPassiveEffect;
162
- }
163
- /**
164
- * Sets the state of the `MotionValue`.
165
- *
166
- * @remarks
167
- *
168
- * ```jsx
169
- * const x = useMotionValue(0)
170
- * x.set(10)
171
- * ```
172
- *
173
- * @param latest - Latest value to set.
174
- * @param render - Whether to notify render subscribers. Defaults to `true`
175
- *
176
- * @public
177
- */
178
- set(v, render = true) {
179
- if (!render || !this.passiveEffect) {
180
- this.updateAndNotify(v, render);
181
- }
182
- else {
183
- this.passiveEffect(v, this.updateAndNotify);
184
- }
185
- }
186
- setWithVelocity(prev, current, delta) {
187
- this.set(current);
188
- this.prev = undefined;
189
- this.prevFrameValue = prev;
190
- this.prevUpdatedAt = this.updatedAt - delta;
191
- }
192
- /**
193
- * Set the state of the `MotionValue`, stopping any active animations,
194
- * effects, and resets velocity to `0`.
195
- */
196
- jump(v, endAnimation = true) {
197
- this.updateAndNotify(v);
198
- this.prev = v;
199
- this.prevUpdatedAt = this.prevFrameValue = undefined;
200
- endAnimation && this.stop();
201
- if (this.stopPassiveEffect)
202
- this.stopPassiveEffect();
203
- }
204
- dirty() {
205
- this.events.change?.notify(this.current);
206
- }
207
- addDependent(dependent) {
208
- if (!this.dependents) {
209
- this.dependents = new Set();
210
- }
211
- this.dependents.add(dependent);
212
- }
213
- removeDependent(dependent) {
214
- if (this.dependents) {
215
- this.dependents.delete(dependent);
216
- }
217
- }
218
- /**
219
- * Returns the latest state of `MotionValue`
220
- *
221
- * @returns - The latest state of `MotionValue`
222
- *
223
- * @public
224
- */
225
- get() {
226
- if (collectMotionValues.current) {
227
- collectMotionValues.current.push(this);
228
- }
229
- return this.current;
230
- }
231
- /**
232
- * @public
233
- */
234
- getPrevious() {
235
- return this.prev;
236
- }
237
- /**
238
- * Returns the latest velocity of `MotionValue`
239
- *
240
- * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
241
- *
242
- * @public
243
- */
244
- getVelocity() {
245
- const currentTime = time.now();
246
- if (!this.canTrackVelocity ||
247
- this.prevFrameValue === undefined ||
248
- currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
249
- return 0;
250
- }
251
- const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
252
- // Casts because of parseFloat's poor typing
253
- return velocityPerSecond(parseFloat(this.current) -
254
- parseFloat(this.prevFrameValue), delta);
255
- }
256
- /**
257
- * Registers a new animation to control this `MotionValue`. Only one
258
- * animation can drive a `MotionValue` at one time.
259
- *
260
- * ```jsx
261
- * value.start()
262
- * ```
263
- *
264
- * @param animation - A function that starts the provided animation
265
- */
266
- start(startAnimation) {
267
- this.stop();
268
- return new Promise((resolve) => {
269
- this.hasAnimated = true;
270
- this.animation = startAnimation(resolve);
271
- if (this.events.animationStart) {
272
- this.events.animationStart.notify();
273
- }
274
- }).then(() => {
275
- if (this.events.animationComplete) {
276
- this.events.animationComplete.notify();
277
- }
278
- this.clearAnimation();
279
- });
280
- }
281
- /**
282
- * Stop the currently active animation.
283
- *
284
- * @public
285
- */
286
- stop() {
287
- if (this.animation) {
288
- this.animation.stop();
289
- if (this.events.animationCancel) {
290
- this.events.animationCancel.notify();
291
- }
292
- }
293
- this.clearAnimation();
294
- }
295
- /**
296
- * Returns `true` if this value is currently animating.
297
- *
298
- * @public
299
- */
300
- isAnimating() {
301
- return !!this.animation;
302
- }
303
- clearAnimation() {
304
- delete this.animation;
305
- }
306
- /**
307
- * Destroy and clean up subscribers to this `MotionValue`.
308
- *
309
- * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
310
- * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
311
- * created a `MotionValue` via the `motionValue` function.
312
- *
313
- * @public
314
- */
315
- destroy() {
316
- this.dependents?.clear();
317
- this.events.destroy?.notify();
318
- this.clearListeners();
319
- this.stop();
320
- if (this.stopPassiveEffect) {
321
- this.stopPassiveEffect();
322
- }
323
- }
324
- }
325
- function motionValue(init, options) {
326
- return new MotionValue(init, options);
327
- }
328
-
329
- export { MotionValue, collectMotionValues, motionValue };
@@ -1,46 +0,0 @@
1
- import { transform } from '../utils/transform.mjs';
2
- import { transformValue } from './transform-value.mjs';
3
-
4
- /**
5
- * Create a `MotionValue` that maps the output of another `MotionValue` by
6
- * mapping it from one range of values into another.
7
- *
8
- * @remarks
9
- *
10
- * Given an input range of `[-200, -100, 100, 200]` and an output range of
11
- * `[0, 1, 1, 0]`, the returned `MotionValue` will:
12
- *
13
- * - When provided a value between `-200` and `-100`, will return a value between `0` and `1`.
14
- * - When provided a value between `-100` and `100`, will return `1`.
15
- * - When provided a value between `100` and `200`, will return a value between `1` and `0`
16
- *
17
- * The input range must be a linear series of numbers. The output range
18
- * can be any value type supported by Motion: numbers, colors, shadows, etc.
19
- *
20
- * Every value in the output range must be of the same type and in the same format.
21
- *
22
- * ```jsx
23
- * const x = motionValue(0)
24
- * const xRange = [-200, -100, 100, 200]
25
- * const opacityRange = [0, 1, 1, 0]
26
- * const opacity = mapValue(x, xRange, opacityRange)
27
- * ```
28
- *
29
- * @param inputValue - `MotionValue`
30
- * @param inputRange - A linear series of numbers (either all increasing or decreasing)
31
- * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.
32
- * @param options -
33
- *
34
- * - clamp: boolean. Clamp values to within the given range. Defaults to `true`
35
- * - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each.
36
- *
37
- * @returns `MotionValue`
38
- *
39
- * @public
40
- */
41
- function mapValue(inputValue, inputRange, outputRange, options) {
42
- const map = transform(inputRange, outputRange, options);
43
- return transformValue(() => map(inputValue.get()));
44
- }
45
-
46
- export { mapValue };
@@ -1,72 +0,0 @@
1
- import { motionValue } from './index.mjs';
2
- import { JSAnimation } from '../animation/JSAnimation.mjs';
3
- import { isMotionValue } from './utils/is-motion-value.mjs';
4
- import { frame } from '../frameloop/frame.mjs';
5
-
6
- /**
7
- * Create a `MotionValue` that animates to its latest value using a spring.
8
- * Can either be a value or track another `MotionValue`.
9
- *
10
- * ```jsx
11
- * const x = motionValue(0)
12
- * const y = transformValue(() => x.get() * 2) // double x
13
- * ```
14
- *
15
- * @param transformer - A transform function. This function must be pure with no side-effects or conditional statements.
16
- * @returns `MotionValue`
17
- *
18
- * @public
19
- */
20
- function springValue(source, options) {
21
- const initialValue = isMotionValue(source) ? source.get() : source;
22
- const value = motionValue(initialValue);
23
- attachSpring(value, source, options);
24
- return value;
25
- }
26
- function attachSpring(value, source, options) {
27
- const initialValue = value.get();
28
- let activeAnimation = null;
29
- let latestValue = initialValue;
30
- let latestSetter;
31
- const unit = typeof initialValue === "string"
32
- ? initialValue.replace(/[\d.-]/g, "")
33
- : undefined;
34
- const stopAnimation = () => {
35
- if (activeAnimation) {
36
- activeAnimation.stop();
37
- activeAnimation = null;
38
- }
39
- };
40
- const startAnimation = () => {
41
- stopAnimation();
42
- activeAnimation = new JSAnimation({
43
- keyframes: [asNumber(value.get()), asNumber(latestValue)],
44
- velocity: value.getVelocity(),
45
- type: "spring",
46
- restDelta: 0.001,
47
- restSpeed: 0.01,
48
- ...options,
49
- onUpdate: latestSetter,
50
- });
51
- };
52
- value.attach((v, set) => {
53
- latestValue = v;
54
- latestSetter = (latest) => set(parseValue(latest, unit));
55
- frame.postRender(startAnimation);
56
- return value.get();
57
- }, stopAnimation);
58
- let unsubscribe = undefined;
59
- if (isMotionValue(source)) {
60
- unsubscribe = source.on("change", (v) => value.set(parseValue(v, unit)));
61
- value.on("destroy", unsubscribe);
62
- }
63
- return unsubscribe;
64
- }
65
- function parseValue(v, unit) {
66
- return unit ? v + unit : v;
67
- }
68
- function asNumber(v) {
69
- return typeof v === "number" ? v : parseFloat(v);
70
- }
71
-
72
- export { attachSpring, springValue };
@@ -1,13 +0,0 @@
1
- import { cancelFrame, frame } from '../frameloop/frame.mjs';
2
-
3
- function subscribeValue(inputValues, outputValue, getLatest) {
4
- const update = () => outputValue.set(getLatest());
5
- const scheduleUpdate = () => frame.preRender(update, false, true);
6
- const subscriptions = inputValues.map((v) => v.on("change", scheduleUpdate));
7
- outputValue.on("destroy", () => {
8
- subscriptions.forEach((unsubscribe) => unsubscribe());
9
- cancelFrame(update);
10
- });
11
- }
12
-
13
- export { subscribeValue };
@@ -1,35 +0,0 @@
1
- import { collectMotionValues, motionValue } from './index.mjs';
2
- import { subscribeValue } from './subscribe-value.mjs';
3
-
4
- /**
5
- * Create a `MotionValue` that transforms the output of other `MotionValue`s by
6
- * passing their latest values through a transform function.
7
- *
8
- * Whenever a `MotionValue` referred to in the provided function is updated,
9
- * it will be re-evaluated.
10
- *
11
- * ```jsx
12
- * const x = motionValue(0)
13
- * const y = transformValue(() => x.get() * 2) // double x
14
- * ```
15
- *
16
- * @param transformer - A transform function. This function must be pure with no side-effects or conditional statements.
17
- * @returns `MotionValue`
18
- *
19
- * @public
20
- */
21
- function transformValue(transform) {
22
- const collectedValues = [];
23
- /**
24
- * Open session of collectMotionValues. Any MotionValue that calls get()
25
- * inside transform will be saved into this array.
26
- */
27
- collectMotionValues.current = collectedValues;
28
- const initialValue = transform();
29
- collectMotionValues.current = undefined;
30
- const value = motionValue(initialValue);
31
- subscribeValue(collectedValues, value, transform);
32
- return value;
33
- }
34
-
35
- export { transformValue };
@@ -1,9 +0,0 @@
1
- /**
2
- * ValueType for "auto"
3
- */
4
- const auto = {
5
- test: (v) => v === "auto",
6
- parse: (v) => v,
7
- };
8
-
9
- export { auto };
@@ -1,40 +0,0 @@
1
- import { rgba } from './rgba.mjs';
2
- import { isColorString } from './utils.mjs';
3
-
4
- function parseHex(v) {
5
- let r = "";
6
- let g = "";
7
- let b = "";
8
- let a = "";
9
- // If we have 6 characters, ie #FF0000
10
- if (v.length > 5) {
11
- r = v.substring(1, 3);
12
- g = v.substring(3, 5);
13
- b = v.substring(5, 7);
14
- a = v.substring(7, 9);
15
- // Or we have 3 characters, ie #F00
16
- }
17
- else {
18
- r = v.substring(1, 2);
19
- g = v.substring(2, 3);
20
- b = v.substring(3, 4);
21
- a = v.substring(4, 5);
22
- r += r;
23
- g += g;
24
- b += b;
25
- a += a;
26
- }
27
- return {
28
- red: parseInt(r, 16),
29
- green: parseInt(g, 16),
30
- blue: parseInt(b, 16),
31
- alpha: a ? parseInt(a, 16) / 255 : 1,
32
- };
33
- }
34
- const hex = {
35
- test: /*@__PURE__*/ isColorString("#"),
36
- parse: parseHex,
37
- transform: rgba.transform,
38
- };
39
-
40
- export { hex };
@@ -1,42 +0,0 @@
1
- // Adapted from https://gist.github.com/mjackson/5311256
2
- function hueToRgb(p, q, t) {
3
- if (t < 0)
4
- t += 1;
5
- if (t > 1)
6
- t -= 1;
7
- if (t < 1 / 6)
8
- return p + (q - p) * 6 * t;
9
- if (t < 1 / 2)
10
- return q;
11
- if (t < 2 / 3)
12
- return p + (q - p) * (2 / 3 - t) * 6;
13
- return p;
14
- }
15
- function hslaToRgba({ hue, saturation, lightness, alpha }) {
16
- hue /= 360;
17
- saturation /= 100;
18
- lightness /= 100;
19
- let red = 0;
20
- let green = 0;
21
- let blue = 0;
22
- if (!saturation) {
23
- red = green = blue = lightness;
24
- }
25
- else {
26
- const q = lightness < 0.5
27
- ? lightness * (1 + saturation)
28
- : lightness + saturation - lightness * saturation;
29
- const p = 2 * lightness - q;
30
- red = hueToRgb(p, q, hue + 1 / 3);
31
- green = hueToRgb(p, q, hue);
32
- blue = hueToRgb(p, q, hue - 1 / 3);
33
- }
34
- return {
35
- red: Math.round(red * 255),
36
- green: Math.round(green * 255),
37
- blue: Math.round(blue * 255),
38
- alpha,
39
- };
40
- }
41
-
42
- export { hslaToRgba };
@@ -1,22 +0,0 @@
1
- import { alpha } from '../numbers/index.mjs';
2
- import { percent } from '../numbers/units.mjs';
3
- import { sanitize } from '../utils/sanitize.mjs';
4
- import { isColorString, splitColor } from './utils.mjs';
5
-
6
- const hsla = {
7
- test: /*@__PURE__*/ isColorString("hsl", "hue"),
8
- parse: /*@__PURE__*/ splitColor("hue", "saturation", "lightness"),
9
- transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
10
- return ("hsla(" +
11
- Math.round(hue) +
12
- ", " +
13
- percent.transform(sanitize(saturation)) +
14
- ", " +
15
- percent.transform(sanitize(lightness)) +
16
- ", " +
17
- sanitize(alpha.transform(alpha$1)) +
18
- ")");
19
- },
20
- };
21
-
22
- export { hsla };
@@ -1,32 +0,0 @@
1
- import { hex } from './hex.mjs';
2
- import { hsla } from './hsla.mjs';
3
- import { rgba } from './rgba.mjs';
4
-
5
- const color = {
6
- test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
7
- parse: (v) => {
8
- if (rgba.test(v)) {
9
- return rgba.parse(v);
10
- }
11
- else if (hsla.test(v)) {
12
- return hsla.parse(v);
13
- }
14
- else {
15
- return hex.parse(v);
16
- }
17
- },
18
- transform: (v) => {
19
- return typeof v === "string"
20
- ? v
21
- : v.hasOwnProperty("red")
22
- ? rgba.transform(v)
23
- : hsla.transform(v);
24
- },
25
- getAnimatableNone: (v) => {
26
- const parsed = color.parse(v);
27
- parsed.alpha = 0;
28
- return color.transform(parsed);
29
- },
30
- };
31
-
32
- export { color };
@@ -1,25 +0,0 @@
1
- import { number, alpha } from '../numbers/index.mjs';
2
- import { sanitize } from '../utils/sanitize.mjs';
3
- import { isColorString, splitColor } from './utils.mjs';
4
- import { clamp } from '../../../../../../motion-utils/dist/es/clamp.mjs';
5
-
6
- const clampRgbUnit = (v) => clamp(0, 255, v);
7
- const rgbUnit = {
8
- ...number,
9
- transform: (v) => Math.round(clampRgbUnit(v)),
10
- };
11
- const rgba = {
12
- test: /*@__PURE__*/ isColorString("rgb", "red"),
13
- parse: /*@__PURE__*/ splitColor("red", "green", "blue"),
14
- transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" +
15
- rgbUnit.transform(red) +
16
- ", " +
17
- rgbUnit.transform(green) +
18
- ", " +
19
- rgbUnit.transform(blue) +
20
- ", " +
21
- sanitize(alpha.transform(alpha$1)) +
22
- ")",
23
- };
24
-
25
- export { rgbUnit, rgba };