motion-start 0.0.1 → 0.0.3

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 (727) hide show
  1. package/README.md +27 -2
  2. package/{src → dist}/animation/UseAnimatedState.svelte +1 -1
  3. package/dist/animation/UseAnimatedState.svelte.d.ts +34 -0
  4. package/dist/animation/UseAnimatedState.svelte.d.ts.map +1 -0
  5. package/dist/animation/UseAnimation.svelte.d.ts +29 -0
  6. package/dist/animation/UseAnimation.svelte.d.ts.map +1 -0
  7. package/{src/animation/animate.ts → dist/animation/animate.d.ts} +59 -78
  8. package/dist/animation/animate.d.ts.map +1 -0
  9. package/dist/animation/animate.js +46 -0
  10. package/dist/animation/animation-controls.d.ts +12 -0
  11. package/dist/animation/animation-controls.d.ts.map +1 -0
  12. package/{src/animation/animation-controls.ts → dist/animation/animation-controls.js} +89 -101
  13. package/{src/animation/types.ts → dist/animation/types.d.ts} +84 -83
  14. package/dist/animation/types.d.ts.map +1 -0
  15. package/dist/animation/types.js +1 -0
  16. package/dist/animation/use-animated-state.d.ts +2 -0
  17. package/dist/animation/use-animated-state.d.ts.map +1 -0
  18. package/dist/animation/use-animated-state.js +1 -0
  19. package/dist/animation/use-animation.d.ts +62 -0
  20. package/dist/animation/use-animation.d.ts.map +1 -0
  21. package/{src/animation/use-animation.ts → dist/animation/use-animation.js} +66 -74
  22. package/dist/animation/utils/default-transitions.d.ts +27 -0
  23. package/dist/animation/utils/default-transitions.d.ts.map +1 -0
  24. package/dist/animation/utils/default-transitions.js +67 -0
  25. package/dist/animation/utils/easing.d.ts +9 -0
  26. package/dist/animation/utils/easing.d.ts.map +1 -0
  27. package/{src/animation/utils/easing.ts → dist/animation/utils/easing.js} +43 -55
  28. package/dist/animation/utils/is-animatable.d.ts +17 -0
  29. package/dist/animation/utils/is-animatable.d.ts.map +1 -0
  30. package/{src/animation/utils/is-animatable.ts → dist/animation/utils/is-animatable.js} +33 -42
  31. package/{src/animation/utils/is-animation-controls.ts → dist/animation/utils/is-animation-controls.d.ts} +12 -17
  32. package/dist/animation/utils/is-animation-controls.d.ts.map +1 -0
  33. package/dist/animation/utils/is-animation-controls.js +8 -0
  34. package/{src/animation/utils/is-keyframes-target.ts → dist/animation/utils/is-keyframes-target.d.ts} +12 -17
  35. package/dist/animation/utils/is-keyframes-target.d.ts.map +1 -0
  36. package/dist/animation/utils/is-keyframes-target.js +8 -0
  37. package/dist/animation/utils/transitions.d.ts +35 -0
  38. package/dist/animation/utils/transitions.d.ts.map +1 -0
  39. package/{src/animation/utils/transitions.ts → dist/animation/utils/transitions.js} +220 -218
  40. package/{src/animation/utils/variant-resolvers.ts → dist/animation/utils/variant-resolvers.d.ts} +17 -15
  41. package/dist/animation/utils/variant-resolvers.d.ts.map +1 -0
  42. package/dist/animation/utils/variant-resolvers.js +5 -0
  43. package/dist/components/AnimatePresence/AnimatePresence.svelte.d.ts +39 -0
  44. package/dist/components/AnimatePresence/AnimatePresence.svelte.d.ts.map +1 -0
  45. package/{src → dist}/components/AnimatePresence/PresenceChild/PresenceChild.svelte +1 -1
  46. package/dist/components/AnimatePresence/PresenceChild/PresenceChild.svelte.d.ts +29 -0
  47. package/dist/components/AnimatePresence/PresenceChild/PresenceChild.svelte.d.ts.map +1 -0
  48. package/{src/components/AnimatePresence/PresenceChild/index.ts → dist/components/AnimatePresence/PresenceChild/index.d.ts} +7 -7
  49. package/dist/components/AnimatePresence/PresenceChild/index.d.ts.map +1 -0
  50. package/dist/components/AnimatePresence/PresenceChild/index.js +5 -0
  51. package/{src/components/AnimatePresence/PresenceChild/types.ts → dist/components/AnimatePresence/PresenceChild/types.d.ts} +10 -10
  52. package/dist/components/AnimatePresence/PresenceChild/types.d.ts.map +1 -0
  53. package/dist/components/AnimatePresence/PresenceChild/types.js +1 -0
  54. package/{src/components/AnimatePresence/index.ts → dist/components/AnimatePresence/index.d.ts} +51 -46
  55. package/dist/components/AnimatePresence/index.d.ts.map +1 -0
  56. package/dist/components/AnimatePresence/index.js +2 -0
  57. package/dist/components/AnimatePresence/type.spec-d.d.ts +2 -0
  58. package/dist/components/AnimatePresence/type.spec-d.d.ts.map +1 -0
  59. package/dist/components/AnimatePresence/type.spec-d.js +6 -0
  60. package/{src/components/AnimatePresence/types.ts → dist/components/AnimatePresence/types.d.ts} +82 -79
  61. package/dist/components/AnimatePresence/types.d.ts.map +1 -0
  62. package/dist/components/AnimatePresence/types.js +1 -0
  63. package/dist/components/AnimatePresence/use-presence.d.ts +56 -0
  64. package/dist/components/AnimatePresence/use-presence.d.ts.map +1 -0
  65. package/{src/components/AnimatePresence/use-presence.ts → dist/components/AnimatePresence/use-presence.js} +69 -90
  66. package/dist/components/AnimateSharedLayout/AnimateSharedLayout.svelte.d.ts +29 -0
  67. package/dist/components/AnimateSharedLayout/AnimateSharedLayout.svelte.d.ts.map +1 -0
  68. package/{src/components/AnimateSharedLayout/index.ts → dist/components/AnimateSharedLayout/index.d.ts} +11 -11
  69. package/dist/components/AnimateSharedLayout/index.d.ts.map +1 -0
  70. package/dist/components/AnimateSharedLayout/index.js +9 -0
  71. package/dist/components/AnimateSharedLayout/type.spec-d.d.ts +2 -0
  72. package/dist/components/AnimateSharedLayout/type.spec-d.d.ts.map +1 -0
  73. package/dist/components/AnimateSharedLayout/type.spec-d.js +6 -0
  74. package/{src/components/AnimateSharedLayout/types.ts → dist/components/AnimateSharedLayout/types.d.ts} +91 -111
  75. package/dist/components/AnimateSharedLayout/types.d.ts.map +1 -0
  76. package/dist/components/AnimateSharedLayout/types.js +40 -0
  77. package/dist/components/AnimateSharedLayout/utils/batcher.d.ts +11 -0
  78. package/dist/components/AnimateSharedLayout/utils/batcher.d.ts.map +1 -0
  79. package/{src/components/AnimateSharedLayout/utils/batcher.ts → dist/components/AnimateSharedLayout/utils/batcher.js} +87 -96
  80. package/dist/components/AnimateSharedLayout/utils/crossfader.d.ts +27 -0
  81. package/dist/components/AnimateSharedLayout/utils/crossfader.d.ts.map +1 -0
  82. package/{src/components/AnimateSharedLayout/utils/crossfader.ts → dist/components/AnimateSharedLayout/utils/crossfader.js} +234 -260
  83. package/dist/components/AnimateSharedLayout/utils/rotate.d.ts +8 -0
  84. package/dist/components/AnimateSharedLayout/utils/rotate.d.ts.map +1 -0
  85. package/{src/components/AnimateSharedLayout/utils/rotate.ts → dist/components/AnimateSharedLayout/utils/rotate.js} +38 -48
  86. package/dist/components/AnimateSharedLayout/utils/stack.d.ts +21 -0
  87. package/dist/components/AnimateSharedLayout/utils/stack.d.ts.map +1 -0
  88. package/{src/components/AnimateSharedLayout/utils/stack.ts → dist/components/AnimateSharedLayout/utils/stack.js} +138 -160
  89. package/dist/components/LazyMotion/LazyMotion.svelte.d.ts +29 -0
  90. package/dist/components/LazyMotion/LazyMotion.svelte.d.ts.map +1 -0
  91. package/{src/components/LazyMotion/index.ts → dist/components/LazyMotion/index.d.ts} +42 -42
  92. package/dist/components/LazyMotion/index.d.ts.map +1 -0
  93. package/dist/components/LazyMotion/index.js +36 -0
  94. package/{src/components/LazyMotion/types.ts → dist/components/LazyMotion/types.d.ts} +57 -58
  95. package/dist/components/LazyMotion/types.d.ts.map +1 -0
  96. package/dist/components/LazyMotion/types.js +1 -0
  97. package/{src → dist}/components/MotionConfig/MotionConfig.svelte +3 -2
  98. package/dist/components/MotionConfig/MotionConfig.svelte.d.ts +29 -0
  99. package/dist/components/MotionConfig/MotionConfig.svelte.d.ts.map +1 -0
  100. package/dist/components/MotionConfig/MotionConfigScaleCorrection.d.ts +4 -0
  101. package/dist/components/MotionConfig/MotionConfigScaleCorrection.d.ts.map +1 -0
  102. package/{src/components/MotionConfig/MotionConfigScaleCorrection.ts → dist/components/MotionConfig/MotionConfigScaleCorrection.js} +29 -47
  103. package/{src/components/MotionConfig/index.ts → dist/components/MotionConfig/index.d.ts} +21 -20
  104. package/dist/components/MotionConfig/index.d.ts.map +1 -0
  105. package/dist/components/MotionConfig/index.js +14 -0
  106. package/dist/components/MotionConfig/type.spec-d.d.ts +2 -0
  107. package/dist/components/MotionConfig/type.spec-d.d.ts.map +1 -0
  108. package/dist/components/MotionConfig/type.spec-d.js +6 -0
  109. package/dist/components/MotionDiv.svelte.d.ts +31 -0
  110. package/dist/components/MotionDiv.svelte.d.ts.map +1 -0
  111. package/dist/context/DOMcontext.d.ts +5 -0
  112. package/dist/context/DOMcontext.d.ts.map +1 -0
  113. package/dist/context/DOMcontext.js +20 -0
  114. package/dist/context/LayoutGroupContext.d.ts +10 -0
  115. package/dist/context/LayoutGroupContext.d.ts.map +1 -0
  116. package/dist/context/LayoutGroupContext.js +6 -0
  117. package/dist/context/LazyContext.d.ts +13 -0
  118. package/dist/context/LazyContext.d.ts.map +1 -0
  119. package/dist/context/LazyContext.js +4 -0
  120. package/{src/context/MotionConfigContext.ts → dist/context/MotionConfigContext.d.ts} +35 -48
  121. package/dist/context/MotionConfigContext.d.ts.map +1 -0
  122. package/dist/context/MotionConfigContext.js +14 -0
  123. package/{src → dist}/context/MotionContext/MotionContext.svelte +5 -4
  124. package/dist/context/MotionContext/MotionContext.svelte.d.ts +39 -0
  125. package/dist/context/MotionContext/MotionContext.svelte.d.ts.map +1 -0
  126. package/dist/context/MotionContext/MotionContextProvider.svelte.d.ts +31 -0
  127. package/dist/context/MotionContext/MotionContextProvider.svelte.d.ts.map +1 -0
  128. package/dist/context/MotionContext/UseCreateMotionContext.svelte +39 -0
  129. package/dist/context/MotionContext/UseCreateMotionContext.svelte.d.ts +42 -0
  130. package/dist/context/MotionContext/UseCreateMotionContext.svelte.d.ts.map +1 -0
  131. package/dist/context/MotionContext/create.d.ts +2 -0
  132. package/dist/context/MotionContext/create.d.ts.map +1 -0
  133. package/{src/context/MotionContext/create.ts → dist/context/MotionContext/create.js} +1 -1
  134. package/{src/context/MotionContext/index.ts → dist/context/MotionContext/index.d.ts} +12 -14
  135. package/dist/context/MotionContext/index.d.ts.map +1 -0
  136. package/dist/context/MotionContext/index.js +1 -0
  137. package/dist/context/MotionContext/utils.d.ts +9 -0
  138. package/dist/context/MotionContext/utils.d.ts.map +1 -0
  139. package/{src/context/MotionContext/utils.ts → dist/context/MotionContext/utils.js} +18 -29
  140. package/{src/context/PresenceContext.ts → dist/context/PresenceContext.d.ts} +22 -26
  141. package/dist/context/PresenceContext.d.ts.map +1 -0
  142. package/dist/context/PresenceContext.js +6 -0
  143. package/{src → dist}/context/ScaleCorrectionProvider.svelte +1 -2
  144. package/dist/context/ScaleCorrectionProvider.svelte.d.ts +33 -0
  145. package/dist/context/ScaleCorrectionProvider.svelte.d.ts.map +1 -0
  146. package/dist/context/SharedLayoutContext.d.ts +14 -0
  147. package/dist/context/SharedLayoutContext.d.ts.map +1 -0
  148. package/dist/context/SharedLayoutContext.js +16 -0
  149. package/dist/events/UseDomEvent-type.spec-d.d.ts +2 -0
  150. package/dist/events/UseDomEvent-type.spec-d.d.ts.map +1 -0
  151. package/dist/events/UseDomEvent-type.spec-d.js +6 -0
  152. package/{src → dist}/events/UseDomEvent.svelte +2 -2
  153. package/dist/events/UseDomEvent.svelte.d.ts +30 -0
  154. package/dist/events/UseDomEvent.svelte.d.ts.map +1 -0
  155. package/{src → dist}/events/UsePointerEvent.svelte +1 -1
  156. package/dist/events/UsePointerEvent.svelte.d.ts +31 -0
  157. package/dist/events/UsePointerEvent.svelte.d.ts.map +1 -0
  158. package/dist/events/event-info.d.ts +11 -0
  159. package/dist/events/event-info.d.ts.map +1 -0
  160. package/{src/events/event-info.ts → dist/events/event-info.js} +65 -69
  161. package/{src/events/types.ts → dist/events/types.d.ts} +15 -15
  162. package/dist/events/types.d.ts.map +1 -0
  163. package/dist/events/types.js +1 -0
  164. package/{src/events/use-dom-event.ts → dist/events/use-dom-event.d.ts} +50 -48
  165. package/dist/events/use-dom-event.d.ts.map +1 -0
  166. package/dist/events/use-dom-event.js +24 -0
  167. package/{src/events/use-pointer-event.ts → dist/events/use-pointer-event.d.ts} +27 -29
  168. package/dist/events/use-pointer-event.d.ts.map +1 -0
  169. package/dist/events/use-pointer-event.js +1 -0
  170. package/dist/events/utils.d.ts +9 -0
  171. package/dist/events/utils.d.ts.map +1 -0
  172. package/{src/events/utils.ts → dist/events/utils.js} +20 -25
  173. package/dist/gestures/PanSession.d.ts +142 -0
  174. package/dist/gestures/PanSession.d.ts.map +1 -0
  175. package/dist/gestures/PanSession.js +233 -0
  176. package/dist/gestures/UseFocusGesture.svelte.d.ts +31 -0
  177. package/dist/gestures/UseFocusGesture.svelte.d.ts.map +1 -0
  178. package/dist/gestures/UseGestures.svelte.d.ts +31 -0
  179. package/dist/gestures/UseGestures.svelte.d.ts.map +1 -0
  180. package/{src → dist}/gestures/UseHoverGesture.svelte +3 -2
  181. package/dist/gestures/UseHoverGesture.svelte.d.ts +31 -0
  182. package/dist/gestures/UseHoverGesture.svelte.d.ts.map +1 -0
  183. package/dist/gestures/UsePanGesture.svelte.d.ts +32 -0
  184. package/dist/gestures/UsePanGesture.svelte.d.ts.map +1 -0
  185. package/dist/gestures/UseTapGesture.svelte.d.ts +31 -0
  186. package/dist/gestures/UseTapGesture.svelte.d.ts.map +1 -0
  187. package/{src → dist}/gestures/drag/UseDrag.svelte +3 -2
  188. package/dist/gestures/drag/UseDrag.svelte.d.ts +32 -0
  189. package/dist/gestures/drag/UseDrag.svelte.d.ts.map +1 -0
  190. package/{src → dist}/gestures/drag/UseDragControls.svelte +4 -8
  191. package/dist/gestures/drag/UseDragControls.svelte.d.ts +19 -0
  192. package/dist/gestures/drag/UseDragControls.svelte.d.ts.map +1 -0
  193. package/dist/gestures/drag/VisualElementDragControls.d.ts +116 -0
  194. package/dist/gestures/drag/VisualElementDragControls.d.ts.map +1 -0
  195. package/dist/gestures/drag/VisualElementDragControls.js +749 -0
  196. package/{src/gestures/drag/types.ts → dist/gestures/drag/types.d.ts} +308 -307
  197. package/dist/gestures/drag/types.d.ts.map +1 -0
  198. package/dist/gestures/drag/types.js +2 -0
  199. package/dist/gestures/drag/use-drag-controls.d.ts +128 -0
  200. package/dist/gestures/drag/use-drag-controls.d.ts.map +1 -0
  201. package/dist/gestures/drag/use-drag-controls.js +157 -0
  202. package/{src/gestures/drag/use-drag.ts → dist/gestures/drag/use-drag.d.ts} +13 -15
  203. package/dist/gestures/drag/use-drag.d.ts.map +1 -0
  204. package/dist/gestures/drag/use-drag.js +1 -0
  205. package/dist/gestures/drag/utils/constraints.d.ts +78 -0
  206. package/dist/gestures/drag/utils/constraints.d.ts.map +1 -0
  207. package/{src/gestures/drag/utils/constraints.ts → dist/gestures/drag/utils/constraints.js} +135 -157
  208. package/dist/gestures/drag/utils/lock.d.ts +14 -0
  209. package/dist/gestures/drag/utils/lock.d.ts.map +1 -0
  210. package/{src/gestures/drag/utils/lock.ts → dist/gestures/drag/utils/lock.js} +56 -69
  211. package/{src/gestures/types.ts → dist/gestures/types.d.ts} +258 -257
  212. package/dist/gestures/types.d.ts.map +1 -0
  213. package/dist/gestures/types.js +1 -0
  214. package/{src/gestures/use-focus-gesture.ts → dist/gestures/use-focus-gesture.d.ts} +14 -16
  215. package/dist/gestures/use-focus-gesture.d.ts.map +1 -0
  216. package/dist/gestures/use-focus-gesture.js +1 -0
  217. package/dist/gestures/use-gestures.d.ts +2 -0
  218. package/dist/gestures/use-gestures.d.ts.map +1 -0
  219. package/{src/gestures/use-gestures.ts → dist/gestures/use-gestures.js} +1 -2
  220. package/{src/gestures/use-hover-gesture.ts → dist/gestures/use-hover-gesture.d.ts} +8 -10
  221. package/dist/gestures/use-hover-gesture.d.ts.map +1 -0
  222. package/dist/gestures/use-hover-gesture.js +1 -0
  223. package/{src/gestures/use-pan-gesture.ts → dist/gestures/use-pan-gesture.d.ts} +20 -22
  224. package/dist/gestures/use-pan-gesture.d.ts.map +1 -0
  225. package/dist/gestures/use-pan-gesture.js +1 -0
  226. package/{src/gestures/use-tap-gesture.ts → dist/gestures/use-tap-gesture.d.ts} +12 -14
  227. package/dist/gestures/use-tap-gesture.d.ts.map +1 -0
  228. package/dist/gestures/use-tap-gesture.js +1 -0
  229. package/dist/gestures/utils/event-type.d.ts +12 -0
  230. package/dist/gestures/utils/event-type.d.ts.map +1 -0
  231. package/{src/gestures/utils/event-type.ts → dist/gestures/utils/event-type.js} +20 -24
  232. package/dist/gestures/utils/is-node-or-child.d.ts +18 -0
  233. package/dist/gestures/utils/is-node-or-child.d.ts.map +1 -0
  234. package/{src/gestures/utils/is-node-or-child.ts → dist/gestures/utils/is-node-or-child.js} +27 -31
  235. package/{src/index.ts → dist/index.d.ts} +96 -104
  236. package/dist/index.d.ts.map +1 -0
  237. package/dist/index.js +75 -0
  238. package/{src → dist}/motion/Motion.svelte +82 -74
  239. package/dist/motion/Motion.svelte.d.ts +41 -0
  240. package/dist/motion/Motion.svelte.d.ts.map +1 -0
  241. package/{src → dist}/motion/MotionSSR.svelte +76 -55
  242. package/dist/motion/MotionSSR.svelte.d.ts +41 -0
  243. package/dist/motion/MotionSSR.svelte.d.ts.map +1 -0
  244. package/dist/motion/features/AnimationState.svelte.d.ts +22 -0
  245. package/dist/motion/features/AnimationState.svelte.d.ts.map +1 -0
  246. package/{src → dist}/motion/features/Exit.svelte +15 -5
  247. package/dist/motion/features/Exit.svelte.d.ts +32 -0
  248. package/dist/motion/features/Exit.svelte.d.ts.map +1 -0
  249. package/{src → dist}/motion/features/UseFeatures.svelte +2 -2
  250. package/dist/motion/features/UseFeatures.svelte.d.ts +45 -0
  251. package/dist/motion/features/UseFeatures.svelte.d.ts.map +1 -0
  252. package/{src/motion/features/animations.ts → dist/motion/features/animations.js} +14 -22
  253. package/dist/motion/features/definitions.d.ts +37 -0
  254. package/dist/motion/features/definitions.d.ts.map +1 -0
  255. package/{src/motion/features/definitions.ts → dist/motion/features/definitions.js} +42 -49
  256. package/{src/motion/features/drag.ts → dist/motion/features/drag.js} +14 -24
  257. package/{src/motion/features/gestures.ts → dist/motion/features/gestures.js} +16 -24
  258. package/dist/motion/features/layout/Animate.d.ts +2 -0
  259. package/dist/motion/features/layout/Animate.d.ts.map +1 -0
  260. package/dist/motion/features/layout/Animate.js +2 -0
  261. package/{src → dist}/motion/features/layout/Animate.svelte +10 -10
  262. package/dist/motion/features/layout/Animate.svelte.d.ts +23 -0
  263. package/dist/motion/features/layout/Animate.svelte.d.ts.map +1 -0
  264. package/dist/motion/features/layout/AnimateLayoutContextProvider.svelte.d.ts +23 -0
  265. package/dist/motion/features/layout/AnimateLayoutContextProvider.svelte.d.ts.map +1 -0
  266. package/dist/motion/features/layout/Measure.d.ts +2 -0
  267. package/dist/motion/features/layout/Measure.d.ts.map +1 -0
  268. package/dist/motion/features/layout/Measure.js +2 -0
  269. package/dist/motion/features/layout/Measure.svelte.d.ts +24 -0
  270. package/dist/motion/features/layout/Measure.svelte.d.ts.map +1 -0
  271. package/{src → dist}/motion/features/layout/MeasureContextProvider.svelte +7 -4
  272. package/dist/motion/features/layout/MeasureContextProvider.svelte.d.ts +23 -0
  273. package/dist/motion/features/layout/MeasureContextProvider.svelte.d.ts.map +1 -0
  274. package/{src/motion/features/layout/index.ts → dist/motion/features/layout/index.js} +11 -20
  275. package/{src/motion/features/layout/types.ts → dist/motion/features/layout/types.d.ts} +72 -71
  276. package/dist/motion/features/layout/types.d.ts.map +1 -0
  277. package/dist/motion/features/layout/types.js +1 -0
  278. package/dist/motion/features/layout/utils.d.ts +26 -0
  279. package/dist/motion/features/layout/utils.d.ts.map +1 -0
  280. package/{src/motion/features/layout/utils.ts → dist/motion/features/layout/utils.js} +28 -40
  281. package/{src/motion/features/types.ts → dist/motion/features/types.d.ts} +54 -53
  282. package/dist/motion/features/types.d.ts.map +1 -0
  283. package/dist/motion/features/types.js +1 -0
  284. package/{src/motion/features/use-features.ts → dist/motion/features/use-features.d.ts} +12 -16
  285. package/dist/motion/features/use-features.d.ts.map +1 -0
  286. package/dist/motion/features/use-features.js +5 -0
  287. package/dist/motion/index.d.ts +30 -0
  288. package/dist/motion/index.d.ts.map +1 -0
  289. package/dist/motion/index.js +35 -0
  290. package/dist/motion/type.spec-d.d.ts +2 -0
  291. package/dist/motion/type.spec-d.d.ts.map +1 -0
  292. package/dist/motion/type.spec-d.js +6 -0
  293. package/{src/motion/types.ts → dist/motion/types.d.ts} +277 -278
  294. package/dist/motion/types.d.ts.map +1 -0
  295. package/dist/motion/types.js +1 -0
  296. package/{src → dist}/motion/utils/UseLayoutId.svelte +3 -2
  297. package/dist/motion/utils/UseLayoutId.svelte.d.ts +35 -0
  298. package/dist/motion/utils/UseLayoutId.svelte.d.ts.map +1 -0
  299. package/{src → dist}/motion/utils/UseVisualElement.svelte +22 -13
  300. package/dist/motion/utils/UseVisualElement.svelte.d.ts +40 -0
  301. package/dist/motion/utils/UseVisualElement.svelte.d.ts.map +1 -0
  302. package/{src → dist}/motion/utils/UseVisualState.svelte +7 -7
  303. package/dist/motion/utils/UseVisualState.svelte.d.ts +37 -0
  304. package/dist/motion/utils/UseVisualState.svelte.d.ts.map +1 -0
  305. package/dist/motion/utils/is-forced-motion-value.d.ts +11 -0
  306. package/dist/motion/utils/is-forced-motion-value.d.ts.map +1 -0
  307. package/{src/motion/utils/is-forced-motion-value.ts → dist/motion/utils/is-forced-motion-value.js} +13 -23
  308. package/{src/motion/utils/make-renderless-component.ts → dist/motion/utils/make-renderless-component.d.ts} +12 -17
  309. package/dist/motion/utils/make-renderless-component.d.ts.map +1 -0
  310. package/dist/motion/utils/make-renderless-component.js +11 -0
  311. package/{src/motion/utils/should-inhert-variant.ts → dist/motion/utils/should-inhert-variant.d.ts} +7 -6
  312. package/dist/motion/utils/should-inhert-variant.d.ts.map +1 -0
  313. package/dist/motion/utils/should-inhert-variant.js +1 -0
  314. package/dist/motion/utils/use-motion-ref.d.ts +13 -0
  315. package/dist/motion/utils/use-motion-ref.d.ts.map +1 -0
  316. package/{src/motion/utils/use-motion-ref.ts → dist/motion/utils/use-motion-ref.js} +29 -41
  317. package/{src/motion/utils/use-visual-element.ts → dist/motion/utils/use-visual-element.d.ts} +10 -13
  318. package/dist/motion/utils/use-visual-element.d.ts.map +1 -0
  319. package/dist/motion/utils/use-visual-element.js +1 -0
  320. package/{src/motion/utils/use-visual-state.ts → dist/motion/utils/use-visual-state.d.ts} +20 -24
  321. package/dist/motion/utils/use-visual-state.d.ts.map +1 -0
  322. package/dist/motion/utils/use-visual-state.js +1 -0
  323. package/dist/motion/utils/valid-prop.d.ts +15 -0
  324. package/dist/motion/utils/valid-prop.d.ts.map +1 -0
  325. package/{src/motion/utils/valid-prop.ts → dist/motion/utils/valid-prop.js} +77 -80
  326. package/dist/render/dom/M-type.spec-d.d.ts +2 -0
  327. package/dist/render/dom/M-type.spec-d.d.ts.map +1 -0
  328. package/dist/render/dom/M-type.spec-d.js +6 -0
  329. package/dist/render/dom/M.svelte.d.ts +32 -0
  330. package/dist/render/dom/M.svelte.d.ts.map +1 -0
  331. package/dist/render/dom/UseRender.svelte.d.ts +42 -0
  332. package/dist/render/dom/UseRender.svelte.d.ts.map +1 -0
  333. package/{src/render/dom/create-motion-class.ts → dist/render/dom/create-motion-class.js} +10 -12
  334. package/dist/render/dom/create-visual-element.d.ts +8 -0
  335. package/dist/render/dom/create-visual-element.d.ts.map +1 -0
  336. package/{src/render/dom/create-visual-element.ts → dist/render/dom/create-visual-element.js} +12 -22
  337. package/{src/render/dom/featureBundle.ts → dist/render/dom/featureBundle.js} +19 -22
  338. package/dist/render/dom/motion-minimal.d.ts +10 -0
  339. package/dist/render/dom/motion-minimal.d.ts.map +1 -0
  340. package/dist/render/dom/motion-minimal.js +18 -0
  341. package/dist/render/dom/motion-proxy.d.ts +245 -0
  342. package/dist/render/dom/motion-proxy.d.ts.map +1 -0
  343. package/dist/render/dom/motion-proxy.js +55 -0
  344. package/{src/render/dom/motion.ts → dist/render/dom/motion.js} +42 -62
  345. package/dist/render/dom/projection/convert-to-relative.d.ts +12 -0
  346. package/dist/render/dom/projection/convert-to-relative.d.ts.map +1 -0
  347. package/{src/render/dom/projection/convert-to-relative.ts → dist/render/dom/projection/convert-to-relative.js} +32 -40
  348. package/dist/render/dom/projection/default-scale-correctors.d.ts +39 -0
  349. package/dist/render/dom/projection/default-scale-correctors.d.ts.map +1 -0
  350. package/{src/render/dom/projection/default-scale-correctors.ts → dist/render/dom/projection/default-scale-correctors.js} +108 -138
  351. package/dist/render/dom/projection/measure.d.ts +17 -0
  352. package/dist/render/dom/projection/measure.d.ts.map +1 -0
  353. package/{src/render/dom/projection/measure.ts → dist/render/dom/projection/measure.js} +19 -28
  354. package/dist/render/dom/projection/relative-set.d.ts +8 -0
  355. package/dist/render/dom/projection/relative-set.d.ts.map +1 -0
  356. package/{src/render/dom/projection/relative-set.ts → dist/render/dom/projection/relative-set.js} +18 -27
  357. package/{src/render/dom/projection/scale-correction.ts → dist/render/dom/projection/scale-correction.d.ts} +16 -22
  358. package/dist/render/dom/projection/scale-correction.d.ts.map +1 -0
  359. package/dist/render/dom/projection/scale-correction.js +14 -0
  360. package/{src/render/dom/projection/types.ts → dist/render/dom/projection/types.d.ts} +14 -13
  361. package/dist/render/dom/projection/types.d.ts.map +1 -0
  362. package/dist/render/dom/projection/types.js +1 -0
  363. package/dist/render/dom/projection/utils.d.ts +18 -0
  364. package/dist/render/dom/projection/utils.d.ts.map +1 -0
  365. package/{src/render/dom/projection/utils.ts → dist/render/dom/projection/utils.js} +62 -69
  366. package/dist/render/dom/svg-visual-element.d.ts +3 -0
  367. package/dist/render/dom/svg-visual-element.d.ts.map +1 -0
  368. package/{src/render/dom/svg-visual-element.ts → dist/render/dom/svg-visual-element.js} +81 -114
  369. package/{src/render/dom/types.ts → dist/render/dom/types.d.ts} +33 -32
  370. package/dist/render/dom/types.d.ts.map +1 -0
  371. package/dist/render/dom/types.js +1 -0
  372. package/{src/render/dom/use-render.ts → dist/render/dom/use-render.d.ts} +10 -11
  373. package/dist/render/dom/use-render.d.ts.map +1 -0
  374. package/dist/render/dom/use-render.js +1 -0
  375. package/dist/render/dom/utils/UseInitialMotionProps.svelte.d.ts +35 -0
  376. package/dist/render/dom/utils/UseInitialMotionProps.svelte.d.ts.map +1 -0
  377. package/dist/render/dom/utils/batch-layout.d.ts +14 -0
  378. package/dist/render/dom/utils/batch-layout.d.ts.map +1 -0
  379. package/{src/render/dom/utils/batch-layout.ts → dist/render/dom/utils/batch-layout.js} +66 -77
  380. package/dist/render/dom/utils/camel-to-dash.d.ts +10 -0
  381. package/dist/render/dom/utils/camel-to-dash.d.ts.map +1 -0
  382. package/{src/render/dom/utils/camel-to-dash.ts → dist/render/dom/utils/camel-to-dash.js} +17 -20
  383. package/dist/render/dom/utils/create-config.d.ts +13 -0
  384. package/dist/render/dom/utils/create-config.d.ts.map +1 -0
  385. package/dist/render/dom/utils/create-config.js +17 -0
  386. package/dist/render/dom/utils/css-variables-conversion.d.ts +28 -0
  387. package/dist/render/dom/utils/css-variables-conversion.d.ts.map +1 -0
  388. package/{src/render/dom/utils/css-variables-conversion.ts → dist/render/dom/utils/css-variables-conversion.js} +109 -121
  389. package/dist/render/dom/utils/filter-props.d.ts +8 -0
  390. package/dist/render/dom/utils/filter-props.d.ts.map +1 -0
  391. package/{src/render/dom/utils/filter-props.ts → dist/render/dom/utils/filter-props.js} +46 -55
  392. package/dist/render/dom/utils/is-css-variable.d.ts +14 -0
  393. package/dist/render/dom/utils/is-css-variable.d.ts.map +1 -0
  394. package/{src/render/dom/utils/is-css-variable.ts → dist/render/dom/utils/is-css-variable.js} +15 -18
  395. package/dist/render/dom/utils/is-svg-component.d.ts +8 -0
  396. package/dist/render/dom/utils/is-svg-component.d.ts.map +1 -0
  397. package/{src/render/dom/utils/is-svg-component.ts → dist/render/dom/utils/is-svg-component.js} +32 -41
  398. package/dist/render/dom/utils/parse-dom-variant.d.ts +12 -0
  399. package/dist/render/dom/utils/parse-dom-variant.d.ts.map +1 -0
  400. package/{src/render/dom/utils/parse-dom-variant.ts → dist/render/dom/utils/parse-dom-variant.js} +17 -26
  401. package/dist/render/dom/utils/unit-conversion.d.ts +27 -0
  402. package/dist/render/dom/utils/unit-conversion.d.ts.map +1 -0
  403. package/{src/render/dom/utils/unit-conversion.ts → dist/render/dom/utils/unit-conversion.js} +253 -258
  404. package/dist/render/dom/utils/use-html-props.d.ts +2 -0
  405. package/dist/render/dom/utils/use-html-props.d.ts.map +1 -0
  406. package/{src/render/dom/utils/use-html-props.ts → dist/render/dom/utils/use-html-props.js} +2 -2
  407. package/dist/render/dom/utils/use-svg-props.d.ts +2 -0
  408. package/dist/render/dom/utils/use-svg-props.d.ts.map +1 -0
  409. package/dist/render/dom/utils/use-svg-props.js +1 -0
  410. package/dist/render/dom/value-types/animatable-none.d.ts +7 -0
  411. package/dist/render/dom/value-types/animatable-none.d.ts.map +1 -0
  412. package/{src/render/dom/value-types/animatable-none.ts → dist/render/dom/value-types/animatable-none.js} +20 -24
  413. package/dist/render/dom/value-types/defaults.d.ts +15 -0
  414. package/dist/render/dom/value-types/defaults.d.ts.map +1 -0
  415. package/{src/render/dom/value-types/defaults.ts → dist/render/dom/value-types/defaults.js} +22 -30
  416. package/dist/render/dom/value-types/dimensions.d.ts +14 -0
  417. package/dist/render/dom/value-types/dimensions.d.ts.map +1 -0
  418. package/{src/render/dom/value-types/dimensions.ts → dist/render/dom/value-types/dimensions.js} +23 -27
  419. package/dist/render/dom/value-types/find.d.ts +15 -0
  420. package/dist/render/dom/value-types/find.d.ts.map +1 -0
  421. package/{src/render/dom/value-types/find.ts → dist/render/dom/value-types/find.js} +24 -31
  422. package/{src/render/dom/value-types/get-as-type.ts → dist/render/dom/value-types/get-as-type.d.ts} +15 -21
  423. package/dist/render/dom/value-types/get-as-type.d.ts.map +1 -0
  424. package/dist/render/dom/value-types/get-as-type.js +13 -0
  425. package/dist/render/dom/value-types/number.d.ts +8 -0
  426. package/dist/render/dom/value-types/number.d.ts.map +1 -0
  427. package/{src/render/dom/value-types/number.ts → dist/render/dom/value-types/number.js} +74 -83
  428. package/{src/render/dom/value-types/test.ts → dist/render/dom/value-types/test.d.ts} +15 -17
  429. package/dist/render/dom/value-types/test.d.ts.map +1 -0
  430. package/dist/render/dom/value-types/test.js +9 -0
  431. package/{src/render/dom/value-types/type-auto.ts → dist/render/dom/value-types/type-auto.d.ts} +15 -21
  432. package/dist/render/dom/value-types/type-auto.d.ts.map +1 -0
  433. package/dist/render/dom/value-types/type-auto.js +12 -0
  434. package/{src/render/dom/value-types/type-int.ts → dist/render/dom/value-types/type-int.d.ts} +14 -23
  435. package/dist/render/dom/value-types/type-int.d.ts.map +1 -0
  436. package/dist/render/dom/value-types/type-int.js +13 -0
  437. package/{src/render/dom/value-types/types.ts → dist/render/dom/value-types/types.d.ts} +9 -8
  438. package/dist/render/dom/value-types/types.d.ts.map +1 -0
  439. package/dist/render/dom/value-types/types.js +1 -0
  440. package/dist/render/html/UseHTMLProps.svelte.d.ts +36 -0
  441. package/dist/render/html/UseHTMLProps.svelte.d.ts.map +1 -0
  442. package/dist/render/html/UseInitialMotionValues.svelte.d.ts +36 -0
  443. package/dist/render/html/UseInitialMotionValues.svelte.d.ts.map +1 -0
  444. package/{src → dist}/render/html/UseStyle.svelte +2 -2
  445. package/dist/render/html/UseStyle.svelte.d.ts +41 -0
  446. package/dist/render/html/UseStyle.svelte.d.ts.map +1 -0
  447. package/dist/render/html/config-motion.d.ts +13 -0
  448. package/dist/render/html/config-motion.d.ts.map +1 -0
  449. package/dist/render/html/config-motion.js +12 -0
  450. package/dist/render/html/supported-elements.d.ts +12 -0
  451. package/dist/render/html/supported-elements.d.ts.map +1 -0
  452. package/{src/render/html/supported-elements.ts → dist/render/html/supported-elements.js} +4 -10
  453. package/{src/render/html/types.ts → dist/render/html/types.d.ts} +66 -64
  454. package/dist/render/html/types.d.ts.map +1 -0
  455. package/dist/render/html/types.js +1 -0
  456. package/{src/render/html/use-props.ts → dist/render/html/use-props.d.ts} +11 -14
  457. package/dist/render/html/use-props.d.ts.map +1 -0
  458. package/dist/render/html/use-props.js +2 -0
  459. package/dist/render/html/utils/build-projection-transform.d.ts +21 -0
  460. package/dist/render/html/utils/build-projection-transform.d.ts.map +1 -0
  461. package/{src/render/html/utils/build-projection-transform.ts → dist/render/html/utils/build-projection-transform.js} +39 -53
  462. package/dist/render/html/utils/build-styles.d.ts +13 -0
  463. package/dist/render/html/utils/build-styles.d.ts.map +1 -0
  464. package/{src/render/html/utils/build-styles.ts → dist/render/html/utils/build-styles.js} +107 -121
  465. package/dist/render/html/utils/build-transform.d.ts +21 -0
  466. package/dist/render/html/utils/build-transform.d.ts.map +1 -0
  467. package/{src/render/html/utils/build-transform.ts → dist/render/html/utils/build-transform.js} +69 -79
  468. package/dist/render/html/utils/create-render-state.d.ts +17 -0
  469. package/dist/render/html/utils/create-render-state.d.ts.map +1 -0
  470. package/dist/render/html/utils/create-render-state.js +18 -0
  471. package/dist/render/html/utils/render.d.ts +12 -0
  472. package/dist/render/html/utils/render.d.ts.map +1 -0
  473. package/{src/render/html/utils/render.ts → dist/render/html/utils/render.js} +14 -22
  474. package/dist/render/html/utils/scrape-motion-values.d.ts +8 -0
  475. package/dist/render/html/utils/scrape-motion-values.d.ts.map +1 -0
  476. package/{src/render/html/utils/scrape-motion-values.ts → dist/render/html/utils/scrape-motion-values.js} +17 -26
  477. package/dist/render/html/utils/transform.d.ts +25 -0
  478. package/dist/render/html/utils/transform.d.ts.map +1 -0
  479. package/{src/render/html/utils/transform.ts → dist/render/html/utils/transform.js} +48 -51
  480. package/dist/render/html/visual-element.d.ts +12 -0
  481. package/dist/render/html/visual-element.d.ts.map +1 -0
  482. package/{src/render/html/visual-element.ts → dist/render/html/visual-element.js} +119 -129
  483. package/dist/render/index.d.ts +8 -0
  484. package/dist/render/index.d.ts.map +1 -0
  485. package/{src/render/index.ts → dist/render/index.js} +711 -703
  486. package/{src → dist}/render/svg/UseSVGProps.svelte +1 -1
  487. package/dist/render/svg/UseSVGProps.svelte.d.ts +35 -0
  488. package/dist/render/svg/UseSVGProps.svelte.d.ts.map +1 -0
  489. package/dist/render/svg/config-motion.d.ts +8 -0
  490. package/dist/render/svg/config-motion.d.ts.map +1 -0
  491. package/dist/render/svg/config-motion.js +41 -0
  492. package/dist/render/svg/lowercase-elements.d.ts +10 -0
  493. package/dist/render/svg/lowercase-elements.d.ts.map +1 -0
  494. package/{src/render/svg/lowercase-elements.ts → dist/render/svg/lowercase-elements.js} +35 -35
  495. package/dist/render/svg/supported-elements.d.ts +12 -0
  496. package/dist/render/svg/supported-elements.d.ts.map +1 -0
  497. package/{src/render/svg/supported-elements.ts → dist/render/svg/supported-elements.js} +4 -10
  498. package/{src/render/svg/types.ts → dist/render/svg/types.d.ts} +53 -51
  499. package/dist/render/svg/types.d.ts.map +1 -0
  500. package/dist/render/svg/types.js +1 -0
  501. package/{src/render/svg/use-props.ts → dist/render/svg/use-props.d.ts} +13 -14
  502. package/dist/render/svg/use-props.d.ts.map +1 -0
  503. package/dist/render/svg/use-props.js +1 -0
  504. package/dist/render/svg/utils/build-attrs.d.ts +16 -0
  505. package/dist/render/svg/utils/build-attrs.d.ts.map +1 -0
  506. package/{src/render/svg/utils/build-attrs.ts → dist/render/svg/utils/build-attrs.js} +44 -58
  507. package/dist/render/svg/utils/camel-case-attrs.d.ts +9 -0
  508. package/dist/render/svg/utils/camel-case-attrs.d.ts.map +1 -0
  509. package/{src/render/svg/utils/camel-case-attrs.ts → dist/render/svg/utils/camel-case-attrs.js} +27 -27
  510. package/dist/render/svg/utils/create-render-state.d.ts +3 -0
  511. package/dist/render/svg/utils/create-render-state.d.ts.map +1 -0
  512. package/{src/render/svg/utils/create-render-state.ts → dist/render/svg/utils/create-render-state.js} +8 -17
  513. package/dist/render/svg/utils/path.d.ts +15 -0
  514. package/dist/render/svg/utils/path.d.ts.map +1 -0
  515. package/{src/render/svg/utils/path.ts → dist/render/svg/utils/path.js} +46 -49
  516. package/dist/render/svg/utils/render.d.ts +8 -0
  517. package/dist/render/svg/utils/render.d.ts.map +1 -0
  518. package/{src/render/svg/utils/render.ts → dist/render/svg/utils/render.js} +14 -22
  519. package/dist/render/svg/utils/scrape-motion-values.d.ts +8 -0
  520. package/dist/render/svg/utils/scrape-motion-values.d.ts.map +1 -0
  521. package/{src/render/svg/utils/scrape-motion-values.ts → dist/render/svg/utils/scrape-motion-values.js} +17 -26
  522. package/dist/render/svg/utils/transform-origin.d.ts +12 -0
  523. package/dist/render/svg/utils/transform-origin.d.ts.map +1 -0
  524. package/{src/render/svg/utils/transform-origin.ts → dist/render/svg/utils/transform-origin.js} +21 -30
  525. package/dist/render/svg/visual-element.d.ts +7 -0
  526. package/dist/render/svg/visual-element.d.ts.map +1 -0
  527. package/{src/render/svg/visual-element.ts → dist/render/svg/visual-element.js} +41 -44
  528. package/{src/render/types.ts → dist/render/types.d.ts} +148 -148
  529. package/dist/render/types.d.ts.map +1 -0
  530. package/dist/render/types.js +4 -0
  531. package/dist/render/utils/animation-state.d.ts +37 -0
  532. package/dist/render/utils/animation-state.d.ts.map +1 -0
  533. package/{src/render/utils/animation-state.ts → dist/render/utils/animation-state.js} +339 -375
  534. package/dist/render/utils/animation.d.ts +27 -0
  535. package/dist/render/utils/animation.d.ts.map +1 -0
  536. package/{src/render/utils/animation.ts → dist/render/utils/animation.js} +157 -167
  537. package/{src/render/utils/compare-by-depth.ts → dist/render/utils/compare-by-depth.d.ts} +15 -18
  538. package/dist/render/utils/compare-by-depth.d.ts.map +1 -0
  539. package/dist/render/utils/compare-by-depth.js +8 -0
  540. package/dist/render/utils/flat-tree.d.ts +14 -0
  541. package/dist/render/utils/flat-tree.d.ts.map +1 -0
  542. package/dist/render/utils/flat-tree.js +53 -0
  543. package/{src/render/utils/is-draggable.ts → dist/render/utils/is-draggable.d.ts} +12 -17
  544. package/dist/render/utils/is-draggable.d.ts.map +1 -0
  545. package/dist/render/utils/is-draggable.js +9 -0
  546. package/{src/render/utils/lifecycles.ts → dist/render/utils/lifecycles.d.ts} +122 -172
  547. package/dist/render/utils/lifecycles.d.ts.map +1 -0
  548. package/dist/render/utils/lifecycles.js +49 -0
  549. package/dist/render/utils/motion-values.d.ts +9 -0
  550. package/dist/render/utils/motion-values.d.ts.map +1 -0
  551. package/{src/render/utils/motion-values.ts → dist/render/utils/motion-values.js} +49 -59
  552. package/dist/render/utils/projection.d.ts +9 -0
  553. package/dist/render/utils/projection.d.ts.map +1 -0
  554. package/{src/render/utils/projection.ts → dist/render/utils/projection.js} +29 -38
  555. package/dist/render/utils/setters.d.ts +794 -0
  556. package/dist/render/utils/setters.d.ts.map +1 -0
  557. package/dist/render/utils/setters.js +119 -0
  558. package/{src/render/utils/state.ts → dist/render/utils/state.d.ts} +90 -113
  559. package/dist/render/utils/state.d.ts.map +1 -0
  560. package/dist/render/utils/state.js +26 -0
  561. package/{src/render/utils/types.ts → dist/render/utils/types.d.ts} +13 -12
  562. package/dist/render/utils/types.d.ts.map +1 -0
  563. package/dist/render/utils/types.js +13 -0
  564. package/dist/render/utils/variants.d.ts +27 -0
  565. package/dist/render/utils/variants.d.ts.map +1 -0
  566. package/{src/render/utils/variants.ts → dist/render/utils/variants.js} +66 -76
  567. package/{src/types/geometry.ts → dist/types/geometry.d.ts} +92 -91
  568. package/dist/types/geometry.d.ts.map +1 -0
  569. package/dist/types/geometry.js +1 -0
  570. package/{src/types.ts → dist/types.d.ts} +1091 -1088
  571. package/dist/types.d.ts.map +1 -0
  572. package/dist/types.js +1 -0
  573. package/dist/utils/UseUnmountEffect.svelte.d.ts +30 -0
  574. package/dist/utils/UseUnmountEffect.svelte.d.ts.map +1 -0
  575. package/dist/utils/array.d.ts +12 -0
  576. package/dist/utils/array.d.ts.map +1 -0
  577. package/{src/utils/array.ts → dist/utils/array.js} +16 -18
  578. package/dist/utils/each-axis.d.ts +11 -0
  579. package/dist/utils/each-axis.d.ts.map +1 -0
  580. package/{src/utils/each-axis.ts → dist/utils/each-axis.js} +13 -15
  581. package/dist/utils/errors.d.ts +5 -0
  582. package/dist/utils/errors.d.ts.map +1 -0
  583. package/dist/utils/errors.js +16 -0
  584. package/dist/utils/fix-process-env.d.ts +2 -0
  585. package/dist/utils/fix-process-env.d.ts.map +1 -0
  586. package/dist/utils/fix-process-env.js +19 -0
  587. package/dist/utils/geometry/delta-apply.d.ts +71 -0
  588. package/dist/utils/geometry/delta-apply.d.ts.map +1 -0
  589. package/{src/utils/geometry/delta-apply.ts → dist/utils/geometry/delta-apply.js} +161 -162
  590. package/dist/utils/geometry/delta-calc.d.ts +34 -0
  591. package/dist/utils/geometry/delta-calc.d.ts.map +1 -0
  592. package/{src/utils/geometry/delta-calc.ts → dist/utils/geometry/delta-calc.js} +84 -89
  593. package/dist/utils/geometry/index.d.ts +30 -0
  594. package/dist/utils/geometry/index.d.ts.map +1 -0
  595. package/{src/utils/geometry/index.ts → dist/utils/geometry/index.js} +71 -83
  596. package/dist/utils/is-browser.d.ts +11 -0
  597. package/dist/utils/is-browser.d.ts.map +1 -0
  598. package/{src/utils/is-browser.ts → dist/utils/is-browser.js} +10 -12
  599. package/dist/utils/is-numerical-string.d.ts +14 -0
  600. package/dist/utils/is-numerical-string.d.ts.map +1 -0
  601. package/{src/utils/is-numerical-string.ts → dist/utils/is-numerical-string.js} +13 -15
  602. package/dist/utils/is-ref-object.d.ts +12 -0
  603. package/dist/utils/is-ref-object.d.ts.map +1 -0
  604. package/dist/utils/is-ref-object.js +9 -0
  605. package/dist/utils/noop.d.ts +11 -0
  606. package/dist/utils/noop.d.ts.map +1 -0
  607. package/{src/utils/noop.ts → dist/utils/noop.js} +13 -15
  608. package/dist/utils/resolve-value.d.ts +9 -0
  609. package/dist/utils/resolve-value.d.ts.map +1 -0
  610. package/{src/utils/resolve-value.ts → dist/utils/resolve-value.js} +15 -23
  611. package/dist/utils/shallow-compare.d.ts +11 -0
  612. package/dist/utils/shallow-compare.d.ts.map +1 -0
  613. package/{src/utils/shallow-compare.ts → dist/utils/shallow-compare.js} +21 -23
  614. package/dist/utils/subscription-manager.d.ts +14 -0
  615. package/dist/utils/subscription-manager.d.ts.map +1 -0
  616. package/dist/utils/subscription-manager.js +69 -0
  617. package/dist/utils/time-conversion.d.ts +17 -0
  618. package/dist/utils/time-conversion.d.ts.map +1 -0
  619. package/{src/utils/time-conversion.ts → dist/utils/time-conversion.js} +16 -18
  620. package/{src/utils/transform.ts → dist/utils/transform.d.ts} +93 -120
  621. package/dist/utils/transform.d.ts.map +1 -0
  622. package/dist/utils/transform.js +22 -0
  623. package/{src/utils/use-constant.ts → dist/utils/use-constant.d.ts} +22 -23
  624. package/dist/utils/use-constant.d.ts.map +1 -0
  625. package/dist/utils/use-constant.js +9 -0
  626. package/dist/utils/use-cycle.d.ts +2 -0
  627. package/dist/utils/use-cycle.d.ts.map +1 -0
  628. package/{src/utils/use-cycle.ts → dist/utils/use-cycle.js} +65 -78
  629. package/dist/utils/use-force-update.d.ts +6 -0
  630. package/dist/utils/use-force-update.d.ts.map +1 -0
  631. package/dist/utils/use-force-update.js +2 -0
  632. package/dist/utils/use-isomorphic-effect.d.ts +7 -0
  633. package/dist/utils/use-isomorphic-effect.d.ts.map +1 -0
  634. package/{src/utils/use-isomorphic-effect.ts → dist/utils/use-isomorphic-effect.js} +7 -8
  635. package/dist/utils/use-reduced-motion.d.ts +33 -0
  636. package/dist/utils/use-reduced-motion.d.ts.map +1 -0
  637. package/{src/utils/use-reduced-motion.ts → dist/utils/use-reduced-motion.js} +52 -70
  638. package/{src/utils/use-unmount-effect.ts → dist/utils/use-unmount-effect.d.ts} +7 -8
  639. package/dist/utils/use-unmount-effect.d.ts.map +1 -0
  640. package/dist/utils/use-unmount-effect.js +1 -0
  641. package/{src/value/index.ts → dist/value/index.d.ts} +273 -409
  642. package/dist/value/index.d.ts.map +1 -0
  643. package/dist/value/index.js +546 -0
  644. package/dist/value/scroll/use-element-scroll.d.ts +8 -0
  645. package/dist/value/scroll/use-element-scroll.d.ts.map +1 -0
  646. package/dist/value/scroll/use-element-scroll.js +40 -0
  647. package/dist/value/scroll/use-viewport-scroll.d.ts +29 -0
  648. package/dist/value/scroll/use-viewport-scroll.d.ts.map +1 -0
  649. package/{src/value/scroll/use-viewport-scroll.ts → dist/value/scroll/use-viewport-scroll.js} +59 -81
  650. package/dist/value/scroll/utils.d.ts +25 -0
  651. package/dist/value/scroll/utils.d.ts.map +1 -0
  652. package/{src/value/scroll/utils.ts → dist/value/scroll/utils.js} +52 -76
  653. package/dist/value/use-combine-values.d.ts +9 -0
  654. package/dist/value/use-combine-values.d.ts.map +1 -0
  655. package/dist/value/use-combine-values.js +41 -0
  656. package/dist/value/use-motion-template.d.ts +31 -0
  657. package/dist/value/use-motion-template.d.ts.map +1 -0
  658. package/{src/value/use-motion-template.ts → dist/value/use-motion-template.js} +51 -57
  659. package/dist/value/use-motion-value.d.ts +27 -0
  660. package/dist/value/use-motion-value.d.ts.map +1 -0
  661. package/{src/value/use-motion-value.ts → dist/value/use-motion-value.js} +27 -27
  662. package/dist/value/use-spring.d.ts +29 -0
  663. package/dist/value/use-spring.d.ts.map +1 -0
  664. package/{src/value/use-spring.ts → dist/value/use-spring.js} +64 -84
  665. package/dist/value/use-transform.d.ts +87 -0
  666. package/dist/value/use-transform.d.ts.map +1 -0
  667. package/dist/value/use-transform.js +77 -0
  668. package/dist/value/use-velocity.d.ts +20 -0
  669. package/dist/value/use-velocity.d.ts.map +1 -0
  670. package/{src/value/use-velocity.ts → dist/value/use-velocity.js} +39 -44
  671. package/dist/value/utils/is-motion-value.d.ts +12 -0
  672. package/dist/value/utils/is-motion-value.d.ts.map +1 -0
  673. package/dist/value/utils/is-motion-value.js +8 -0
  674. package/dist/value/utils/resolve-motion-value.d.ts +16 -0
  675. package/dist/value/utils/resolve-motion-value.d.ts.map +1 -0
  676. package/{src/value/utils/resolve-motion-value.ts → dist/value/utils/resolve-motion-value.js} +25 -29
  677. package/package.json +39 -18
  678. package/src/animation/use-animated-state.ts +0 -1
  679. package/src/animation/utils/default-transitions.ts +0 -70
  680. package/src/context/DOMcontext.ts +0 -21
  681. package/src/context/LayoutGroupContext.ts +0 -13
  682. package/src/context/LazyContext.ts +0 -18
  683. package/src/context/MotionContext/UseCreateMotionContext.svelte +0 -34
  684. package/src/context/SharedLayoutContext.ts +0 -29
  685. package/src/gestures/PanSession.ts +0 -298
  686. package/src/gestures/drag/VisualElementDragControls.ts +0 -632
  687. package/src/gestures/drag/use-drag-controls.ts +0 -148
  688. package/src/motion/features/layout/Animate.ts +0 -9
  689. package/src/motion/features/layout/Measure.ts +0 -9
  690. package/src/motion/index.ts +0 -64
  691. package/src/render/dom/motion-minimal.ts +0 -22
  692. package/src/render/dom/motion-proxy.ts +0 -107
  693. package/src/render/dom/utils/create-config.ts +0 -33
  694. package/src/render/dom/utils/use-svg-props.ts +0 -1
  695. package/src/render/html/config-motion.ts +0 -23
  696. package/src/render/html/utils/create-render-state.ts +0 -18
  697. package/src/render/svg/config-motion.ts +0 -51
  698. package/src/render/utils/flat-tree.ts +0 -35
  699. package/src/render/utils/setters.ts +0 -910
  700. package/src/utils/errors.ts +0 -22
  701. package/src/utils/fix-process-env.ts +0 -22
  702. package/src/utils/is-ref-object.ts +0 -16
  703. package/src/utils/subscription-manager.ts +0 -49
  704. package/src/utils/use-force-update.ts +0 -7
  705. package/src/value/scroll/use-element-scroll.ts +0 -73
  706. package/src/value/use-combine-values.ts +0 -53
  707. package/src/value/use-transform.ts +0 -216
  708. package/src/value/utils/is-motion-value.ts +0 -15
  709. /package/{src → dist}/animation/UseAnimation.svelte +0 -0
  710. /package/{src → dist}/components/AnimatePresence/AnimatePresence.svelte +0 -0
  711. /package/{src → dist}/components/AnimateSharedLayout/AnimateSharedLayout.svelte +0 -0
  712. /package/{src → dist}/components/LazyMotion/LazyMotion.svelte +0 -0
  713. /package/{src → dist}/components/MotionDiv.svelte +0 -0
  714. /package/{src → dist}/context/MotionContext/MotionContextProvider.svelte +0 -0
  715. /package/{src → dist}/gestures/UseFocusGesture.svelte +0 -0
  716. /package/{src → dist}/gestures/UseGestures.svelte +0 -0
  717. /package/{src → dist}/gestures/UsePanGesture.svelte +0 -0
  718. /package/{src → dist}/gestures/UseTapGesture.svelte +0 -0
  719. /package/{src → dist}/motion/features/AnimationState.svelte +0 -0
  720. /package/{src → dist}/motion/features/layout/AnimateLayoutContextProvider.svelte +0 -0
  721. /package/{src → dist}/motion/features/layout/Measure.svelte +0 -0
  722. /package/{src → dist}/render/dom/M.svelte +0 -0
  723. /package/{src → dist}/render/dom/UseRender.svelte +0 -0
  724. /package/{src → dist}/render/dom/utils/UseInitialMotionProps.svelte +0 -0
  725. /package/{src → dist}/render/html/UseHTMLProps.svelte +0 -0
  726. /package/{src → dist}/render/html/UseInitialMotionValues.svelte +0 -0
  727. /package/{src → dist}/utils/UseUnmountEffect.svelte +0 -0
