motion 12.0.5 → 12.0.8-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.
- package/dist/cjs/index.js +43 -12
- package/dist/cjs/react-client.js +504 -486
- package/dist/cjs/react-m.js +494 -494
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +6 -1
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +3 -0
- package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +2 -2
- package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +12 -0
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/value/index.mjs +1 -1
- package/dist/motion.dev.js +43 -12
- package/dist/motion.js +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1569,7 +1569,7 @@ class MotionValue {
|
|
|
1569
1569
|
* This will be replaced by the build step with the latest version number.
|
|
1570
1570
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1571
1571
|
*/
|
|
1572
|
-
this.version = "12.0.
|
|
1572
|
+
this.version = "12.0.8-alpha.0";
|
|
1573
1573
|
/**
|
|
1574
1574
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
1575
1575
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -4503,7 +4503,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4503
4503
|
* and warn against mismatches.
|
|
4504
4504
|
*/
|
|
4505
4505
|
if (process.env.NODE_ENV === "development") {
|
|
4506
|
-
warnOnce(nextValue.version === "12.0.
|
|
4506
|
+
warnOnce(nextValue.version === "12.0.8-alpha.0", `Attempting to mix Motion versions ${nextValue.version} with 12.0.8-alpha.0 may not work as expected.`);
|
|
4507
4507
|
}
|
|
4508
4508
|
}
|
|
4509
4509
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4725,6 +4725,9 @@ class VisualElement {
|
|
|
4725
4725
|
this.valueSubscriptions.get(key)();
|
|
4726
4726
|
}
|
|
4727
4727
|
const valueIsTransform = transformProps.has(key);
|
|
4728
|
+
if (valueIsTransform && this.onBindTransform) {
|
|
4729
|
+
this.onBindTransform();
|
|
4730
|
+
}
|
|
4728
4731
|
const removeOnChange = value.on("change", (latestValue) => {
|
|
4729
4732
|
this.latestValues[key] = latestValue;
|
|
4730
4733
|
this.props.onUpdate && frame.preRender(this.notifyUpdate);
|
|
@@ -5251,6 +5254,16 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathL
|
|
|
5251
5254
|
}
|
|
5252
5255
|
}
|
|
5253
5256
|
|
|
5257
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
5258
|
+
|
|
5259
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
5260
|
+
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
5261
|
+
// Loop over any CSS variables and assign those.
|
|
5262
|
+
for (const key in vars) {
|
|
5263
|
+
element.style.setProperty(key, vars[key]);
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
|
|
5254
5267
|
/**
|
|
5255
5268
|
* A set of attribute names that are always read/written as camel case.
|
|
5256
5269
|
*/
|
|
@@ -5280,16 +5293,6 @@ const camelCaseAttributes = new Set([
|
|
|
5280
5293
|
"lengthAdjust",
|
|
5281
5294
|
]);
|
|
5282
5295
|
|
|
5283
|
-
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
5284
|
-
|
|
5285
|
-
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
5286
|
-
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
5287
|
-
// Loop over any CSS variables and assign those.
|
|
5288
|
-
for (const key in vars) {
|
|
5289
|
-
element.style.setProperty(key, vars[key]);
|
|
5290
|
-
}
|
|
5291
|
-
}
|
|
5292
|
-
|
|
5293
5296
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
5294
5297
|
renderHTML(element, renderState, undefined, projection);
|
|
5295
5298
|
for (const key in renderState.attrs) {
|
|
@@ -5336,12 +5339,35 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
5336
5339
|
return newValues;
|
|
5337
5340
|
}
|
|
5338
5341
|
|
|
5342
|
+
function updateSVGDimensions(instance, renderState) {
|
|
5343
|
+
try {
|
|
5344
|
+
renderState.dimensions =
|
|
5345
|
+
typeof instance.getBBox === "function"
|
|
5346
|
+
? instance.getBBox()
|
|
5347
|
+
: instance.getBoundingClientRect();
|
|
5348
|
+
}
|
|
5349
|
+
catch (e) {
|
|
5350
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
5351
|
+
renderState.dimensions = {
|
|
5352
|
+
x: 0,
|
|
5353
|
+
y: 0,
|
|
5354
|
+
width: 0,
|
|
5355
|
+
height: 0,
|
|
5356
|
+
};
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5339
5360
|
class SVGVisualElement extends DOMVisualElement {
|
|
5340
5361
|
constructor() {
|
|
5341
5362
|
super(...arguments);
|
|
5342
5363
|
this.type = "svg";
|
|
5343
5364
|
this.isSVGTag = false;
|
|
5344
5365
|
this.measureInstanceViewportBox = createBox;
|
|
5366
|
+
this.updateDimensions = () => {
|
|
5367
|
+
if (this.current && !this.renderState.dimensions) {
|
|
5368
|
+
updateSVGDimensions(this.current, this.renderState);
|
|
5369
|
+
}
|
|
5370
|
+
};
|
|
5345
5371
|
}
|
|
5346
5372
|
getBaseTargetFromProps(props, key) {
|
|
5347
5373
|
return props[key];
|
|
@@ -5357,6 +5383,11 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
5357
5383
|
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
5358
5384
|
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
5359
5385
|
}
|
|
5386
|
+
onBindTransform() {
|
|
5387
|
+
if (this.current && !this.renderState.dimensions) {
|
|
5388
|
+
frame.postRender(this.updateDimensions);
|
|
5389
|
+
}
|
|
5390
|
+
}
|
|
5360
5391
|
build(renderState, latestValues, props) {
|
|
5361
5392
|
buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate);
|
|
5362
5393
|
}
|