motion 12.7.4 → 12.7.5-alpha.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.
Files changed (173) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/debug.js +22 -14
  3. package/dist/cjs/index.js +4113 -3624
  4. package/dist/cjs/mini.js +403 -324
  5. package/dist/cjs/react-client.js +3151 -3245
  6. package/dist/cjs/react-m.js +169 -166
  7. package/dist/cjs/react-mini.js +330 -251
  8. package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +1 -1
  9. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +81 -9
  10. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +11 -30
  11. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -1
  12. package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +1 -1
  13. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
  14. package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +2 -2
  15. package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +1 -1
  16. package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +1 -1
  17. package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +1 -1
  18. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
  19. package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +2 -2
  20. package/dist/es/framer-motion/dist/es/gestures/focus.mjs +1 -1
  21. package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +1 -1
  22. package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +1 -1
  23. package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +3 -3
  24. package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +1 -1
  25. package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +1 -1
  26. package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +2 -2
  27. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +3 -5
  28. package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +1 -1
  29. package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +2 -2
  30. package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +1 -1
  31. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +7 -7
  32. package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +1 -1
  33. package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +17 -0
  34. package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +23 -0
  35. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +6 -82
  36. package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +3 -3
  37. package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +29 -0
  38. package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +3 -3
  39. package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +4 -4
  40. package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +3 -3
  41. package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +2 -2
  42. package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +1 -1
  43. package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +1 -1
  44. package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +1 -1
  45. package/dist/es/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +1 -1
  46. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
  47. package/dist/es/framer-motion/dist/es/utils/delay.mjs +1 -1
  48. package/dist/es/framer-motion/dist/es/utils/transform.mjs +1 -1
  49. package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +1 -1
  50. package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +4 -4
  51. package/dist/es/framer-motion/dist/es/value/use-spring.mjs +2 -2
  52. package/dist/es/framer-motion/dist/es/value/use-will-change/get-will-change-name.mjs +2 -2
  53. package/dist/es/motion/lib/index.mjs +109 -26
  54. package/dist/es/motion/lib/react.mjs +108 -32
  55. package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +179 -0
  56. package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +6 -15
  57. package/dist/es/{framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs → motion-dom/dist/es/animation/JSAnimation.mjs} +108 -156
  58. package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +64 -67
  59. package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +65 -0
  60. package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +14 -0
  61. package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/drivers/driver-frameloop.mjs +2 -2
  62. package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/keyframes.mjs +5 -5
  63. package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/find.mjs +1 -1
  64. package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/index.mjs +5 -6
  65. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation/keyframes}/DOMKeyframesResolver.mjs +9 -8
  66. package/dist/es/{framer-motion/dist/es/render/utils → motion-dom/dist/es/animation/keyframes}/KeyframesResolver.mjs +28 -35
  67. package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +3 -4
  68. package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/fill.mjs +2 -2
  69. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +11 -0
  70. package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +7 -0
  71. package/dist/es/{framer-motion/dist/es/animation → motion-dom/dist/es/animation/keyframes}/utils/is-none.mjs +1 -1
  72. package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/animation/keyframes}/utils/make-none-animatable.mjs +1 -1
  73. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation/keyframes}/utils/unit-conversion.mjs +2 -2
  74. package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +28 -0
  75. package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +9 -0
  76. package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/utils/can-animate.mjs +3 -3
  77. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation}/utils/css-variables-conversion.mjs +2 -2
  78. package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +18 -0
  79. package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +1 -1
  80. package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +5 -3
  81. package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +6 -4
  82. package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +39 -0
  83. package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +2 -1
  84. package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +20 -0
  85. package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +2 -1
  86. package/dist/es/motion-dom/dist/es/frameloop/order.mjs +1 -0
  87. package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +3 -0
  88. package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +10 -0
  89. package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +9 -0
  90. package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/render}/utils/keys-transform.mjs +1 -1
  91. package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es}/scroll/observe.mjs +1 -1
  92. package/dist/es/motion-dom/dist/es/stats/index.mjs +2 -0
  93. package/dist/es/{framer-motion → motion-dom}/dist/es/utils/interpolate.mjs +4 -3
  94. package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/color.mjs +3 -3
  95. package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/complex.mjs +5 -5
  96. package/dist/es/motion-dom/dist/es/value/index.mjs +3 -1
  97. package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/rgba.mjs +2 -2
  98. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types}/dimensions.mjs +3 -3
  99. package/dist/es/{framer-motion/dist/es/render/dom/value-types/type-int.mjs → motion-dom/dist/es/value/types/int.mjs} +1 -1
  100. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/maps}/defaults.mjs +2 -2
  101. package/dist/es/{framer-motion/dist/es/render/dom/value-types/number-browser.mjs → motion-dom/dist/es/value/types/maps/number.mjs} +13 -3
  102. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/maps}/transform.mjs +2 -2
  103. package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/numbers/index.mjs +1 -1
  104. package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/numbers/units.mjs +3 -2
  105. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/animatable-none.mjs +4 -4
  106. package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/find.mjs +4 -4
  107. package/dist/es/motion-dom/dist/es/view/index.mjs +64 -0
  108. package/dist/es/motion-dom/dist/es/view/queue.mjs +52 -0
  109. package/dist/es/motion-dom/dist/es/view/start.mjs +155 -0
  110. package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +11 -0
  111. package/dist/es/motion-dom/dist/es/view/utils/css.mjs +32 -0
  112. package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +8 -0
  113. package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +12 -0
  114. package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +5 -0
  115. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/cubic-bezier.mjs +1 -1
  116. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/steps.mjs +1 -1
  117. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/get-easing-for-segment.mjs +1 -1
  118. package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/map.mjs +7 -4
  119. package/dist/es/motion-utils/dist/es/global-config.mjs +1 -4
  120. package/dist/es/motion-utils/dist/es/warn-once.mjs +4 -1
  121. package/dist/motion.dev.js +4108 -3619
  122. package/dist/motion.js +1 -1
  123. package/package.json +3 -3
  124. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +0 -324
  125. package/dist/es/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +0 -120
  126. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +0 -5
  127. package/dist/es/framer-motion/dist/es/render/dom/value-types/number.mjs +0 -18
  128. package/dist/es/framer-motion/dist/es/utils/use-instant-transition-state.mjs +0 -5
  129. package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +0 -26
  130. package/dist/es/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs +0 -6
  131. package/dist/es/motion-dom/dist/es/render/dom/style.mjs +0 -15
  132. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/inertia.mjs +0 -0
  133. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/defaults.mjs +0 -0
  134. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/velocity.mjs +0 -0
  135. /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/default.mjs +0 -0
  136. /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/time.mjs +0 -0
  137. /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/utils/is-animatable.mjs +0 -0
  138. /package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation}/utils/is-css-variable.mjs +0 -0
  139. /package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation/waapi}/utils/accelerated-values.mjs +0 -0
  140. /package/dist/es/{framer-motion/dist/es/render/html/utils → motion-dom/dist/es/render/dom}/parse-transform.mjs +0 -0
  141. /package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/render}/utils/keys-position.mjs +0 -0
  142. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/immediate.mjs +0 -0
  143. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/index.mjs +0 -0
  144. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/number.mjs +0 -0
  145. /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/visibility.mjs +0 -0
  146. /package/dist/es/{framer-motion/dist/es/render/dom/value-types/type-auto.mjs → motion-dom/dist/es/value/types/auto.mjs} +0 -0
  147. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/hex.mjs +0 -0
  148. /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/value/types/color}/hsla-to-rgba.mjs +0 -0
  149. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/hsla.mjs +0 -0
  150. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/index.mjs +0 -0
  151. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/utils.mjs +0 -0
  152. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/complex/filter.mjs +0 -0
  153. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/complex/index.mjs +0 -0
  154. /package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types}/test.mjs +0 -0
  155. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/color-regex.mjs +0 -0
  156. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/float-regex.mjs +0 -0
  157. /package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/get-as-type.mjs +0 -0
  158. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/is-nullish.mjs +0 -0
  159. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/sanitize.mjs +0 -0
  160. /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/single-color-regex.mjs +0 -0
  161. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/clamp.mjs +0 -0
  162. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/anticipate.mjs +0 -0
  163. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/back.mjs +0 -0
  164. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/circ.mjs +0 -0
  165. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/ease.mjs +0 -0
  166. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/modifiers/mirror.mjs +0 -0
  167. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/modifiers/reverse.mjs +0 -0
  168. /package/dist/es/{motion-dom/dist/es → motion-utils/dist/es/easing}/utils/is-bezier-definition.mjs +0 -0
  169. /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/is-easing-array.mjs +0 -0
  170. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/is-numerical-string.mjs +0 -0
  171. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/is-zero-value-string.mjs +0 -0
  172. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/pipe.mjs +0 -0
  173. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/wrap.mjs +0 -0