@@ -1,375 +1,339 @@
1
- /**
2
- based on framer-motion@4.1.17,
3
- Copyright (c) 2018 Framer B.V.
4
- */
5
- import type { VariantLabels } from "../../motion/types";
6
- import type { TargetAndTransition } from "../../types";
7
- import type { VisualElement } from "../types";
8
- import type { AnimationOptions } from "./animation";
9
- import { AnimationType } from "./types";
10
- export interface AnimationState {
11
- animateChanges: (options?: AnimationOptions, type?: AnimationType) => Promise<any>;
12
- setActive: (type: AnimationType, isActive: boolean, options?: AnimationOptions) => Promise<any>;
13
- setAnimateFunction: (fn: any) => void;
14
- isAnimated(key: string): boolean;
15
- getState: () => {
16
- [key: string]: AnimationTypeState;
17
- };
18
- }
19
- export type AnimationList = string[] | TargetAndTransition[];
20
- // export declare const variantPriorityOrder: AnimationType[];
21
- // export declare function createAnimationState(visualElement: VisualElement): AnimationState;
22
- // export declare function variantsHaveChanged(prev: any, next: any): boolean;
23
- export interface AnimationTypeState {
24
- isActive: boolean;
25
- protectedKeys: {
26
- [key: string]: true;
27
- };
28
- needsAnimating: {
29
- [key: string]: boolean;
30
- };
31
- prevResolvedValues: {
32
- [key: string]: any;
33
- };
34
- prevProp?: VariantLabels | TargetAndTransition;
35
- }
36
-
37
-
38
- /**
39
- based on framer-motion@4.0.3,
40
- Copyright (c) 2018 Framer B.V.
41
- */
42
- import { __assign, __read, __rest, __spreadArray } from 'tslib';
43
- import { isAnimationControls } from '../../animation/utils/is-animation-controls.js';
44
- import { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.js';
45
- import { shallowCompare } from '../../utils/shallow-compare.js';
46
- import { animateVisualElement } from './animation.js';
47
- import { isVariantLabel, isVariantLabels, resolveVariant } from './variants.js';
48
-
49
- var variantPriorityOrder = [
50
- AnimationType.Animate,
51
- AnimationType.Hover,
52
- AnimationType.Tap,
53
- AnimationType.Drag,
54
- AnimationType.Focus,
55
- AnimationType.Exit,
56
- ];
57
- var reversePriorityOrder = __spreadArray([], __read(variantPriorityOrder)).reverse();
58
- var numAnimationTypes = variantPriorityOrder.length;
59
- function animateList(visualElement: VisualElement) {
60
- return function (animations) {
61
- return Promise.all(animations.map(function (_a) {
62
- var animation = _a.animation, options = _a.options;
63
- return animateVisualElement(visualElement, animation, options);
64
- }));
65
- };
66
- }
67
- function createAnimationState(visualElement: VisualElement) {
68
- var animate = animateList(visualElement);
69
- var state = createState();
70
- var allAnimatedKeys = {};
71
- var isInitialRender = true;
72
- /**
73
- * This function will be used to reduce the animation definitions for
74
- * each active animation type into an object of resolved values for it.
75
- */
76
- var buildResolvedTypeValues = function (acc, definition) {
77
- var resolved = resolveVariant(visualElement, definition);
78
- if (resolved) {
79
- resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
80
- acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
81
- }
82
- return acc;
83
- };
84
- function isAnimated(key) {
85
- return allAnimatedKeys[key] !== undefined;
86
- }
87
- /**
88
- * This just allows us to inject mocked animation functions
89
- * @internal
90
- */
91
- function setAnimateFunction(makeAnimator) {
92
- animate = makeAnimator(visualElement);
93
- }
94
- /**
95
- * When we receive new props, we need to:
96
- * 1. Create a list of protected keys for each type. This is a directory of
97
- * value keys that are currently being "handled" by types of a higher priority
98
- * so that whenever an animation is played of a given type, these values are
99
- * protected from being animated.
100
- * 2. Determine if an animation type needs animating.
101
- * 3. Determine if any values have been removed from a type and figure out
102
- * what to animate those to.
103
- */
104
- function animateChanges(options, changedActiveType) {
105
- var _a;
106
- var props = visualElement.getProps();
107
- var context = visualElement.getVariantContext(true) || {};
108
- /**
109
- * A list of animations that we'll build into as we iterate through the animation
110
- * types. This will get executed at the end of the function.
111
- */
112
- var animations = [];
113
- /**
114
- * Keep track of which values have been removed. Then, as we hit lower priority
115
- * animation types, we can check if they contain removed values and animate to that.
116
- */
117
- var removedKeys = new Set();
118
- /**
119
- * A dictionary of all encountered keys. This is an object to let us build into and
120
- * copy it without iteration. Each time we hit an animation type we set its protected
121
- * keys - the keys its not allowed to animate - to the latest version of this object.
122
- */
123
- var encounteredKeys = {};
124
- /**
125
- * If a variant has been removed at a given index, and this component is controlling
126
- * variant animations, we want to ensure lower-priority variants are forced to animate.
127
- */
128
- var removedVariantIndex = Infinity;
129
- var _loop_1 = function (i) {
130
- var type = reversePriorityOrder[i];
131
- var typeState = state[type];
132
- var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];
133
- var propIsVariant = isVariantLabel(prop);
134
- /**
135
- * If this type has *just* changed isActive status, set activeDelta
136
- * to that status. Otherwise set to null.
137
- */
138
- var activeDelta = type === changedActiveType ? typeState.isActive : null;
139
- if (activeDelta === false)
140
- removedVariantIndex = i;
141
- /**
142
- * If this prop is an inherited variant, rather than been set directly on the
143
- * component itself, we want to make sure we allow the parent to trigger animations.
144
- *
145
- * TODO: Can probably change this to a !isControllingVariants check
146
- */
147
- var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
148
- /**
149
- *
150
- */
151
- if (isInherited &&
152
- isInitialRender &&
153
- visualElement.manuallyAnimateOnMount) {
154
- isInherited = false;
155
- }
156
- /**
157
- * Set all encountered keys so far as the protected keys for this type. This will
158
- * be any key that has been animated or otherwise handled by active, higher-priortiy types.
159
- */
160
- typeState.protectedKeys = __assign({}, encounteredKeys);
161
- // Check if we can skip analysing this prop early
162
- if (
163
- // If it isn't active and hasn't *just* been set as inactive
164
- (!typeState.isActive && activeDelta === null) ||
165
- // If we didn't and don't have any defined prop for this animation type
166
- (!prop && !typeState.prevProp) ||
167
- // Or if the prop doesn't define an animation
168
- isAnimationControls(prop) ||
169
- typeof prop === "boolean") {
170
- return "continue";
171
- }
172
- /**
173
- * As we go look through the values defined on this type, if we detect
174
- * a changed value or a value that was removed in a higher priority, we set
175
- * this to true and add this prop to the animation list.
176
- */
177
- var shouldAnimateType = variantsHaveChanged(typeState.prevProp, prop) ||
178
- // If we're making this variant active, we want to always make it active
179
- (type === changedActiveType &&
180
- typeState.isActive &&
181
- !isInherited &&
182
- propIsVariant) ||
183
- // If we removed a higher-priority variant (i is in reverse order)
184
- (i > removedVariantIndex && propIsVariant);
185
- /**
186
- * As animations can be set as variant lists, variants or target objects, we
187
- * coerce everything to an array if it isn't one already
188
- */
189
- var definitionList = Array.isArray(prop) ? prop : [prop];
190
- /**
191
- * Build an object of all the resolved values. We'll use this in the subsequent
192
- * animateChanges calls to determine whether a value has changed.
193
- */
194
- var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
195
- if (activeDelta === false)
196
- resolvedValues = {};
197
- /**
198
- * Now we need to loop through all the keys in the prev prop and this prop,
199
- * and decide:
200
- * 1. If the value has changed, and needs animating
201
- * 2. If it has been removed, and needs adding to the removedKeys set
202
- * 3. If it has been removed in a higher priority type and needs animating
203
- * 4. If it hasn't been removed in a higher priority but hasn't changed, and
204
- * needs adding to the type's protectedKeys list.
205
- */
206
- var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;
207
- var allKeys = __assign(__assign({}, prevResolvedValues), resolvedValues);
208
- var markToAnimate = function (key) {
209
- shouldAnimateType = true;
210
- removedKeys.delete(key);
211
- typeState.needsAnimating[key] = true;
212
- };
213
- for (var key in allKeys) {
214
- var next = resolvedValues[key];
215
- var prev = prevResolvedValues[key];
216
- // If we've already handled this we can just skip ahead
217
- if (encounteredKeys.hasOwnProperty(key))
218
- continue;
219
- /**
220
- * If the value has changed, we probably want to animate it.
221
- */
222
- if (next !== prev) {
223
- /**
224
- * If both values are keyframes, we need to shallow compare them to
225
- * detect whether any value has changed. If it has, we animate it.
226
- */
227
- if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
228
- if (!shallowCompare(next, prev)) {
229
- markToAnimate(key);
230
- }
231
- else {
232
- /**
233
- * If it hasn't changed, we want to ensure it doesn't animate by
234
- * adding it to the list of protected keys.
235
- */
236
- typeState.protectedKeys[key] = true;
237
- }
238
- }
239
- else if (next !== undefined) {
240
- // If next is defined and doesn't equal prev, it needs animating
241
- markToAnimate(key);
242
- }
243
- else {
244
- // If it's undefined, it's been removed.
245
- removedKeys.add(key);
246
- }
247
- }
248
- else if (next !== undefined && removedKeys.has(key)) {
249
- /**
250
- * If next hasn't changed and it isn't undefined, we want to check if it's
251
- * been removed by a higher priority
252
- */
253
- markToAnimate(key);
254
- }
255
- else {
256
- /**
257
- * If it hasn't changed, we add it to the list of protected values
258
- * to ensure it doesn't get animated.
259
- */
260
- typeState.protectedKeys[key] = true;
261
- }
262
- }
263
- /**
264
- * Update the typeState so next time animateChanges is called we can compare the
265
- * latest prop and resolvedValues to these.
266
- */
267
- typeState.prevProp = prop;
268
- typeState.prevResolvedValues = resolvedValues;
269
- /**
270
- *
271
- */
272
- if (typeState.isActive) {
273
- encounteredKeys = __assign(__assign({}, encounteredKeys), resolvedValues);
274
- }
275
- if (isInitialRender && visualElement.blockInitialAnimation) {
276
- shouldAnimateType = false;
277
- }
278
- /**
279
- * If this is an inherited prop we want to hard-block animations
280
- * TODO: Test as this should probably still handle animations triggered
281
- * by removed values?
282
- */
283
- if (shouldAnimateType && !isInherited) {
284
- animations.push.apply(animations, __spreadArray([], __read(definitionList.map(function (animation) { return ({
285
- animation: animation,
286
- options: __assign({ type: type }, options),
287
- }); }))));
288
- }
289
- };
290
- /**
291
- * Iterate through all animation types in reverse priority order. For each, we want to
292
- * detect which values it's handling and whether or not they've changed (and therefore
293
- * need to be animated). If any values have been removed, we want to detect those in
294
- * lower priority props and flag for animation.
295
- */
296
- for (var i = 0; i < numAnimationTypes; i++) {
297
- _loop_1(i);
298
- }
299
- allAnimatedKeys = __assign({}, encounteredKeys);
300
- /**
301
- * If there are some removed value that haven't been dealt with,
302
- * we need to create a new animation that falls back either to the value
303
- * defined in the style prop, or the last read value.
304
- */
305
- if (removedKeys.size) {
306
- var fallbackAnimation_1 = {};
307
- removedKeys.forEach(function (key) {
308
- var fallbackTarget = visualElement.getBaseTarget(key);
309
- if (fallbackTarget !== undefined) {
310
- fallbackAnimation_1[key] = fallbackTarget;
311
- }
312
- });
313
- animations.push({ animation: fallbackAnimation_1 });
314
- }
315
- var shouldAnimate = Boolean(animations.length);
316
- if (isInitialRender &&
317
- props.initial === false &&
318
- !visualElement.manuallyAnimateOnMount) {
319
- shouldAnimate = false;
320
- }
321
- isInitialRender = false;
322
- return shouldAnimate ? animate(animations) : Promise.resolve();
323
- }
324
- /**
325
- * Change whether a certain animation type is active.
326
- */
327
- function setActive(type, isActive, options) {
328
- var _a;
329
- // If the active state hasn't changed, we can safely do nothing here
330
- if (state[type].isActive === isActive)
331
- return Promise.resolve();
332
- // Propagate active change to children
333
- (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
334
- state[type].isActive = isActive;
335
- return animateChanges(options, type);
336
- }
337
- return {
338
- isAnimated: isAnimated,
339
- animateChanges: animateChanges,
340
- setActive: setActive,
341
- setAnimateFunction: setAnimateFunction,
342
- getState: function () { return state; },
343
- } as AnimationState;
344
- }
345
- function variantsHaveChanged(prev: any, next: any) {
346
- if (typeof next === "string") {
347
- return next !== prev;
348
- }
349
- else if (isVariantLabels(next)) {
350
- return !shallowCompare(next, prev);
351
- }
352
- return false;
353
- }
354
- function createTypeState(isActive: boolean = false) {
355
- return {
356
- isActive: isActive,
357
- protectedKeys: {},
358
- needsAnimating: {},
359
- prevResolvedValues: {},
360
- };
361
- }
362
- function createState() {
363
- var _a;
364
- return _a = {},
365
- _a[AnimationType.Animate] = createTypeState(true),
366
- _a[AnimationType.Hover] = createTypeState(),
367
- _a[AnimationType.Tap] = createTypeState(),
368
- _a[AnimationType.Drag] = createTypeState(),
369
- _a[AnimationType.Focus] = createTypeState(),
370
- _a[AnimationType.Exit] = createTypeState(),
371
- _a;
372
- }
373
-
374
- export { createAnimationState, variantPriorityOrder, variantsHaveChanged };
375
-
1
+ import { AnimationType } from "./types";
2
+ /**
3
+ based on framer-motion@4.0.3,
4
+ Copyright (c) 2018 Framer B.V.
5
+ */
6
+ import { __assign, __read, __rest, __spreadArray } from 'tslib';
7
+ import { isAnimationControls } from '../../animation/utils/is-animation-controls.js';
8
+ import { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.js';
9
+ import { shallowCompare } from '../../utils/shallow-compare.js';
10
+ import { animateVisualElement } from './animation.js';
11
+ import { isVariantLabel, isVariantLabels, resolveVariant } from './variants.js';
12
+ var variantPriorityOrder = [
13
+ AnimationType.Animate,
14
+ AnimationType.Hover,
15
+ AnimationType.Tap,
16
+ AnimationType.Drag,
17
+ AnimationType.Focus,
18
+ AnimationType.Exit,
19
+ ];
20
+ var reversePriorityOrder = __spreadArray([], __read(variantPriorityOrder)).reverse();
21
+ var numAnimationTypes = variantPriorityOrder.length;
22
+ function animateList(visualElement) {
23
+ return function (animations) {
24
+ return Promise.all(animations.map(function (_a) {
25
+ var animation = _a.animation, options = _a.options;
26
+ return animateVisualElement(visualElement, animation, options);
27
+ }));
28
+ };
29
+ }
30
+ function createAnimationState(visualElement) {
31
+ var animate = animateList(visualElement);
32
+ var state = createState();
33
+ var allAnimatedKeys = {};
34
+ var isInitialRender = true;
35
+ /**
36
+ * This function will be used to reduce the animation definitions for
37
+ * each active animation type into an object of resolved values for it.
38
+ */
39
+ var buildResolvedTypeValues = function (acc, definition) {
40
+ var resolved = resolveVariant(visualElement, definition);
41
+ if (resolved) {
42
+ resolved.transition;
43
+ var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
44
+ acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
45
+ }
46
+ return acc;
47
+ };
48
+ function isAnimated(key) {
49
+ return allAnimatedKeys[key] !== undefined;
50
+ }
51
+ /**
52
+ * This just allows us to inject mocked animation functions
53
+ * @internal
54
+ */
55
+ function setAnimateFunction(makeAnimator) {
56
+ animate = makeAnimator(visualElement);
57
+ }
58
+ /**
59
+ * When we receive new props, we need to:
60
+ * 1. Create a list of protected keys for each type. This is a directory of
61
+ * value keys that are currently being "handled" by types of a higher priority
62
+ * so that whenever an animation is played of a given type, these values are
63
+ * protected from being animated.
64
+ * 2. Determine if an animation type needs animating.
65
+ * 3. Determine if any values have been removed from a type and figure out
66
+ * what to animate those to.
67
+ */
68
+ function animateChanges(options, changedActiveType) {
69
+ var _a;
70
+ var props = visualElement.getProps();
71
+ var context = visualElement.getVariantContext(true) || {};
72
+ /**
73
+ * A list of animations that we'll build into as we iterate through the animation
74
+ * types. This will get executed at the end of the function.
75
+ */
76
+ var animations = [];
77
+ /**
78
+ * Keep track of which values have been removed. Then, as we hit lower priority
79
+ * animation types, we can check if they contain removed values and animate to that.
80
+ */
81
+ var removedKeys = new Set();
82
+ /**
83
+ * A dictionary of all encountered keys. This is an object to let us build into and
84
+ * copy it without iteration. Each time we hit an animation type we set its protected
85
+ * keys - the keys its not allowed to animate - to the latest version of this object.
86
+ */
87
+ var encounteredKeys = {};
88
+ /**
89
+ * If a variant has been removed at a given index, and this component is controlling
90
+ * variant animations, we want to ensure lower-priority variants are forced to animate.
91
+ */
92
+ var removedVariantIndex = Infinity;
93
+ var _loop_1 = function (i) {
94
+ var type = reversePriorityOrder[i];
95
+ var typeState = state[type];
96
+ var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];
97
+ var propIsVariant = isVariantLabel(prop);
98
+ /**
99
+ * If this type has *just* changed isActive status, set activeDelta
100
+ * to that status. Otherwise set to null.
101
+ */
102
+ var activeDelta = type === changedActiveType ? typeState.isActive : null;
103
+ if (activeDelta === false)
104
+ removedVariantIndex = i;
105
+ /**
106
+ * If this prop is an inherited variant, rather than been set directly on the
107
+ * component itself, we want to make sure we allow the parent to trigger animations.
108
+ *
109
+ * TODO: Can probably change this to a !isControllingVariants check
110
+ */
111
+ var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
112
+ /**
113
+ *
114
+ */
115
+ if (isInherited &&
116
+ isInitialRender &&
117
+ visualElement.manuallyAnimateOnMount) {
118
+ isInherited = false;
119
+ }
120
+ /**
121
+ * Set all encountered keys so far as the protected keys for this type. This will
122
+ * be any key that has been animated or otherwise handled by active, higher-priortiy types.
123
+ */
124
+ typeState.protectedKeys = __assign({}, encounteredKeys);
125
+ // Check if we can skip analysing this prop early
126
+ if (
127
+ // If it isn't active and hasn't *just* been set as inactive
128
+ (!typeState.isActive && activeDelta === null) ||
129
+ // If we didn't and don't have any defined prop for this animation type
130
+ (!prop && !typeState.prevProp) ||
131
+ // Or if the prop doesn't define an animation
132
+ isAnimationControls(prop) ||
133
+ typeof prop === "boolean") {
134
+ return "continue";
135
+ }
136
+ /**
137
+ * As we go look through the values defined on this type, if we detect
138
+ * a changed value or a value that was removed in a higher priority, we set
139
+ * this to true and add this prop to the animation list.
140
+ */
141
+ var shouldAnimateType = variantsHaveChanged(typeState.prevProp, prop) ||
142
+ // If we're making this variant active, we want to always make it active
143
+ (type === changedActiveType &&
144
+ typeState.isActive &&
145
+ !isInherited &&
146
+ propIsVariant) ||
147
+ // If we removed a higher-priority variant (i is in reverse order)
148
+ (i > removedVariantIndex && propIsVariant);
149
+ /**
150
+ * As animations can be set as variant lists, variants or target objects, we
151
+ * coerce everything to an array if it isn't one already
152
+ */
153
+ var definitionList = Array.isArray(prop) ? prop : [prop];
154
+ /**
155
+ * Build an object of all the resolved values. We'll use this in the subsequent
156
+ * animateChanges calls to determine whether a value has changed.
157
+ */
158
+ var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
159
+ if (activeDelta === false)
160
+ resolvedValues = {};
161
+ /**
162
+ * Now we need to loop through all the keys in the prev prop and this prop,
163
+ * and decide:
164
+ * 1. If the value has changed, and needs animating
165
+ * 2. If it has been removed, and needs adding to the removedKeys set
166
+ * 3. If it has been removed in a higher priority type and needs animating
167
+ * 4. If it hasn't been removed in a higher priority but hasn't changed, and
168
+ * needs adding to the type's protectedKeys list.
169
+ */
170
+ var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;
171
+ var allKeys = __assign(__assign({}, prevResolvedValues), resolvedValues);
172
+ var markToAnimate = function (key) {
173
+ shouldAnimateType = true;
174
+ removedKeys.delete(key);
175
+ typeState.needsAnimating[key] = true;
176
+ };
177
+ for (var key in allKeys) {
178
+ var next = resolvedValues[key];
179
+ var prev = prevResolvedValues[key];
180
+ // If we've already handled this we can just skip ahead
181
+ if (encounteredKeys.hasOwnProperty(key))
182
+ continue;
183
+ /**
184
+ * If the value has changed, we probably want to animate it.
185
+ */
186
+ if (next !== prev) {
187
+ /**
188
+ * If both values are keyframes, we need to shallow compare them to
189
+ * detect whether any value has changed. If it has, we animate it.
190
+ */
191
+ if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
192
+ if (!shallowCompare(next, prev)) {
193
+ markToAnimate(key);
194
+ }
195
+ else {
196
+ /**
197
+ * If it hasn't changed, we want to ensure it doesn't animate by
198
+ * adding it to the list of protected keys.
199
+ */
200
+ typeState.protectedKeys[key] = true;
201
+ }
202
+ }
203
+ else if (next !== undefined) {
204
+ // If next is defined and doesn't equal prev, it needs animating
205
+ markToAnimate(key);
206
+ }
207
+ else {
208
+ // If it's undefined, it's been removed.
209
+ removedKeys.add(key);
210
+ }
211
+ }
212
+ else if (next !== undefined && removedKeys.has(key)) {
213
+ /**
214
+ * If next hasn't changed and it isn't undefined, we want to check if it's
215
+ * been removed by a higher priority
216
+ */
217
+ markToAnimate(key);
218
+ }
219
+ else {
220
+ /**
221
+ * If it hasn't changed, we add it to the list of protected values
222
+ * to ensure it doesn't get animated.
223
+ */
224
+ typeState.protectedKeys[key] = true;
225
+ }
226
+ }
227
+ /**
228
+ * Update the typeState so next time animateChanges is called we can compare the
229
+ * latest prop and resolvedValues to these.
230
+ */
231
+ typeState.prevProp = prop;
232
+ typeState.prevResolvedValues = resolvedValues;
233
+ /**
234
+ *
235
+ */
236
+ if (typeState.isActive) {
237
+ encounteredKeys = __assign(__assign({}, encounteredKeys), resolvedValues);
238
+ }
239
+ if (isInitialRender && visualElement.blockInitialAnimation) {
240
+ shouldAnimateType = false;
241
+ }
242
+ /**
243
+ * If this is an inherited prop we want to hard-block animations
244
+ * TODO: Test as this should probably still handle animations triggered
245
+ * by removed values?
246
+ */
247
+ if (shouldAnimateType && !isInherited) {
248
+ animations.push.apply(animations, __spreadArray([], __read(definitionList.map(function (animation) {
249
+ return ({
250
+ animation: animation,
251
+ options: __assign({ type: type }, options),
252
+ });
253
+ }))));
254
+ }
255
+ };
256
+ /**
257
+ * Iterate through all animation types in reverse priority order. For each, we want to
258
+ * detect which values it's handling and whether or not they've changed (and therefore
259
+ * need to be animated). If any values have been removed, we want to detect those in
260
+ * lower priority props and flag for animation.
261
+ */
262
+ for (var i = 0; i < numAnimationTypes; i++) {
263
+ _loop_1(i);
264
+ }
265
+ allAnimatedKeys = __assign({}, encounteredKeys);
266
+ /**
267
+ * If there are some removed value that haven't been dealt with,
268
+ * we need to create a new animation that falls back either to the value
269
+ * defined in the style prop, or the last read value.
270
+ */
271
+ if (removedKeys.size) {
272
+ var fallbackAnimation_1 = {};
273
+ removedKeys.forEach(function (key) {
274
+ var fallbackTarget = visualElement.getBaseTarget(key);
275
+ if (fallbackTarget !== undefined) {
276
+ fallbackAnimation_1[key] = fallbackTarget;
277
+ }
278
+ });
279
+ animations.push({ animation: fallbackAnimation_1 });
280
+ }
281
+ var shouldAnimate = Boolean(animations.length);
282
+ if (isInitialRender &&
283
+ props.initial === false &&
284
+ !visualElement.manuallyAnimateOnMount) {
285
+ shouldAnimate = false;
286
+ }
287
+ isInitialRender = false;
288
+ return shouldAnimate ? animate(animations) : Promise.resolve();
289
+ }
290
+ /**
291
+ * Change whether a certain animation type is active.
292
+ */
293
+ function setActive(type, isActive, options) {
294
+ var _a;
295
+ // If the active state hasn't changed, we can safely do nothing here
296
+ if (state[type].isActive === isActive)
297
+ return Promise.resolve();
298
+ // Propagate active change to children
299
+ (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
300
+ state[type].isActive = isActive;
301
+ return animateChanges(options, type);
302
+ }
303
+ return {
304
+ isAnimated: isAnimated,
305
+ animateChanges: animateChanges,
306
+ setActive: setActive,
307
+ setAnimateFunction: setAnimateFunction,
308
+ getState: function () { return state; },
309
+ };
310
+ }
311
+ function variantsHaveChanged(prev, next) {
312
+ if (typeof next === "string") {
313
+ return next !== prev;
314
+ }
315
+ else if (isVariantLabels(next)) {
316
+ return !shallowCompare(next, prev);
317
+ }
318
+ return false;
319
+ }
320
+ function createTypeState(isActive = false) {
321
+ return {
322
+ isActive: isActive,
323
+ protectedKeys: {},
324
+ needsAnimating: {},
325
+ prevResolvedValues: {},
326
+ };
327
+ }
328
+ function createState() {
329
+ var _a;
330
+ return _a = {},
331
+ _a[AnimationType.Animate] = createTypeState(true),
332
+ _a[AnimationType.Hover] = createTypeState(),
333
+ _a[AnimationType.Tap] = createTypeState(),
334
+ _a[AnimationType.Drag] = createTypeState(),
335
+ _a[AnimationType.Focus] = createTypeState(),
336
+ _a[AnimationType.Exit] = createTypeState(),
337
+ _a;
338
+ }
339
+ export { createAnimationState, variantPriorityOrder, variantsHaveChanged };