framer-motion 10.16.1 → 10.16.2
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/dom-entry.js +1 -1
- package/dist/cjs/{index-legacy-22d86ed2.js → index-legacy-ccd59e4d.js} +73 -32
- package/dist/cjs/index.js +1 -1
- package/dist/es/frameloop/render-step.mjs +37 -21
- package/dist/es/render/dom/scroll/offsets/index.mjs +6 -1
- package/dist/es/render/dom/scroll/offsets/inset.mjs +28 -8
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +73 -32
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +39 -23
- package/package.json +8 -8
package/dist/cjs/dom-entry.js
CHANGED
|
@@ -553,16 +553,37 @@ const resolveFinalValueInKeyframes = (v) => {
|
|
|
553
553
|
|
|
554
554
|
const noop = (any) => any;
|
|
555
555
|
|
|
556
|
+
class Queue {
|
|
557
|
+
constructor() {
|
|
558
|
+
this.order = [];
|
|
559
|
+
this.scheduled = new Set();
|
|
560
|
+
}
|
|
561
|
+
add(process) {
|
|
562
|
+
if (!this.scheduled.has(process)) {
|
|
563
|
+
this.scheduled.add(process);
|
|
564
|
+
this.order.push(process);
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
remove(process) {
|
|
569
|
+
const index = this.order.indexOf(process);
|
|
570
|
+
if (index !== -1) {
|
|
571
|
+
this.order.splice(index, 1);
|
|
572
|
+
this.scheduled.delete(process);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
clear() {
|
|
576
|
+
this.order.length = 0;
|
|
577
|
+
this.scheduled.clear();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
556
580
|
function createRenderStep(runNextFrame) {
|
|
557
581
|
/**
|
|
558
|
-
* We create and reuse two
|
|
582
|
+
* We create and reuse two queues, one to queue jobs for the current frame
|
|
559
583
|
* and one for the next. We reuse to avoid triggering GC after x frames.
|
|
560
584
|
*/
|
|
561
|
-
let
|
|
562
|
-
let
|
|
563
|
-
/**
|
|
564
|
-
*
|
|
565
|
-
*/
|
|
585
|
+
let thisFrame = new Queue();
|
|
586
|
+
let nextFrame = new Queue();
|
|
566
587
|
let numToRun = 0;
|
|
567
588
|
/**
|
|
568
589
|
* Track whether we're currently processing jobs in this step. This way
|
|
@@ -580,15 +601,12 @@ function createRenderStep(runNextFrame) {
|
|
|
580
601
|
*/
|
|
581
602
|
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
582
603
|
const addToCurrentFrame = immediate && isProcessing;
|
|
583
|
-
const
|
|
604
|
+
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
584
605
|
if (keepAlive)
|
|
585
606
|
toKeepAlive.add(callback);
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
// If we're adding it to the currently running buffer, update its measured size
|
|
590
|
-
if (addToCurrentFrame && isProcessing)
|
|
591
|
-
numToRun = toRun.length;
|
|
607
|
+
if (queue.add(callback) && addToCurrentFrame && isProcessing) {
|
|
608
|
+
// If we're adding it to the currently running queue, update its measured size
|
|
609
|
+
numToRun = thisFrame.order.length;
|
|
592
610
|
}
|
|
593
611
|
return callback;
|
|
594
612
|
},
|
|
@@ -596,9 +614,7 @@ function createRenderStep(runNextFrame) {
|
|
|
596
614
|
* Cancel the provided callback from running on the next frame.
|
|
597
615
|
*/
|
|
598
616
|
cancel: (callback) => {
|
|
599
|
-
|
|
600
|
-
if (index !== -1)
|
|
601
|
-
toRunNextFrame.splice(index, 1);
|
|
617
|
+
nextFrame.remove(callback);
|
|
602
618
|
toKeepAlive.delete(callback);
|
|
603
619
|
},
|
|
604
620
|
/**
|
|
@@ -615,14 +631,14 @@ function createRenderStep(runNextFrame) {
|
|
|
615
631
|
return;
|
|
616
632
|
}
|
|
617
633
|
isProcessing = true;
|
|
618
|
-
[
|
|
619
|
-
// Clear the next frame
|
|
620
|
-
|
|
634
|
+
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
635
|
+
// Clear the next frame queue
|
|
636
|
+
nextFrame.clear();
|
|
621
637
|
// Execute this frame
|
|
622
|
-
numToRun =
|
|
638
|
+
numToRun = thisFrame.order.length;
|
|
623
639
|
if (numToRun) {
|
|
624
640
|
for (let i = 0; i < numToRun; i++) {
|
|
625
|
-
const callback =
|
|
641
|
+
const callback = thisFrame.order[i];
|
|
626
642
|
callback(frameData);
|
|
627
643
|
if (toKeepAlive.has(callback)) {
|
|
628
644
|
step.schedule(callback);
|
|
@@ -2662,7 +2678,7 @@ class MotionValue {
|
|
|
2662
2678
|
* This will be replaced by the build step with the latest version number.
|
|
2663
2679
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2664
2680
|
*/
|
|
2665
|
-
this.version = "10.16.
|
|
2681
|
+
this.version = "10.16.2";
|
|
2666
2682
|
/**
|
|
2667
2683
|
* Duration, in milliseconds, since last updating frame.
|
|
2668
2684
|
*
|
|
@@ -3880,7 +3896,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3880
3896
|
* and warn against mismatches.
|
|
3881
3897
|
*/
|
|
3882
3898
|
if (process.env.NODE_ENV === "development") {
|
|
3883
|
-
warnOnce(nextValue.version === "10.16.
|
|
3899
|
+
warnOnce(nextValue.version === "10.16.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.16.2 may not work as expected.`);
|
|
3884
3900
|
}
|
|
3885
3901
|
}
|
|
3886
3902
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5071,7 +5087,7 @@ function updateScrollInfo(element, info, time) {
|
|
|
5071
5087
|
}
|
|
5072
5088
|
|
|
5073
5089
|
function calcInset(element, container) {
|
|
5074
|
-
|
|
5090
|
+
const inset = { x: 0, y: 0 };
|
|
5075
5091
|
let current = element;
|
|
5076
5092
|
while (current && current !== container) {
|
|
5077
5093
|
if (current instanceof HTMLElement) {
|
|
@@ -5079,16 +5095,36 @@ function calcInset(element, container) {
|
|
|
5079
5095
|
inset.y += current.offsetTop;
|
|
5080
5096
|
current = current.offsetParent;
|
|
5081
5097
|
}
|
|
5082
|
-
else if (current
|
|
5083
|
-
const { top, left } = current.getBBox();
|
|
5084
|
-
inset.x += left;
|
|
5085
|
-
inset.y += top;
|
|
5098
|
+
else if (current.tagName === "svg") {
|
|
5086
5099
|
/**
|
|
5087
|
-
*
|
|
5100
|
+
* This isn't an ideal approach to measuring the offset of <svg /> tags.
|
|
5101
|
+
* It would be preferable, given they behave like HTMLElements in most ways
|
|
5102
|
+
* to use offsetLeft/Top. But these don't exist on <svg />. Likewise we
|
|
5103
|
+
* can't use .getBBox() like most SVG elements as these provide the offset
|
|
5104
|
+
* relative to the SVG itself, which for <svg /> is usually 0x0.
|
|
5088
5105
|
*/
|
|
5089
|
-
|
|
5090
|
-
|
|
5106
|
+
const svgBoundingBox = current.getBoundingClientRect();
|
|
5107
|
+
current = current.parentElement;
|
|
5108
|
+
const parentBoundingBox = current.getBoundingClientRect();
|
|
5109
|
+
inset.x += svgBoundingBox.left - parentBoundingBox.left;
|
|
5110
|
+
inset.y += svgBoundingBox.top - parentBoundingBox.top;
|
|
5111
|
+
}
|
|
5112
|
+
else if (current instanceof SVGGraphicsElement) {
|
|
5113
|
+
const { x, y } = current.getBBox();
|
|
5114
|
+
inset.x += x;
|
|
5115
|
+
inset.y += y;
|
|
5116
|
+
let svg = null;
|
|
5117
|
+
let parent = current.parentNode;
|
|
5118
|
+
while (!svg) {
|
|
5119
|
+
if (parent.tagName === "svg") {
|
|
5120
|
+
svg = parent;
|
|
5121
|
+
}
|
|
5122
|
+
parent = current.parentNode;
|
|
5091
5123
|
}
|
|
5124
|
+
current = svg;
|
|
5125
|
+
}
|
|
5126
|
+
else {
|
|
5127
|
+
break;
|
|
5092
5128
|
}
|
|
5093
5129
|
}
|
|
5094
5130
|
return inset;
|
|
@@ -5190,6 +5226,11 @@ function resolveOffset(offset, containerLength, targetLength, targetInset) {
|
|
|
5190
5226
|
}
|
|
5191
5227
|
|
|
5192
5228
|
const point = { x: 0, y: 0 };
|
|
5229
|
+
function getTargetSize(target) {
|
|
5230
|
+
return "getBBox" in target && target.tagName !== "svg"
|
|
5231
|
+
? target.getBBox()
|
|
5232
|
+
: { width: target.clientWidth, height: target.clientHeight };
|
|
5233
|
+
}
|
|
5193
5234
|
function resolveOffsets(container, info, options) {
|
|
5194
5235
|
let { offset: offsetDefinition = ScrollOffset.All } = options;
|
|
5195
5236
|
const { target = container, axis = "y" } = options;
|
|
@@ -5202,7 +5243,7 @@ function resolveOffsets(container, info, options) {
|
|
|
5202
5243
|
*/
|
|
5203
5244
|
const targetSize = target === container
|
|
5204
5245
|
? { width: container.scrollWidth, height: container.scrollHeight }
|
|
5205
|
-
:
|
|
5246
|
+
: getTargetSize(target);
|
|
5206
5247
|
const containerSize = {
|
|
5207
5248
|
width: container.clientWidth,
|
|
5208
5249
|
height: container.clientHeight,
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var indexLegacy = require('./index-legacy-
|
|
6
|
+
var indexLegacy = require('./index-legacy-ccd59e4d.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
+
class Queue {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.order = [];
|
|
4
|
+
this.scheduled = new Set();
|
|
5
|
+
}
|
|
6
|
+
add(process) {
|
|
7
|
+
if (!this.scheduled.has(process)) {
|
|
8
|
+
this.scheduled.add(process);
|
|
9
|
+
this.order.push(process);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
remove(process) {
|
|
14
|
+
const index = this.order.indexOf(process);
|
|
15
|
+
if (index !== -1) {
|
|
16
|
+
this.order.splice(index, 1);
|
|
17
|
+
this.scheduled.delete(process);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
clear() {
|
|
21
|
+
this.order.length = 0;
|
|
22
|
+
this.scheduled.clear();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
1
25
|
function createRenderStep(runNextFrame) {
|
|
2
26
|
/**
|
|
3
|
-
* We create and reuse two
|
|
27
|
+
* We create and reuse two queues, one to queue jobs for the current frame
|
|
4
28
|
* and one for the next. We reuse to avoid triggering GC after x frames.
|
|
5
29
|
*/
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
30
|
+
let thisFrame = new Queue();
|
|
31
|
+
let nextFrame = new Queue();
|
|
11
32
|
let numToRun = 0;
|
|
12
33
|
/**
|
|
13
34
|
* Track whether we're currently processing jobs in this step. This way
|
|
@@ -25,15 +46,12 @@ function createRenderStep(runNextFrame) {
|
|
|
25
46
|
*/
|
|
26
47
|
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
27
48
|
const addToCurrentFrame = immediate && isProcessing;
|
|
28
|
-
const
|
|
49
|
+
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
29
50
|
if (keepAlive)
|
|
30
51
|
toKeepAlive.add(callback);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// If we're adding it to the currently running buffer, update its measured size
|
|
35
|
-
if (addToCurrentFrame && isProcessing)
|
|
36
|
-
numToRun = toRun.length;
|
|
52
|
+
if (queue.add(callback) && addToCurrentFrame && isProcessing) {
|
|
53
|
+
// If we're adding it to the currently running queue, update its measured size
|
|
54
|
+
numToRun = thisFrame.order.length;
|
|
37
55
|
}
|
|
38
56
|
return callback;
|
|
39
57
|
},
|
|
@@ -41,9 +59,7 @@ function createRenderStep(runNextFrame) {
|
|
|
41
59
|
* Cancel the provided callback from running on the next frame.
|
|
42
60
|
*/
|
|
43
61
|
cancel: (callback) => {
|
|
44
|
-
|
|
45
|
-
if (index !== -1)
|
|
46
|
-
toRunNextFrame.splice(index, 1);
|
|
62
|
+
nextFrame.remove(callback);
|
|
47
63
|
toKeepAlive.delete(callback);
|
|
48
64
|
},
|
|
49
65
|
/**
|
|
@@ -60,14 +76,14 @@ function createRenderStep(runNextFrame) {
|
|
|
60
76
|
return;
|
|
61
77
|
}
|
|
62
78
|
isProcessing = true;
|
|
63
|
-
[
|
|
64
|
-
// Clear the next frame
|
|
65
|
-
|
|
79
|
+
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
80
|
+
// Clear the next frame queue
|
|
81
|
+
nextFrame.clear();
|
|
66
82
|
// Execute this frame
|
|
67
|
-
numToRun =
|
|
83
|
+
numToRun = thisFrame.order.length;
|
|
68
84
|
if (numToRun) {
|
|
69
85
|
for (let i = 0; i < numToRun; i++) {
|
|
70
|
-
const callback =
|
|
86
|
+
const callback = thisFrame.order[i];
|
|
71
87
|
callback(frameData);
|
|
72
88
|
if (toKeepAlive.has(callback)) {
|
|
73
89
|
step.schedule(callback);
|
|
@@ -5,6 +5,11 @@ import { interpolate } from '../../../../utils/interpolate.mjs';
|
|
|
5
5
|
import { defaultOffset } from '../../../../utils/offsets/default.mjs';
|
|
6
6
|
|
|
7
7
|
const point = { x: 0, y: 0 };
|
|
8
|
+
function getTargetSize(target) {
|
|
9
|
+
return "getBBox" in target && target.tagName !== "svg"
|
|
10
|
+
? target.getBBox()
|
|
11
|
+
: { width: target.clientWidth, height: target.clientHeight };
|
|
12
|
+
}
|
|
8
13
|
function resolveOffsets(container, info, options) {
|
|
9
14
|
let { offset: offsetDefinition = ScrollOffset.All } = options;
|
|
10
15
|
const { target = container, axis = "y" } = options;
|
|
@@ -17,7 +22,7 @@ function resolveOffsets(container, info, options) {
|
|
|
17
22
|
*/
|
|
18
23
|
const targetSize = target === container
|
|
19
24
|
? { width: container.scrollWidth, height: container.scrollHeight }
|
|
20
|
-
:
|
|
25
|
+
: getTargetSize(target);
|
|
21
26
|
const containerSize = {
|
|
22
27
|
width: container.clientWidth,
|
|
23
28
|
height: container.clientHeight,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function calcInset(element, container) {
|
|
2
|
-
|
|
2
|
+
const inset = { x: 0, y: 0 };
|
|
3
3
|
let current = element;
|
|
4
4
|
while (current && current !== container) {
|
|
5
5
|
if (current instanceof HTMLElement) {
|
|
@@ -7,16 +7,36 @@ function calcInset(element, container) {
|
|
|
7
7
|
inset.y += current.offsetTop;
|
|
8
8
|
current = current.offsetParent;
|
|
9
9
|
}
|
|
10
|
-
else if (current
|
|
11
|
-
const { top, left } = current.getBBox();
|
|
12
|
-
inset.x += left;
|
|
13
|
-
inset.y += top;
|
|
10
|
+
else if (current.tagName === "svg") {
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
12
|
+
* This isn't an ideal approach to measuring the offset of <svg /> tags.
|
|
13
|
+
* It would be preferable, given they behave like HTMLElements in most ways
|
|
14
|
+
* to use offsetLeft/Top. But these don't exist on <svg />. Likewise we
|
|
15
|
+
* can't use .getBBox() like most SVG elements as these provide the offset
|
|
16
|
+
* relative to the SVG itself, which for <svg /> is usually 0x0.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const svgBoundingBox = current.getBoundingClientRect();
|
|
19
|
+
current = current.parentElement;
|
|
20
|
+
const parentBoundingBox = current.getBoundingClientRect();
|
|
21
|
+
inset.x += svgBoundingBox.left - parentBoundingBox.left;
|
|
22
|
+
inset.y += svgBoundingBox.top - parentBoundingBox.top;
|
|
23
|
+
}
|
|
24
|
+
else if (current instanceof SVGGraphicsElement) {
|
|
25
|
+
const { x, y } = current.getBBox();
|
|
26
|
+
inset.x += x;
|
|
27
|
+
inset.y += y;
|
|
28
|
+
let svg = null;
|
|
29
|
+
let parent = current.parentNode;
|
|
30
|
+
while (!svg) {
|
|
31
|
+
if (parent.tagName === "svg") {
|
|
32
|
+
svg = parent;
|
|
33
|
+
}
|
|
34
|
+
parent = current.parentNode;
|
|
19
35
|
}
|
|
36
|
+
current = svg;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
break;
|
|
20
40
|
}
|
|
21
41
|
}
|
|
22
42
|
return inset;
|
|
@@ -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 === "10.16.
|
|
25
|
+
warnOnce(nextValue.version === "10.16.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.16.2 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ class MotionValue {
|
|
|
28
28
|
* This will be replaced by the build step with the latest version number.
|
|
29
29
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
30
30
|
*/
|
|
31
|
-
this.version = "10.16.
|
|
31
|
+
this.version = "10.16.2";
|
|
32
32
|
/**
|
|
33
33
|
* Duration, in milliseconds, since last updating frame.
|
|
34
34
|
*
|
|
@@ -1218,16 +1218,37 @@
|
|
|
1218
1218
|
|
|
1219
1219
|
const noop = (any) => any;
|
|
1220
1220
|
|
|
1221
|
+
class Queue {
|
|
1222
|
+
constructor() {
|
|
1223
|
+
this.order = [];
|
|
1224
|
+
this.scheduled = new Set();
|
|
1225
|
+
}
|
|
1226
|
+
add(process) {
|
|
1227
|
+
if (!this.scheduled.has(process)) {
|
|
1228
|
+
this.scheduled.add(process);
|
|
1229
|
+
this.order.push(process);
|
|
1230
|
+
return true;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
remove(process) {
|
|
1234
|
+
const index = this.order.indexOf(process);
|
|
1235
|
+
if (index !== -1) {
|
|
1236
|
+
this.order.splice(index, 1);
|
|
1237
|
+
this.scheduled.delete(process);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
clear() {
|
|
1241
|
+
this.order.length = 0;
|
|
1242
|
+
this.scheduled.clear();
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1221
1245
|
function createRenderStep(runNextFrame) {
|
|
1222
1246
|
/**
|
|
1223
|
-
* We create and reuse two
|
|
1247
|
+
* We create and reuse two queues, one to queue jobs for the current frame
|
|
1224
1248
|
* and one for the next. We reuse to avoid triggering GC after x frames.
|
|
1225
1249
|
*/
|
|
1226
|
-
let
|
|
1227
|
-
let
|
|
1228
|
-
/**
|
|
1229
|
-
*
|
|
1230
|
-
*/
|
|
1250
|
+
let thisFrame = new Queue();
|
|
1251
|
+
let nextFrame = new Queue();
|
|
1231
1252
|
let numToRun = 0;
|
|
1232
1253
|
/**
|
|
1233
1254
|
* Track whether we're currently processing jobs in this step. This way
|
|
@@ -1245,15 +1266,12 @@
|
|
|
1245
1266
|
*/
|
|
1246
1267
|
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
1247
1268
|
const addToCurrentFrame = immediate && isProcessing;
|
|
1248
|
-
const
|
|
1269
|
+
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
1249
1270
|
if (keepAlive)
|
|
1250
1271
|
toKeepAlive.add(callback);
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
// If we're adding it to the currently running buffer, update its measured size
|
|
1255
|
-
if (addToCurrentFrame && isProcessing)
|
|
1256
|
-
numToRun = toRun.length;
|
|
1272
|
+
if (queue.add(callback) && addToCurrentFrame && isProcessing) {
|
|
1273
|
+
// If we're adding it to the currently running queue, update its measured size
|
|
1274
|
+
numToRun = thisFrame.order.length;
|
|
1257
1275
|
}
|
|
1258
1276
|
return callback;
|
|
1259
1277
|
},
|
|
@@ -1261,9 +1279,7 @@
|
|
|
1261
1279
|
* Cancel the provided callback from running on the next frame.
|
|
1262
1280
|
*/
|
|
1263
1281
|
cancel: (callback) => {
|
|
1264
|
-
|
|
1265
|
-
if (index !== -1)
|
|
1266
|
-
toRunNextFrame.splice(index, 1);
|
|
1282
|
+
nextFrame.remove(callback);
|
|
1267
1283
|
toKeepAlive.delete(callback);
|
|
1268
1284
|
},
|
|
1269
1285
|
/**
|
|
@@ -1280,14 +1296,14 @@
|
|
|
1280
1296
|
return;
|
|
1281
1297
|
}
|
|
1282
1298
|
isProcessing = true;
|
|
1283
|
-
[
|
|
1284
|
-
// Clear the next frame
|
|
1285
|
-
|
|
1299
|
+
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
1300
|
+
// Clear the next frame queue
|
|
1301
|
+
nextFrame.clear();
|
|
1286
1302
|
// Execute this frame
|
|
1287
|
-
numToRun =
|
|
1303
|
+
numToRun = thisFrame.order.length;
|
|
1288
1304
|
if (numToRun) {
|
|
1289
1305
|
for (let i = 0; i < numToRun; i++) {
|
|
1290
|
-
const callback =
|
|
1306
|
+
const callback = thisFrame.order[i];
|
|
1291
1307
|
callback(frameData);
|
|
1292
1308
|
if (toKeepAlive.has(callback)) {
|
|
1293
1309
|
step.schedule(callback);
|
|
@@ -3809,7 +3825,7 @@
|
|
|
3809
3825
|
* This will be replaced by the build step with the latest version number.
|
|
3810
3826
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3811
3827
|
*/
|
|
3812
|
-
this.version = "10.16.
|
|
3828
|
+
this.version = "10.16.2";
|
|
3813
3829
|
/**
|
|
3814
3830
|
* Duration, in milliseconds, since last updating frame.
|
|
3815
3831
|
*
|
|
@@ -6656,7 +6672,7 @@
|
|
|
6656
6672
|
* and warn against mismatches.
|
|
6657
6673
|
*/
|
|
6658
6674
|
{
|
|
6659
|
-
warnOnce(nextValue.version === "10.16.
|
|
6675
|
+
warnOnce(nextValue.version === "10.16.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.16.2 may not work as expected.`);
|
|
6660
6676
|
}
|
|
6661
6677
|
}
|
|
6662
6678
|
else if (isMotionValue(prevValue)) {
|
|
@@ -7846,7 +7862,7 @@
|
|
|
7846
7862
|
}
|
|
7847
7863
|
|
|
7848
7864
|
function calcInset(element, container) {
|
|
7849
|
-
|
|
7865
|
+
const inset = { x: 0, y: 0 };
|
|
7850
7866
|
let current = element;
|
|
7851
7867
|
while (current && current !== container) {
|
|
7852
7868
|
if (current instanceof HTMLElement) {
|
|
@@ -7854,16 +7870,36 @@
|
|
|
7854
7870
|
inset.y += current.offsetTop;
|
|
7855
7871
|
current = current.offsetParent;
|
|
7856
7872
|
}
|
|
7857
|
-
else if (current
|
|
7858
|
-
const { top, left } = current.getBBox();
|
|
7859
|
-
inset.x += left;
|
|
7860
|
-
inset.y += top;
|
|
7873
|
+
else if (current.tagName === "svg") {
|
|
7861
7874
|
/**
|
|
7862
|
-
*
|
|
7875
|
+
* This isn't an ideal approach to measuring the offset of <svg /> tags.
|
|
7876
|
+
* It would be preferable, given they behave like HTMLElements in most ways
|
|
7877
|
+
* to use offsetLeft/Top. But these don't exist on <svg />. Likewise we
|
|
7878
|
+
* can't use .getBBox() like most SVG elements as these provide the offset
|
|
7879
|
+
* relative to the SVG itself, which for <svg /> is usually 0x0.
|
|
7863
7880
|
*/
|
|
7864
|
-
|
|
7865
|
-
|
|
7881
|
+
const svgBoundingBox = current.getBoundingClientRect();
|
|
7882
|
+
current = current.parentElement;
|
|
7883
|
+
const parentBoundingBox = current.getBoundingClientRect();
|
|
7884
|
+
inset.x += svgBoundingBox.left - parentBoundingBox.left;
|
|
7885
|
+
inset.y += svgBoundingBox.top - parentBoundingBox.top;
|
|
7886
|
+
}
|
|
7887
|
+
else if (current instanceof SVGGraphicsElement) {
|
|
7888
|
+
const { x, y } = current.getBBox();
|
|
7889
|
+
inset.x += x;
|
|
7890
|
+
inset.y += y;
|
|
7891
|
+
let svg = null;
|
|
7892
|
+
let parent = current.parentNode;
|
|
7893
|
+
while (!svg) {
|
|
7894
|
+
if (parent.tagName === "svg") {
|
|
7895
|
+
svg = parent;
|
|
7896
|
+
}
|
|
7897
|
+
parent = current.parentNode;
|
|
7866
7898
|
}
|
|
7899
|
+
current = svg;
|
|
7900
|
+
}
|
|
7901
|
+
else {
|
|
7902
|
+
break;
|
|
7867
7903
|
}
|
|
7868
7904
|
}
|
|
7869
7905
|
return inset;
|
|
@@ -7965,6 +8001,11 @@
|
|
|
7965
8001
|
}
|
|
7966
8002
|
|
|
7967
8003
|
const point = { x: 0, y: 0 };
|
|
8004
|
+
function getTargetSize(target) {
|
|
8005
|
+
return "getBBox" in target && target.tagName !== "svg"
|
|
8006
|
+
? target.getBBox()
|
|
8007
|
+
: { width: target.clientWidth, height: target.clientHeight };
|
|
8008
|
+
}
|
|
7968
8009
|
function resolveOffsets(container, info, options) {
|
|
7969
8010
|
let { offset: offsetDefinition = ScrollOffset.All } = options;
|
|
7970
8011
|
const { target = container, axis = "y" } = options;
|
|
@@ -7977,7 +8018,7 @@
|
|
|
7977
8018
|
*/
|
|
7978
8019
|
const targetSize = target === container
|
|
7979
8020
|
? { width: container.scrollWidth, height: container.scrollHeight }
|
|
7980
|
-
:
|
|
8021
|
+
: getTargetSize(target);
|
|
7981
8022
|
const containerSize = {
|
|
7982
8023
|
width: container.clientWidth,
|
|
7983
8024
|
height: container.clientHeight,
|