framer-motion 12.0.0-alpha.1 → 12.0.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 (171) hide show
  1. package/README.md +58 -52
  2. package/client/README.md +1 -0
  3. package/client/package.json +6 -0
  4. package/dist/cjs/{client-entry.js → client.js} +4582 -4926
  5. package/dist/cjs/dom-mini.js +644 -0
  6. package/dist/cjs/{dom-entry.js → dom.js} +2848 -2713
  7. package/dist/cjs/index.js +7132 -7447
  8. package/dist/cjs/{m-entry.js → m.js} +427 -455
  9. package/dist/cjs/mini.js +273 -0
  10. package/dist/{client-entry.d.ts → client.d.ts} +464 -568
  11. package/dist/dom-mini.d.ts +230 -0
  12. package/dist/dom-mini.js +1 -0
  13. package/dist/dom.d.ts +579 -0
  14. package/dist/dom.js +1 -1
  15. package/dist/es/animation/animate/index.mjs +34 -0
  16. package/dist/es/animation/animate/resolve-subjects.mjs +19 -0
  17. package/dist/es/animation/animate/sequence.mjs +14 -0
  18. package/dist/es/animation/{interfaces → animate}/single-value.mjs +1 -1
  19. package/dist/es/animation/animate/subject.mjs +52 -0
  20. package/dist/es/animation/animators/AcceleratedAnimation.mjs +40 -17
  21. package/dist/es/animation/animators/BaseAnimation.mjs +7 -2
  22. package/dist/es/animation/animators/MainThreadAnimation.mjs +18 -10
  23. package/dist/es/animation/animators/utils/can-animate.mjs +4 -2
  24. package/dist/es/animation/animators/waapi/NativeAnimation.mjs +112 -0
  25. package/dist/es/animation/animators/waapi/animate-elements.mjs +34 -0
  26. package/dist/es/animation/animators/waapi/animate-sequence.mjs +13 -0
  27. package/dist/es/animation/animators/waapi/animate-style.mjs +12 -0
  28. package/dist/es/animation/animators/waapi/index.mjs +4 -4
  29. package/dist/es/animation/animators/waapi/utils/style.mjs +8 -0
  30. package/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +13 -0
  31. package/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +5 -0
  32. package/dist/es/animation/generators/spring/defaults.mjs +27 -0
  33. package/dist/es/animation/generators/spring/find.mjs +9 -13
  34. package/dist/es/animation/generators/spring/index.mjs +55 -18
  35. package/dist/es/animation/hooks/animation-controls.mjs +1 -1
  36. package/dist/es/animation/hooks/use-animate-style.mjs +17 -0
  37. package/dist/es/animation/hooks/use-animate.mjs +1 -1
  38. package/dist/es/animation/interfaces/motion-value.mjs +7 -16
  39. package/dist/es/animation/interfaces/visual-element-target.mjs +7 -6
  40. package/dist/es/animation/optimized-appear/handoff.mjs +2 -1
  41. package/dist/es/animation/optimized-appear/start.mjs +16 -9
  42. package/dist/es/animation/optimized-appear/store-id.mjs +1 -1
  43. package/dist/es/animation/optimized-appear/store.mjs +2 -2
  44. package/dist/es/animation/sequence/create.mjs +45 -22
  45. package/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +5 -0
  46. package/dist/es/animation/sequence/utils/normalize-times.mjs +13 -0
  47. package/dist/es/animation/utils/create-visual-element.mjs +18 -2
  48. package/dist/es/animation/utils/default-transitions.mjs +1 -1
  49. package/dist/es/animation/utils/{transitions.mjs → is-transition-defined.mjs} +1 -6
  50. package/dist/es/components/AnimatePresence/PresenceChild.mjs +13 -10
  51. package/dist/es/components/AnimatePresence/index.mjs +10 -7
  52. package/dist/es/components/AnimatePresence/use-presence.mjs +6 -3
  53. package/dist/es/components/AnimateSharedLayout.mjs +1 -1
  54. package/dist/es/components/Reorder/Group.mjs +4 -4
  55. package/dist/es/components/Reorder/Item.mjs +4 -4
  56. package/dist/es/dom-mini.mjs +2 -0
  57. package/dist/es/{dom-entry.mjs → dom.mjs} +14 -8
  58. package/dist/es/easing/back.mjs +3 -3
  59. package/dist/es/easing/cubic-bezier.mjs +1 -1
  60. package/dist/es/easing/ease.mjs +3 -3
  61. package/dist/es/easing/steps.mjs +15 -0
  62. package/dist/es/easing/utils/map.mjs +6 -6
  63. package/dist/es/events/event-info.mjs +4 -4
  64. package/dist/es/frameloop/frame.mjs +3 -3
  65. package/dist/es/frameloop/render-step.mjs +3 -2
  66. package/dist/es/gestures/drag/VisualElementDragControls.mjs +15 -21
  67. package/dist/es/gestures/drag/index.mjs +1 -1
  68. package/dist/es/gestures/drag/utils/constraints.mjs +1 -1
  69. package/dist/es/gestures/hover.mjs +19 -22
  70. package/dist/es/gestures/pan/PanSession.mjs +5 -5
  71. package/dist/es/gestures/pan/index.mjs +1 -1
  72. package/dist/es/gestures/press.mjs +19 -119
  73. package/dist/es/index.mjs +43 -38
  74. package/dist/es/mini.mjs +1 -0
  75. package/dist/es/motion/index.mjs +11 -7
  76. package/dist/es/motion/utils/is-forced-motion-value.mjs +1 -1
  77. package/dist/es/motion/utils/use-motion-ref.mjs +3 -1
  78. package/dist/es/motion/utils/use-visual-element.mjs +21 -14
  79. package/dist/es/motion/utils/use-visual-state.mjs +36 -59
  80. package/dist/es/projection/animation/mix-values.mjs +3 -4
  81. package/dist/es/projection/node/create-projection-node.mjs +17 -17
  82. package/dist/es/render/VisualElement.mjs +19 -47
  83. package/dist/es/render/dom/DOMKeyframesResolver.mjs +4 -3
  84. package/dist/es/render/dom/DOMVisualElement.mjs +15 -0
  85. package/dist/es/render/dom/resize/handle-element.mjs +1 -1
  86. package/dist/es/render/dom/scroll/index.mjs +66 -15
  87. package/dist/es/render/dom/scroll/info.mjs +1 -1
  88. package/dist/es/render/dom/scroll/offsets/index.mjs +6 -5
  89. package/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
  90. package/dist/es/render/dom/utils/is-css-variable.mjs +4 -2
  91. package/dist/es/render/dom/utils/unit-conversion.mjs +2 -14
  92. package/dist/es/render/dom/value-types/number-browser.mjs +41 -0
  93. package/dist/es/render/dom/value-types/number.mjs +7 -63
  94. package/dist/es/render/dom/value-types/transform.mjs +31 -0
  95. package/dist/es/render/dom/viewport/index.mjs +3 -3
  96. package/dist/es/render/html/HTMLVisualElement.mjs +6 -21
  97. package/dist/es/render/html/config-motion.mjs +0 -1
  98. package/dist/es/render/html/utils/build-styles.mjs +2 -2
  99. package/dist/es/render/html/utils/build-transform.mjs +1 -1
  100. package/dist/es/render/html/utils/keys-position.mjs +13 -0
  101. package/dist/es/render/html/utils/scrape-motion-values.mjs +0 -7
  102. package/dist/es/render/object/ObjectVisualElement.mjs +41 -0
  103. package/dist/es/render/svg/SVGVisualElement.mjs +6 -6
  104. package/dist/es/render/svg/config-motion.mjs +57 -24
  105. package/dist/es/render/svg/utils/build-attrs.mjs +1 -1
  106. package/dist/es/render/svg/utils/scrape-motion-values.mjs +1 -1
  107. package/dist/es/render/utils/animation-state.mjs +8 -4
  108. package/dist/es/render/utils/get-variant-context.mjs +28 -0
  109. package/dist/es/render/utils/motion-values.mjs +1 -1
  110. package/dist/es/utils/delay.mjs +5 -1
  111. package/dist/es/utils/get-context-window.mjs +1 -1
  112. package/dist/es/utils/interpolate.mjs +6 -5
  113. package/dist/es/utils/mix/color.mjs +2 -2
  114. package/dist/es/utils/mix/complex.mjs +1 -1
  115. package/dist/es/utils/offsets/fill.mjs +1 -1
  116. package/dist/es/utils/use-instant-transition.mjs +1 -1
  117. package/dist/es/value/index.mjs +2 -2
  118. package/dist/es/value/types/color/hex.mjs +1 -1
  119. package/dist/es/value/types/color/hsla.mjs +3 -3
  120. package/dist/es/value/types/color/index.mjs +1 -2
  121. package/dist/es/value/types/color/rgba.mjs +3 -3
  122. package/dist/es/value/types/color/utils.mjs +7 -3
  123. package/dist/es/value/types/complex/filter.mjs +1 -1
  124. package/dist/es/value/types/complex/index.mjs +4 -2
  125. package/dist/es/value/types/numbers/units.mjs +6 -8
  126. package/dist/es/value/types/utils/color-regex.mjs +3 -0
  127. package/dist/es/value/types/utils/float-regex.mjs +3 -0
  128. package/dist/es/value/types/utils/is-nullish.mjs +5 -0
  129. package/dist/es/value/types/utils/sanitize.mjs +5 -0
  130. package/dist/es/value/types/utils/single-color-regex.mjs +3 -0
  131. package/dist/es/value/use-inverted-scale.mjs +1 -1
  132. package/dist/es/value/use-scroll.mjs +3 -3
  133. package/dist/es/value/use-spring.mjs +3 -3
  134. package/dist/es/value/use-will-change/WillChangeMotionValue.mjs +5 -30
  135. package/dist/es/value/use-will-change/add-will-change.mjs +1 -13
  136. package/dist/es/value/use-will-change/get-will-change-name.mjs +1 -1
  137. package/dist/framer-motion.dev.js +8715 -8448
  138. package/dist/framer-motion.js +1 -1
  139. package/dist/index.d.ts +1794 -2232
  140. package/dist/{m-entry.d.ts → m.d.ts} +464 -568
  141. package/dist/mini.d.ts +6 -0
  142. package/dist/mini.js +1 -0
  143. package/dist/{three-entry.d.ts → three.d.ts} +391 -518
  144. package/dom/mini/package.json +6 -0
  145. package/dom/package.json +3 -3
  146. package/m/package.json +6 -0
  147. package/mini/package.json +6 -0
  148. package/package.json +54 -34
  149. package/dist/dom-entry.d.ts +0 -985
  150. package/dist/es/animation/GroupPlaybackControls.mjs +0 -83
  151. package/dist/es/animation/animate.mjs +0 -83
  152. package/dist/es/animation/animators/waapi/easing.mjs +0 -40
  153. package/dist/es/animation/generators/utils/calc-duration.mjs +0 -17
  154. package/dist/es/easing/utils/create-generator-easing.mjs +0 -18
  155. package/dist/es/easing/utils/is-bezier-definition.mjs +0 -3
  156. package/dist/es/events/utils/is-primary-pointer.mjs +0 -18
  157. package/dist/es/gestures/drag/utils/lock.mjs +0 -53
  158. package/dist/es/gestures/utils/is-node-or-child.mjs +0 -20
  159. package/dist/es/render/components/motion/namespace.mjs +0 -2
  160. package/dist/es/render/dom/scroll/supports.mjs +0 -5
  161. package/dist/es/render/dom/utils/resolve-element.mjs +0 -28
  162. package/dist/es/utils/errors.mjs +0 -18
  163. package/dist/es/utils/memo.mjs +0 -10
  164. package/dist/es/utils/noop.mjs +0 -3
  165. package/dist/es/utils/progress.mjs +0 -18
  166. package/dist/es/utils/time-conversion.mjs +0 -10
  167. package/dist/es/value/types/utils.mjs +0 -18
  168. /package/dist/es/{client-entry.mjs → client.mjs} +0 -0
  169. /package/dist/es/{m-entry.mjs → m.mjs} +0 -0
  170. /package/dist/es/{projection-entry.mjs → projection.mjs} +0 -0
  171. /package/dist/es/render/html/utils/{transform.mjs → keys-transform.mjs} +0 -0
