motion 12.7.4 → 12.7.5-alpha.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 (173) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/debug.js +22 -14
  3. package/dist/cjs/index.js +4113 -3624
  4. package/dist/cjs/mini.js +403 -324
  5. package/dist/cjs/react-client.js +3151 -3245
  6. package/dist/cjs/react-m.js +169 -166
  7. package/dist/cjs/react-mini.js +330 -251
  8. package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +1 -1
  9. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +81 -9
  10. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +11 -30
  11. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -1
  12. package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +1 -1
  13. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
  14. package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +2 -2
  15. package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +1 -1
  16. package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +1 -1
  17. package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +1 -1
  18. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
  19. package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +2 -2
  20. package/dist/es/framer-motion/dist/es/gestures/focus.mjs +1 -1
  21. package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +1 -1
  22. package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +1 -1
  23. package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +3 -3
  24. package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +1 -1
  25. package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +1 -1
  26. package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +2 -2
  27. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +3 -5
  28. package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +1 -1
  29. package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +2 -2
  30. package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +1 -1
  31. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +7 -7
  32. package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +1 -1
  33. package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +17 -0
  34. package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +23 -0
  35. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +6 -82
  36. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +3 -3
  37. package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +29 -0
  38. package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +3 -3
  39. package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +4 -4
  40. package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +3 -3
  41. package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +2 -2
  42. package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +1 -1
  43. package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +1 -1
  44. package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +1 -1
  45. package/dist/es/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +1 -1
  46. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
  47. package/dist/es/framer-motion/dist/es/utils/delay.mjs +1 -1
  48. package/dist/es/framer-motion/dist/es/utils/transform.mjs +1 -1
  49. package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +1 -1
  50. package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +4 -4
  51. package/dist/es/framer-motion/dist/es/value/use-spring.mjs +2 -2
  52. package/dist/es/framer-motion/dist/es/value/use-will-change/get-will-change-name.mjs +2 -2
  53. package/dist/es/motion/lib/index.mjs +109 -26
  54. package/dist/es/motion/lib/react.mjs +108 -32
  55. package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +179 -0
  56. package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +6 -15
  57. package/dist/es/{framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs → motion-dom/dist/es/animation/JSAnimation.mjs} +108 -156
  58. package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +64 -67
  59. package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +65 -0
  60. package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +14 -0
  61. package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/drivers/driver-frameloop.mjs +2 -2
  62. package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/keyframes.mjs +5 -5
  63. package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/find.mjs +1 -1
  64. package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/index.mjs +5 -6
  65. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation/keyframes}/DOMKeyframesResolver.mjs +9 -8
  66. package/dist/es/{framer-motion/dist/es/render/utils → motion-dom/dist/es/animation/keyframes}/KeyframesResolver.mjs +28 -35
  67. package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +3 -4
  68. package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/fill.mjs +2 -2
  69. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +11 -0
  70. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +7 -0
  71. package/dist/es/{framer-motion/dist/es/animation → motion-dom/dist/es/animation/keyframes}/utils/is-none.mjs +1 -1
  72. package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/animation/keyframes}/utils/make-none-animatable.mjs +1 -1
  73. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation/keyframes}/utils/unit-conversion.mjs +2 -2
  74. package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +28 -0
  75. package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +9 -0
  76. package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/utils/can-animate.mjs +3 -3
  77. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation}/utils/css-variables-conversion.mjs +2 -2
  78. package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +18 -0
  79. package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +1 -1
  80. package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +5 -3
  81. package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +6 -4
  82. package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +39 -0
  83. package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +2 -1
  84. package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +20 -0
  85. package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +2 -1
  86. package/dist/es/motion-dom/dist/es/frameloop/order.mjs +1 -0
  87. package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +3 -0
  88. package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +10 -0
  89. package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +9 -0
  90. package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/render}/utils/keys-transform.mjs +1 -1
  91. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es}/scroll/observe.mjs +1 -1
  92. package/dist/es/motion-dom/dist/es/stats/index.mjs +2 -0
  93. package/dist/es/{framer-motion → motion-dom}/dist/es/utils/interpolate.mjs +4 -3
  94. package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/color.mjs +3 -3
  95. package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/complex.mjs +5 -5
  96. package/dist/es/motion-dom/dist/es/value/index.mjs +3 -1
  97. package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/rgba.mjs +2 -2
  98. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types}/dimensions.mjs +3 -3
  99. package/dist/es/{framer-motion/dist/es/render/dom/value-types/type-int.mjs → motion-dom/dist/es/value/types/int.mjs} +1 -1
  100. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/maps}/defaults.mjs +2 -2
  101. package/dist/es/{framer-motion/dist/es/render/dom/value-types/number-browser.mjs → motion-dom/dist/es/value/types/maps/number.mjs} +13 -3
  102. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/maps}/transform.mjs +2 -2
  103. package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/numbers/index.mjs +1 -1
  104. package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/numbers/units.mjs +3 -2
  105. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/animatable-none.mjs +4 -4
  106. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/find.mjs +4 -4
  107. package/dist/es/motion-dom/dist/es/view/index.mjs +64 -0
  108. package/dist/es/motion-dom/dist/es/view/queue.mjs +52 -0
  109. package/dist/es/motion-dom/dist/es/view/start.mjs +155 -0
  110. package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +11 -0
  111. package/dist/es/motion-dom/dist/es/view/utils/css.mjs +32 -0
  112. package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +8 -0
  113. package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +12 -0
  114. package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +5 -0
  115. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/cubic-bezier.mjs +1 -1
  116. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/steps.mjs +1 -1
  117. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/get-easing-for-segment.mjs +1 -1
  118. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/map.mjs +7 -4
  119. package/dist/es/motion-utils/dist/es/global-config.mjs +1 -4
  120. package/dist/es/motion-utils/dist/es/warn-once.mjs +4 -1
  121. package/dist/motion.dev.js +4108 -3619
  122. package/dist/motion.js +1 -1
  123. package/package.json +3 -3
  124. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +0 -324
  125. package/dist/es/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +0 -120
  126. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +0 -5
  127. package/dist/es/framer-motion/dist/es/render/dom/value-types/number.mjs +0 -18
  128. package/dist/es/framer-motion/dist/es/utils/use-instant-transition-state.mjs +0 -5
  129. package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +0 -26
  130. package/dist/es/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs +0 -6
  131. package/dist/es/motion-dom/dist/es/render/dom/style.mjs +0 -15
  132. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/inertia.mjs +0 -0
  133. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/defaults.mjs +0 -0
  134. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/velocity.mjs +0 -0
  135. /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/default.mjs +0 -0
  136. /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/time.mjs +0 -0
  137. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/utils/is-animatable.mjs +0 -0
  138. /package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation}/utils/is-css-variable.mjs +0 -0
  139. /package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation/waapi}/utils/accelerated-values.mjs +0 -0
  140. /package/dist/es/{framer-motion/dist/es/render/html/utils → motion-dom/dist/es/render/dom}/parse-transform.mjs +0 -0
  141. /package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/render}/utils/keys-position.mjs +0 -0
  142. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/immediate.mjs +0 -0
  143. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/index.mjs +0 -0
  144. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/number.mjs +0 -0
  145. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/visibility.mjs +0 -0
  146. /package/dist/es/{framer-motion/dist/es/render/dom/value-types/type-auto.mjs → motion-dom/dist/es/value/types/auto.mjs} +0 -0
  147. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/hex.mjs +0 -0
  148. /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/value/types/color}/hsla-to-rgba.mjs +0 -0
  149. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/hsla.mjs +0 -0
  150. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/index.mjs +0 -0
  151. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/utils.mjs +0 -0
  152. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/complex/filter.mjs +0 -0
  153. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/complex/index.mjs +0 -0
  154. /package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types}/test.mjs +0 -0
  155. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/color-regex.mjs +0 -0
  156. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/float-regex.mjs +0 -0
  157. /package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/get-as-type.mjs +0 -0
  158. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/is-nullish.mjs +0 -0
  159. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/sanitize.mjs +0 -0
  160. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/single-color-regex.mjs +0 -0
  161. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/clamp.mjs +0 -0
  162. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/anticipate.mjs +0 -0
  163. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/back.mjs +0 -0
  164. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/circ.mjs +0 -0
  165. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/ease.mjs +0 -0
  166. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/modifiers/mirror.mjs +0 -0
  167. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/modifiers/reverse.mjs +0 -0
  168. /package/dist/es/{motion-dom/dist/es → motion-utils/dist/es/easing}/utils/is-bezier-definition.mjs +0 -0
  169. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/is-easing-array.mjs +0 -0
  170. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/is-numerical-string.mjs +0 -0
  171. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/is-zero-value-string.mjs +0 -0
  172. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/pipe.mjs +0 -0
  173. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/wrap.mjs +0 -0
