framer-motion 11.17.1 → 11.18.1

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.
@@ -409,7 +409,7 @@ class MotionValue {
409
409
  * This will be replaced by the build step with the latest version number.
410
410
  * When MotionValues are provided to motion components, warn if versions are mixed.
411
411
  */
412
- this.version = "11.17.1";
412
+ this.version = "11.18.1";
413
413
  /**
414
414
  * Tracks whether this value can output a velocity. Currently this is only true
415
415
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -5201,7 +5201,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5201
5201
  * and warn against mismatches.
5202
5202
  */
5203
5203
  if (process.env.NODE_ENV === "development") {
5204
- warnOnce(nextValue.version === "11.17.1", `Attempting to mix Motion versions ${nextValue.version} with 11.17.1 may not work as expected.`);
5204
+ warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
5205
5205
  }
5206
5206
  }
5207
5207
  else if (isMotionValue(prevValue)) {
@@ -5858,21 +5858,6 @@ function buildHTMLStyles(state, latestValues, transformTemplate) {
5858
5858
  }
5859
5859
  }
5860
5860
 
5861
- function calcOrigin(origin, offset, size) {
5862
- return typeof origin === "string"
5863
- ? origin
5864
- : px.transform(offset + size * origin);
5865
- }
5866
- /**
5867
- * The SVG transform origin defaults are different to CSS and is less intuitive,
5868
- * so we use the measured dimensions of the SVG to reconcile these.
5869
- */
5870
- function calcSVGTransformOrigin(dimensions, originX, originY) {
5871
- const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
5872
- const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
5873
- return `${pxOriginX} ${pxOriginY}`;
5874
- }
5875
-
5876
5861
  const dashKeys = {
5877
5862
  offset: "stroke-dashoffset",
5878
5863
  array: "stroke-dasharray",
@@ -5902,6 +5887,21 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
5902
5887
  attrs[keys.array] = `${pathLength} ${pathSpacing}`;
5903
5888
  }
5904
5889
 
5890
+ function calcOrigin(origin, offset, size) {
5891
+ return typeof origin === "string"
5892
+ ? origin
5893
+ : px.transform(offset + size * origin);
5894
+ }
5895
+ /**
5896
+ * The SVG transform origin defaults are different to CSS and is less intuitive,
5897
+ * so we use the measured dimensions of the SVG to reconcile these.
5898
+ */
5899
+ function calcSVGTransformOrigin(dimensions, originX, originY) {
5900
+ const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
5901
+ const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
5902
+ return `${pxOriginX} ${pxOriginY}`;
5903
+ }
5904
+
5905
5905
  /**
5906
5906
  * Build SVG visual attrbutes, like cx and style.transform
5907
5907
  */
@@ -9086,10 +9086,12 @@ const svgMotionConfig = {
9086
9086
  }
9087
9087
  if (!needsMeasure)
9088
9088
  return;
9089
- frame.read(() => updateSVGDimensions(current, renderState));
9090
- frame.render(() => {
9091
- buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
9092
- renderSVG(current, renderState);
9089
+ frame.read(() => {
9090
+ updateSVGDimensions(current, renderState);
9091
+ frame.render(() => {
9092
+ buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
9093
+ renderSVG(current, renderState);
9094
+ });
9093
9095
  });
9094
9096
  },
9095
9097
  }),
@@ -5,6 +5,399 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var motionDom = require('motion-dom');
6
6
  var motionUtils = require('motion-utils');
7
7
 