package/README.md CHANGED
@@ -1,25 +1,7 @@
1
1
  <p align="center">
2
- <img src="https://framerusercontent.com/images/48ha9ZR9oZQGQ6gZ8YUfElP3T0A.png" width="50" height="50" alt="Framer Motion Icon" />
3
- </p>
4
- <h1 align="center">Framer Motion</h1>
5
- <h3 align="center">
6
- An open source motion library for React, made by Framer.
7
- </h3>
8
- <h3 align="center">
9
- Motion powers Framer, the web builder for creative pros. Design and ship your dream site. Zero code, maximum speed.
10
- </h3>
11
- <br/>
12
- <p align="center">
13
- <a href="https://www.framer.com?utm_source=motion-readme">
14
- <img src="https://framerusercontent.com/images/atXqxn4JhKm4LXVncdNjkKV7yCU.png" width="140" alt="Start for free" />
15
- </a>
16
- </p>
17
- <br/>
18
- <p align="center">
19
- <a href="https://www.framer.com?utm_source=motion-readme">
20
- <img src="https://framerusercontent.com/images/pMSOmGP2V8sSaZRV2D7i4HTBTe4.png" width="1000" alt="Framer Banner" />
21
- </a>
2
+ <img width="100" height="100" alt="Motion logo" src="https://user-images.githubusercontent.com/7850794/164965523-3eced4c4-6020-467e-acde-f11b7900ad62.png" />
22
3
  </p>
