framer-motion 7.6.4 → 7.6.6

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 (39) hide show
  1. package/dist/cjs/index.js +789 -850
  2. package/dist/es/animation/use-animated-state.mjs +29 -17
  3. package/dist/es/gestures/drag/VisualElementDragControls.mjs +14 -10
  4. package/dist/es/gestures/use-focus-gesture.mjs +1 -1
  5. package/dist/es/gestures/use-tap-gesture.mjs +1 -1
  6. package/dist/es/index.mjs +1 -1
  7. package/dist/es/motion/features/viewport/use-viewport.mjs +2 -2
  8. package/dist/es/motion/utils/use-visual-element.mjs +3 -3
  9. package/dist/es/projection/node/create-projection-node.mjs +74 -60
  10. package/dist/es/render/VisualElement.mjs +480 -0
  11. package/dist/es/render/dom/DOMVisualElement.mjs +49 -0
  12. package/dist/es/render/dom/create-visual-element.mjs +4 -4
  13. package/dist/es/render/dom/utils/css-variables-conversion.mjs +2 -2
  14. package/dist/es/render/dom/utils/unit-conversion.mjs +4 -4
  15. package/dist/es/render/html/HTMLVisualElement.mjs +41 -0
  16. package/dist/es/render/svg/{visual-element.mjs → SVGVisualElement.mjs} +21 -15
  17. package/dist/es/render/utils/animation.mjs +4 -4
  18. package/dist/es/render/utils/motion-values.mjs +1 -1
  19. package/dist/es/render/utils/resolve-dynamic-variants.mjs +2 -2
  20. package/dist/es/render/utils/setters.mjs +2 -1
  21. package/dist/es/value/index.mjs +1 -1
  22. package/dist/framer-motion.dev.js +789 -850
  23. package/dist/framer-motion.js +1 -1
  24. package/dist/index.d.ts +2101 -1931
  25. package/dist/projection.dev.js +1053 -1136
  26. package/dist/size-rollup-dom-animation-m.js +1 -1
  27. package/dist/size-rollup-dom-animation.js +1 -1
  28. package/dist/size-rollup-dom-max-assets.js +1 -1
  29. package/dist/size-rollup-dom-max.js +1 -1
  30. package/dist/size-rollup-m.js +1 -1
  31. package/dist/size-rollup-motion.js +1 -1
  32. package/dist/size-webpack-dom-animation.js +1 -1
  33. package/dist/size-webpack-dom-max.js +1 -1
  34. package/dist/size-webpack-m.js +1 -1
  35. package/dist/three-entry.d.ts +1956 -1745
  36. package/package.json +8 -8
  37. package/dist/es/render/html/visual-element.mjs +0 -109
  38. package/dist/es/render/index.mjs +0 -515
  39. package/dist/es/render/utils/lifecycles.mjs +0 -43
@@ -1,31 +1,37 @@
1
- import { visualElement } from '../index.mjs';
2
1
  import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
3
- import { htmlConfig } from '../html/visual-element.mjs';
2
+ import { DOMVisualElement } from '../dom/DOMVisualElement.mjs';
4
3
  import { buildSVGAttrs } from './utils/build-attrs.mjs';
5
4
  import { camelToDash } from '../dom/utils/camel-to-dash.mjs';
6
5
  import { camelCaseAttributes } from './utils/camel-case-attrs.mjs';
7
6
  import { transformProps } from '../html/utils/transform.mjs';
8
7
  import { renderSVG } from './utils/render.mjs';
9
8
  import { getDefaultValueType } from '../dom/value-types/defaults.mjs';
9
+ import { createBox } from '../../projection/geometry/models.mjs';
10
10
 
11
- const svgVisualElement = visualElement({
12
- ...htmlConfig,
13
- getBaseTarget(props, key) {
11
+ class SVGVisualElement extends DOMVisualElement {
12
+ getBaseTargetFromProps(props, key) {
14
13
  return props[key];
15
- },
16
- readValueFromInstance(domElement, key) {
14
+ }
15
+ readValueFromInstance(instance, key) {
17
16
  var _a;
18
17
  if (transformProps.has(key)) {
19
18
  return ((_a = getDefaultValueType(key)) === null || _a === void 0 ? void 0 : _a.default) || 0;
20
19
  }
21
20
  key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
22
- return domElement.getAttribute(key);
23
- },
24
- scrapeMotionValuesFromProps,
25
- build(_element, renderState, latestValues, options, props) {
21
+ return instance.getAttribute(key);
22
+ }
23
+ measureInstanceViewportBox() {
24
+ return createBox();
25
+ }
26
+ scrapeMotionValuesFromProps(props) {
27
+ return scrapeMotionValuesFromProps(props);
28
+ }
29
+ build(renderState, latestValues, options, props) {
26
30
  buildSVGAttrs(renderState, latestValues, options, props.transformTemplate);
27
- },
28
- render: renderSVG,
29
- });
31
+ }
32
+ renderInstance(instance, renderState, styleProp, projection) {
33
+ renderSVG(instance, renderState, styleProp, projection);
34
+ }
35
+ }
30
36
 
