motion-start 0.0.1 → 0.1.0

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