4
+ <h1 align="center">Motion for React</h1>
23
5
 
24
6
  <br>
25
7
 
@@ -30,19 +12,18 @@ Motion powers Framer, the web builder for creative pros. Design and ship your dr
30
12
  <a href="https://www.npmjs.com/package/framer-motion" target="_blank">
31
13
  <img src="https://img.shields.io/npm/dm/framer-motion.svg?style=flat-square" />
32
14
  </a>
33
- <a href="https://twitter.com/framer" target="_blank">
15
+ <a href="https://twitter.com/motiondotdev" target="_blank">
34
16
  <img src="https://img.shields.io/twitter/follow/framer.svg?style=social&label=Follow" />
35
17
  </a>
36
- <a href="https://discord.gg/DfkSpYe" target="_blank">
37
- <img src="https://img.shields.io/discord/308323056592486420.svg?logo=discord&logoColor=white" alt="Chat on Discord">
38
- </a>
39
18
  </p>
40
19
 
41
20
  <br>
42
21
  <hr>
43
22
  <br>
44
23
 
45
- Framer Motion is an open source, production-ready library that’s designed for all creative developers.
24
+ Motion for React is an open source, production-ready library that’s designed for all creative developers.
25
+
26
+ It's the only animation library with a hybrid engine, combining the power of JavaScript animations with the performance of native browser APIs.
46
27
 
