framer-motion 12.0.10 → 12.0.11
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/client.js +1 -1
- package/dist/cjs/{create-CGH8xAz7.js → create-DH48y06M.js} +88 -87
- package/dist/cjs/dom.js +30 -30
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/m.js +18 -17
- package/dist/dom.js +1 -1
- package/dist/es/render/svg/SVGVisualElement.mjs +1 -1
- package/dist/es/render/svg/config-motion.mjs +2 -18
- package/dist/es/render/svg/utils/measure.mjs +19 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +88 -87
- package/dist/framer-motion.js +1 -1
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -424,7 +424,7 @@ class MotionValue {
|
|
|
424
424
|
* This will be replaced by the build step with the latest version number.
|
|
425
425
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
426
426
|
*/
|
|
427
|
-
this.version = "12.0.
|
|
427
|
+
this.version = "12.0.11";
|
|
428
428
|
/**
|
|
429
429
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
430
430
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -4533,7 +4533,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4533
4533
|
* and warn against mismatches.
|
|
4534
4534
|
*/
|
|
4535
4535
|
if (process.env.NODE_ENV === "development") {
|
|
4536
|
-
warnOnce(nextValue.version === "12.0.
|
|
4536
|
+
warnOnce(nextValue.version === "12.0.11", `Attempting to mix Motion versions ${nextValue.version} with 12.0.11 may not work as expected.`);
|
|
4537
4537
|
}
|
|
4538
4538
|
}
|
|
4539
4539
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5284,28 +5284,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathL
|
|
|
5284
5284
|
}
|
|
5285
5285
|
}
|
|
5286
5286
|
|
|
5287
|
-
const createHtmlRenderState = () => ({
|
|
5288
|
-
style: {},
|
|
5289
|
-
transform: {},
|
|
5290
|
-
transformOrigin: {},
|
|
5291
|
-
vars: {},
|
|
5292
|
-
});
|
|
5293
|
-
|
|
5294
|
-
const createSvgRenderState = () => ({
|
|
5295
|
-
...createHtmlRenderState(),
|
|
5296
|
-
attrs: {},
|
|
5297
|
-
});
|
|
5298
|
-
|
|
5299
|
-
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
5300
|
-
|
|
5301
|
-
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
5302
|
-
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
5303
|
-
// Loop over any CSS variables and assign those.
|
|
5304
|
-
for (const key in vars) {
|
|
5305
|
-
element.style.setProperty(key, vars[key]);
|
|
5306
|
-
}
|
|
5307
|
-
}
|
|
5308
|
-
|
|
5309
5287
|
/**
|
|
5310
5288
|
* A set of attribute names that are always read/written as camel case.
|
|
5311
5289
|
*/
|
|
@@ -5335,6 +5313,34 @@ const camelCaseAttributes = new Set([
|
|
|
5335
5313
|
"lengthAdjust",
|
|
5336
5314
|
]);
|
|
5337
5315
|
|
|
5316
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
5317
|
+
|
|
5318
|
+
function updateSVGDimensions(instance, renderState) {
|
|
5319
|
+
try {
|
|
5320
|
+
renderState.dimensions =
|
|
5321
|
+
typeof instance.getBBox === "function"
|
|
5322
|
+
? instance.getBBox()
|
|
5323
|
+
: instance.getBoundingClientRect();
|
|
5324
|
+
}
|
|
5325
|
+
catch (e) {
|
|
5326
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
5327
|
+
renderState.dimensions = {
|
|
5328
|
+
x: 0,
|
|
5329
|
+
y: 0,
|
|
5330
|
+
width: 0,
|
|
5331
|
+
height: 0,
|
|
5332
|
+
};
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5336
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
5337
|
+
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
5338
|
+
// Loop over any CSS variables and assign those.
|
|
5339
|
+
for (const key in vars) {
|
|
5340
|
+
element.style.setProperty(key, vars[key]);
|
|
5341
|
+
}
|
|
5342
|
+
}
|
|
5343
|
+
|
|
5338
5344
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
5339
5345
|
renderHTML(element, renderState, undefined, projection);
|
|
5340
5346
|
for (const key in renderState.attrs) {
|
|
@@ -5389,69 +5395,6 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
5389
5395
|
return newValues;
|
|
5390
5396
|
}
|
|
5391
5397
|
|
|
5392
|
-
function updateSVGDimensions(instance, renderState) {
|
|
5393
|
-
try {
|
|
5394
|
-
renderState.dimensions =
|
|
5395
|
-
typeof instance.getBBox === "function"
|
|
5396
|
-
? instance.getBBox()
|
|
5397
|
-
: instance.getBoundingClientRect();
|
|
5398
|
-
}
|
|
5399
|
-
catch (e) {
|
|
5400
|
-
// Most likely trying to measure an unrendered element under Firefox
|
|
5401
|
-
renderState.dimensions = {
|
|
5402
|
-
x: 0,
|
|
5403
|
-
y: 0,
|
|
5404
|
-
width: 0,
|
|
5405
|
-
height: 0,
|
|
5406
|
-
};
|
|
5407
|
-
}
|
|
5408
|
-
}
|
|
5409
|
-
const layoutProps = ["x", "y", "width", "height", "cx", "cy", "r"];
|
|
5410
|
-
const svgMotionConfig = {
|
|
5411
|
-
useVisualState: makeUseVisualState({
|
|
5412
|
-
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
|
|
5413
|
-
createRenderState: createSvgRenderState,
|
|
5414
|
-
onUpdate: ({ props, prevProps, current, renderState, latestValues, }) => {
|
|
5415
|
-
if (!current)
|
|
5416
|
-
return;
|
|
5417
|
-
let hasTransform = !!props.drag;
|
|
5418
|
-
if (!hasTransform) {
|
|
5419
|
-
for (const key in latestValues) {
|
|
5420
|
-
if (transformProps.has(key)) {
|
|
5421
|
-
hasTransform = true;
|
|
5422
|
-
break;
|
|
5423
|
-
}
|
|
5424
|
-
}
|
|
5425
|
-
}
|
|
5426
|
-
if (!hasTransform)
|
|
5427
|
-
return;
|
|
5428
|
-
let needsMeasure = !prevProps;
|
|
5429
|
-
if (prevProps) {
|
|
5430
|
-
/**
|
|
5431
|
-
* Check the layout props for changes, if any are found we need to
|
|
5432
|
-
* measure the element again.
|
|
5433
|
-
*/
|
|
5434
|
-
for (let i = 0; i < layoutProps.length; i++) {
|
|
5435
|
-
const key = layoutProps[i];
|
|
5436
|
-
if (props[key] !==
|
|
5437
|
-
prevProps[key]) {
|
|
5438
|
-
needsMeasure = true;
|
|
5439
|
-
}
|
|
5440
|
-
}
|
|
5441
|
-
}
|
|
5442
|
-
if (!needsMeasure)
|
|
5443
|
-
return;
|
|
5444
|
-
frame.read(() => {
|
|
5445
|
-
updateSVGDimensions(current, renderState);
|
|
5446
|
-
frame.render(() => {
|
|
5447
|
-
buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
|
|
5448
|
-
renderSVG(current, renderState);
|
|
5449
|
-
});
|
|
5450
|
-
});
|
|
5451
|
-
},
|
|
5452
|
-
}),
|
|
5453
|
-
};
|
|
5454
|
-
|
|
5455
5398
|
class SVGVisualElement extends DOMVisualElement {
|
|
5456
5399
|
constructor() {
|
|
5457
5400
|
super(...arguments);
|
|
@@ -9247,6 +9190,13 @@ function getProjectionFunctionality(props) {
|
|
|
9247
9190
|
};
|
|
9248
9191
|
}
|
|
9249
9192
|
|
|
9193
|
+
const createHtmlRenderState = () => ({
|
|
9194
|
+
style: {},
|
|
9195
|
+
transform: {},
|
|
9196
|
+
transformOrigin: {},
|
|
9197
|
+
vars: {},
|
|
9198
|
+
});
|
|
9199
|
+
|
|
9250
9200
|
function copyRawValuesOnly(target, source, props) {
|
|
9251
9201
|
for (const key in source) {
|
|
9252
9202
|
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
|
|
@@ -9356,6 +9306,11 @@ function isSVGComponent(Component) {
|
|
|
9356
9306
|
return false;
|
|
9357
9307
|
}
|
|
9358
9308
|
|
|
9309
|
+
const createSvgRenderState = () => ({
|
|
9310
|
+
...createHtmlRenderState(),
|
|
9311
|
+
attrs: {},
|
|
9312
|
+
});
|
|
9313
|
+
|
|
9359
9314
|
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
9360
9315
|
const visualProps = React.useMemo(() => {
|
|
9361
9316
|
const state = createSvgRenderState();
|
|
@@ -9405,6 +9360,52 @@ const htmlMotionConfig = {
|
|
|
9405
9360
|
}),
|
|
9406
9361
|
};
|
|
9407
9362
|
|
|
9363
|
+
const layoutProps = ["x", "y", "width", "height", "cx", "cy", "r"];
|
|
9364
|
+
const svgMotionConfig = {
|
|
9365
|
+
useVisualState: makeUseVisualState({
|
|
9366
|
+
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
|
|
9367
|
+
createRenderState: createSvgRenderState,
|
|
9368
|
+
onUpdate: ({ props, prevProps, current, renderState, latestValues, }) => {
|
|
9369
|
+
if (!current)
|
|
9370
|
+
return;
|
|
9371
|
+
let hasTransform = !!props.drag;
|
|
9372
|
+
if (!hasTransform) {
|
|
9373
|
+
for (const key in latestValues) {
|
|
9374
|
+
if (transformProps.has(key)) {
|
|
9375
|
+
hasTransform = true;
|
|
9376
|
+
break;
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
}
|
|
9380
|
+
if (!hasTransform)
|
|
9381
|
+
return;
|
|
9382
|
+
let needsMeasure = !prevProps;
|
|
9383
|
+
if (prevProps) {
|
|
9384
|
+
/**
|
|
9385
|
+
* Check the layout props for changes, if any are found we need to
|
|
9386
|
+
* measure the element again.
|
|
9387
|
+
*/
|
|
9388
|
+
for (let i = 0; i < layoutProps.length; i++) {
|
|
9389
|
+
const key = layoutProps[i];
|
|
9390
|
+
if (props[key] !==
|
|
9391
|
+
prevProps[key]) {
|
|
9392
|
+
needsMeasure = true;
|
|
9393
|
+
}
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9396
|
+
if (!needsMeasure)
|
|
9397
|
+
return;
|
|
9398
|
+
frame.read(() => {
|
|
9399
|
+
updateSVGDimensions(current, renderState);
|
|
9400
|
+
frame.render(() => {
|
|
9401
|
+
buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
|
|
9402
|
+
renderSVG(current, renderState);
|
|
9403
|
+
});
|
|
9404
|
+
});
|
|
9405
|
+
},
|
|
9406
|
+
}),
|
|
9407
|
+
};
|
|
9408
|
+
|
|
9408
9409
|
function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
|
|
9409
9410
|
return function createMotionComponent(Component, { forwardMotionProps } = { forwardMotionProps: false }) {
|
|
9410
9411
|
const baseConfig = isSVGComponent(Component)
|
package/dist/cjs/dom.js
CHANGED
|
@@ -994,7 +994,7 @@ class MotionValue {
|
|
|
994
994
|
* This will be replaced by the build step with the latest version number.
|
|
995
995
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
996
996
|
*/
|
|
997
|
-
this.version = "12.0.
|
|
997
|
+
this.version = "12.0.11";
|
|
998
998
|
/**
|
|
999
999
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
1000
1000
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3928,7 +3928,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3928
3928
|
* and warn against mismatches.
|
|
3929
3929
|
*/
|
|
3930
3930
|
if (process.env.NODE_ENV === "development") {
|
|
3931
|
-
warnOnce(nextValue.version === "12.0.
|
|
3931
|
+
warnOnce(nextValue.version === "12.0.11", `Attempting to mix Motion versions ${nextValue.version} with 12.0.11 may not work as expected.`);
|
|
3932
3932
|
}
|
|
3933
3933
|
}
|
|
3934
3934
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4679,16 +4679,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathL
|
|
|
4679
4679
|
}
|
|
4680
4680
|
}
|
|
4681
4681
|
|
|
4682
|
-
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
4683
|
-
|
|
4684
|
-
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
4685
|
-
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
4686
|
-
// Loop over any CSS variables and assign those.
|
|
4687
|
-
for (const key in vars) {
|
|
4688
|
-
element.style.setProperty(key, vars[key]);
|
|
4689
|
-
}
|
|
4690
|
-
}
|
|
4691
|
-
|
|
4692
4682
|
/**
|
|
4693
4683
|
* A set of attribute names that are always read/written as camel case.
|
|
4694
4684
|
*/
|
|
@@ -4718,6 +4708,34 @@ const camelCaseAttributes = new Set([
|
|
|
4718
4708
|
"lengthAdjust",
|
|
4719
4709
|
]);
|
|
4720
4710
|
|
|
4711
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
4712
|
+
|
|
4713
|
+
function updateSVGDimensions(instance, renderState) {
|
|
4714
|
+
try {
|
|
4715
|
+
renderState.dimensions =
|
|
4716
|
+
typeof instance.getBBox === "function"
|
|
4717
|
+
? instance.getBBox()
|
|
4718
|
+
: instance.getBoundingClientRect();
|
|
4719
|
+
}
|
|
4720
|
+
catch (e) {
|
|
4721
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
4722
|
+
renderState.dimensions = {
|
|
4723
|
+
x: 0,
|
|
4724
|
+
y: 0,
|
|
4725
|
+
width: 0,
|
|
4726
|
+
height: 0,
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4731
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
4732
|
+
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
4733
|
+
// Loop over any CSS variables and assign those.
|
|
4734
|
+
for (const key in vars) {
|
|
4735
|
+
element.style.setProperty(key, vars[key]);
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4721
4739
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
4722
4740
|
renderHTML(element, renderState, undefined, projection);
|
|
4723
4741
|
for (const key in renderState.attrs) {
|
|
@@ -4764,24 +4782,6 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
4764
4782
|
return newValues;
|
|
4765
4783
|
}
|
|
4766
4784
|
|
|
4767
|
-
function updateSVGDimensions(instance, renderState) {
|
|
4768
|
-
try {
|
|
4769
|
-
renderState.dimensions =
|
|
4770
|
-
typeof instance.getBBox === "function"
|
|
4771
|
-
? instance.getBBox()
|
|
4772
|
-
: instance.getBoundingClientRect();
|
|
4773
|
-
}
|
|
4774
|
-
catch (e) {
|
|
4775
|
-
// Most likely trying to measure an unrendered element under Firefox
|
|
4776
|
-
renderState.dimensions = {
|
|
4777
|
-
x: 0,
|
|
4778
|
-
y: 0,
|
|
4779
|
-
width: 0,
|
|
4780
|
-
height: 0,
|
|
4781
|
-
};
|
|
4782
|
-
}
|
|
4783
|
-
}
|
|
4784
|
-
|
|
4785
4785
|
class SVGVisualElement extends DOMVisualElement {
|
|
4786
4786
|
constructor() {
|
|
4787
4787
|
super(...arguments);
|
package/dist/cjs/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var create = require('./create-
|
|
7
|
+
var create = require('./create-DH48y06M.js');
|
|
8
8
|
var motionUtils = require('motion-utils');
|
|
9
9
|
var motionDom = require('motion-dom');
|
|
10
10
|
|
package/dist/cjs/m.js
CHANGED
|
@@ -1352,6 +1352,24 @@ const htmlMotionConfig = {
|
|
|
1352
1352
|
|
|
1353
1353
|
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : motionUtils.noop, true);
|
|
1354
1354
|
|
|
1355
|
+
function updateSVGDimensions(instance, renderState) {
|
|
1356
|
+
try {
|
|
1357
|
+
renderState.dimensions =
|
|
1358
|
+
typeof instance.getBBox === "function"
|
|
1359
|
+
? instance.getBBox()
|
|
1360
|
+
: instance.getBoundingClientRect();
|
|
1361
|
+
}
|
|
1362
|
+
catch (e) {
|
|
1363
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
1364
|
+
renderState.dimensions = {
|
|
1365
|
+
x: 0,
|
|
1366
|
+
y: 0,
|
|
1367
|
+
width: 0,
|
|
1368
|
+
height: 0,
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1355
1373
|
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
1356
1374
|
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
1357
1375
|
// Loop over any CSS variables and assign those.
|
|
@@ -1410,23 +1428,6 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
1410
1428
|
return newValues;
|
|
1411
1429
|
}
|
|
1412
1430
|
|
|
1413
|
-
function updateSVGDimensions(instance, renderState) {
|
|
1414
|
-
try {
|
|
1415
|
-
renderState.dimensions =
|
|
1416
|
-
typeof instance.getBBox === "function"
|
|
1417
|
-
? instance.getBBox()
|
|
1418
|
-
: instance.getBoundingClientRect();
|
|
1419
|
-
}
|
|
1420
|
-
catch (e) {
|
|
1421
|
-
// Most likely trying to measure an unrendered element under Firefox
|
|
1422
|
-
renderState.dimensions = {
|
|
1423
|
-
x: 0,
|
|
1424
|
-
y: 0,
|
|
1425
|
-
width: 0,
|
|
1426
|
-
height: 0,
|
|
1427
|
-
};
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
1431
|
const layoutProps = ["x", "y", "width", "height", "cx", "cy", "r"];
|
|
1431
1432
|
const svgMotionConfig = {
|
|
1432
1433
|
useVisualState: makeUseVisualState({
|