motion 10.17.1 → 11.11.12

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 (320) hide show
  1. package/.turbo/turbo-build.log +29 -0
  2. package/{LICENSE → LICENSE.md} +2 -2
  3. package/README.md +99 -7
  4. package/dist/cjs/index.js +6117 -0
  5. package/dist/cjs/react-client.js +10003 -0
  6. package/dist/cjs/react-m.js +1852 -0
  7. package/dist/es/framer-motion/dist/es/animation/GroupPlaybackControls.mjs +78 -0
  8. package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +34 -0
  9. package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +19 -0
  10. package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +14 -0
  11. package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +11 -0
  12. package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +52 -0
  13. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +318 -0
  14. package/dist/es/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +112 -0
  15. package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +380 -0
  16. package/dist/es/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +17 -0
  17. package/dist/es/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +14 -0
  18. package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +42 -0
  19. package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +169 -0
  20. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +36 -0
  21. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +12 -0
  22. package/dist/es/framer-motion/dist/es/animation/animators/waapi/easing.mjs +44 -0
  23. package/dist/es/framer-motion/dist/es/animation/animators/waapi/index.mjs +23 -0
  24. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/attach-timeline.mjs +6 -0
  25. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +12 -0
  26. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +15 -0
  27. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs +9 -0
  28. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +8 -0
  29. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs +9 -0
  30. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs +15 -0
  31. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +13 -0
  32. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +5 -0
  33. package/dist/es/framer-motion/dist/es/animation/generators/inertia.mjs +87 -0
  34. package/dist/es/framer-motion/dist/es/animation/generators/keyframes.mjs +51 -0
  35. package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +89 -0
  36. package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +129 -0
  37. package/dist/es/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs +17 -0
  38. package/dist/es/framer-motion/dist/es/animation/generators/utils/is-generator.mjs +5 -0
  39. package/dist/es/framer-motion/dist/es/animation/generators/utils/velocity.mjs +9 -0
  40. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +105 -0
  41. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +75 -0
  42. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +66 -0
  43. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element.mjs +26 -0
  44. package/dist/es/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +6 -0
  45. package/dist/es/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +7 -0
  46. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +230 -0
  47. package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +21 -0
  48. package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +31 -0
  49. package/dist/es/framer-motion/dist/es/animation/sequence/utils/sort.mjs +14 -0
  50. package/dist/es/framer-motion/dist/es/animation/utils/create-visual-element.mjs +44 -0
  51. package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +40 -0
  52. package/dist/es/framer-motion/dist/es/animation/utils/get-value-transition.mjs +9 -0
  53. package/dist/es/framer-motion/dist/es/animation/utils/is-animatable.mjs +30 -0
  54. package/dist/es/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +7 -0
  55. package/dist/es/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +5 -0
  56. package/dist/es/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +5 -0
  57. package/dist/es/framer-motion/dist/es/animation/utils/is-none.mjs +15 -0
  58. package/dist/es/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +10 -0
  59. package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +26 -0
  60. package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs +40 -0
  61. package/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs +6 -0
  62. package/dist/es/framer-motion/dist/es/context/LazyContext.mjs +6 -0
  63. package/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs +13 -0
  64. package/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs +13 -0
  65. package/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs +6 -0
  66. package/dist/es/framer-motion/dist/es/context/MotionContext/utils.mjs +17 -0
  67. package/dist/es/framer-motion/dist/es/context/PresenceContext.mjs +9 -0
  68. package/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs +9 -0
  69. package/dist/es/framer-motion/dist/es/easing/anticipate.mjs +5 -0
  70. package/dist/es/framer-motion/dist/es/easing/back.mjs +9 -0
  71. package/dist/es/framer-motion/dist/es/easing/circ.mjs +8 -0
  72. package/dist/es/framer-motion/dist/es/easing/cubic-bezier.mjs +51 -0
  73. package/dist/es/framer-motion/dist/es/easing/ease.mjs +7 -0
  74. package/dist/es/framer-motion/dist/es/easing/modifiers/mirror.mjs +5 -0
  75. package/dist/es/framer-motion/dist/es/easing/modifiers/reverse.mjs +5 -0
  76. package/dist/es/framer-motion/dist/es/easing/steps.mjs +15 -0
  77. package/dist/es/framer-motion/dist/es/easing/utils/create-generator-easing.mjs +17 -0
  78. package/dist/es/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +8 -0
  79. package/dist/es/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs +3 -0
  80. package/dist/es/framer-motion/dist/es/easing/utils/is-easing-array.mjs +5 -0
  81. package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +38 -0
  82. package/dist/es/framer-motion/dist/es/events/add-dom-event.mjs +6 -0
  83. package/dist/es/framer-motion/dist/es/events/add-pointer-event.mjs +8 -0
  84. package/dist/es/framer-motion/dist/es/events/event-info.mjs +15 -0
  85. package/dist/es/framer-motion/dist/es/events/utils/is-primary-pointer.mjs +18 -0
  86. package/dist/es/framer-motion/dist/es/frameloop/batcher.mjs +71 -0
  87. package/dist/es/framer-motion/dist/es/frameloop/frame.mjs +6 -0
  88. package/dist/es/framer-motion/dist/es/frameloop/index-legacy.mjs +20 -0
  89. package/dist/es/framer-motion/dist/es/frameloop/microtask.mjs +5 -0
  90. package/dist/es/framer-motion/dist/es/frameloop/render-step.mjs +80 -0
  91. package/dist/es/framer-motion/dist/es/frameloop/sync-time.mjs +31 -0
  92. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +487 -0
  93. package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +27 -0
  94. package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +129 -0
  95. package/dist/es/framer-motion/dist/es/gestures/drag/utils/lock.mjs +53 -0
  96. package/dist/es/framer-motion/dist/es/gestures/focus.mjs +41 -0
  97. package/dist/es/framer-motion/dist/es/gestures/hover.mjs +33 -0
  98. package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +156 -0
  99. package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +50 -0
  100. package/dist/es/framer-motion/dist/es/gestures/press.mjs +130 -0
  101. package/dist/es/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs +20 -0
  102. package/dist/es/framer-motion/dist/es/motion/features/Feature.mjs +9 -0
  103. package/dist/es/framer-motion/dist/es/motion/features/animation/exit.mjs +31 -0
  104. package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +41 -0
  105. package/dist/es/framer-motion/dist/es/motion/features/animations.mjs +13 -0
  106. package/dist/es/framer-motion/dist/es/motion/features/definitions.mjs +28 -0
  107. package/dist/es/framer-motion/dist/es/motion/features/drag.mjs +17 -0
  108. package/dist/es/framer-motion/dist/es/motion/features/gestures.mjs +21 -0
  109. package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +134 -0
  110. package/dist/es/framer-motion/dist/es/motion/features/layout.mjs +11 -0
  111. package/dist/es/framer-motion/dist/es/motion/features/load-features.mjs +12 -0
  112. package/dist/es/framer-motion/dist/es/motion/features/viewport/index.mjs +72 -0
  113. package/dist/es/framer-motion/dist/es/motion/features/viewport/observers.mjs +49 -0
  114. package/dist/es/framer-motion/dist/es/motion/index.mjs +98 -0
  115. package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +11 -0
  116. package/dist/es/framer-motion/dist/es/motion/utils/symbol.mjs +3 -0
  117. package/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs +36 -0
  118. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +134 -0
  119. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs +82 -0
  120. package/dist/es/framer-motion/dist/es/motion/utils/valid-prop.mjs +57 -0
  121. package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +93 -0
  122. package/dist/es/framer-motion/dist/es/projection/geometry/conversion.mjs +33 -0
  123. package/dist/es/framer-motion/dist/es/projection/geometry/copy.mjs +31 -0
  124. package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +119 -0
  125. package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +52 -0
  126. package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +54 -0
  127. package/dist/es/framer-motion/dist/es/projection/geometry/models.mjs +17 -0
  128. package/dist/es/framer-motion/dist/es/projection/geometry/utils.mjs +31 -0
  129. package/dist/es/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +13 -0
  130. package/dist/es/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +27 -0
  131. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +1583 -0
  132. package/dist/es/framer-motion/dist/es/projection/node/state.mjs +19 -0
  133. package/dist/es/framer-motion/dist/es/projection/shared/stack.mjs +112 -0
  134. package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +41 -0
  135. package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +35 -0
  136. package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +6 -0
  137. package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +49 -0
  138. package/dist/es/framer-motion/dist/es/projection/utils/each-axis.mjs +5 -0
  139. package/dist/es/framer-motion/dist/es/projection/utils/has-transform.mjs +26 -0
  140. package/dist/es/framer-motion/dist/es/projection/utils/measure.mjs +17 -0
  141. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +477 -0
  142. package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +23 -0
  143. package/dist/es/framer-motion/dist/es/render/components/m/create.mjs +6 -0
  144. package/dist/es/framer-motion/dist/es/render/components/m/elements.mjs +227 -0
  145. package/dist/es/framer-motion/dist/es/render/components/motion/create.mjs +15 -0
  146. package/dist/es/framer-motion/dist/es/render/components/motion/elements.mjs +194 -0
  147. package/dist/es/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +130 -0
  148. package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +28 -0
  149. package/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs +14 -0
  150. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +64 -0
  151. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-window.mjs +30 -0
  152. package/dist/es/framer-motion/dist/es/render/dom/resize/index.mjs +8 -0
  153. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +80 -0
  154. package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +56 -0
  155. package/dist/es/framer-motion/dist/es/render/dom/scroll/observe.mjs +18 -0
  156. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +45 -0
  157. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +59 -0
  158. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +45 -0
  159. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +35 -0
  160. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +20 -0
  161. package/dist/es/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +48 -0
  162. package/dist/es/framer-motion/dist/es/render/dom/scroll/supports.mjs +5 -0
  163. package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +84 -0
  164. package/dist/es/framer-motion/dist/es/render/dom/use-render.mjs +33 -0
  165. package/dist/es/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +6 -0
  166. package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +42 -0
  167. package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +59 -0
  168. package/dist/es/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +15 -0
  169. package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs +30 -0
  170. package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +5 -0
  171. package/dist/es/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +28 -0
  172. package/dist/es/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +65 -0
  173. package/dist/es/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +15 -0
  174. package/dist/es/framer-motion/dist/es/render/dom/value-types/defaults.mjs +30 -0
  175. package/dist/es/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +15 -0
  176. package/dist/es/framer-motion/dist/es/render/dom/value-types/find.mjs +15 -0
  177. package/dist/es/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +10 -0
  178. package/dist/es/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +41 -0
  179. package/dist/es/framer-motion/dist/es/render/dom/value-types/number.mjs +18 -0
  180. package/dist/es/framer-motion/dist/es/render/dom/value-types/test.mjs +6 -0
  181. package/dist/es/framer-motion/dist/es/render/dom/value-types/transform.mjs +31 -0
  182. package/dist/es/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +9 -0
  183. package/dist/es/framer-motion/dist/es/render/dom/value-types/type-int.mjs +8 -0
  184. package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +43 -0
  185. package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +57 -0
  186. package/dist/es/framer-motion/dist/es/render/html/config-motion.mjs +12 -0
  187. package/dist/es/framer-motion/dist/es/render/html/use-props.mjs +57 -0
  188. package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +65 -0
  189. package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +62 -0
  190. package/dist/es/framer-motion/dist/es/render/html/utils/create-render-state.mjs +8 -0
  191. package/dist/es/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +30 -0
  192. package/dist/es/framer-motion/dist/es/render/html/utils/render.mjs +9 -0
  193. package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +20 -0
  194. package/dist/es/framer-motion/dist/es/render/html/utils/transform.mjs +28 -0
  195. package/dist/es/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +41 -0
  196. package/dist/es/framer-motion/dist/es/render/store.mjs +3 -0
  197. package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +45 -0
  198. package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +40 -0
  199. package/dist/es/framer-motion/dist/es/render/svg/lowercase-elements.mjs +33 -0
  200. package/dist/es/framer-motion/dist/es/render/svg/use-props.mjs +24 -0
  201. package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +52 -0
  202. package/dist/es/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +30 -0
  203. package/dist/es/framer-motion/dist/es/render/svg/utils/create-render-state.mjs +8 -0
  204. package/dist/es/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +3 -0
  205. package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +32 -0
  206. package/dist/es/framer-motion/dist/es/render/svg/utils/render.mjs +12 -0
  207. package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +19 -0
  208. package/dist/es/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +18 -0
  209. package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +164 -0
  210. package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +332 -0
  211. package/dist/es/framer-motion/dist/es/render/utils/compare-by-depth.mjs +3 -0
  212. package/dist/es/framer-motion/dist/es/render/utils/flat-tree.mjs +24 -0
  213. package/dist/es/framer-motion/dist/es/render/utils/get-variant-context.mjs +28 -0
  214. package/dist/es/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +13 -0
  215. package/dist/es/framer-motion/dist/es/render/utils/is-variant-label.mjs +8 -0
  216. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +59 -0
  217. package/dist/es/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +8 -0
  218. package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +36 -0
  219. package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +27 -0
  220. package/dist/es/framer-motion/dist/es/render/utils/variant-props.mjs +12 -0
  221. package/dist/es/framer-motion/dist/es/utils/GlobalConfig.mjs +6 -0
  222. package/dist/es/framer-motion/dist/es/utils/array.mjs +11 -0
  223. package/dist/es/framer-motion/dist/es/utils/clamp.mjs +9 -0
  224. package/dist/es/framer-motion/dist/es/utils/delay.mjs +24 -0
  225. package/dist/es/framer-motion/dist/es/utils/distance.mjs +9 -0
  226. package/dist/es/framer-motion/dist/es/utils/errors.mjs +18 -0
  227. package/dist/es/framer-motion/dist/es/utils/get-context-window.mjs +6 -0
  228. package/dist/es/framer-motion/dist/es/utils/hsla-to-rgba.mjs +42 -0
  229. package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +75 -0
  230. package/dist/es/framer-motion/dist/es/utils/is-browser.mjs +3 -0
  231. package/dist/es/framer-motion/dist/es/utils/is-numerical-string.mjs +6 -0
  232. package/dist/es/framer-motion/dist/es/utils/is-ref-object.mjs +7 -0
  233. package/dist/es/framer-motion/dist/es/utils/is-zero-value-string.mjs +6 -0
  234. package/dist/es/framer-motion/dist/es/utils/memo.mjs +10 -0
  235. package/dist/es/framer-motion/dist/es/utils/mix/color.mjs +47 -0
  236. package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +94 -0
  237. package/dist/es/framer-motion/dist/es/utils/mix/immediate.mjs +5 -0
  238. package/dist/es/framer-motion/dist/es/utils/mix/index.mjs +14 -0
  239. package/dist/es/framer-motion/dist/es/utils/mix/number.mjs +26 -0
  240. package/dist/es/framer-motion/dist/es/utils/mix/visibility.mjs +16 -0
  241. package/dist/es/framer-motion/dist/es/utils/noop.mjs +3 -0
  242. package/dist/es/framer-motion/dist/es/utils/offsets/default.mjs +9 -0
  243. package/dist/es/framer-motion/dist/es/utils/offsets/fill.mjs +12 -0
  244. package/dist/es/framer-motion/dist/es/utils/offsets/time.mjs +5 -0
  245. package/dist/es/framer-motion/dist/es/utils/pipe.mjs +11 -0
  246. package/dist/es/framer-motion/dist/es/utils/progress.mjs +18 -0
  247. package/dist/es/framer-motion/dist/es/utils/reduced-motion/index.mjs +19 -0
  248. package/dist/es/framer-motion/dist/es/utils/reduced-motion/state.mjs +5 -0
  249. package/dist/es/framer-motion/dist/es/utils/resolve-value.mjs +11 -0
  250. package/dist/es/framer-motion/dist/es/utils/shallow-compare.mjs +14 -0
  251. package/dist/es/framer-motion/dist/es/utils/subscription-manager.mjs +40 -0
  252. package/dist/es/framer-motion/dist/es/utils/time-conversion.mjs +10 -0
  253. package/dist/es/framer-motion/dist/es/utils/transform.mjs +21 -0
  254. package/dist/es/framer-motion/dist/es/utils/use-constant.mjs +18 -0
  255. package/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs +6 -0
  256. package/dist/es/framer-motion/dist/es/utils/velocity-per-second.mjs +11 -0
  257. package/dist/es/framer-motion/dist/es/utils/warn-once.mjs +11 -0
  258. package/dist/es/framer-motion/dist/es/utils/wrap.mjs +6 -0
  259. package/dist/es/framer-motion/dist/es/value/index.mjs +313 -0
  260. package/dist/es/framer-motion/dist/es/value/types/color/hex.mjs +40 -0
  261. package/dist/es/framer-motion/dist/es/value/types/color/hsla.mjs +22 -0
  262. package/dist/es/framer-motion/dist/es/value/types/color/index.mjs +27 -0
  263. package/dist/es/framer-motion/dist/es/value/types/color/rgba.mjs +25 -0
  264. package/dist/es/framer-motion/dist/es/value/types/color/utils.mjs +29 -0
  265. package/dist/es/framer-motion/dist/es/value/types/complex/filter.mjs +30 -0
  266. package/dist/es/framer-motion/dist/es/value/types/complex/index.mjs +92 -0
  267. package/dist/es/framer-motion/dist/es/value/types/numbers/index.mjs +17 -0
  268. package/dist/es/framer-motion/dist/es/value/types/numbers/units.mjs +17 -0
  269. package/dist/es/framer-motion/dist/es/value/types/utils/color-regex.mjs +3 -0
  270. package/dist/es/framer-motion/dist/es/value/types/utils/float-regex.mjs +3 -0
  271. package/dist/es/framer-motion/dist/es/value/types/utils/is-nullish.mjs +5 -0
  272. package/dist/es/framer-motion/dist/es/value/types/utils/sanitize.mjs +5 -0
  273. package/dist/es/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +3 -0
  274. package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +14 -0
  275. package/dist/es/framer-motion/dist/es/value/use-will-change/is.mjs +7 -0
  276. package/dist/es/framer-motion/dist/es/value/utils/is-motion-value.mjs +3 -0
  277. package/dist/es/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +16 -0
  278. package/dist/es/motion/lib/index.mjs +30 -0
  279. package/dist/es/motion/lib/react-client.mjs +3 -0
  280. package/dist/es/motion/lib/react-m.mjs +3 -0
  281. package/dist/index.d.ts +1 -0
  282. package/dist/motion.dev.js +6121 -0
  283. package/dist/motion.js +1 -0
  284. package/dist/react-client.d.ts +1 -0
  285. package/dist/react-m.d.ts +1 -0
  286. package/lib/index.js +1 -3
  287. package/lib/index.js.map +1 -1
  288. package/lib/react-client.js +3 -0
  289. package/lib/react-client.js.map +1 -0
  290. package/lib/react-m.js +3 -0
  291. package/lib/react-m.js.map +1 -0
  292. package/lib/react.js +3 -0
  293. package/lib/react.js.map +1 -0
  294. package/package.json +79 -29
  295. package/react/package.json +6 -0
  296. package/react-client/package.json +6 -0
  297. package/react-m/package.json +6 -0
  298. package/rollup.config.mjs +174 -0
  299. package/src/index.ts +1 -0
  300. package/src/react-client.ts +3 -0
  301. package/src/react-m.ts +3 -0
  302. package/src/react.ts +3 -0
  303. package/tsconfig.json +25 -0
  304. package/types/index.d.ts +1 -4
  305. package/types/react-client.d.ts +1 -0
  306. package/types/react-m.d.ts +1 -0
  307. package/types/react.d.ts +1 -0
  308. package/CHANGELOG.md +0 -372
  309. package/dist/animate.cjs.js +0 -22
  310. package/dist/animate.es.js +0 -19
  311. package/dist/main.cjs.js +0 -21
  312. package/dist/main.es.js +0 -3
  313. package/dist/motion.min.js +0 -1
  314. package/dist/motion.umd.js +0 -2359
  315. package/dist/size-index.js +0 -1
  316. package/lib/animate.js +0 -17
  317. package/lib/animate.js.map +0 -1
  318. package/types/animate.d.ts +0 -6
  319. package/types/animate.d.ts.map +0 -1
  320. package/types/index.d.ts.map +0 -1
