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.
package/dist/cjs/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ /*#__NO_SIDE_EFFECTS__*/
5
6
  const noop = (any) => any;
6
7
 
7
8
  let warning = noop;
@@ -19,6 +20,7 @@ if (process.env.NODE_ENV !== "production") {
19
20
  };
20
21
  }
21
22
 
23
+ /*#__NO_SIDE_EFFECTS__*/
22
24
  function memo(callback) {
23
25
  let result;
24
26
  return () => {
@@ -40,6 +42,7 @@ function memo(callback) {
40
42
  @param [number]: Value to find progress within given range
41
43
  @return [number]: Progress of value within range as expressed 0-1
42
44
  */
45
+ /*#__NO_SIDE_EFFECTS__*/
43
46
  const progress = (from, to, value) => {
44
47
  const toFromDifference = to - from;
45
48
  return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
@@ -51,7 +54,9 @@ const progress = (from, to, value) => {
51
54
  * @param seconds - Time in seconds.
52
55
  * @return milliseconds - Converted time in milliseconds.
53
56
  */
57
+ /*#__NO_SIDE_EFFECTS__*/
54
58
  const secondsToMilliseconds = (seconds) => seconds * 1000;
59
+ /*#__NO_SIDE_EFFECTS__*/
55
60
  const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
56
61
 
57
62
  const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);
@@ -1367,7 +1372,7 @@ class MotionValue {
1367
1372
  * This will be replaced by the build step with the latest version number.
1368
1373
  * When MotionValues are provided to motion components, warn if versions are mixed.
1369
1374
  */
1370
- this.version = "11.17.1";
1375
+ this.version = "11.18.1";
1371
1376
  /**
1372
1377
  * Tracks whether this value can output a velocity. Currently this is only true
1373
1378
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -4297,7 +4302,7 @@ function updateMotionValuesFromProps(element, next, prev) {
4297
4302
  * and warn against mismatches.
4298
4303
  */
4299
4304
  if (process.env.NODE_ENV === "development") {
4300
- warnOnce(nextValue.version === "11.17.1", `Attempting to mix Motion versions ${nextValue.version} with 11.17.1 may not work as expected.`);
4305
+ warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
4301
4306
  }
4302
4307
  }
4303
4308
  else if (isMotionValue(prevValue)) {
@@ -4954,21 +4959,6 @@ function buildHTMLStyles(state, latestValues, transformTemplate) {
4954
4959
  }
4955
4960
  }
4956
4961
 
4957
- function calcOrigin(origin, offset, size) {
4958
- return typeof origin === "string"
4959
- ? origin
4960
- : px.transform(offset + size * origin);
4961
- }
4962
- /**
4963
- * The SVG transform origin defaults are different to CSS and is less intuitive,
4964
- * so we use the measured dimensions of the SVG to reconcile these.
4965
- */
4966
- function calcSVGTransformOrigin(dimensions, originX, originY) {
4967
- const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
4968
- const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
4969
- return `${pxOriginX} ${pxOriginY}`;
4970
- }
4971
-
4972
4962
  const dashKeys = {
4973
4963
  offset: "stroke-dashoffset",
4974
4964
  array: "stroke-dasharray",
@@ -4998,6 +4988,21 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
4998
4988
  attrs[keys.array] = `${pathLength} ${pathSpacing}`;
4999
4989
  }
5000
4990
 
4991
+ function calcOrigin(origin, offset, size) {
4992
+ return typeof origin === "string"
4993
+ ? origin
4994
+ : px.transform(offset + size * origin);
4995
+ }
4996
+ /**
4997
+ * The SVG transform origin defaults are different to CSS and is less intuitive,
4998
+ * so we use the measured dimensions of the SVG to reconcile these.
4999
+ */
5000
+ function calcSVGTransformOrigin(dimensions, originX, originY) {
5001
+ const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
5002
+ const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
5003
+ return `${pxOriginX} ${pxOriginY}`;
5004
+ }
5005
+
5001
5006
  /**
5002
5007
  * Build SVG visual attrbutes, like cx and style.transform
5003
5008
  */
package/dist/cjs/mini.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ /*#__NO_SIDE_EFFECTS__*/
5
6
  const noop = (any) => any;
6
7
 
7
8
  let invariant = noop;
@@ -13,6 +14,7 @@ if (process.env.NODE_ENV !== "production") {
13
14
  };
14
15
  }
15
16
 
17
+ /*#__NO_SIDE_EFFECTS__*/
16
18
  function memo(callback) {
17
19
  let result;
18
20
  return () => {
@@ -34,6 +36,7 @@ function memo(callback) {
34
36
  @param [number]: Value to find progress within given range
35
37
  @return [number]: Progress of value within range as expressed 0-1
36
38
  */
39
+ /*#__NO_SIDE_EFFECTS__*/
37
40
  const progress = (from, to, value) => {
38
41
  const toFromDifference = to - from;
39
42
  return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
@@ -45,7 +48,9 @@ const progress = (from, to, value) => {
45
48
  * @param seconds - Time in seconds.
46
49
  * @return milliseconds - Converted time in milliseconds.
47
50
  */
51
+ /*#__NO_SIDE_EFFECTS__*/
48
52
  const secondsToMilliseconds = (seconds) => seconds * 1000;
53
+ /*#__NO_SIDE_EFFECTS__*/
49
54
  const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
50
55
 
51
56
  const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);
@@ -139,7 +144,7 @@ class GroupPlaybackControls extends BaseGroupPlaybackControls {
139
144
  }
140
145
  }
141
146
 
142
- function getValueTransition(transition, key) {
147
+ function getValueTransition$1(transition, key) {
143
148
  return transition
144
149
  ? transition[key] ||
145
150
  transition["default"] ||
@@ -356,6 +361,399 @@ function resolveElements(elementOrSelector, scope, selectorCache) {
356
361
  return Array.from(elementOrSelector);
357
362
  }
358
363
 
364
+ const wrap = (min, max, v) => {
365
+ const rangeSize = max - min;
366
+ return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;
367
+ };
368
+
369
+ const isEasingArray = (ease) => {
370
+ return Array.isArray(ease) && typeof ease[0] !== "number";
371
+ };
372
+
373
+ function getEasingForSegment(easing, i) {
374
+ return isEasingArray(easing) ? easing[wrap(0, easing.length, i)] : easing;
375
+ }
376
+
377
+ /*
378
+ Value in range from progress
379
+
380
+ Given a lower limit and an upper limit, we return the value within
381
+ that range as expressed by progress (usually a number from 0 to 1)
382
+
383
+ So progress = 0.5 would change
384
+
385
+ from -------- to
386
+
387
+ to
388
+
389
+ from ---- to
390
+
391
+ E.g. from = 10, to = 20, progress = 0.5 => 15
392
+
393
+ @param [number]: Lower limit of range
394
+ @param [number]: Upper limit of range
395
+ @param [number]: The progress between lower and upper limits expressed 0-1
396
+ @return [number]: Value as calculated from progress within range (not limited within range)
397
+ */
398
+ const mixNumber = (from, to, progress) => {
399
+ return from + (to - from) * progress;
400
+ };
401
+
402
+ function fillOffset(offset, remaining) {
403
+ const min = offset[offset.length - 1];
404
+ for (let i = 1; i <= remaining; i++) {
405
+ const offsetProgress = progress(0, remaining, i);
406
+ offset.push(mixNumber(min, 1, offsetProgress));
407
+ }
408
+ }
409
+
410
+ function defaultOffset(arr) {
411
+ const offset = [0];
412
+ fillOffset(offset, arr.length - 1);
413
+ return offset;
414
+ }
415
+
416
+ const isMotionValue = (value) => Boolean(value && value.getVelocity);
417
+
418
+ function isDOMKeyframes(keyframes) {
419
+ return typeof keyframes === "object" && !Array.isArray(keyframes);
420
+ }
421
+
422
+ function resolveSubjects(subject, keyframes, scope, selectorCache) {
423
+ if (typeof subject === "string" && isDOMKeyframes(keyframes)) {
424
+ return resolveElements(subject, scope, selectorCache);
425
+ }
426
+ else if (subject instanceof NodeList) {
427
+ return Array.from(subject);
428
+ }
429
+ else if (Array.isArray(subject)) {
430
+ return subject;
431
+ }
432
+ else {
433
+ return [subject];
434
+ }
435
+ }
436
+
437
+ function calculateRepeatDuration(duration, repeat, _repeatDelay) {
438
+ return duration * (repeat + 1);
439
+ }
440
+
441
+ /**
442
+ * Given a absolute or relative time definition and current/prev time state of the sequence,
443
+ * calculate an absolute time for the next keyframes.
444
+ */
445
+ function calcNextTime(current, next, prev, labels) {
446
+ var _a;
447
+ if (typeof next === "number") {
448
+ return next;
449
+ }
450
+ else if (next.startsWith("-") || next.startsWith("+")) {
451
+ return Math.max(0, current + parseFloat(next));
452
+ }
453
+ else if (next === "<") {
454
+ return prev;
455
+ }
456
+ else {
457
+ return (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
458
+ }
459
+ }
460
+
461
+ function removeItem(arr, item) {
462
+ const index = arr.indexOf(item);
463
+ if (index > -1)
464
+ arr.splice(index, 1);
465
+ }
466
+
467
+ function eraseKeyframes(sequence, startTime, endTime) {
468
+ for (let i = 0; i < sequence.length; i++) {
469
+ const keyframe = sequence[i];
470
+ if (keyframe.at > startTime && keyframe.at < endTime) {
471
+ removeItem(sequence, keyframe);
472
+ // If we remove this item we have to push the pointer back one
473
+ i--;
474
+ }
475
+ }
476
+ }
477
+ function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
478
+ /**
479
+ * Erase every existing value between currentTime and targetTime,
480
+ * this will essentially splice this timeline into any currently
481
+ * defined ones.
482
+ */
483
+ eraseKeyframes(sequence, startTime, endTime);
484
+ for (let i = 0; i < keyframes.length; i++) {
485
+ sequence.push({
486
+ value: keyframes[i],
487
+ at: mixNumber(startTime, endTime, offset[i]),
488
+ easing: getEasingForSegment(easing, i),
489
+ });
490
+ }
491
+ }
492
+
493
+ /**
494
+ * Take an array of times that represent repeated keyframes. For instance
495
+ * if we have original times of [0, 0.5, 1] then our repeated times will
496
+ * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back
497
+ * down to a 0-1 scale.
498
+ */
499
+ function normalizeTimes(times, repeat) {
500
+ for (let i = 0; i < times.length; i++) {
501
+ times[i] = times[i] / (repeat + 1);
502
+ }
503
+ }
504
+
505
+ function compareByTime(a, b) {
506
+ if (a.at === b.at) {
507
+ if (a.value === null)
508
+ return 1;
509
+ if (b.value === null)
510
+ return -1;
511
+ return 0;
512
+ }
513
+ else {
514
+ return a.at - b.at;
515
+ }
516
+ }
517
+
518
+ const defaultSegmentEasing = "easeInOut";
519
+ const MAX_REPEAT = 20;
520
+ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...sequenceTransition } = {}, scope, generators) {
521
+ const defaultDuration = defaultTransition.duration || 0.3;
522
+ const animationDefinitions = new Map();
523
+ const sequences = new Map();
524
+ const elementCache = {};
525
+ const timeLabels = new Map();
526
+ let prevTime = 0;
527
+ let currentTime = 0;
528
+ let totalDuration = 0;
529
+ /**
530
+ * Build the timeline by mapping over the sequence array and converting
531
+ * the definitions into keyframes and offsets with absolute time values.
532
+ * These will later get converted into relative offsets in a second pass.
533
+ */
534
+ for (let i = 0; i < sequence.length; i++) {
535
+ const segment = sequence[i];
536
+ /**
537
+ * If this is a timeline label, mark it and skip the rest of this iteration.
538
+ */
539
+ if (typeof segment === "string") {
540
+ timeLabels.set(segment, currentTime);
541
+ continue;
542
+ }
543
+ else if (!Array.isArray(segment)) {
544
+ timeLabels.set(segment.name, calcNextTime(currentTime, segment.at, prevTime, timeLabels));
545
+ continue;
546
+ }
547
+ let [subject, keyframes, transition = {}] = segment;
548
+ /**
549
+ * If a relative or absolute time value has been specified we need to resolve
550
+ * it in relation to the currentTime.
551
+ */
552
+ if (transition.at !== undefined) {
553
+ currentTime = calcNextTime(currentTime, transition.at, prevTime, timeLabels);
554
+ }
555
+ /**
556
+ * Keep track of the maximum duration in this definition. This will be
557
+ * applied to currentTime once the definition has been parsed.
558
+ */
559
+ let maxDuration = 0;
560
+ const resolveValueSequence = (valueKeyframes, valueTransition, valueSequence, elementIndex = 0, numSubjects = 0) => {
561
+ const valueKeyframesAsList = keyframesAsList(valueKeyframes);
562
+ const { delay = 0, times = defaultOffset(valueKeyframesAsList), type = "keyframes", repeat, repeatType, repeatDelay = 0, ...remainingTransition } = valueTransition;
563
+ let { ease = defaultTransition.ease || "easeOut", duration } = valueTransition;
564
+ /**
565
+ * Resolve stagger() if defined.
566
+ */
567
+ const calculatedDelay = typeof delay === "function"
568
+ ? delay(elementIndex, numSubjects)
569
+ : delay;
570
+ /**
571
+ * If this animation should and can use a spring, generate a spring easing function.
572
+ */
573
+ const numKeyframes = valueKeyframesAsList.length;
574
+ const createGenerator = isGenerator(type)
575
+ ? type
576
+ : generators === null || generators === void 0 ? void 0 : generators[type];
577
+ if (numKeyframes <= 2 && createGenerator) {
578
+ /**
579
+ * As we're creating an easing function from a spring,
580
+ * ideally we want to generate it using the real distance
581
+ * between the two keyframes. However this isn't always
582
+ * possible - in these situations we use 0-100.
583
+ */
584
+ let absoluteDelta = 100;
585
+ if (numKeyframes === 2 &&
586
+ isNumberKeyframesArray(valueKeyframesAsList)) {
587
+ const delta = valueKeyframesAsList[1] - valueKeyframesAsList[0];
588
+ absoluteDelta = Math.abs(delta);
589
+ }
590
+ const springTransition = { ...remainingTransition };
591
+ if (duration !== undefined) {
592
+ springTransition.duration = secondsToMilliseconds(duration);
593
+ }
594
+ const springEasing = createGeneratorEasing(springTransition, absoluteDelta, createGenerator);
595
+ ease = springEasing.ease;
596
+ duration = springEasing.duration;
597
+ }
598
+ duration !== null && duration !== void 0 ? duration : (duration = defaultDuration);
599
+ const startTime = currentTime + calculatedDelay;
600
+ /**
601
+ * If there's only one time offset of 0, fill in a second with length 1
602
+ */
603
+ if (times.length === 1 && times[0] === 0) {
604
+ times[1] = 1;
605
+ }
606
+ /**
607
+ * Fill out if offset if fewer offsets than keyframes
608
+ */
609
+ const remainder = times.length - valueKeyframesAsList.length;
610
+ remainder > 0 && fillOffset(times, remainder);
611
+ /**
612
+ * If only one value has been set, ie [1], push a null to the start of
613
+ * the keyframe array. This will let us mark a keyframe at this point
614
+ * that will later be hydrated with the previous value.
615
+ */
616
+ valueKeyframesAsList.length === 1 &&
617
+ valueKeyframesAsList.unshift(null);
618
+ /**
619
+ * Handle repeat options
620
+ */
621
+ if (repeat) {
622
+ invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
623
+ duration = calculateRepeatDuration(duration, repeat);
624
+ const originalKeyframes = [...valueKeyframesAsList];
625
+ const originalTimes = [...times];
626
+ ease = Array.isArray(ease) ? [...ease] : [ease];
627
+ const originalEase = [...ease];
628
+ for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {
629
+ valueKeyframesAsList.push(...originalKeyframes);
630
+ for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) {
631
+ times.push(originalTimes[keyframeIndex] + (repeatIndex + 1));
632
+ ease.push(keyframeIndex === 0
633
+ ? "linear"
634
+ : getEasingForSegment(originalEase, keyframeIndex - 1));
635
+ }
636
+ }
637
+ normalizeTimes(times, repeat);
638
+ }
639
+ const targetTime = startTime + duration;
640
+ /**
641
+ * Add keyframes, mapping offsets to absolute time.
642
+ */
643
+ addKeyframes(valueSequence, valueKeyframesAsList, ease, times, startTime, targetTime);
644
+ maxDuration = Math.max(calculatedDelay + duration, maxDuration);
645
+ totalDuration = Math.max(targetTime, totalDuration);
646
+ };
647
+ if (isMotionValue(subject)) {
648
+ const subjectSequence = getSubjectSequence(subject, sequences);
649
+ resolveValueSequence(keyframes, transition, getValueSequence("default", subjectSequence));
650
+ }
651
+ else {
652
+ const subjects = resolveSubjects(subject, keyframes, scope, elementCache);
653
+ const numSubjects = subjects.length;
654
+ /**
655
+ * For every element in this segment, process the defined values.
656
+ */
657
+ for (let subjectIndex = 0; subjectIndex < numSubjects; subjectIndex++) {
658
+ /**
659
+ * Cast necessary, but we know these are of this type
660
+ */
661
+ keyframes = keyframes;
662
+ transition = transition;
663
+ const thisSubject = subjects[subjectIndex];
664
+ const subjectSequence = getSubjectSequence(thisSubject, sequences);
665
+ for (const key in keyframes) {
666
+ resolveValueSequence(keyframes[key], getValueTransition(transition, key), getValueSequence(key, subjectSequence), subjectIndex, numSubjects);
667
+ }
668
+ }
669
+ }
670
+ prevTime = currentTime;
671
+ currentTime += maxDuration;
672
+ }
673
+ /**
674
+ * For every element and value combination create a new animation.
675
+ */
676
+ sequences.forEach((valueSequences, element) => {
677
+ for (const key in valueSequences) {
678
+ const valueSequence = valueSequences[key];
679
+ /**
680
+ * Arrange all the keyframes in ascending time order.
681
+ */
682
+ valueSequence.sort(compareByTime);
683
+ const keyframes = [];
684
+ const valueOffset = [];
685
+ const valueEasing = [];
686
+ /**
687
+ * For each keyframe, translate absolute times into
688
+ * relative offsets based on the total duration of the timeline.
689
+ */
690
+ for (let i = 0; i < valueSequence.length; i++) {
691
+ const { at, value, easing } = valueSequence[i];
692
+ keyframes.push(value);
693
+ valueOffset.push(progress(0, totalDuration, at));
694
+ valueEasing.push(easing || "easeOut");
695
+ }
696
+ /**
697
+ * If the first keyframe doesn't land on offset: 0
698
+ * provide one by duplicating the initial keyframe. This ensures
699
+ * it snaps to the first keyframe when the animation starts.
700
+ */
701
+ if (valueOffset[0] !== 0) {
702
+ valueOffset.unshift(0);
703
+ keyframes.unshift(keyframes[0]);
704
+ valueEasing.unshift(defaultSegmentEasing);
705
+ }
706
+ /**
707
+ * If the last keyframe doesn't land on offset: 1
708
+ * provide one with a null wildcard value. This will ensure it
709
+ * stays static until the end of the animation.
710
+ */
711
+ if (valueOffset[valueOffset.length - 1] !== 1) {
712
+ valueOffset.push(1);
713
+ keyframes.push(null);
714
+ }
715
+ if (!animationDefinitions.has(element)) {
716
+ animationDefinitions.set(element, {
717
+ keyframes: {},
718
+ transition: {},
719
+ });
720
+ }
721
+ const definition = animationDefinitions.get(element);
722
+ definition.keyframes[key] = keyframes;
723
+ definition.transition[key] = {
724
+ ...defaultTransition,
725
+ duration: totalDuration,
726
+ ease: valueEasing,
727
+ times: valueOffset,
728
+ ...sequenceTransition,
729
+ };
730
+ }
731
+ });
732
+ return animationDefinitions;
733
+ }
734
+ function getSubjectSequence(subject, sequences) {
735
+ !sequences.has(subject) && sequences.set(subject, {});
736
+ return sequences.get(subject);
737
+ }
738
+ function getValueSequence(name, sequences) {
739
+ if (!sequences[name])
740
+ sequences[name] = [];
741
+ return sequences[name];
742
+ }
743
+ function keyframesAsList(keyframes) {
744
+ return Array.isArray(keyframes) ? keyframes : [keyframes];
745
+ }
746
+ function getValueTransition(transition, key) {
747
+ return transition && transition[key]
748
+ ? {
749
+ ...transition,
750
+ ...transition[key],
751
+ }
752
+ : { ...transition };
753
+ }
754
+ const isNumber = (keyframe) => typeof keyframe === "number";
755
+ const isNumberKeyframesArray = (keyframes) => keyframes.every(isNumber);
756
+
359
757
  function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
360
758
  const keyframeOptions = { [valueName]: keyframes };
361
759
  if (times)
@@ -567,7 +965,7 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
567
965
  for (const valueName in keyframes) {
568
966
  const valueKeyframes = keyframes[valueName];
569
967
  const valueOptions = {
570
- ...getValueTransition(elementTransition, valueName),
968
+ ...getValueTransition$1(elementTransition, valueName),
571
969
  };
572
970
  valueOptions.duration = valueOptions.duration
573
971
  ? secondsToMilliseconds(valueOptions.duration)
@@ -579,6 +977,14 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
579
977
  return animations;
580
978
  }
581
979
 
980
+ function animateSequence(definition, options) {
981
+ const animations = [];
982
+ createAnimationsFromSequence(definition, options).forEach(({ keyframes, transition }, element) => {
983
+ animations.push(...animateElements(element, keyframes, transition));
984
+ });
985
+ return new GroupPlaybackControls(animations);
986
+ }
987
+
582
988
  const createScopedWaapiAnimate = (scope) => {
583
989
  function scopedAnimate(elementOrSelector, keyframes, options) {
584
990
  return new GroupPlaybackControls(animateElements(elementOrSelector, keyframes, options, scope));
@@ -588,3 +994,4 @@ const createScopedWaapiAnimate = (scope) => {
588
994
  const animateMini = /*@__PURE__*/ createScopedWaapiAnimate();
589
995
 
590
996
  exports.animate = animateMini;
997
+ exports.animateSequence = animateSequence;
@@ -86,6 +86,7 @@ const variantPriorityOrder = [
86
86
  ];
87
87
  const variantProps = ["initial", ...variantPriorityOrder];
88
88
 
89
+ /*#__NO_SIDE_EFFECTS__*/
89
90
  const noop = (any) => any;
90
91
 
91
92
  let warning = noop;
@@ -103,6 +104,7 @@ if (process.env.NODE_ENV !== "production") {
103
104
  };
104
105
  }
105
106
 
107
+ /*#__NO_SIDE_EFFECTS__*/
106
108
  function memo(callback) {
107
109
  let result;
108
110
  return () => {
@@ -124,6 +126,7 @@ function memo(callback) {
124
126
  @param [number]: Value to find progress within given range
125
127
  @return [number]: Progress of value within range as expressed 0-1
126
128
  */
129
+ /*#__NO_SIDE_EFFECTS__*/
127
130
  const progress = (from, to, value) => {
128
131
  const toFromDifference = to - from;
129
132
  return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
@@ -135,7 +138,9 @@ const progress = (from, to, value) => {
135
138
  * @param seconds - Time in seconds.
136
139
  * @return milliseconds - Converted time in milliseconds.
137
140
  */
141
+ /*#__NO_SIDE_EFFECTS__*/
138
142
  const secondsToMilliseconds = (seconds) => seconds * 1000;
143
+ /*#__NO_SIDE_EFFECTS__*/
139
144
  const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
140
145
 
141
146
  const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);
@@ -915,7 +920,7 @@ class MotionValue {
915
920
  * This will be replaced by the build step with the latest version number.
916
921
  * When MotionValues are provided to motion components, warn if versions are mixed.
917
922
  */
918
- this.version = "11.17.1";
923
+ this.version = "11.18.1";
919
924
  /**
920
925
  * Tracks whether this value can output a velocity. Currently this is only true
921
926
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -8710,21 +8715,6 @@ function buildHTMLStyles(state, latestValues, transformTemplate) {
8710
8715
  }
8711
8716
  }
8712
8717
 
8713
- function calcOrigin(origin, offset, size) {
8714
- return typeof origin === "string"
8715
- ? origin
8716
- : px.transform(offset + size * origin);
8717
- }
8718
- /**
8719
- * The SVG transform origin defaults are different to CSS and is less intuitive,
8720
- * so we use the measured dimensions of the SVG to reconcile these.
8721
- */
8722
- function calcSVGTransformOrigin(dimensions, originX, originY) {
8723
- const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
8724
- const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
8725
- return `${pxOriginX} ${pxOriginY}`;
8726
- }
8727
-
8728
8718
  const dashKeys = {
8729
8719
  offset: "stroke-dashoffset",
8730
8720
  array: "stroke-dasharray",
@@ -8754,6 +8744,21 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
8754
8744
  attrs[keys.array] = `${pathLength} ${pathSpacing}`;
8755
8745
  }
8756
8746
 
8747
+ function calcOrigin(origin, offset, size) {
8748
+ return typeof origin === "string"
8749
+ ? origin
8750
+ : px.transform(offset + size * origin);
8751
+ }
8752
+ /**
8753
+ * The SVG transform origin defaults are different to CSS and is less intuitive,
8754
+ * so we use the measured dimensions of the SVG to reconcile these.
8755
+ */
8756
+ function calcSVGTransformOrigin(dimensions, originX, originY) {
8757
+ const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
8758
+ const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
8759
+ return `${pxOriginX} ${pxOriginY}`;
8760
+ }
8761
+
8757
8762
  /**
8758
8763
  * Build SVG visual attrbutes, like cx and style.transform
8759
8764
  */
@@ -8948,10 +8953,12 @@ const svgMotionConfig = {
8948
8953
  }
8949
8954
  if (!needsMeasure)
8950
8955
  return;
8951
- frame.read(() => updateSVGDimensions(current, renderState));
8952
- frame.render(() => {
8953
- buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
8954
- renderSVG(current, renderState);
8956
+ frame.read(() => {
8957
+ updateSVGDimensions(current, renderState);
8958
+ frame.render(() => {
8959
+ buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
8960
+ renderSVG(current, renderState);
8961
+ });
8955
8962
  });
8956
8963
  },
8957
8964
  }),
@@ -9229,7 +9236,7 @@ function updateMotionValuesFromProps(element, next, prev) {
9229
9236
  * and warn against mismatches.
9230
9237
  */
9231
9238
  if (process.env.NODE_ENV === "development") {
9232
- warnOnce(nextValue.version === "11.17.1", `Attempting to mix Motion versions ${nextValue.version} with 11.17.1 may not work as expected.`);
9239
+ warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
9233
9240
  }
9234
9241
  }
9235
9242
  else if (isMotionValue(prevValue)) {