47
28
  It looks like this:
48
29
 
@@ -52,18 +33,18 @@ It looks like this:
52
33
 
53
34
  It does all this:
54
35
 
55
- - [Springs](https://www.framer.com/docs/transition/#spring?utm_source=motion-readme-docs)
56
- - [Keyframes](https://www.framer.com/docs/animation/##keyframes?utm_source=motion-readme-docs)
57
- - [Layout animations](https://www.framer.com/docs/layout-animations/?utm_source=motion-readme-docs)
58
- - [Shared layout animations](https://www.framer.com/docs/layout-animations/#shared-layout-animations?utm_source=motion-readme-docs)
59
- - [Gestures (drag/tap/hover)](https://www.framer.com/docs/gestures/?utm_source=motion-readme-docs)
60
- - [Scroll animations](https://www.framer.com/docs/scroll-animations?utm_source=motion-readme-docs)
61
- - [SVG paths](https://www.framer.com/docs/component/###svg-line-drawing?utm_source=motion-readme-docs)
62
- - [Exit animations](https://www.framer.com/docs/animate-presence/?utm_source=motion-readme-docs)
63
- - Server-side rendering
64
- - [Hardware-accelerated animations](https://www.framer.com/docs/animation/#hardware-accelerated-animations?utm_source=motion-readme-docs)
65
- - [Orchestrate animations across components](https://www.framer.com/docs/animation/##orchestration?utm_source=motion-readme-docs)
66
- - [CSS variables](https://www.framer.com/docs/component/##css-variables?utm_source=motion-readme-docs)
36
+ - [Springs](https://motion.dev/docs/react-transitions#spring)
37
+ - [Keyframes](https://motion.dev/docs/react-animation#keyframes)
38
+ - [Layout animations](https://motion.dev/docs/react-layout-animations)
39
+ - [Shared layout animations](https://motion.dev/docs/react-layout-animations#shared-layout-animations)
40
+ - [Gestures (drag/tap/hover)](https://motion.dev/docs/react-gestures)
41
+ - [Scroll animations](https://motion.dev/docs/react-scroll-animations)
42
+ - [SVG paths](https://motion.dev/docs/react-animation#svg-line-drawing)
43
+ - [Exit animations](https://motion.dev/docs/react-animation#exit-animations)
44
+ - [Server-side rendering](https://motion.dev/docs/react-motion-component#server-side-rendering)
45
+ - [Independent transforms](https://motion.dev/docs/react-motion-component#style)
46
+ - [Orchestrate animations across components](https://motion.dev/docs/react-animation#orchestration)
47
+ - [CSS variables](https://motion.dev/docs/react-animation#css-variables)
67
48
 
68
49
  ...and a whole lot more.
69
50
 
@@ -71,35 +52,60 @@ It does all this:
71
52
 
72
53
  ### 🐇 Quick start
73
54
 
74
- Install `framer-motion` with via your package manager:
55
+ Install `motion` via your package manager:
75
56
 
76
57
  ```
77
- npm install framer-motion
58
+ npm install motion
78
59
  ```
79
60
 
80
61
  Then import the `motion` component:
81
62
 
82
63
  ```jsx
83
- import { motion } from "framer-motion"
64
+ import { motion } from "motion/react"
84
65
 
85
- export const MyComponent = ({ isVisible }) => (
86
- <motion.div animate={{ opacity: isVisible ? 1 : 0 }} />
87
- )
66
+ export function Component({ isVisible }) {
67
+ return <motion.div animate={{ opacity: isVisible ? 1 : 0 }} />
68
+ }
88
69
  ```
89
70
 
90
- ### 📚 Docs
91
-
92
- - Check out [our documentation](https://www.framer.com/docs/?utm_source=motion-readme-docs) for guides and a full API reference.
93
- - Or see [our examples](https://www.framer.com/docs/examples/?utm_source=motion-readme-docs) for inspiration.
94
-
95
71
  ### 💎 Contribute
96
72
 
97
- - Want to contribute to Framer Motion? Our [contributing guide](https://github.com/framer/motion/blob/master/CONTRIBUTING.md) has you covered.
73
+ - Want to contribute to Motion? Our [contributing guide](https://github.com/motiondivision/motion/blob/master/CONTRIBUTING.md) has you covered.
98
74
 
99
75
  ### 👩🏻‍⚖️ License
100
76
 
101
- - Framer Motion is MIT licensed.
77
+ - Motion for React is MIT licensed.
78
+
79
+ ## ✨ Sponsors
80
+
81
+ Motion is sustainable thanks to the kind support of its sponsors.
82
+
83
+ ### Partners
84
+
85
+ #### Framer
86
+
87
+ Motion powers Framer animations, the web builder for creative pros. Design and ship your dream site. Zero code, maximum speed.
88
+
89
+ <a href="https://www.framer.com?utm_source=motion-readme">
90
+ <img alt="Framer" src="https://github.com/user-attachments/assets/0404c7a1-c29d-4785-89ae-aae315f3c759" width="300px" height="200px">
91
+ </a>
92
+
93
+ ### Platinum
94
+
95
+ <a href="https://syntax.fm"><img alt="Syntax.fm" src="https://github.com/user-attachments/assets/ab852bfe-b36c-490b-b98d-4061158c4863" width="300px" height="200px"></a> <a href="https://tailwindcss.com"><img alt="Tailwind" src="https://github.com/user-attachments/assets/c0496f09-b8ee-4bc4-85ab-83a071bbbdec" width="300px" height="200px"></a> <a href="https://emilkowal.ski"><img alt="Emil Kowalski" src="https://github.com/user-attachments/assets/29f56b1a-37fb-4695-a6a6-151f6c24864f" width="300px" height="200px"></a> <a href="https://linear.app"><img alt="Linear" src="https://github.com/user-attachments/assets/a93710bb-d8ed-40e3-b0fb-1c5b3e2b16bb" width="300px" height="200px"></a>
96
+
97
+ ### Gold
98
+
99
+ <a href="https://vercel.com"><img alt="Vercel" src="https://github.com/user-attachments/assets/23cb1e37-fa67-49ad-8f77-7f4b8eaba325" width="225px" height="150px"></a> <a href="https://liveblocks.io"><img alt="Liveblocks" src="https://github.com/user-attachments/assets/31436a47-951e-4eab-9a68-bdd54ccf9444" width="225px" height="150px"></a> <a href="https://lu.ma"><img alt="Luma" src="https://github.com/user-attachments/assets/4fae0c9d-de0f-4042-9cd6-e07885d028a9" width="225px" height="150px"></a>
100
+
101
+ ### Silver
102
+
103
+ <a href="https://www.frontend.fyi/?utm_source=motion"><img alt="Frontend.fyi" src="https://github.com/user-attachments/assets/07d23aa5-69db-44a0-849d-90177e6fc817" width="150px" height="100px"></a> <a href="https://statamic.com"><img alt="Statamic" src="https://github.com/user-attachments/assets/5d28f090-bdd9-4b31-b134-fb2b94ca636f" width="150px" height="100px"></a> <a href="https://firecrawl.dev"><img alt="Firecrawl" src="https://github.com/user-attachments/assets/cba90e54-1329-4353-8fba-85beef4d2ee9" width="150px" height="100px"></a> <a href="https://puzzmo.com"><img alt="Puzzmo" src="https://github.com/user-attachments/assets/aa2d5586-e5e2-43b9-8446-db456e4b0758" width="150px" height="100px"></a> <a href="https://buildui.com"><img alt="Build UI" src="https://github.com/user-attachments/assets/024bfcd5-50e8-4b3d-a115-d5c6d6030d1c" width="150px" height="100px"></a> <a href="https://hover.dev"><img alt="Hover" src="https://github.com/user-attachments/assets/4715b555-d2ac-4cb7-9f35-d36d708827b3" width="150px" height="100px"></a>
102
104
 
103
- ### ✨ Framer
105
+ ### Personal
104
106
 
105
- - Design and publish sites that inspire. [Try Framer for free](https://www.framer.com/?utm_source=motion-readme).
107
+ - [Nusu](https://x.com/nusualabuga)
108
+ - [OlegWock](https://sinja.io)
109
+ - [Lambert Weller](https://github.com/l-mbert)
110
+ - [Jake LeBoeuf](https://jklb.wf)
111
+ - [Han Lee](https://github.com/hahnlee)
@@ -0,0 +1 @@
1
+ This directory is a fallback for `exports["./client"]` in the root `framer-motion` `package.json`.
@@ -0,0 +1,6 @@
1
+ {
2
+ "private": true,
3
+ "types": "../dist/client.d.ts",
4
+ "main": "../dist/cjs/client.js",
5
+ "module": "../dist/es/client.mjs"
6
+ }