@@ -0,0 +1,155 @@
1
+ import { GroupAnimation } from '../animation/GroupAnimation.mjs';
2
+ import { NativeAnimation } from '../animation/NativeAnimation.mjs';
3
+ import { NativeAnimationWrapper } from '../animation/NativeAnimationWrapper.mjs';
4
+ import { getValueTransition } from '../animation/utils/get-value-transition.mjs';
5
+ import { mapEasingToNativeEasing } from '../animation/waapi/easing/map-easing.mjs';
6
+ import { applyGeneratorOptions } from '../animation/waapi/utils/apply-generator.mjs';
7
+ import { chooseLayerType } from './utils/choose-layer-type.mjs';
8
+ import { css } from './utils/css.mjs';
9
+ import { getLayerName } from './utils/get-layer-name.mjs';
10
+ import { getViewAnimations } from './utils/get-view-animations.mjs';
11
+ import { hasTarget } from './utils/has-target.mjs';
12
+ import { secondsToMilliseconds } from '../../../../motion-utils/dist/es/time-conversion.mjs';
13
+
14
+ const definitionNames = ["layout", "enter", "exit", "new", "old"];
15
+ function startViewAnimation(builder) {
16
+ const { update, targets, options: defaultOptions } = builder;
17
+ if (!document.startViewTransition) {
18
+ return new Promise(async (resolve) => {
19
+ await update();
20
+ resolve(new GroupAnimation([]));
21
+ });
22
+ }
23
+ // TODO: Go over existing targets and ensure they all have ids
24
+ /**
25
+ * If we don't have any animations defined for the root target,
26
+ * remove it from being captured.
27
+ */
28
+ if (!hasTarget("root", targets)) {
29
+ css.set(":root", {
30
+ "view-transition-name": "none",
31
+ });
32
+ }
33
+ /**
34
+ * Set the timing curve to linear for all view transition layers.
35
+ * This gets baked into the keyframes, which can't be changed
36
+ * without breaking the generated animation.
37
+ *
38
+ * This allows us to set easing via updateTiming - which can be changed.
39
+ */
40
+ css.set("::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)", { "animation-timing-function": "linear !important" });
41
+ css.commit(); // Write
42
+ const transition = document.startViewTransition(async () => {
43
+ await update();
44
+ // TODO: Go over new targets and ensure they all have ids
45
+ });
46
+ transition.finished.finally(() => {
47
+ css.remove(); // Write
48
+ });
49
+ return new Promise((resolve) => {
50
+ transition.ready.then(() => {
51
+ const generatedViewAnimations = getViewAnimations();
52
+ const animations = [];
53
+ /**
54
+ * Create animations for each of our explicitly-defined subjects.
55
+ */
56
+ targets.forEach((definition, target) => {
57
+ // TODO: If target is not "root", resolve elements
58
+ // and iterate over each
59
+ for (const key of definitionNames) {
60
+ if (!definition[key])
61
+ continue;
62
+ const { keyframes, options } = definition[key];
63
+ for (let [valueName, valueKeyframes] of Object.entries(keyframes)) {
64
+ if (!valueKeyframes)
65
+ continue;
66
+ const valueOptions = {
67
+ ...getValueTransition(defaultOptions, valueName),
68
+ ...getValueTransition(options, valueName),
69
+ };
70
+ const type = chooseLayerType(key);
71
+ /**
72
+ * If this is an opacity animation, and keyframes are not an array,
73
+ * we need to convert them into an array and set an initial value.
74
+ */
75
+ if (valueName === "opacity" &&
76
+ !Array.isArray(valueKeyframes)) {
77
+ const initialValue = type === "new" ? 0 : 1;
78
+ valueKeyframes = [initialValue, valueKeyframes];
79
+ }
80
+ /**
81
+ * Resolve stagger function if provided.
82
+ */
83
+ if (typeof valueOptions.delay === "function") {
84
+ valueOptions.delay = valueOptions.delay(0, 1);
85
+ }
86
+ valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));
87
+ valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));
88
+ const animation = new NativeAnimation({
89
+ ...valueOptions,
90
+ element: document.documentElement,
91
+ name: valueName,
92
+ pseudoElement: `::view-transition-${type}(${target})`,
93
+ keyframes: valueKeyframes,
94
+ });
95
+ animations.push(animation);
96
+ }
97
+ }
98
+ });
99
+ /**
100
+ * Handle browser generated animations
101
+ */
102
+ for (const animation of generatedViewAnimations) {
103
+ if (animation.playState === "finished")
104
+ continue;
105
+ const { effect } = animation;
106
+ if (!effect || !(effect instanceof KeyframeEffect))
107
+ continue;
108
+ const { pseudoElement } = effect;
109
+ if (!pseudoElement)
110
+ continue;
111
+ const name = getLayerName(pseudoElement);
112
+ if (!name)
113
+ continue;
114
+ const targetDefinition = targets.get(name.layer);
115
+ if (!targetDefinition) {
116
+ /**
117
+ * If transition name is group then update the timing of the animation
118
+ * whereas if it's old or new then we could possibly replace it using
119
+ * the above method.
120
+ */
121
+ const transitionName = name.type === "group" ? "layout" : "";
122
+ let animationTransition = {
123
+ ...getValueTransition(defaultOptions, transitionName),
124
+ };
125
+ animationTransition.duration && (animationTransition.duration = secondsToMilliseconds(animationTransition.duration));
126
+ animationTransition =
127
+ applyGeneratorOptions(animationTransition);
128
+ const easing = mapEasingToNativeEasing(animationTransition.ease, animationTransition.duration);
129
+ effect.updateTiming({
130
+ delay: secondsToMilliseconds(animationTransition.delay ?? 0),
131
+ duration: animationTransition.duration,
132
+ easing,
133
+ });
134
+ animations.push(new NativeAnimationWrapper(animation));
135
+ }
136
+ else if (hasOpacity(targetDefinition, "enter") &&
137
+ hasOpacity(targetDefinition, "exit") &&
138
+ effect
139
+ .getKeyframes()
140
+ .some((keyframe) => keyframe.mixBlendMode)) {
141
+ animations.push(new NativeAnimationWrapper(animation));
142
+ }
143
+ else {
144
+ animation.cancel();
145
+ }
146
+ }
147
+ resolve(new GroupAnimation(animations));
148
+ });
149
+ });
150
+ }
151
+ function hasOpacity(target, key) {
152
+ return target?.[key]?.keyframes.opacity;
153
+ }
154
+
155
+ export { startViewAnimation };
@@ -0,0 +1,11 @@
1
+ function chooseLayerType(valueName) {
2
+ if (valueName === "layout")
3
+ return "group";
4
+ if (valueName === "enter" || valueName === "new")
5
+ return "new";
6
+ if (valueName === "exit" || valueName === "old")
7
+ return "old";
8
+ return "group";
9
+ }
10
+
11
+ export { chooseLayerType };
@@ -0,0 +1,32 @@
1
+ let pendingRules = {};
2
+ let style = null;
3
+ const css = {
4
+ set: (selector, values) => {
5
+ pendingRules[selector] = values;
6
+ },
7
+ commit: () => {
8
+ if (!style) {
9
+ style = document.createElement("style");
10
+ style.id = "motion-view";
11
+ }
12
+ let cssText = "";
13
+ for (const selector in pendingRules) {
14
+ const rule = pendingRules[selector];
15
+ cssText += `${selector} {\n`;
16
+ for (const [property, value] of Object.entries(rule)) {
17
+ cssText += ` ${property}: ${value};\n`;
18
+ }
19
+ cssText += "}\n";
20
+ }
21
+ style.textContent = cssText;
22
+ document.head.appendChild(style);
23
+ pendingRules = {};
24
+ },
25
+ remove: () => {
26
+ if (style && style.parentElement) {
27
+ style.parentElement.removeChild(style);
28
+ }
29
+ },
30
+ };
31
+
32
+ export { css };
@@ -0,0 +1,8 @@
1
+ function getLayerName(pseudoElement) {
2
+ const match = pseudoElement.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);
3
+ if (!match)
4
+ return null;
5
+ return { layer: match[2], type: match[1] };
6
+ }
7
+
8
+ export { getLayerName };
@@ -0,0 +1,12 @@
1
+ function filterViewAnimations(animation) {
2
+ const { effect } = animation;
3
+ if (!effect)
4
+ return false;
5
+ return (effect.target === document.documentElement &&
6
+ effect.pseudoElement?.startsWith("::view-transition"));
7
+ }
8
+ function getViewAnimations() {
9
+ return document.getAnimations().filter(filterViewAnimations);
10
+ }
11
+
12
+ export { getViewAnimations };
@@ -0,0 +1,5 @@
1
+ function hasTarget(target, targets) {
2
+ return targets.has(target) && Object.keys(targets.get(target)).length > 0;
3
+ }
4
+
5
+ export { hasTarget };
@@ -1,4 +1,4 @@
1
- import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
1
+ import { noop } from '../noop.mjs';
2
2
 