@@ -1,15 +1,17 @@
1
- import { isBezierDefinition } from '../../../utils/is-bezier-definition.mjs';
2
1
  import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
3
2
  import { generateLinearEasing } from '../utils/linear.mjs';
4
3
  import { cubicBezierAsString } from './cubic-bezier.mjs';
5
4
  import { supportedWaapiEasing } from './supported.mjs';
5
+ import { isBezierDefinition } from '../../../../../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs';
6
6
 
7
7
  function mapEasingToNativeEasing(easing, duration) {
8
8
  if (!easing) {
9
9
  return undefined;
10
10
  }
11
- else if (typeof easing === "function" && supportsLinearEasing()) {
12
- return generateLinearEasing(easing, duration);
11
+ else if (typeof easing === "function") {
12
+ return supportsLinearEasing()
13
+ ? generateLinearEasing(easing, duration)
14
+ : "ease-out";
13
15
  }
14
16
  else if (isBezierDefinition(easing)) {
15
17
  return cubicBezierAsString(easing);
@@ -2,7 +2,7 @@ import { activeAnimations } from '../../stats/animation-count.mjs';
2
2
  import { statsBuffer } from '../../stats/buffer.mjs';
3
3
  import { mapEasingToNativeEasing } from './easing/map-easing.mjs';
4
4
 
5
- function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}, pseudoElement = undefined) {
5
+ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeOut", times, } = {}, pseudoElement = undefined) {
6
6
  const keyframeOptions = {
7
7
  [valueName]: keyframes,
8
8
  };
@@ -17,15 +17,17 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
17
17
  if (statsBuffer.value) {
18
18
  activeAnimations.waapi++;
19
19
  }
20
- const animation = element.animate(keyframeOptions, {
20
+ const options = {
21
21
  delay,
22
22
  duration,
23
23
  easing: !Array.isArray(easing) ? easing : "linear",
24
24
  fill: "both",
25
25
  iterations: repeat + 1,
26
26
  direction: repeatType === "reverse" ? "alternate" : "normal",
27
- pseudoElement,
28
- });
27
+ };
28
+ if (pseudoElement)
29
+ options.pseudoElement = pseudoElement;
30
+ const animation = element.animate(keyframeOptions, options);
29
31
  if (statsBuffer.value) {
30
32
  animation.finished.finally(() => {
31
33
  activeAnimations.waapi--;
@@ -0,0 +1,39 @@
1
+ import { memo } from '../../../../../../motion-utils/dist/es/memo.mjs';
2
+
3
+ /**
4
+ * A list of values that can be hardware-accelerated.
5
+ */
6
+ const acceleratedValues = new Set([
7
+ "opacity",
8
+ "clipPath",
9
+ "filter",
10
+ "transform",
11
+ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
12
+ // or until we implement support for linear() easing.
13
+ // "background-color"
14
+ ]);
15
+ const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
16
+ function supportsBrowserAnimation(options) {
17
+ const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
18
+ if (!motionValue ||
19
+ !motionValue.owner ||
20
+ !(motionValue.owner.current instanceof HTMLElement)) {
21
+ return false;
22
+ }
23
+ const { onUpdate, transformTemplate } = motionValue.owner.getProps();
24
+ return (supportsWaapi() &&
25
+ name &&
26
+ acceleratedValues.has(name) &&
27
+ (name !== "transform" || !transformTemplate) &&
28
+ /**
29
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
30
+ * no way to read the value from WAAPI every frame.
31
+ */
32
+ !onUpdate &&
33
+ !repeatDelay &&
34
+ repeatType !== "mirror" &&
35
+ damping !== 0 &&
36
+ type !== "inertia");
37
+ }
38
+
39
+ export { supportsBrowserAnimation };
@@ -1,7 +1,8 @@
1
+ import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
1
2
  import { isGenerator } from '../../generators/utils/is-generator.mjs';
2
3
 
3
4
  function applyGeneratorOptions({ type, ...options }) {
4
- if (isGenerator(type)) {
5
+ if (isGenerator(type) && supportsLinearEasing()) {
5
6
  return type.applyToOptions(options);
6
7
  }
7
8
  else {
@@ -0,0 +1,20 @@
1
+ import { anticipate } from '../../../../../../motion-utils/dist/es/easing/anticipate.mjs';
2
+ import { backInOut } from '../../../../../../motion-utils/dist/es/easing/back.mjs';
3
+ import { circInOut } from '../../../../../../motion-utils/dist/es/easing/circ.mjs';
4
+
5
+ const unsupportedEasingFunctions = {
6
+ anticipate,
7
+ backInOut,
8
+ circInOut,
9
+ };
10
+ function isUnsupportedEase(key) {
11
+ return key in unsupportedEasingFunctions;
12
+ }
13
+ function replaceStringEasing(transition) {
14
+ if (typeof transition.ease === "string" &&
15
+ isUnsupportedEase(transition.ease)) {
16
+ transition.ease = unsupportedEasingFunctions[transition.ease];
17
+ }
18
+ }
19
+
20
+ export { replaceStringEasing };
@@ -16,7 +16,7 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
16
16
  acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);
17
17
  return acc;
18
18
  }, {});
19
- const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
19
+ const { setup, read, resolveKeyframes, update, preRender, render, postRender, } = steps;
20
20
  const processBatch = () => {
21
21
  const timestamp = MotionGlobalConfig.useManualTiming
22
22
  ? state.timestamp
@@ -30,6 +30,7 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
30
30
  state.timestamp = timestamp;
31
31
  state.isProcessing = true;
32
32
  // Unrolled render loop for better per-frame performance
33
+ setup.process(state);
33
34
  read.process(state);
34
35
  resolveKeyframes.process(state);
35
36
  update.process(state);
@@ -1,4 +1,5 @@
1
1
  const stepsOrder = [
2
+ "setup", // Compute
2
3
  "read", // Read
3
4
  "resolveKeyframes", // Write/Read/Write/Read
4
5
  "update", // Compute
@@ -0,0 +1,3 @@
1
+ const isCSSVar = (name) => name.startsWith("--");
2
+
3
+ export { isCSSVar };
@@ -0,0 +1,10 @@
1
+ import { isCSSVar } from './is-css-var.mjs';
2
+
3
+ function getComputedStyle(element, name) {
4
+ const computedStyle = window.getComputedStyle(element);
5
+ return isCSSVar(name)
6
+ ? computedStyle.getPropertyValue(name)
7
+ : computedStyle[name];
8
+ }
9
+
10
+ export { getComputedStyle };
@@ -0,0 +1,9 @@
1
+ import { isCSSVar } from './is-css-var.mjs';
2
+
3
+ function setStyle(element, name, value) {
4
+ isCSSVar(name)
5
+ ? element.style.setProperty(name, value)
6
+ : (element.style[name] = value);
7
+ }
8
+
9
+ export { setStyle };
@@ -23,6 +23,6 @@ const transformPropOrder = [
23
23
  /**
24
24
  * A quick lookup for transform props.
25
25
  */
26
- const transformProps = new Set(transformPropOrder);
26
+ const transformProps = /*@__PURE__*/ (() => new Set(transformPropOrder))();
27
27
 
28
28
  export { transformPropOrder, transformProps };
@@ -1,4 +1,4 @@
1
- import { frame, cancelFrame } from '../../../../../../motion-dom/dist/es/frameloop/frame.mjs';
1
+ import { frame, cancelFrame } from '../frameloop/frame.mjs';
2
2
 
3
3
  function observeTimeline(update, timeline) {
4
4
  let prevProgress;
@@ -44,6 +44,7 @@ function reportStats() {
44
44
  cancelFrame(record);
45
45
  const summary = {
46
46
  frameloop: {
47
+ setup: summarise(value.frameloop.setup),
47
48
  rate: summarise(value.frameloop.rate),
48
49
  read: summarise(value.frameloop.read),
49
50
  resolveKeyframes: summarise(value.frameloop.resolveKeyframes),
@@ -81,6 +82,7 @@ function recordStats() {
81
82
  const newStatsBuffer = statsBuffer;
82
83
  newStatsBuffer.value = {
83
84
  frameloop: {
85
+ setup: [],
84
86
  rate: [],
85
87
  read: [],
86
88
  resolveKeyframes: [],
@@ -1,13 +1,14 @@
1
- import { clamp } from './clamp.mjs';
2
1
  import { mix } from './mix/index.mjs';
3
- import { pipe } from './pipe.mjs';
4
2
  import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
3
+ import { clamp } from '../../../../motion-utils/dist/es/clamp.mjs';
4
+ import { MotionGlobalConfig } from '../../../../motion-utils/dist/es/global-config.mjs';
5
5
  import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
6
+ import { pipe } from '../../../../motion-utils/dist/es/pipe.mjs';
6
7
  import { progress } from '../../../../motion-utils/dist/es/progress.mjs';
7
8
 
8
9
  function createMixers(output, ease, customMixer) {
9
10
  const mixers = [];
10
- const mixerFactory = customMixer || mix;
11
+ const mixerFactory = customMixer || MotionGlobalConfig.mix || mix;
11
12
  const numMixers = output.length - 1;
12
13
  for (let i = 0; i < numMixers; i++) {
13
14
  let mixer = mixerFactory(output[i], output[i + 1]);
@@ -1,9 +1,9 @@
1
- import { mixNumber } from './number.mjs';
2
- import { hslaToRgba } from '../hsla-to-rgba.mjs';
3
1
  import { hex } from '../../value/types/color/hex.mjs';
4
- import { rgba } from '../../value/types/color/rgba.mjs';
5
2
  import { hsla } from '../../value/types/color/hsla.mjs';
3
+ import { hslaToRgba } from '../../value/types/color/hsla-to-rgba.mjs';
4
+ import { rgba } from '../../value/types/color/rgba.mjs';
6
5
  import { mixImmediate } from './immediate.mjs';
6
+ import { mixNumber } from './number.mjs';
7
7
  import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
8
8
 
9
9
  // Linear color space blending
@@ -1,11 +1,11 @@
1
- import { mixNumber as mixNumber$1 } from './number.mjs';
2
- import { mixColor } from './color.mjs';
3
- import { pipe } from '../pipe.mjs';
1
+ import { isCSSVariableToken } from '../../animation/utils/is-css-variable.mjs';
4
2
  import { color } from '../../value/types/color/index.mjs';
5
3
  import { complex, analyseComplexValue } from '../../value/types/complex/index.mjs';
6
- import { isCSSVariableToken } from '../../render/dom/utils/is-css-variable.mjs';
7
- import { invisibleValues, mixVisibility } from './visibility.mjs';
4
+ import { mixColor } from './color.mjs';
8
5
  import { mixImmediate } from './immediate.mjs';
6
+ import { mixNumber as mixNumber$1 } from './number.mjs';
7
+ import { invisibleValues, mixVisibility } from './visibility.mjs';
8
+ import { pipe } from '../../../../../motion-utils/dist/es/pipe.mjs';
9
9
  import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
10
10
 
11
11
  function mixNumber(a, b) {
@@ -32,7 +32,7 @@ class MotionValue {
32
32
  * This will be replaced by the build step with the latest version number.
33
33
  * When MotionValues are provided to motion components, warn if versions are mixed.
34
34
  */
35
- this.version = "12.7.4";
35
+ this.version = "12.7.5-alpha.0";
36
36
  /**
37
37
  * Tracks whether this value can output a velocity. Currently this is only true
38
38
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -176,6 +176,8 @@ class MotionValue {
176
176
  * @public
177
177
  */
178
178
  set(v, render = true) {
179
+ if (v === "none")
180
+ console.trace();
179
181
  if (!render || !this.passiveEffect) {
180
182
  this.updateAndNotify(v, render);
181
183
  }
@@ -1,7 +1,7 @@
1
- import { clamp } from '../../../utils/clamp.mjs';
2
- import { alpha, number } from '../numbers/index.mjs';
1
+ import { number, alpha } from '../numbers/index.mjs';
3
2
  import { sanitize } from '../utils/sanitize.mjs';
4
3
  import { isColorString, splitColor } from './utils.mjs';
4
+ import { clamp } from '../../../../../../motion-utils/dist/es/clamp.mjs';
5
5
 
6
6
  const clampRgbUnit = (v) => clamp(0, 255, v);
7
7
  const rgbUnit = {
@@ -1,7 +1,7 @@
1
- import { number } from '../../../value/types/numbers/index.mjs';
2
- import { px, percent, degrees, vw, vh } from '../../../value/types/numbers/units.mjs';
1
+ import { auto } from './auto.mjs';
2
+ import { number } from './numbers/index.mjs';
3
+ import { px, percent, degrees, vw, vh } from './numbers/units.mjs';
3
4
  import { testValueType } from './test.mjs';
4
- import { auto } from './type-auto.mjs';
5
5
 
6
6
  /**
7
7
  * A list of value types commonly used for dimensions
@@ -1,4 +1,4 @@
1
- import { number } from '../../../value/types/numbers/index.mjs';
1
+ import { number } from './numbers/index.mjs';
2
2
 
3
3
  const int = {
4
4
  ...number,
@@ -1,5 +1,5 @@
1
- import { color } from '../../../value/types/color/index.mjs';
2
- import { filter } from '../../../value/types/complex/filter.mjs';
1
+ import { color } from '../color/index.mjs';
2
+ import { filter } from '../complex/filter.mjs';
3
3
  import { numberValueTypes } from './number.mjs';
4
4
 
5
5
  /**
@@ -1,6 +1,9 @@
1
- import { px } from '../../../value/types/numbers/units.mjs';
1
+ import { int } from '../int.mjs';
2
+ import { alpha } from '../numbers/index.mjs';
3
+ import { px } from '../numbers/units.mjs';
4
+ import { transformValueTypes } from './transform.mjs';
2
5
 
3
- const browserNumberValueTypes = {
6
+ const numberValueTypes = {
4
7
  // Border props
5
8
  borderWidth: px,
6
9
  borderTopWidth: px,
@@ -36,6 +39,13 @@ const browserNumberValueTypes = {
36
39
  // Misc
37
40
  backgroundPositionX: px,
38
41
  backgroundPositionY: px,
42
+ ...transformValueTypes,
43
+ zIndex: int,
44
+ size: px,
45
+ // SVG
46
+ fillOpacity: alpha,
47
+ strokeOpacity: alpha,
48
+ numOctaves: int,
39
49
  };
40
50
 
41
- export { browserNumberValueTypes };
51
+ export { numberValueTypes };
@@ -1,5 +1,5 @@
1
- import { scale, alpha } from '../../../value/types/numbers/index.mjs';
2
- import { degrees, px, progressPercentage } from '../../../value/types/numbers/units.mjs';
1
+ import { scale, alpha } from '../numbers/index.mjs';
2
+ import { degrees, px, progressPercentage } from '../numbers/units.mjs';
3
3
 
4
4
  const transformValueTypes = {
5
5
  rotate: degrees,
@@ -1,4 +1,4 @@
1
- import { clamp } from '../../../utils/clamp.mjs';
1
+ import { clamp } from '../../../../../../motion-utils/dist/es/clamp.mjs';
2
2
 
3
3
  const number = {
4
4
  test: (v) => typeof v === "number",
@@ -1,3 +1,4 @@
1
+ /*#__NO_SIDE_EFFECTS__*/
1
2
  const createUnitType = (unit) => ({
2
3
  test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
3
4
  parse: parseFloat,
@@ -8,10 +9,10 @@ const percent = /*@__PURE__*/ createUnitType("%");
8
9
  const px = /*@__PURE__*/ createUnitType("px");
9
10
  const vh = /*@__PURE__*/ createUnitType("vh");
10
11
  const vw = /*@__PURE__*/ createUnitType("vw");
11
- const progressPercentage = {
12
+ const progressPercentage = /*@__PURE__*/ (() => ({
12
13
  ...percent,
13
14
  parse: (v) => percent.parse(v) / 100,
14
15
  transform: (v) => percent.transform(v * 100),
15
- };
16
+ }))();
16
17
 
17
18
  export { degrees, percent, progressPercentage, px, vh, vw };
@@ -1,12 +1,12 @@
1
- import { complex } from '../../../value/types/complex/index.mjs';
2
- import { filter } from '../../../value/types/complex/filter.mjs';
3
- import { getDefaultValueType } from './defaults.mjs';
1
+ import { complex } from '../complex/index.mjs';
2
+ import { filter } from '../complex/filter.mjs';
3
+ import { getDefaultValueType } from '../maps/defaults.mjs';
4
4
 
5
5
  function getAnimatableNone(key, value) {
6
6
  let defaultValueType = getDefaultValueType(key);
7
7
  if (defaultValueType !== filter)
8
8
  defaultValueType = complex;
9
- // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
9
+ // If value is not recognised as animatable, ie "one", create an animatable version origin based on the target
10
10
  return defaultValueType.getAnimatableNone
11
11
  ? defaultValueType.getAnimatableNone(value)
12
12
  : undefined;
@@ -1,7 +1,7 @@
1
- import { color } from '../../../value/types/color/index.mjs';
2
- import { complex } from '../../../value/types/complex/index.mjs';
3
- import { dimensionValueTypes } from './dimensions.mjs';
4
- import { testValueType } from './test.mjs';
1
+ import { color } from '../color/index.mjs';
2
+ import { complex } from '../complex/index.mjs';
3
+ import { dimensionValueTypes } from '../dimensions.mjs';
4
+ import { testValueType } from '../test.mjs';
5
5
 
6
6
  /**
7
7
  * A list of all ValueTypes
@@ -0,0 +1,64 @@
1
+ import { addToQueue } from './queue.mjs';
2
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
3
+
4
+ class ViewTransitionBuilder {
5
+ constructor(update, options = {}) {
6
+ this.currentTarget = "root";
7
+ this.targets = new Map();
8
+ this.notifyReady = noop;
9
+ this.readyPromise = new Promise((resolve) => {
10
+ this.notifyReady = resolve;
11
+ });
12
+ this.update = update;
13
+ this.options = {
14
+ interrupt: "wait",
15
+ ...options,
16
+ };
17
+ addToQueue(this);
18
+ }
19
+ get(selector) {
20
+ this.currentTarget = selector;
21
+ return this;
22
+ }
23
+ layout(keyframes, options) {
24
+ this.updateTarget("layout", keyframes, options);
25
+ return this;
26
+ }
27
+ new(keyframes, options) {
28
+ this.updateTarget("new", keyframes, options);
29
+ return this;
30
+ }
31
+ old(keyframes, options) {
32
+ this.updateTarget("old", keyframes, options);
33
+ return this;
34
+ }
35
+ enter(keyframes, options) {
36
+ this.updateTarget("enter", keyframes, options);
37
+ return this;
38
+ }
39
+ exit(keyframes, options) {
40
+ this.updateTarget("exit", keyframes, options);
41
+ return this;
42
+ }
43
+ crossfade(options) {
44
+ this.updateTarget("enter", { opacity: 1 }, options);
45
+ this.updateTarget("exit", { opacity: 0 }, options);
46
+ return this;
47
+ }
48
+ updateTarget(target, keyframes, options = {}) {
49
+ const { currentTarget, targets } = this;
50
+ if (!targets.has(currentTarget)) {
51
+ targets.set(currentTarget, {});
52
+ }
53
+ const targetData = targets.get(currentTarget);
54
+ targetData[target] = { keyframes, options };
55
+ }
56
+ then(resolve, reject) {
57
+ return this.readyPromise.then(resolve, reject);
58
+ }
59
+ }
60
+ function animateView(update, defaultOptions = {}) {
61
+ return new ViewTransitionBuilder(update, defaultOptions);
62
+ }
63
+
64
+ export { ViewTransitionBuilder, animateView };
@@ -0,0 +1,52 @@
1
+ import { microtask } from '../frameloop/microtask.mjs';
2
+ import { startViewAnimation } from './start.mjs';
3
+ import { removeItem } from '../../../../motion-utils/dist/es/array.mjs';
4
+
5
+ let builders = [];
6
+ let current = null;
7
+ function next() {
8
+ current = null;
9
+ const [nextBuilder] = builders;
10
+ if (nextBuilder)
11
+ start(nextBuilder);
12
+ }
13
+ function start(builder) {
14
+ removeItem(builders, builder);
15
+ current = builder;
16
+ startViewAnimation(builder).then((animation) => {
17
+ builder.notifyReady(animation);
18
+ animation.finished.finally(next);
19
+ });
20
+ }
21
+ function processQueue() {
22
+ /**
23
+ * Iterate backwards over the builders array. We can ignore the
24
+ * "wait" animations. If we have an interrupting animation in the
25
+ * queue then we need to batch all preceeding animations into it.
26
+ * Currently this only batches the update functions but will also
27
+ * need to batch the targets.
28
+ */
29
+ for (let i = builders.length - 1; i >= 0; i--) {
30
+ const builder = builders[i];
31
+ const { interrupt } = builder.options;
32
+ if (interrupt === "immediate") {
33
+ const batchedUpdates = builders.slice(0, i + 1).map((b) => b.update);
34
+ const remaining = builders.slice(i + 1);
35
+ builder.update = () => {
36
+ batchedUpdates.forEach((update) => update());
37
+ };
38
+ // Put the current builder at the front, followed by any "wait" builders
39
+ builders = [builder, ...remaining];
40
+ break;
41
+ }
42
+ }
43
+ if (!current || builders[0]?.options.interrupt === "immediate") {
44
+ next();
45
+ }
46
+ }
47
+ function addToQueue(builder) {
48
+ builders.push(builder);
49
+ microtask.render(processQueue);
50
+ }
51
+
52
+ export { addToQueue };