31
- export { svgVisualElement };
37
+ export { SVGVisualElement };
@@ -5,7 +5,7 @@ import { transformProps } from '../html/utils/transform.mjs';
5
5
  import { isWillChangeMotionValue } from '../../value/use-will-change/is.mjs';
6
6
 
7
7
  function animateVisualElement(visualElement, definition, options = {}) {
8
- visualElement.notifyAnimationStart(definition);
8
+ visualElement.notify("AnimationStart", definition);
9
9
  let animation;
10
10
  if (Array.isArray(definition)) {
11
11
  const animations = definition.map((variant) => animateVariant(visualElement, variant, options));
@@ -20,7 +20,7 @@ function animateVisualElement(visualElement, definition, options = {}) {
20
20
  : definition;
21
21
  animation = animateTarget(visualElement, resolvedDefinition, options);
22
22
  }
23
- return animation.then(() => visualElement.notifyAnimationComplete(definition));
23
+ return animation.then(() => visualElement.notify("AnimationComplete", definition));
24
24
  }
25
25
  function animateVariant(visualElement, variant, options = {}) {
26
26
  var _a;
@@ -115,12 +115,12 @@ function animateChildren(visualElement, variant, delayChildren = 0, staggerChild
115
115
  animations.push(animateVariant(child, variant, {
116
116
  ...options,
117
117
  delay: delayChildren + generateStaggerDuration(i),
118
- }).then(() => child.notifyAnimationComplete(variant)));
118
+ }).then(() => child.notify("AnimationComplete", variant)));
119
119
  });
120
120
  return Promise.all(animations);
121
121
  }
122
122
  function stopAnimation(visualElement) {
123
- visualElement.forEachValue((value) => value.stop());
123
+ visualElement.values.forEach((value) => value.stop());
124
124
  }
125
125
  function sortByTreeOrder(a, b) {
126
126
  return a.sortNodePosition(b);
@@ -22,7 +22,7 @@ function updateMotionValuesFromProps(element, next, prev) {
22
22
  * and warn against mismatches.
23
23
  */
24
24
  if (process.env.NODE_ENV === "development") {
25
- warnOnce(nextValue.version === "7.6.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.4 may not work as expected.`);
25
+ warnOnce(nextValue.version === "7.6.6", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.6 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -5,7 +5,7 @@ import { resolveVariantFromProps } from './resolve-variants.mjs';
5
5
  */
6
6
  function getCurrent(visualElement) {
7
7
  const current = {};
8
- visualElement.forEachValue((value, key) => (current[key] = value.get()));
8
+ visualElement.values.forEach((value, key) => (current[key] = value.get()));
9
9
  return current;
10
10
  }
11
11
  /**
@@ -13,7 +13,7 @@ function getCurrent(visualElement) {
13
13
  */
14
14
  function getVelocity(visualElement) {
15
15
  const velocity = {};
16
- visualElement.forEachValue((value, key) => (velocity[key] = value.getVelocity()));
16
+ visualElement.values.forEach((value, key) => (velocity[key] = value.getVelocity()));
17
17
  return velocity;
18
18
  }
19
19
  function resolveVariant(visualElement, definition, custom) {
@@ -93,7 +93,8 @@ function checkTargetForNewValues(visualElement, target, origin) {
93
93
  if (origin[key] === undefined) {
94
94
  origin[key] = value;
95
95
  }
96
- visualElement.setBaseTarget(key, value);
96
+ if (value !== null)
97
+ visualElement.setBaseTarget(key, value);
97
98
  }
98
99
  }
99
100
  function getOriginFromTransition(key, transition) {
@@ -24,7 +24,7 @@ class MotionValue {
24
24
  * This will be replaced by the build step with the latest version number.
25
25
  * When MotionValues are provided to motion components, warn if versions are mixed.
26
26
  */
27
- this.version = "7.6.4";
27
+ this.version = "7.6.6";
28
28
  /**
29
29
  * Duration, in milliseconds, since last updating frame.
30
30
  *