3
3
  /*
4
4
  Bezier function generator
@@ -1,4 +1,4 @@
1
- import { clamp } from '../utils/clamp.mjs';
1
+ import { clamp } from '../clamp.mjs';
2
2
 
3
3
  function steps(numSteps, direction = "end") {
4
4
  return (progress) => {
@@ -1,4 +1,4 @@
1
- import { wrap } from '../../utils/wrap.mjs';
1
+ import { wrap } from '../../wrap.mjs';
2
2
  import { isEasingArray } from './is-easing-array.mjs';
3
3
 
4
4
  function getEasingForSegment(easing, i) {
@@ -1,11 +1,11 @@
1
+ import { invariant } from '../../errors.mjs';
2
+ import { noop } from '../../noop.mjs';
1
3
  import { anticipate } from '../anticipate.mjs';
2
4
  import { backIn, backInOut, backOut } from '../back.mjs';
3
5
  import { circIn, circInOut, circOut } from '../circ.mjs';
4
6
  import { cubicBezier } from '../cubic-bezier.mjs';
5
7
  import { easeIn, easeInOut, easeOut } from '../ease.mjs';
6
- import { isBezierDefinition } from '../../../../../motion-dom/dist/es/utils/is-bezier-definition.mjs';
7
- import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
8
- import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
8
+ import { isBezierDefinition } from './is-bezier-definition.mjs';
9
9
 
10
10
  const easingLookup = {
11
11
  linear: noop,
@@ -20,6 +20,9 @@ const easingLookup = {
20
20
  backOut,
21
21
  anticipate,
22
22
  };
23
+ const isValidEasing = (easing) => {
24
+ return typeof easing === "string";
25
+ };
23
26
  const easingDefinitionToFunction = (definition) => {
24
27
  if (isBezierDefinition(definition)) {
25
28
  // If cubic bezier definition, create bezier curve
@@ -27,7 +30,7 @@ const easingDefinitionToFunction = (definition) => {
27
30
  const [x1, y1, x2, y2] = definition;
28
31
  return cubicBezier(x1, y1, x2, y2);
29
32
  }
30
- else if (typeof definition === "string") {
33
+ else if (isValidEasing(definition)) {
31
34
  // Else lookup from table
32
35
  invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`);
33
36
  return easingLookup[definition];
@@ -1,6 +1,3 @@
1
- const MotionGlobalConfig = {
2
- skipAnimations: false,
3
- useManualTiming: false,
4
- };
1
+ const MotionGlobalConfig = {};
5
2
 
6
3
  export { MotionGlobalConfig };
@@ -1,4 +1,7 @@
1
1
  const warned = new Set();
2
+ function hasWarned(message) {
3
+ return warned.has(message);
4
+ }
2
5
  function warnOnce(condition, message, element) {
3
6
  if (condition || warned.has(message))
4
7
  return;
@@ -8,4 +11,4 @@ function warnOnce(condition, message, element) {
8
11
  warned.add(message);
9
12
  }
10
13
 
11
- export { warnOnce };
14
+ export { hasWarned, warnOnce };