@@ -0,0 +1,164 @@
1
+ import { removeNonTranslationalTransform } from '../dom/utils/unit-conversion.mjs';
2
+ import { frame } from '../../frameloop/frame.mjs';
3
+
4
+ const toResolve = new Set();
5
+ let isScheduled = false;
6
+ let anyNeedsMeasurement = false;
7
+ function measureAllKeyframes() {
8
+ if (anyNeedsMeasurement) {
9
+ const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement);
10
+ const elementsToMeasure = new Set(resolversToMeasure.map((resolver) => resolver.element));
11
+ const transformsToRestore = new Map();
12
+ /**
13
+ * Write pass
14
+ * If we're measuring elements we want to remove bounding box-changing transforms.
15
+ */
16
+ elementsToMeasure.forEach((element) => {
17
+ const removedTransforms = removeNonTranslationalTransform(element);
18
+ if (!removedTransforms.length)
19
+ return;
20
+ transformsToRestore.set(element, removedTransforms);
21
+ element.render();
22
+ });
23
+ // Read
24
+ resolversToMeasure.forEach((resolver) => resolver.measureInitialState());
25
+ // Write
26
+ elementsToMeasure.forEach((element) => {
27
+ element.render();
28
+ const restore = transformsToRestore.get(element);
29
+ if (restore) {
30
+ restore.forEach(([key, value]) => {
31
+ var _a;
32
+ (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
33
+ });
34
+ }
35
+ });
36
+ // Read
37
+ resolversToMeasure.forEach((resolver) => resolver.measureEndState());
38
+ // Write
39
+ resolversToMeasure.forEach((resolver) => {
40
+ if (resolver.suspendedScrollY !== undefined) {
41
+ window.scrollTo(0, resolver.suspendedScrollY);
42
+ }
43
+ });
44
+ }
45
+ anyNeedsMeasurement = false;
46
+ isScheduled = false;
47
+ toResolve.forEach((resolver) => resolver.complete());
48
+ toResolve.clear();
49
+ }
50
+ function readAllKeyframes() {
51
+ toResolve.forEach((resolver) => {
52
+ resolver.readKeyframes();
53
+ if (resolver.needsMeasurement) {
54
+ anyNeedsMeasurement = true;
55
+ }
56
+ });
57
+ }
58
+ function flushKeyframeResolvers() {
59
+ readAllKeyframes();
60
+ measureAllKeyframes();
61
+ }
62
+ class KeyframeResolver {
63
+ constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {
64
+ /**
65
+ * Track whether this resolver has completed. Once complete, it never
66
+ * needs to attempt keyframe resolution again.
67
+ */
68
+ this.isComplete = false;
69
+ /**
70
+ * Track whether this resolver is async. If it is, it'll be added to the
71
+ * resolver queue and flushed in the next frame. Resolvers that aren't going
72
+ * to trigger read/write thrashing don't need to be async.
73
+ */
74
+ this.isAsync = false;
75
+ /**
76
+ * Track whether this resolver needs to perform a measurement
77
+ * to resolve its keyframes.
78
+ */
79
+ this.needsMeasurement = false;
80
+ /**
81
+ * Track whether this resolver is currently scheduled to resolve
82
+ * to allow it to be cancelled and resumed externally.
83
+ */
84
+ this.isScheduled = false;
85
+ this.unresolvedKeyframes = [...unresolvedKeyframes];
86
+ this.onComplete = onComplete;
87
+ this.name = name;
88
+ this.motionValue = motionValue;
89
+ this.element = element;
90
+ this.isAsync = isAsync;
91
+ }
92
+ scheduleResolve() {
93
+ this.isScheduled = true;
94
+ if (this.isAsync) {
95
+ toResolve.add(this);
96
+ if (!isScheduled) {
97
+ isScheduled = true;
98
+ frame.read(readAllKeyframes);
99
+ frame.resolveKeyframes(measureAllKeyframes);
100
+ }
101
+ }
102
+ else {
103
+ this.readKeyframes();
104
+ this.complete();
105
+ }
106
+ }
107
+ readKeyframes() {
108
+ const { unresolvedKeyframes, name, element, motionValue } = this;
109
+ /**
110
+ * If a keyframe is null, we hydrate it either by reading it from
111
+ * the instance, or propagating from previous keyframes.
112
+ */
113
+ for (let i = 0; i < unresolvedKeyframes.length; i++) {
114
+ if (unresolvedKeyframes[i] === null) {
115
+ /**
116
+ * If the first keyframe is null, we need to find its value by sampling the element
117
+ */
118
+ if (i === 0) {
119
+ const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get();
120
+ const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
121
+ if (currentValue !== undefined) {
122
+ unresolvedKeyframes[0] = currentValue;
123
+ }
124
+ else if (element && name) {
125
+ const valueAsRead = element.readValue(name, finalKeyframe);
126
+ if (valueAsRead !== undefined && valueAsRead !== null) {
127
+ unresolvedKeyframes[0] = valueAsRead;
128
+ }
129
+ }
130
+ if (unresolvedKeyframes[0] === undefined) {
131
+ unresolvedKeyframes[0] = finalKeyframe;
132
+ }
133
+ if (motionValue && currentValue === undefined) {
134
+ motionValue.set(unresolvedKeyframes[0]);
135
+ }
136
+ }
137
+ else {
138
+ unresolvedKeyframes[i] = unresolvedKeyframes[i - 1];
139
+ }
140
+ }
141
+ }
142
+ }
143
+ setFinalKeyframe() { }
144
+ measureInitialState() { }
145
+ renderEndStyles() { }
146
+ measureEndState() { }
147
+ complete() {
148
+ this.isComplete = true;
149
+ this.onComplete(this.unresolvedKeyframes, this.finalKeyframe);
150
+ toResolve.delete(this);
151
+ }
152
+ cancel() {
153
+ if (!this.isComplete) {
154
+ this.isScheduled = false;
155
+ toResolve.delete(this);
156
+ }
157
+ }
158
+ resume() {
159
+ if (!this.isComplete)
160
+ this.scheduleResolve();
161
+ }
162
+ }
163
+
164
+ export { KeyframeResolver, flushKeyframeResolvers };
@@ -0,0 +1,332 @@
1
+ import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
2
+ import { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.mjs';
3
+ import { shallowCompare } from '../../utils/shallow-compare.mjs';
4
+ import { isVariantLabel } from './is-variant-label.mjs';
5
+ import { resolveVariant } from './resolve-dynamic-variants.mjs';
6
+ import { variantPriorityOrder } from './variant-props.mjs';
7
+ import { animateVisualElement } from '../../animation/interfaces/visual-element.mjs';
8
+ import { getVariantContext } from './get-variant-context.mjs';
9
+
10
+ const reversePriorityOrder = [...variantPriorityOrder].reverse();
11
+ const numAnimationTypes = variantPriorityOrder.length;
12
+ function animateList(visualElement) {
13
+ return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
14
+ }
15
+ function createAnimationState(visualElement) {
16
+ let animate = animateList(visualElement);
17
+ let state = createState();
18
+ let isInitialRender = true;
19
+ /**
20
+ * This function will be used to reduce the animation definitions for
21
+ * each active animation type into an object of resolved values for it.
22
+ */
23
+ const buildResolvedTypeValues = (type) => (acc, definition) => {
24
+ var _a;
25
+ const resolved = resolveVariant(visualElement, definition, type === "exit"
26
+ ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
27
+ : undefined);
28
+ if (resolved) {
29
+ const { transition, transitionEnd, ...target } = resolved;
30
+ acc = { ...acc, ...target, ...transitionEnd };
31
+ }
32
+ return acc;
33
+ };
34
+ /**
35
+ * This just allows us to inject mocked animation functions
36
+ * @internal
37
+ */
38
+ function setAnimateFunction(makeAnimator) {
39
+ animate = makeAnimator(visualElement);
40
+ }
41
+ /**
42
+ * When we receive new props, we need to:
43
+ * 1. Create a list of protected keys for each type. This is a directory of
44
+ * value keys that are currently being "handled" by types of a higher priority
45
+ * so that whenever an animation is played of a given type, these values are
46
+ * protected from being animated.
47
+ * 2. Determine if an animation type needs animating.
48
+ * 3. Determine if any values have been removed from a type and figure out
49
+ * what to animate those to.
50
+ */
51
+ function animateChanges(changedActiveType) {
52
+ const { props } = visualElement;
53
+ const context = getVariantContext(visualElement.parent) || {};
54
+ /**
55
+ * A list of animations that we'll build into as we iterate through the animation
56
+ * types. This will get executed at the end of the function.
57
+ */
58
+ const animations = [];
59
+ /**
60
+ * Keep track of which values have been removed. Then, as we hit lower priority
61
+ * animation types, we can check if they contain removed values and animate to that.
62
+ */
63
+ const removedKeys = new Set();
64
+ /**
65
+ * A dictionary of all encountered keys. This is an object to let us build into and
66
+ * copy it without iteration. Each time we hit an animation type we set its protected
67
+ * keys - the keys its not allowed to animate - to the latest version of this object.
68
+ */
69
+ let encounteredKeys = {};
70
+ /**
71
+ * If a variant has been removed at a given index, and this component is controlling
72
+ * variant animations, we want to ensure lower-priority variants are forced to animate.
73
+ */
74
+ let removedVariantIndex = Infinity;
75
+ /**
76
+ * Iterate through all animation types in reverse priority order. For each, we want to
77
+ * detect which values it's handling and whether or not they've changed (and therefore
78
+ * need to be animated). If any values have been removed, we want to detect those in
79
+ * lower priority props and flag for animation.
80
+ */
81
+ for (let i = 0; i < numAnimationTypes; i++) {
82
+ const type = reversePriorityOrder[i];
83
+ const typeState = state[type];
84
+ const prop = props[type] !== undefined
85
+ ? props[type]
86
+ : context[type];
87
+ const propIsVariant = isVariantLabel(prop);
88
+ /**
89
+ * If this type has *just* changed isActive status, set activeDelta
90
+ * to that status. Otherwise set to null.
91
+ */
92
+ const activeDelta = type === changedActiveType ? typeState.isActive : null;
93
+ if (activeDelta === false)
94
+ removedVariantIndex = i;
95
+ /**
96
+ * If this prop is an inherited variant, rather than been set directly on the
97
+ * component itself, we want to make sure we allow the parent to trigger animations.
98
+ *
99
+ * TODO: Can probably change this to a !isControllingVariants check
100
+ */
101
+ let isInherited = prop === context[type] &&
102
+ prop !== props[type] &&
103
+ propIsVariant;
104
+ /**
105
+ *
106
+ */
107
+ if (isInherited &&
108
+ isInitialRender &&
109
+ visualElement.manuallyAnimateOnMount) {
110
+ isInherited = false;
111
+ }
112
+ /**
113
+ * Set all encountered keys so far as the protected keys for this type. This will
114
+ * be any key that has been animated or otherwise handled by active, higher-priortiy types.
115
+ */
116
+ typeState.protectedKeys = { ...encounteredKeys };
117
+ // Check if we can skip analysing this prop early
118
+ if (
119
+ // If it isn't active and hasn't *just* been set as inactive
120
+ (!typeState.isActive && activeDelta === null) ||
121
+ // If we didn't and don't have any defined prop for this animation type
122
+ (!prop && !typeState.prevProp) ||
123
+ // Or if the prop doesn't define an animation
124
+ isAnimationControls(prop) ||
125
+ typeof prop === "boolean") {
126
+ continue;
127
+ }
128
+ /**
129
+ * As we go look through the values defined on this type, if we detect
130
+ * a changed value or a value that was removed in a higher priority, we set
131
+ * this to true and add this prop to the animation list.
132
+ */
133
+ const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
134
+ let shouldAnimateType = variantDidChange ||
135
+ // If we're making this variant active, we want to always make it active
136
+ (type === changedActiveType &&
137
+ typeState.isActive &&
138
+ !isInherited &&
139
+ propIsVariant) ||
140
+ // If we removed a higher-priority variant (i is in reverse order)
141
+ (i > removedVariantIndex && propIsVariant);
142
+ let handledRemovedValues = false;
143
+ /**
144
+ * As animations can be set as variant lists, variants or target objects, we
145
+ * coerce everything to an array if it isn't one already
146
+ */
147
+ const definitionList = Array.isArray(prop) ? prop : [prop];
148
+ /**
149
+ * Build an object of all the resolved values. We'll use this in the subsequent
150
+ * animateChanges calls to determine whether a value has changed.
151
+ */
152
+ let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
153
+ if (activeDelta === false)
154
+ resolvedValues = {};
155
+ /**
156
+ * Now we need to loop through all the keys in the prev prop and this prop,
157
+ * and decide:
158
+ * 1. If the value has changed, and needs animating
159
+ * 2. If it has been removed, and needs adding to the removedKeys set
160
+ * 3. If it has been removed in a higher priority type and needs animating
161
+ * 4. If it hasn't been removed in a higher priority but hasn't changed, and
162
+ * needs adding to the type's protectedKeys list.
163
+ */
164
+ const { prevResolvedValues = {} } = typeState;
165
+ const allKeys = {
166
+ ...prevResolvedValues,
167
+ ...resolvedValues,
168
+ };
169
+ const markToAnimate = (key) => {
170
+ shouldAnimateType = true;
171
+ if (removedKeys.has(key)) {
172
+ handledRemovedValues = true;
173
+ removedKeys.delete(key);
174
+ }
175
+ typeState.needsAnimating[key] = true;
176
+ const motionValue = visualElement.getValue(key);
177
+ if (motionValue)
178
+ motionValue.liveStyle = false;
179
+ };
180
+ for (const key in allKeys) {
181
+ const next = resolvedValues[key];
182
+ const prev = prevResolvedValues[key];
183
+ // If we've already handled this we can just skip ahead
184
+ if (encounteredKeys.hasOwnProperty(key))
185
+ continue;
186
+ /**
187
+ * If the value has changed, we probably want to animate it.
188
+ */
189
+ let valueHasChanged = false;
190
+ if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
191
+ valueHasChanged = !shallowCompare(next, prev);
192
+ }
193
+ else {
194
+ valueHasChanged = next !== prev;
195
+ }
196
+ if (valueHasChanged) {
197
+ if (next !== undefined && next !== null) {
198
+ // If next is defined and doesn't equal prev, it needs animating
199
+ markToAnimate(key);
200
+ }
201
+ else {
202
+ // If it's undefined, it's been removed.
203
+ removedKeys.add(key);
204
+ }
205
+ }
206
+ else if (next !== undefined && removedKeys.has(key)) {
207
+ /**
208
+ * If next hasn't changed and it isn't undefined, we want to check if it's
209
+ * been removed by a higher priority
210
+ */
211
+ markToAnimate(key);
212
+ }
213
+ else {
214
+ /**
215
+ * If it hasn't changed, we add it to the list of protected values
216
+ * to ensure it doesn't get animated.
217
+ */
218
+ typeState.protectedKeys[key] = true;
219
+ }
220
+ }
221
+ /**
222
+ * Update the typeState so next time animateChanges is called we can compare the
223
+ * latest prop and resolvedValues to these.
224
+ */
225
+ typeState.prevProp = prop;
226
+ typeState.prevResolvedValues = resolvedValues;
227
+ /**
228
+ *
229
+ */
230
+ if (typeState.isActive) {
231
+ encounteredKeys = { ...encounteredKeys, ...resolvedValues };
232
+ }
233
+ if (isInitialRender && visualElement.blockInitialAnimation) {
234
+ shouldAnimateType = false;
235
+ }
236
+ /**
237
+ * If this is an inherited prop we want to skip this animation
238
+ * unless the inherited variants haven't changed on this render.
239
+ */
240
+ const willAnimateViaParent = isInherited && variantDidChange;
241
+ const needsAnimating = !willAnimateViaParent || handledRemovedValues;
242
+ if (shouldAnimateType && needsAnimating) {
243
+ animations.push(...definitionList.map((animation) => ({
244
+ animation: animation,
245
+ options: { type },
246
+ })));
247
+ }
248
+ }
249
+ /**
250
+ * If there are some removed value that haven't been dealt with,
251
+ * we need to create a new animation that falls back either to the value
252
+ * defined in the style prop, or the last read value.
253
+ */
254
+ if (removedKeys.size) {
255
+ const fallbackAnimation = {};
256
+ removedKeys.forEach((key) => {
257
+ const fallbackTarget = visualElement.getBaseTarget(key);
258
+ const motionValue = visualElement.getValue(key);
259
+ if (motionValue)
260
+ motionValue.liveStyle = true;
261
+ // @ts-expect-error - @mattgperry to figure if we should do something here
262
+ fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
263
+ });
264
+ animations.push({ animation: fallbackAnimation });
265
+ }
266
+ let shouldAnimate = Boolean(animations.length);
267
+ if (isInitialRender &&
268
+ (props.initial === false || props.initial === props.animate) &&
269
+ !visualElement.manuallyAnimateOnMount) {
270
+ shouldAnimate = false;
271
+ }
272
+ isInitialRender = false;
273
+ return shouldAnimate ? animate(animations) : Promise.resolve();
274
+ }
275
+ /**
276
+ * Change whether a certain animation type is active.
277
+ */
278
+ function setActive(type, isActive) {
279
+ var _a;
280
+ // If the active state hasn't changed, we can safely do nothing here
281
+ if (state[type].isActive === isActive)
282
+ return Promise.resolve();
283
+ // Propagate active change to children
284
+ (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
285
+ state[type].isActive = isActive;
286
+ const animations = animateChanges(type);
287
+ for (const key in state) {
288
+ state[key].protectedKeys = {};
289
+ }
290
+ return animations;
291
+ }
292
+ return {
293
+ animateChanges,
294
+ setActive,
295
+ setAnimateFunction,
296
+ getState: () => state,
297
+ reset: () => {
298
+ state = createState();
299
+ isInitialRender = true;
300
+ },
301
+ };
302
+ }
303
+ function checkVariantsDidChange(prev, next) {
304
+ if (typeof next === "string") {
305
+ return next !== prev;
306
+ }
307
+ else if (Array.isArray(next)) {
308
+ return !shallowCompare(next, prev);
309
+ }
310
+ return false;
311
+ }
312
+ function createTypeState(isActive = false) {
313
+ return {
314
+ isActive,
315
+ protectedKeys: {},
316
+ needsAnimating: {},
317
+ prevResolvedValues: {},
318
+ };
319
+ }
320
+ function createState() {
321
+ return {
322
+ animate: createTypeState(true),
323
+ whileInView: createTypeState(),
324
+ whileHover: createTypeState(),
325
+ whileTap: createTypeState(),
326
+ whileDrag: createTypeState(),
327
+ whileFocus: createTypeState(),
328
+ exit: createTypeState(),
329
+ };
330
+ }
331
+
332
+ export { checkVariantsDidChange, createAnimationState };
@@ -0,0 +1,3 @@
1
+ const compareByDepth = (a, b) => a.depth - b.depth;
2
+
3
+ export { compareByDepth };
@@ -0,0 +1,24 @@
1
+ import { addUniqueItem, removeItem } from '../../utils/array.mjs';
2
+ import { compareByDepth } from './compare-by-depth.mjs';
3
+
4
+ class FlatTree {
5
+ constructor() {
6
+ this.children = [];
7
+ this.isDirty = false;
8
+ }
9
+ add(child) {
10
+ addUniqueItem(this.children, child);
11
+ this.isDirty = true;
12
+ }
13
+ remove(child) {
14
+ removeItem(this.children, child);
15
+ this.isDirty = true;
16
+ }
17
+ forEach(callback) {
18
+ this.isDirty && this.children.sort(compareByDepth);
19
+ this.isDirty = false;
20
+ this.children.forEach(callback);
21
+ }
22
+ }
23
+
24
+ export { FlatTree };
@@ -0,0 +1,28 @@
1
+ import { isVariantLabel } from './is-variant-label.mjs';
2
+ import { variantProps } from './variant-props.mjs';
3
+
4
+ const numVariantProps = variantProps.length;
5
+ function getVariantContext(visualElement) {
6
+ if (!visualElement)
7
+ return undefined;
8
+ if (!visualElement.isControllingVariants) {
9
+ const context = visualElement.parent
10
+ ? getVariantContext(visualElement.parent) || {}
11
+ : {};
12
+ if (visualElement.props.initial !== undefined) {
13
+ context.initial = visualElement.props.initial;
14
+ }
15
+ return context;
16
+ }
17
+ const context = {};
18
+ for (let i = 0; i < numVariantProps; i++) {
19
+ const name = variantProps[i];
20
+ const prop = visualElement.props[name];
21
+ if (isVariantLabel(prop) || prop === false) {
22
+ context[name] = prop;
23
+ }
24
+ }
25
+ return context;
26
+ }
27
+
28
+ export { getVariantContext };
@@ -0,0 +1,13 @@
1
+ import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
2
+ import { isVariantLabel } from './is-variant-label.mjs';
3
+ import { variantProps } from './variant-props.mjs';
4
+
5
+ function isControllingVariants(props) {
6
+ return (isAnimationControls(props.animate) ||
7
+ variantProps.some((name) => isVariantLabel(props[name])));
8
+ }
9
+ function isVariantNode(props) {
10
+ return Boolean(isControllingVariants(props) || props.variants);
11
+ }
12
+
13
+ export { isControllingVariants, isVariantNode };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Decides if the supplied variable is variant label
3
+ */
4
+ function isVariantLabel(v) {
5
+ return typeof v === "string" || Array.isArray(v);
6
+ }
7
+
8
+ export { isVariantLabel };
@@ -0,0 +1,59 @@
1
+ import { warnOnce } from '../../utils/warn-once.mjs';
2
+ import { motionValue } from '../../value/index.mjs';
3
+ import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
4
+
5
+ function updateMotionValuesFromProps(element, next, prev) {
6
+ for (const key in next) {
7
+ const nextValue = next[key];
8
+ const prevValue = prev[key];
9
+ if (isMotionValue(nextValue)) {
10
+ /**
11
+ * If this is a motion value found in props or style, we want to add it
12
+ * to our visual element's motion value map.
13
+ */
14
+ element.addValue(key, nextValue);
15
+ /**
16
+ * Check the version of the incoming motion value with this version
17
+ * and warn against mismatches.
18
+ */
19
+ if (process.env.NODE_ENV === "development") {
20
+ warnOnce(nextValue.version === "11.11.12", `Attempting to mix Motion versions ${nextValue.version} with 11.11.12 may not work as expected.`);
21
+ }
22
+ }
23
+ else if (isMotionValue(prevValue)) {
24
+ /**
25
+ * If we're swapping from a motion value to a static value,
26
+ * create a new motion value from that
27
+ */
28
+ element.addValue(key, motionValue(nextValue, { owner: element }));
29
+ }
30
+ else if (prevValue !== nextValue) {
31
+ /**
32
+ * If this is a flat value that has changed, update the motion value
33
+ * or create one if it doesn't exist. We only want to do this if we're
34
+ * not handling the value with our animation state.
35
+ */
36
+ if (element.hasValue(key)) {
37
+ const existingValue = element.getValue(key);
38
+ if (existingValue.liveStyle === true) {
39
+ existingValue.jump(nextValue);
40
+ }
41
+ else if (!existingValue.hasAnimated) {
42
+ existingValue.set(nextValue);
43
+ }
44
+ }
45
+ else {
46
+ const latestValue = element.getStaticValue(key);
47
+ element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element }));
48
+ }
49
+ }
50
+ }
51
+ // Handle removed values
52
+ for (const key in prev) {
53
+ if (next[key] === undefined)
54
+ element.removeValue(key);
55
+ }
56
+ return next;
57
+ }
58
+
59
+ export { updateMotionValuesFromProps };
@@ -0,0 +1,8 @@
1
+ import { resolveVariantFromProps } from './resolve-variants.mjs';
2
+
3
+ function resolveVariant(visualElement, definition, custom) {
4
+ const props = visualElement.getProps();
5
+ return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
6
+ }
7
+
8
+ export { resolveVariant };
@@ -0,0 +1,36 @@
1
+ function getValueState(visualElement) {
2
+ const state = [{}, {}];
3
+ visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
4
+ state[0][key] = value.get();
5
+ state[1][key] = value.getVelocity();
6
+ });
7
+ return state;
8
+ }
9
+ function resolveVariantFromProps(props, definition, custom, visualElement) {
10
+ /**
11
+ * If the variant definition is a function, resolve.
12
+ */
13
+ if (typeof definition === "function") {
14
+ const [current, velocity] = getValueState(visualElement);
15
+ definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
16
+ }
17
+ /**
18
+ * If the variant definition is a variant label, or
19
+ * the function returned a variant label, resolve.
20
+ */
21
+ if (typeof definition === "string") {
22
+ definition = props.variants && props.variants[definition];
23
+ }
24
+ /**
25
+ * At this point we've resolved both functions and variant labels,
26
+ * but the resolved variant label might itself have been a function.
27
+ * If so, resolve. This can only have returned a valid target object.
28
+ */
29
+ if (typeof definition === "function") {
30
+ const [current, velocity] = getValueState(visualElement);
31
+ definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
32
+ }
33
+ return definition;
34
+ }
35
+
36
+ export { resolveVariantFromProps };