framer-motion 12.0.10 → 12.1.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/client.js +1 -1
- package/dist/cjs/{create-CGH8xAz7.js → create-DLcVgZwy.js} +130 -125
- package/dist/cjs/dom.js +30 -31
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/m.js +18 -17
- package/dist/dom.js +1 -1
- package/dist/es/motion/features/animation/exit.mjs +7 -2
- package/dist/es/render/VisualElement.mjs +0 -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/animation-state.mjs +2 -2
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +130 -125
- package/dist/framer-motion.js +1 -1
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -13,30 +13,6 @@ function isAnimationControls(v) {
|
|
|
13
13
|
typeof v.start === "function");
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const isKeyframesTarget = (v) => {
|
|
17
|
-
return Array.isArray(v);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
function shallowCompare(next, prev) {
|
|
21
|
-
if (!Array.isArray(prev))
|
|
22
|
-
return false;
|
|
23
|
-
const prevLength = prev.length;
|
|
24
|
-
if (prevLength !== next.length)
|
|
25
|
-
return false;
|
|
26
|
-
for (let i = 0; i < prevLength; i++) {
|
|
27
|
-
if (prev[i] !== next[i])
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Decides if the supplied variable is variant label
|
|
35
|
-
*/
|
|
36
|
-
function isVariantLabel(v) {
|
|
37
|
-
return typeof v === "string" || Array.isArray(v);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
16
|
function getValueState(visualElement) {
|
|
41
17
|
const state = [{}, {}];
|
|
42
18
|
visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
|
|
@@ -77,17 +53,6 @@ function resolveVariant(visualElement, definition, custom) {
|
|
|
77
53
|
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
|
|
78
54
|
}
|
|
79
55
|
|
|
80
|
-
const variantPriorityOrder = [
|
|
81
|
-
"animate",
|
|
82
|
-
"whileInView",
|
|
83
|
-
"whileFocus",
|
|
84
|
-
"whileHover",
|
|
85
|
-
"whileTap",
|
|
86
|
-
"whileDrag",
|
|
87
|
-
"exit",
|
|
88
|
-
];
|
|
89
|
-
const variantProps = ["initial", ...variantPriorityOrder];
|
|
90
|
-
|
|
91
56
|
const MotionGlobalConfig = {
|
|
92
57
|
skipAnimations: false,
|
|
93
58
|
useManualTiming: false,
|
|
@@ -282,6 +247,10 @@ const positionalKeys = new Set([
|
|
|
282
247
|
...transformPropOrder,
|
|
283
248
|
]);
|
|
284
249
|
|
|
250
|
+
const isKeyframesTarget = (v) => {
|
|
251
|
+
return Array.isArray(v);
|
|
252
|
+
};
|
|
253
|
+
|
|
285
254
|
const isCustomValue = (v) => {
|
|
286
255
|
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
|
|
287
256
|
};
|
|
@@ -424,7 +393,7 @@ class MotionValue {
|
|
|
424
393
|
* This will be replaced by the build step with the latest version number.
|
|
425
394
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
426
395
|
*/
|
|
427
|
-
this.version = "12.0
|
|
396
|
+
this.version = "12.1.0";
|
|
428
397
|
/**
|
|
429
398
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
430
399
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3627,6 +3596,37 @@ function animateVisualElement(visualElement, definition, options = {}) {
|
|
|
3627
3596
|
});
|
|
3628
3597
|
}
|
|
3629
3598
|
|
|
3599
|
+
function shallowCompare(next, prev) {
|
|
3600
|
+
if (!Array.isArray(prev))
|
|
3601
|
+
return false;
|
|
3602
|
+
const prevLength = prev.length;
|
|
3603
|
+
if (prevLength !== next.length)
|
|
3604
|
+
return false;
|
|
3605
|
+
for (let i = 0; i < prevLength; i++) {
|
|
3606
|
+
if (prev[i] !== next[i])
|
|
3607
|
+
return false;
|
|
3608
|
+
}
|
|
3609
|
+
return true;
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3612
|
+
/**
|
|
3613
|
+
* Decides if the supplied variable is variant label
|
|
3614
|
+
*/
|
|
3615
|
+
function isVariantLabel(v) {
|
|
3616
|
+
return typeof v === "string" || Array.isArray(v);
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
const variantPriorityOrder = [
|
|
3620
|
+
"animate",
|
|
3621
|
+
"whileInView",
|
|
3622
|
+
"whileFocus",
|
|
3623
|
+
"whileHover",
|
|
3624
|
+
"whileTap",
|
|
3625
|
+
"whileDrag",
|
|
3626
|
+
"exit",
|
|
3627
|
+
];
|
|
3628
|
+
const variantProps = ["initial", ...variantPriorityOrder];
|
|
3629
|
+
|
|
3630
3630
|
const numVariantProps = variantProps.length;
|
|
3631
3631
|
function getVariantContext(visualElement) {
|
|
3632
3632
|
if (!visualElement)
|
|
@@ -4033,11 +4033,16 @@ class ExitAnimationFeature extends Feature {
|
|
|
4033
4033
|
}
|
|
4034
4034
|
const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
|
|
4035
4035
|
if (onExitComplete && !isPresent) {
|
|
4036
|
-
exitAnimation.then(() =>
|
|
4036
|
+
exitAnimation.then(() => {
|
|
4037
|
+
onExitComplete(this.id);
|
|
4038
|
+
});
|
|
4037
4039
|
}
|
|
4038
4040
|
}
|
|
4039
4041
|
mount() {
|
|
4040
|
-
const { register } = this.node.presenceContext || {};
|
|
4042
|
+
const { register, onExitComplete } = this.node.presenceContext || {};
|
|
4043
|
+
if (onExitComplete) {
|
|
4044
|
+
onExitComplete(this.id);
|
|
4045
|
+
}
|
|
4041
4046
|
if (register) {
|
|
4042
4047
|
this.unmount = register(this.id);
|
|
4043
4048
|
}
|
|
@@ -4533,7 +4538,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4533
4538
|
* and warn against mismatches.
|
|
4534
4539
|
*/
|
|
4535
4540
|
if (process.env.NODE_ENV === "development") {
|
|
4536
|
-
warnOnce(nextValue.version === "12.0
|
|
4541
|
+
warnOnce(nextValue.version === "12.1.0", `Attempting to mix Motion versions ${nextValue.version} with 12.1.0 may not work as expected.`);
|
|
4537
4542
|
}
|
|
4538
4543
|
}
|
|
4539
4544
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4730,7 +4735,6 @@ class VisualElement {
|
|
|
4730
4735
|
this.update(this.props, this.presenceContext);
|
|
4731
4736
|
}
|
|
4732
4737
|
unmount() {
|
|
4733
|
-
visualElementStore.delete(this.current);
|
|
4734
4738
|
this.projection && this.projection.unmount();
|
|
4735
4739
|
cancelFrame(this.notifyUpdate);
|
|
4736
4740
|
cancelFrame(this.render);
|
|
@@ -5284,28 +5288,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathL
|
|
|
5284
5288
|
}
|
|
5285
5289
|
}
|
|
5286
5290
|
|
|
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
5291
|
/**
|
|
5310
5292
|
* A set of attribute names that are always read/written as camel case.
|
|
5311
5293
|
*/
|
|
@@ -5335,6 +5317,34 @@ const camelCaseAttributes = new Set([
|
|
|
5335
5317
|
"lengthAdjust",
|
|
5336
5318
|
]);
|
|
5337
5319
|
|
|
5320
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
5321
|
+
|
|
5322
|
+
function updateSVGDimensions(instance, renderState) {
|
|
5323
|
+
try {
|
|
5324
|
+
renderState.dimensions =
|
|
5325
|
+
typeof instance.getBBox === "function"
|
|
5326
|
+
? instance.getBBox()
|
|
5327
|
+
: instance.getBoundingClientRect();
|
|
5328
|
+
}
|
|
5329
|
+
catch (e) {
|
|
5330
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
5331
|
+
renderState.dimensions = {
|
|
5332
|
+
x: 0,
|
|
5333
|
+
y: 0,
|
|
5334
|
+
width: 0,
|
|
5335
|
+
height: 0,
|
|
5336
|
+
};
|
|
5337
|
+
}
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5340
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
5341
|
+
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
5342
|
+
// Loop over any CSS variables and assign those.
|
|
5343
|
+
for (const key in vars) {
|
|
5344
|
+
element.style.setProperty(key, vars[key]);
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
|
|
5338
5348
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
5339
5349
|
renderHTML(element, renderState, undefined, projection);
|
|
5340
5350
|
for (const key in renderState.attrs) {
|
|
@@ -5389,69 +5399,6 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
5389
5399
|
return newValues;
|
|
5390
5400
|
}
|
|
5391
5401
|
|
|
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
5402
|
class SVGVisualElement extends DOMVisualElement {
|
|
5456
5403
|
constructor() {
|
|
5457
5404
|
super(...arguments);
|
|
@@ -9247,6 +9194,13 @@ function getProjectionFunctionality(props) {
|
|
|
9247
9194
|
};
|
|
9248
9195
|
}
|
|
9249
9196
|
|
|
9197
|
+
const createHtmlRenderState = () => ({
|
|
9198
|
+
style: {},
|
|
9199
|
+
transform: {},
|
|
9200
|
+
transformOrigin: {},
|
|
9201
|
+
vars: {},
|
|
9202
|
+
});
|
|
9203
|
+
|
|
9250
9204
|
function copyRawValuesOnly(target, source, props) {
|
|
9251
9205
|
for (const key in source) {
|
|
9252
9206
|
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
|
|
@@ -9356,6 +9310,11 @@ function isSVGComponent(Component) {
|
|
|
9356
9310
|
return false;
|
|
9357
9311
|
}
|
|
9358
9312
|
|
|
9313
|
+
const createSvgRenderState = () => ({
|
|
9314
|
+
...createHtmlRenderState(),
|
|
9315
|
+
attrs: {},
|
|
9316
|
+
});
|
|
9317
|
+
|
|
9359
9318
|
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
9360
9319
|
const visualProps = React.useMemo(() => {
|
|
9361
9320
|
const state = createSvgRenderState();
|
|
@@ -9405,6 +9364,52 @@ const htmlMotionConfig = {
|
|
|
9405
9364
|
}),
|
|
9406
9365
|
};
|
|
9407
9366
|
|
|
9367
|
+
const layoutProps = ["x", "y", "width", "height", "cx", "cy", "r"];
|
|
9368
|
+
const svgMotionConfig = {
|
|
9369
|
+
useVisualState: makeUseVisualState({
|
|
9370
|
+
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
|
|
9371
|
+
createRenderState: createSvgRenderState,
|
|
9372
|
+
onUpdate: ({ props, prevProps, current, renderState, latestValues, }) => {
|
|
9373
|
+
if (!current)
|
|
9374
|
+
return;
|
|
9375
|
+
let hasTransform = !!props.drag;
|
|
9376
|
+
if (!hasTransform) {
|
|
9377
|
+
for (const key in latestValues) {
|
|
9378
|
+
if (transformProps.has(key)) {
|
|
9379
|
+
hasTransform = true;
|
|
9380
|
+
break;
|
|
9381
|
+
}
|
|
9382
|
+
}
|
|
9383
|
+
}
|
|
9384
|
+
if (!hasTransform)
|
|
9385
|
+
return;
|
|
9386
|
+
let needsMeasure = !prevProps;
|
|
9387
|
+
if (prevProps) {
|
|
9388
|
+
/**
|
|
9389
|
+
* Check the layout props for changes, if any are found we need to
|
|
9390
|
+
* measure the element again.
|
|
9391
|
+
*/
|
|
9392
|
+
for (let i = 0; i < layoutProps.length; i++) {
|
|
9393
|
+
const key = layoutProps[i];
|
|
9394
|
+
if (props[key] !==
|
|
9395
|
+
prevProps[key]) {
|
|
9396
|
+
needsMeasure = true;
|
|
9397
|
+
}
|
|
9398
|
+
}
|
|
9399
|
+
}
|
|
9400
|
+
if (!needsMeasure)
|
|
9401
|
+
return;
|
|
9402
|
+
frame.read(() => {
|
|
9403
|
+
updateSVGDimensions(current, renderState);
|
|
9404
|
+
frame.render(() => {
|
|
9405
|
+
buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
|
|
9406
|
+
renderSVG(current, renderState);
|
|
9407
|
+
});
|
|
9408
|
+
});
|
|
9409
|
+
},
|
|
9410
|
+
}),
|
|
9411
|
+
};
|
|
9412
|
+
|
|
9408
9413
|
function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
|
|
9409
9414
|
return function createMotionComponent(Component, { forwardMotionProps } = { forwardMotionProps: false }) {
|
|
9410
9415
|
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.1.0";
|
|
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.1.0", `Attempting to mix Motion versions ${nextValue.version} with 12.1.0 may not work as expected.`);
|
|
3932
3932
|
}
|
|
3933
3933
|
}
|
|
3934
3934
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4125,7 +4125,6 @@ class VisualElement {
|
|
|
4125
4125
|
this.update(this.props, this.presenceContext);
|
|
4126
4126
|
}
|
|
4127
4127
|
unmount() {
|
|
4128
|
-
visualElementStore.delete(this.current);
|
|
4129
4128
|
this.projection && this.projection.unmount();
|
|
4130
4129
|
cancelFrame(this.notifyUpdate);
|
|
4131
4130
|
cancelFrame(this.render);
|
|
@@ -4679,16 +4678,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathL
|
|
|
4679
4678
|
}
|
|
4680
4679
|
}
|
|
4681
4680
|
|
|
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
4681
|
/**
|
|
4693
4682
|
* A set of attribute names that are always read/written as camel case.
|
|
4694
4683
|
*/
|
|
@@ -4718,6 +4707,34 @@ const camelCaseAttributes = new Set([
|
|
|
4718
4707
|
"lengthAdjust",
|
|
4719
4708
|
]);
|
|
4720
4709
|
|
|
4710
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
4711
|
+
|
|
4712
|
+
function updateSVGDimensions(instance, renderState) {
|
|
4713
|
+
try {
|
|
4714
|
+
renderState.dimensions =
|
|
4715
|
+
typeof instance.getBBox === "function"
|
|
4716
|
+
? instance.getBBox()
|
|
4717
|
+
: instance.getBoundingClientRect();
|
|
4718
|
+
}
|
|
4719
|
+
catch (e) {
|
|
4720
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
4721
|
+
renderState.dimensions = {
|
|
4722
|
+
x: 0,
|
|
4723
|
+
y: 0,
|
|
4724
|
+
width: 0,
|
|
4725
|
+
height: 0,
|
|
4726
|
+
};
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
4731
|
+
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
4732
|
+
// Loop over any CSS variables and assign those.
|
|
4733
|
+
for (const key in vars) {
|
|
4734
|
+
element.style.setProperty(key, vars[key]);
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
|
|
4721
4738
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
4722
4739
|
renderHTML(element, renderState, undefined, projection);
|
|
4723
4740
|
for (const key in renderState.attrs) {
|
|
@@ -4764,24 +4781,6 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
4764
4781
|
return newValues;
|
|
4765
4782
|
}
|
|
4766
4783
|
|
|
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
4784
|
class SVGVisualElement extends DOMVisualElement {
|
|
4786
4785
|
constructor() {
|
|
4787
4786
|
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-DLcVgZwy.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({
|