8
+ const wrap = (min, max, v) => {
9
+ const rangeSize = max - min;
10
+ return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;
11
+ };
12
+
13
+ const isEasingArray = (ease) => {
14
+ return Array.isArray(ease) && typeof ease[0] !== "number";
15
+ };
16
+
17
+ function getEasingForSegment(easing, i) {
18
+ return isEasingArray(easing) ? easing[wrap(0, easing.length, i)] : easing;
19
+ }
20
+
21
+ /*
22
+ Value in range from progress
23
+
24
+ Given a lower limit and an upper limit, we return the value within
25
+ that range as expressed by progress (usually a number from 0 to 1)
26
+
27
+ So progress = 0.5 would change
28
+
29
+ from -------- to
30
+
31
+ to
32
+
33
+ from ---- to
34
+
35
+ E.g. from = 10, to = 20, progress = 0.5 => 15
36
+
37
+ @param [number]: Lower limit of range
38
+ @param [number]: Upper limit of range
39
+ @param [number]: The progress between lower and upper limits expressed 0-1
40
+ @return [number]: Value as calculated from progress within range (not limited within range)
41
+ */
42
+ const mixNumber = (from, to, progress) => {
43
+ return from + (to - from) * progress;
44
+ };
45
+
46
+ function fillOffset(offset, remaining) {
47
+ const min = offset[offset.length - 1];
48
+ for (let i = 1; i <= remaining; i++) {
49
+ const offsetProgress = motionUtils.progress(0, remaining, i);
50
+ offset.push(mixNumber(min, 1, offsetProgress));
51
+ }
52
+ }
53
+
54
+ function defaultOffset(arr) {
55
+ const offset = [0];
56
+ fillOffset(offset, arr.length - 1);
57
+ return offset;
58
+ }
59
+
60
+ const isMotionValue = (value) => Boolean(value && value.getVelocity);
61
+
62
+ function isDOMKeyframes(keyframes) {
63
+ return typeof keyframes === "object" && !Array.isArray(keyframes);
64
+ }
65
+
66
+ function resolveSubjects(subject, keyframes, scope, selectorCache) {
67
+ if (typeof subject === "string" && isDOMKeyframes(keyframes)) {
68
+ return motionDom.resolveElements(subject, scope, selectorCache);
69
+ }
70
+ else if (subject instanceof NodeList) {
71
+ return Array.from(subject);
72
+ }
73
+ else if (Array.isArray(subject)) {
74
+ return subject;
75
+ }
76
+ else {
77
+ return [subject];
78
+ }
79
+ }
80
+
81
+ function calculateRepeatDuration(duration, repeat, _repeatDelay) {
82
+ return duration * (repeat + 1);
83
+ }
84
+
85
+ /**
86
+ * Given a absolute or relative time definition and current/prev time state of the sequence,
87
+ * calculate an absolute time for the next keyframes.
88
+ */
89
+ function calcNextTime(current, next, prev, labels) {
90
+ var _a;
91
+ if (typeof next === "number") {
92
+ return next;
93
+ }
94
+ else if (next.startsWith("-") || next.startsWith("+")) {
95
+ return Math.max(0, current + parseFloat(next));
96
+ }
97
+ else if (next === "<") {
98
+ return prev;
99
+ }
100
+ else {
101
+ return (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
102
+ }
103
+ }
104
+
105
+ function removeItem(arr, item) {
106
+ const index = arr.indexOf(item);
107
+ if (index > -1)
108
+ arr.splice(index, 1);
109
+ }
110
+
111
+ function eraseKeyframes(sequence, startTime, endTime) {
112
+ for (let i = 0; i < sequence.length; i++) {
113
+ const keyframe = sequence[i];
114
+ if (keyframe.at > startTime && keyframe.at < endTime) {
115
+ removeItem(sequence, keyframe);
116
+ // If we remove this item we have to push the pointer back one
117
+ i--;
118
+ }
119
+ }
120
+ }
121
+ function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
122
+ /**
123
+ * Erase every existing value between currentTime and targetTime,
124
+ * this will essentially splice this timeline into any currently
125
+ * defined ones.
126
+ */
127
+ eraseKeyframes(sequence, startTime, endTime);
128
+ for (let i = 0; i < keyframes.length; i++) {
129
+ sequence.push({
130
+ value: keyframes[i],
131
+ at: mixNumber(startTime, endTime, offset[i]),
132
+ easing: getEasingForSegment(easing, i),
133
+ });
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Take an array of times that represent repeated keyframes. For instance
139
+ * if we have original times of [0, 0.5, 1] then our repeated times will
140
+ * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back
141
+ * down to a 0-1 scale.
142
+ */
143
+ function normalizeTimes(times, repeat) {
144
+ for (let i = 0; i < times.length; i++) {
145
+ times[i] = times[i] / (repeat + 1);
146
+ }
147
+ }
148
+
149
+ function compareByTime(a, b) {
150
+ if (a.at === b.at) {
151
+ if (a.value === null)
152
+ return 1;
153
+ if (b.value === null)
154
+ return -1;
155
+ return 0;
156
+ }
157
+ else {
158
+ return a.at - b.at;
159
+ }
160
+ }
161
+
162
+ const defaultSegmentEasing = "easeInOut";
163
+ const MAX_REPEAT = 20;
164
+ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...sequenceTransition } = {}, scope, generators) {
165
+ const defaultDuration = defaultTransition.duration || 0.3;
166
+ const animationDefinitions = new Map();
167
+ const sequences = new Map();
168
+ const elementCache = {};
169
+ const timeLabels = new Map();
170
+ let prevTime = 0;
171
+ let currentTime = 0;
172
+ let totalDuration = 0;
173
+ /**
174
+ * Build the timeline by mapping over the sequence array and converting
175
+ * the definitions into keyframes and offsets with absolute time values.
176
+ * These will later get converted into relative offsets in a second pass.
177
+ */
178
+ for (let i = 0; i < sequence.length; i++) {
179
+ const segment = sequence[i];
180
+ /**
181
+ * If this is a timeline label, mark it and skip the rest of this iteration.
182
+ */
183
+ if (typeof segment === "string") {
184
+ timeLabels.set(segment, currentTime);
185
+ continue;
186
+ }
187
+ else if (!Array.isArray(segment)) {
188
+ timeLabels.set(segment.name, calcNextTime(currentTime, segment.at, prevTime, timeLabels));
189
+ continue;
190
+ }
191
+ let [subject, keyframes, transition = {}] = segment;
192
+ /**
193
+ * If a relative or absolute time value has been specified we need to resolve
194
+ * it in relation to the currentTime.
195
+ */
196
+ if (transition.at !== undefined) {
197
+ currentTime = calcNextTime(currentTime, transition.at, prevTime, timeLabels);
198
+ }
199
+ /**
200
+ * Keep track of the maximum duration in this definition. This will be
201
+ * applied to currentTime once the definition has been parsed.
202
+ */
203
+ let maxDuration = 0;
204
+ const resolveValueSequence = (valueKeyframes, valueTransition, valueSequence, elementIndex = 0, numSubjects = 0) => {
205
+ const valueKeyframesAsList = keyframesAsList(valueKeyframes);
206
+ const { delay = 0, times = defaultOffset(valueKeyframesAsList), type = "keyframes", repeat, repeatType, repeatDelay = 0, ...remainingTransition } = valueTransition;
207
+ let { ease = defaultTransition.ease || "easeOut", duration } = valueTransition;
208
+ /**
209
+ * Resolve stagger() if defined.
210
+ */
211
+ const calculatedDelay = typeof delay === "function"
212
+ ? delay(elementIndex, numSubjects)
213
+ : delay;
214
+ /**
215
+ * If this animation should and can use a spring, generate a spring easing function.
216
+ */
217
+ const numKeyframes = valueKeyframesAsList.length;
218
+ const createGenerator = motionDom.isGenerator(type)
219
+ ? type
220
+ : generators === null || generators === void 0 ? void 0 : generators[type];
221
+ if (numKeyframes <= 2 && createGenerator) {
222
+ /**
223
+ * As we're creating an easing function from a spring,
224
+ * ideally we want to generate it using the real distance
225
+ * between the two keyframes. However this isn't always
226
+ * possible - in these situations we use 0-100.
227
+ */
228
+ let absoluteDelta = 100;
229
+ if (numKeyframes === 2 &&
230
+ isNumberKeyframesArray(valueKeyframesAsList)) {
231
+ const delta = valueKeyframesAsList[1] - valueKeyframesAsList[0];
232
+ absoluteDelta = Math.abs(delta);
233
+ }
234
+ const springTransition = { ...remainingTransition };
235
+ if (duration !== undefined) {
236
+ springTransition.duration = motionUtils.secondsToMilliseconds(duration);
237
+ }
238
+ const springEasing = motionDom.createGeneratorEasing(springTransition, absoluteDelta, createGenerator);
239
+ ease = springEasing.ease;
240
+ duration = springEasing.duration;
241
+ }
242
+ duration !== null && duration !== void 0 ? duration : (duration = defaultDuration);
243
+ const startTime = currentTime + calculatedDelay;
244
+ /**
245
+ * If there's only one time offset of 0, fill in a second with length 1
246
+ */
247
+ if (times.length === 1 && times[0] === 0) {
248
+ times[1] = 1;
249
+ }
250
+ /**
251
+ * Fill out if offset if fewer offsets than keyframes
252
+ */
253
+ const remainder = times.length - valueKeyframesAsList.length;
254
+ remainder > 0 && fillOffset(times, remainder);
255
+ /**
256
+ * If only one value has been set, ie [1], push a null to the start of
257
+ * the keyframe array. This will let us mark a keyframe at this point
258
+ * that will later be hydrated with the previous value.
259
+ */
260
+ valueKeyframesAsList.length === 1 &&
261
+ valueKeyframesAsList.unshift(null);
262
+ /**
263
+ * Handle repeat options
264
+ */
265
+ if (repeat) {
266
+ motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
267
+ duration = calculateRepeatDuration(duration, repeat);
268
+ const originalKeyframes = [...valueKeyframesAsList];
269
+ const originalTimes = [...times];
270
+ ease = Array.isArray(ease) ? [...ease] : [ease];
271
+ const originalEase = [...ease];
272
+ for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {
273
+ valueKeyframesAsList.push(...originalKeyframes);
274
+ for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) {
275
+ times.push(originalTimes[keyframeIndex] + (repeatIndex + 1));
276
+ ease.push(keyframeIndex === 0
277
+ ? "linear"
278
+ : getEasingForSegment(originalEase, keyframeIndex - 1));
279
+ }
280
+ }
281
+ normalizeTimes(times, repeat);
282
+ }
283
+ const targetTime = startTime + duration;
284
+ /**
285
+ * Add keyframes, mapping offsets to absolute time.
286
+ */
287
+ addKeyframes(valueSequence, valueKeyframesAsList, ease, times, startTime, targetTime);
288
+ maxDuration = Math.max(calculatedDelay + duration, maxDuration);
289
+ totalDuration = Math.max(targetTime, totalDuration);
290
+ };
291
+ if (isMotionValue(subject)) {
292
+ const subjectSequence = getSubjectSequence(subject, sequences);
293
+ resolveValueSequence(keyframes, transition, getValueSequence("default", subjectSequence));
294
+ }
295
+ else {
296
+ const subjects = resolveSubjects(subject, keyframes, scope, elementCache);
297
+ const numSubjects = subjects.length;
298
+ /**
299
+ * For every element in this segment, process the defined values.
300
+ */
301
+ for (let subjectIndex = 0; subjectIndex < numSubjects; subjectIndex++) {
302
+ /**
303
+ * Cast necessary, but we know these are of this type
304
+ */
305
+ keyframes = keyframes;
306
+ transition = transition;
307
+ const thisSubject = subjects[subjectIndex];
308
+ const subjectSequence = getSubjectSequence(thisSubject, sequences);
309
+ for (const key in keyframes) {
310
+ resolveValueSequence(keyframes[key], getValueTransition(transition, key), getValueSequence(key, subjectSequence), subjectIndex, numSubjects);
311
+ }
312
+ }
313
+ }
314
+ prevTime = currentTime;
315
+ currentTime += maxDuration;
316
+ }
317
+ /**
318
+ * For every element and value combination create a new animation.
319
+ */
320
+ sequences.forEach((valueSequences, element) => {
321
+ for (const key in valueSequences) {
322
+ const valueSequence = valueSequences[key];
323
+ /**
324
+ * Arrange all the keyframes in ascending time order.
325
+ */
326
+ valueSequence.sort(compareByTime);
327
+ const keyframes = [];
328
+ const valueOffset = [];
329
+ const valueEasing = [];
330
+ /**
331
+ * For each keyframe, translate absolute times into
332
+ * relative offsets based on the total duration of the timeline.
333
+ */
334
+ for (let i = 0; i < valueSequence.length; i++) {
335
+ const { at, value, easing } = valueSequence[i];
336
+ keyframes.push(value);
337
+ valueOffset.push(motionUtils.progress(0, totalDuration, at));
338
+ valueEasing.push(easing || "easeOut");
339
+ }
340
+ /**
341
+ * If the first keyframe doesn't land on offset: 0
342
+ * provide one by duplicating the initial keyframe. This ensures
343
+ * it snaps to the first keyframe when the animation starts.
344
+ */
345
+ if (valueOffset[0] !== 0) {
346
+ valueOffset.unshift(0);
347
+ keyframes.unshift(keyframes[0]);
348
+ valueEasing.unshift(defaultSegmentEasing);
349
+ }
350
+ /**
351
+ * If the last keyframe doesn't land on offset: 1
352
+ * provide one with a null wildcard value. This will ensure it
353
+ * stays static until the end of the animation.
354
+ */
355
+ if (valueOffset[valueOffset.length - 1] !== 1) {
356
+ valueOffset.push(1);
357
+ keyframes.push(null);
358
+ }
359
+ if (!animationDefinitions.has(element)) {
360
+ animationDefinitions.set(element, {
361
+ keyframes: {},
362
+ transition: {},
363
+ });
364
+ }
365
+ const definition = animationDefinitions.get(element);
366
+ definition.keyframes[key] = keyframes;
367
+ definition.transition[key] = {
368
+ ...defaultTransition,
369
+ duration: totalDuration,
370
+ ease: valueEasing,
371
+ times: valueOffset,
372
+ ...sequenceTransition,
373
+ };
374
+ }
375
+ });
376
+ return animationDefinitions;
377
+ }
378
+ function getSubjectSequence(subject, sequences) {
379
+ !sequences.has(subject) && sequences.set(subject, {});
380
+ return sequences.get(subject);
381
+ }
382
+ function getValueSequence(name, sequences) {
383
+ if (!sequences[name])
384
+ sequences[name] = [];
385
+ return sequences[name];
386
+ }
387
+ function keyframesAsList(keyframes) {
388
+ return Array.isArray(keyframes) ? keyframes : [keyframes];
389
+ }
390
+ function getValueTransition(transition, key) {
391
+ return transition && transition[key]
392
+ ? {
393
+ ...transition,
394
+ ...transition[key],
395
+ }
396
+ : { ...transition };
397
+ }
398
+ const isNumber = (keyframe) => typeof keyframe === "number";
399
+ const isNumberKeyframesArray = (keyframes) => keyframes.every(isNumber);
400
+
8
401
  function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
9
402
  const keyframeOptions = { [valueName]: keyframes };
10
403
  if (times)
@@ -228,6 +621,14 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
228
621
  return animations;
229
622
  }
230
623
 
624
+ function animateSequence(definition, options) {
625
+ const animations = [];
626
+ createAnimationsFromSequence(definition, options).forEach(({ keyframes, transition }, element) => {
627
+ animations.push(...animateElements(element, keyframes, transition));
628
+ });
629
+ return new motionDom.GroupPlaybackControls(animations);
630
+ }
631
+
231
632
  const createScopedWaapiAnimate = (scope) => {
232
633
  function scopedAnimate(elementOrSelector, keyframes, options) {
233
634
  return new motionDom.GroupPlaybackControls(animateElements(elementOrSelector, keyframes, options, scope));
@@ -237,3 +638,4 @@ const createScopedWaapiAnimate = (scope) => {
237
638
  const animateMini = /*@__PURE__*/ createScopedWaapiAnimate();
238
639
 
239
640
  exports.animate = animateMini;
641
+ exports.animateSequence = animateSequence;
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 = "11.17.1";
997
+ this.version = "11.18.1";
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
@@ -3924,7 +3924,7 @@ function updateMotionValuesFromProps(element, next, prev) {
3924
3924
  * and warn against mismatches.
3925
3925
  */
3926
3926
  if (process.env.NODE_ENV === "development") {
3927
- warnOnce(nextValue.version === "11.17.1", `Attempting to mix Motion versions ${nextValue.version} with 11.17.1 may not work as expected.`);
3927
+ warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
3928
3928
  }
3929
3929
  }
3930
3930
  else if (isMotionValue(prevValue)) {
@@ -4581,21 +4581,6 @@ function buildHTMLStyles(state, latestValues, transformTemplate) {
4581
4581
  }
4582
4582
  }
4583
4583
 
4584
- function calcOrigin(origin, offset, size) {
4585
- return typeof origin === "string"
4586
- ? origin
4587
- : px.transform(offset + size * origin);
4588
- }
4589
- /**
4590
- * The SVG transform origin defaults are different to CSS and is less intuitive,
4591
- * so we use the measured dimensions of the SVG to reconcile these.
4592
- */
4593
- function calcSVGTransformOrigin(dimensions, originX, originY) {
4594
- const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
4595
- const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
4596
- return `${pxOriginX} ${pxOriginY}`;
4597
- }
4598
-
4599
4584
  const dashKeys = {
4600
4585
  offset: "stroke-dashoffset",
4601
4586
  array: "stroke-dasharray",
@@ -4625,6 +4610,21 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
4625
4610
  attrs[keys.array] = `${pathLength} ${pathSpacing}`;
4626
4611
  }
4627
4612
 
4613
+ function calcOrigin(origin, offset, size) {
4614
+ return typeof origin === "string"
4615
+ ? origin
4616
+ : px.transform(offset + size * origin);
4617
+ }
4618
+ /**
4619
+ * The SVG transform origin defaults are different to CSS and is less intuitive,
4620
+ * so we use the measured dimensions of the SVG to reconcile these.
4621
+ */
4622
+ function calcSVGTransformOrigin(dimensions, originX, originY) {
4623
+ const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
4624
+ const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
4625
+ return `${pxOriginX} ${pxOriginY}`;
4626
+ }
4627
+
4628
4628
  /**
4629
4629
  * Build SVG visual attrbutes, like cx and style.transform
4630
4630
  */
package/dist/cjs/index.js CHANGED
@@ -445,7 +445,7 @@ class MotionValue {
445
445
  * This will be replaced by the build step with the latest version number.
446
446
  * When MotionValues are provided to motion components, warn if versions are mixed.
447
447
  */
448
- this.version = "11.17.1";
448
+ this.version = "11.18.1";
449
449
  /**
450
450
  * Tracks whether this value can output a velocity. Currently this is only true
451
451
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -5215,7 +5215,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5215
5215
  * and warn against mismatches.
5216
5216
  */
5217
5217
  if (process.env.NODE_ENV === "development") {
5218
- warnOnce(nextValue.version === "11.17.1", `Attempting to mix Motion versions ${nextValue.version} with 11.17.1 may not work as expected.`);
5218
+ warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
5219
5219
  }
5220
5220
  }
5221
5221
  else if (isMotionValue(prevValue)) {
@@ -5872,21 +5872,6 @@ function buildHTMLStyles(state, latestValues, transformTemplate) {
5872
5872
  }
5873
5873
  }
5874
5874
 
5875
- function calcOrigin$1(origin, offset, size) {
5876
- return typeof origin === "string"
5877
- ? origin
5878
- : px.transform(offset + size * origin);
5879
- }
5880
- /**
5881
- * The SVG transform origin defaults are different to CSS and is less intuitive,
5882
- * so we use the measured dimensions of the SVG to reconcile these.
5883
- */
5884
- function calcSVGTransformOrigin(dimensions, originX, originY) {
5885
- const pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
5886
- const pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
5887
- return `${pxOriginX} ${pxOriginY}`;
5888
- }
5889
-
5890
5875
  const dashKeys = {
5891
5876
  offset: "stroke-dashoffset",
5892
5877
  array: "stroke-dasharray",
@@ -5916,6 +5901,21 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
5916
5901
  attrs[keys.array] = `${pathLength} ${pathSpacing}`;
5917
5902
  }
5918
5903
 
5904
+ function calcOrigin$1(origin, offset, size) {
5905
+ return typeof origin === "string"
5906
+ ? origin
5907
+ : px.transform(offset + size * origin);
5908
+ }
5909
+ /**
5910
+ * The SVG transform origin defaults are different to CSS and is less intuitive,
5911
+ * so we use the measured dimensions of the SVG to reconcile these.
5912
+ */
5913
+ function calcSVGTransformOrigin(dimensions, originX, originY) {
5914
+ const pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
5915
+ const pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
5916
+ return `${pxOriginX} ${pxOriginY}`;
5917
+ }
5918
+
5919
5919
  /**
5920
5920
  * Build SVG visual attrbutes, like cx and style.transform
5921
5921
  */
@@ -11095,10 +11095,12 @@ const svgMotionConfig = {
11095
11095
  }
11096
11096
  if (!needsMeasure)
11097
11097
  return;
11098
- frame.read(() => updateSVGDimensions(current, renderState));
11099
- frame.render(() => {
11100
- buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
11101
- renderSVG(current, renderState);
11098
+ frame.read(() => {
11099
+ updateSVGDimensions(current, renderState);
11100
+ frame.render(() => {
11101
+ buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
11102
+ renderSVG(current, renderState);
11103
+ });
11102
11104
  });
11103
11105
  },
11104
11106
  }),