motion 12.7.3 → 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.
- package/README.md +1 -1
- package/dist/cjs/debug.js +22 -14
- package/dist/cjs/index.js +4113 -3624
- package/dist/cjs/mini.js +403 -324
- package/dist/cjs/react-client.js +3151 -3245
- package/dist/cjs/react-m.js +169 -166
- package/dist/cjs/react-mini.js +330 -251
- package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +81 -9
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +11 -30
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +1 -1
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +26 -23
- package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +1 -1
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/focus.mjs +1 -1
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +1 -1
- package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +1 -1
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +3 -3
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +1 -1
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +1 -1
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +2 -2
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +3 -5
- package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +1 -1
- package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +2 -2
- package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +7 -7
- package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +17 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +23 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +6 -82
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +3 -3
- package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +29 -0
- package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +3 -3
- package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +4 -4
- package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +3 -3
- package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +2 -2
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/transform.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +4 -4
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +2 -2
- package/dist/es/framer-motion/dist/es/value/use-will-change/get-will-change-name.mjs +2 -2
- package/dist/es/motion/lib/index.mjs +109 -26
- package/dist/es/motion/lib/react.mjs +108 -32
- package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +179 -0
- package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +6 -15
- package/dist/es/{framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs → motion-dom/dist/es/animation/JSAnimation.mjs} +108 -156
- package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +64 -67
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +65 -0
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +14 -0
- package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/drivers/driver-frameloop.mjs +2 -2
- package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/keyframes.mjs +5 -5
- package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/find.mjs +1 -1
- package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/index.mjs +5 -6
- package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation/keyframes}/DOMKeyframesResolver.mjs +9 -8
- package/dist/es/{framer-motion/dist/es/render/utils → motion-dom/dist/es/animation/keyframes}/KeyframesResolver.mjs +28 -35
- package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +3 -4
- package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/fill.mjs +2 -2
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +11 -0
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +7 -0
- package/dist/es/{framer-motion/dist/es/animation → motion-dom/dist/es/animation/keyframes}/utils/is-none.mjs +1 -1
- package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/animation/keyframes}/utils/make-none-animatable.mjs +1 -1
- package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation/keyframes}/utils/unit-conversion.mjs +2 -2
- package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +28 -0
- package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +9 -0
- package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/utils/can-animate.mjs +3 -3
- package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation}/utils/css-variables-conversion.mjs +2 -2
- package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +18 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +1 -1
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +5 -3
- package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +6 -4
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +39 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +2 -1
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +20 -0
- package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +2 -1
- package/dist/es/motion-dom/dist/es/frameloop/order.mjs +1 -0
- package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +3 -0
- package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +10 -0
- package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +9 -0
- package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/render}/utils/keys-transform.mjs +1 -1
- package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es}/scroll/observe.mjs +1 -1
- package/dist/es/motion-dom/dist/es/stats/index.mjs +2 -0
- package/dist/es/{framer-motion → motion-dom}/dist/es/utils/interpolate.mjs +4 -3
- package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/color.mjs +3 -3
- package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/complex.mjs +5 -5
- package/dist/es/motion-dom/dist/es/value/index.mjs +3 -1
- package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/rgba.mjs +2 -2
- package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types}/dimensions.mjs +3 -3
- package/dist/es/{framer-motion/dist/es/render/dom/value-types/type-int.mjs → motion-dom/dist/es/value/types/int.mjs} +1 -1
- package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/maps}/defaults.mjs +2 -2
- 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
- package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/maps}/transform.mjs +2 -2
- package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/numbers/index.mjs +1 -1
- package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/numbers/units.mjs +3 -2
- package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/animatable-none.mjs +4 -4
- package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/find.mjs +4 -4
- package/dist/es/motion-dom/dist/es/view/index.mjs +64 -0
- package/dist/es/motion-dom/dist/es/view/queue.mjs +52 -0
- package/dist/es/motion-dom/dist/es/view/start.mjs +155 -0
- package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +11 -0
- package/dist/es/motion-dom/dist/es/view/utils/css.mjs +32 -0
- package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +8 -0
- package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +12 -0
- package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +5 -0
- package/dist/es/{framer-motion → motion-utils}/dist/es/easing/cubic-bezier.mjs +1 -1
- package/dist/es/{framer-motion → motion-utils}/dist/es/easing/steps.mjs +1 -1
- package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/get-easing-for-segment.mjs +1 -1
- package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/map.mjs +7 -4
- package/dist/es/motion-utils/dist/es/global-config.mjs +1 -4
- package/dist/es/motion-utils/dist/es/warn-once.mjs +4 -1
- package/dist/motion.dev.js +4108 -3619
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +0 -324
- package/dist/es/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +0 -120
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +0 -5
- package/dist/es/framer-motion/dist/es/render/dom/value-types/number.mjs +0 -18
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition-state.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +0 -26
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs +0 -6
- package/dist/es/motion-dom/dist/es/render/dom/style.mjs +0 -15
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/inertia.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/spring/defaults.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/velocity.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/default.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/animation/keyframes}/offsets/time.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/utils/is-animatable.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/render/dom → motion-dom/dist/es/animation}/utils/is-css-variable.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation/waapi}/utils/accelerated-values.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/render/html/utils → motion-dom/dist/es/render/dom}/parse-transform.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/render/html → motion-dom/dist/es/render}/utils/keys-position.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/immediate.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/index.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/number.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/utils/mix/visibility.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/render/dom/value-types/type-auto.mjs → motion-dom/dist/es/value/types/auto.mjs} +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/hex.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-dom/dist/es/value/types/color}/hsla-to-rgba.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/hsla.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/index.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/color/utils.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/complex/filter.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/complex/index.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types}/test.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/color-regex.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/float-regex.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/render/dom/value-types → motion-dom/dist/es/value/types/utils}/get-as-type.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/is-nullish.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/sanitize.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/value/types/utils/single-color-regex.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/clamp.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/anticipate.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/back.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/circ.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/ease.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/modifiers/mirror.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/modifiers/reverse.mjs +0 -0
- /package/dist/es/{motion-dom/dist/es → motion-utils/dist/es/easing}/utils/is-bezier-definition.mjs +0 -0
- /package/dist/es/{framer-motion → motion-utils}/dist/es/easing/utils/is-easing-array.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/is-numerical-string.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/is-zero-value-string.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/pipe.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/wrap.mjs +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { JSAnimation } from './JSAnimation.mjs';
|
|
2
|
+
import { NativeAnimation } from './NativeAnimation.mjs';
|
|
3
|
+
import { replaceTransitionType } from './utils/replace-transition-type.mjs';
|
|
4
|
+
import { replaceStringEasing } from './waapi/utils/unsupported-easing.mjs';
|
|
5
|
+
import { secondsToMilliseconds } from '../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 10ms is chosen here as it strikes a balance between smooth
|
|
9
|
+
* results (more than one keyframe per frame at 60fps) and
|
|
10
|
+
* keyframe quantity.
|
|
11
|
+
*/
|
|
12
|
+
const sampleDelta = 10; //ms
|
|
13
|
+
class NativeAnimationExtended extends NativeAnimation {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
/**
|
|
16
|
+
* The base NativeAnimation function only supports a subset
|
|
17
|
+
* of Motion easings, and WAAPI also only supports some
|
|
18
|
+
* easing functions via string/cubic-bezier definitions.
|
|
19
|
+
*
|
|
20
|
+
* This function replaces those unsupported easing functions
|
|
21
|
+
* with a JS easing function. This will later get compiled
|
|
22
|
+
* to a linear() easing function.
|
|
23
|
+
*/
|
|
24
|
+
replaceStringEasing(options);
|
|
25
|
+
/**
|
|
26
|
+
* Ensure we replace the transition type with a generator function
|
|
27
|
+
* before passing to WAAPI.
|
|
28
|
+
*
|
|
29
|
+
* TODO: Does this have a better home? It could be shared with
|
|
30
|
+
* JSAnimation.
|
|
31
|
+
*/
|
|
32
|
+
replaceTransitionType(options);
|
|
33
|
+
super(options);
|
|
34
|
+
if (options.startTime) {
|
|
35
|
+
this.startTime = options.startTime;
|
|
36
|
+
}
|
|
37
|
+
this.options = options;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
41
|
+
*
|
|
42
|
+
* Rather than read commited styles back out of the DOM, we can
|
|
43
|
+
* create a renderless JS animation and sample it twice to calculate
|
|
44
|
+
* its current value, "previous" value, and therefore allow
|
|
45
|
+
* Motion to calculate velocity for any subsequent animation.
|
|
46
|
+
*/
|
|
47
|
+
updateMotionValue(value) {
|
|
48
|
+
const { motionValue, onUpdate, onComplete, element, ...options } = this.options;
|
|
49
|
+
if (!motionValue)
|
|
50
|
+
return;
|
|
51
|
+
if (value !== undefined) {
|
|
52
|
+
motionValue.set(value);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const sampleAnimation = new JSAnimation({
|
|
56
|
+
...options,
|
|
57
|
+
autoplay: false,
|
|
58
|
+
});
|
|
59
|
+
const sampleTime = secondsToMilliseconds(this.finishedTime ?? this.time);
|
|
60
|
+
motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
|
|
61
|
+
sampleAnimation.stop();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { NativeAnimationExtended };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NativeAnimation } from './NativeAnimation.mjs';
|
|
2
|
+
|
|
3
|
+
class NativeAnimationWrapper extends NativeAnimation {
|
|
4
|
+
constructor(animation) {
|
|
5
|
+
super();
|
|
6
|
+
this.animation = animation;
|
|
7
|
+
animation.onfinish = () => {
|
|
8
|
+
this.finishedTime = this.time;
|
|
9
|
+
this.notifyFinished();
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { NativeAnimationWrapper };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { time } from '../../frameloop/sync-time.mjs';
|
|
2
|
+
import { frame, cancelFrame, frameData } from '../../frameloop/frame.mjs';
|
|
3
3
|
|
|
4
4
|
const frameloopDriver = (update) => {
|
|
5
5
|
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { easeInOut } from '../../easing/ease.mjs';
|
|
2
|
-
import { isEasingArray } from '../../easing/utils/is-easing-array.mjs';
|
|
3
|
-
import { easingDefinitionToFunction } from '../../easing/utils/map.mjs';
|
|
4
1
|
import { interpolate } from '../../utils/interpolate.mjs';
|
|
5
|
-
import { defaultOffset } from '
|
|
6
|
-
import { convertOffsetToTimes } from '
|
|
2
|
+
import { defaultOffset } from '../keyframes/offsets/default.mjs';
|
|
3
|
+
import { convertOffsetToTimes } from '../keyframes/offsets/time.mjs';
|
|
4
|
+
import { easeInOut } from '../../../../../motion-utils/dist/es/easing/ease.mjs';
|
|
5
|
+
import { isEasingArray } from '../../../../../motion-utils/dist/es/easing/utils/is-easing-array.mjs';
|
|
6
|
+
import { easingDefinitionToFunction } from '../../../../../motion-utils/dist/es/easing/utils/map.mjs';
|
|
7
7
|
|
|
8
8
|
function defaultEasing(values, easing) {
|
|
9
9
|
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { clamp } from '../../../utils/clamp.mjs';
|
|
2
1
|
import { springDefaults } from './defaults.mjs';
|
|
3
2
|
import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
4
3
|
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
4
|
+
import { clamp } from '../../../../../../motion-utils/dist/es/clamp.mjs';
|
|
5
5
|
|
|
6
6
|
const safeMin = 0.001;
|
|
7
7
|
function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateLinearEasing } from '../../waapi/utils/linear.mjs';
|
|
2
|
+
import { calcGeneratorDuration, maxGeneratorDuration } from '../utils/calc-duration.mjs';
|
|
3
|
+
import { createGeneratorEasing } from '../utils/create-generator-easing.mjs';
|
|
2
4
|
import { calcGeneratorVelocity } from '../utils/velocity.mjs';
|
|
3
5
|
import { springDefaults } from './defaults.mjs';
|
|
4
6
|
import { findSpring, calcAngularFreq } from './find.mjs';
|
|
5
7
|
import { millisecondsToSeconds, secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import { supportsLinearEasing } from '../../../../../../motion-dom/dist/es/utils/supports/linear-easing.mjs';
|
|
8
|
-
import { calcGeneratorDuration, maxGeneratorDuration } from '../../../../../../motion-dom/dist/es/animation/generators/utils/calc-duration.mjs';
|
|
9
|
-
import { generateLinearEasing } from '../../../../../../motion-dom/dist/es/animation/waapi/utils/linear.mjs';
|
|
8
|
+
import { clamp } from '../../../../../../motion-utils/dist/es/clamp.mjs';
|
|
10
9
|
|
|
11
10
|
const durationKeys = ["duration", "bounce"];
|
|
12
11
|
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
@@ -168,7 +167,7 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
168
167
|
}
|
|
169
168
|
spring.applyToOptions = (options) => {
|
|
170
169
|
const generatorOptions = createGeneratorEasing(options, 100, spring);
|
|
171
|
-
options.ease =
|
|
170
|
+
options.ease = generatorOptions.ease;
|
|
172
171
|
options.duration = secondsToMilliseconds(generatorOptions.duration);
|
|
173
172
|
options.type = "keyframes";
|
|
174
173
|
return options;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { positionalKeys } from '../../render/utils/keys-position.mjs';
|
|
2
|
+
import { findDimensionValueType } from '../../value/types/dimensions.mjs';
|
|
3
|
+
import { getVariableValue } from '../utils/css-variables-conversion.mjs';
|
|
4
|
+
import { isCSSVariableToken } from '../utils/is-css-variable.mjs';
|
|
5
|
+
import { KeyframeResolver } from './KeyframesResolver.mjs';
|
|
6
|
+
import { isNone } from './utils/is-none.mjs';
|
|
7
|
+
import { makeNoneKeyframesAnimatable } from './utils/make-none-animatable.mjs';
|
|
7
8
|
import { isNumOrPxType, positionalValues } from './utils/unit-conversion.mjs';
|
|
8
|
-
import { findDimensionValueType } from './value-types/dimensions.mjs';
|
|
9
9
|
|
|
10
10
|
class DOMKeyframesResolver extends KeyframeResolver {
|
|
11
11
|
constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {
|
|
@@ -80,7 +80,8 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
80
80
|
const { unresolvedKeyframes, name } = this;
|
|
81
81
|
const noneKeyframeIndexes = [];
|
|
82
82
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
83
|
-
if (
|
|
83
|
+
if (unresolvedKeyframes[i] === null ||
|
|
84
|
+
isNone(unresolvedKeyframes[i])) {
|
|
84
85
|
noneKeyframeIndexes.push(i);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { fillWildcards } from './utils/fill-wildcards.mjs';
|
|
2
|
+
import { removeNonTranslationalTransform } from './utils/unit-conversion.mjs';
|
|
3
|
+
import { frame } from '../../frameloop/frame.mjs';
|
|
3
4
|
|
|
4
5
|
const toResolve = new Set();
|
|
5
6
|
let isScheduled = false;
|
|
6
7
|
let anyNeedsMeasurement = false;
|
|
8
|
+
let isForced = false;
|
|
7
9
|
function measureAllKeyframes() {
|
|
8
10
|
if (anyNeedsMeasurement) {
|
|
9
11
|
const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement);
|
|
@@ -43,7 +45,7 @@ function measureAllKeyframes() {
|
|
|
43
45
|
}
|
|
44
46
|
anyNeedsMeasurement = false;
|
|
45
47
|
isScheduled = false;
|
|
46
|
-
toResolve.forEach((resolver) => resolver.complete());
|
|
48
|
+
toResolve.forEach((resolver) => resolver.complete(isForced));
|
|
47
49
|
toResolve.clear();
|
|
48
50
|
}
|
|
49
51
|
function readAllKeyframes() {
|
|
@@ -55,8 +57,10 @@ function readAllKeyframes() {
|
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
59
|
function flushKeyframeResolvers() {
|
|
60
|
+
isForced = true;
|
|
58
61
|
readAllKeyframes();
|
|
59
62
|
measureAllKeyframes();
|
|
63
|
+
isForced = false;
|
|
60
64
|
}
|
|
61
65
|
class KeyframeResolver {
|
|
62
66
|
constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {
|
|
@@ -105,47 +109,36 @@ class KeyframeResolver {
|
|
|
105
109
|
}
|
|
106
110
|
readKeyframes() {
|
|
107
111
|
const { unresolvedKeyframes, name, element, motionValue } = this;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (currentValue !== undefined) {
|
|
121
|
-
unresolvedKeyframes[0] = currentValue;
|
|
122
|
-
}
|
|
123
|
-
else if (element && name) {
|
|
124
|
-
const valueAsRead = element.readValue(name, finalKeyframe);
|
|
125
|
-
if (valueAsRead !== undefined && valueAsRead !== null) {
|
|
126
|
-
unresolvedKeyframes[0] = valueAsRead;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (unresolvedKeyframes[0] === undefined) {
|
|
130
|
-
unresolvedKeyframes[0] = finalKeyframe;
|
|
131
|
-
}
|
|
132
|
-
if (motionValue && currentValue === undefined) {
|
|
133
|
-
motionValue.set(unresolvedKeyframes[0]);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
unresolvedKeyframes[i] = unresolvedKeyframes[i - 1];
|
|
112
|
+
// If initial keyframe is null we need to read it from the DOM
|
|
113
|
+
if (unresolvedKeyframes[0] === null) {
|
|
114
|
+
const currentValue = motionValue?.get();
|
|
115
|
+
// TODO: This doesn't work if the final keyframe is a wildcard
|
|
116
|
+
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
117
|
+
if (currentValue !== undefined) {
|
|
118
|
+
unresolvedKeyframes[0] = currentValue;
|
|
119
|
+
}
|
|
120
|
+
else if (element && name) {
|
|
121
|
+
const valueAsRead = element.readValue(name, finalKeyframe);
|
|
122
|
+
if (valueAsRead !== undefined && valueAsRead !== null) {
|
|
123
|
+
unresolvedKeyframes[0] = valueAsRead;
|
|
138
124
|
}
|
|
139
125
|
}
|
|
126
|
+
if (unresolvedKeyframes[0] === undefined) {
|
|
127
|
+
unresolvedKeyframes[0] = finalKeyframe;
|
|
128
|
+
}
|
|
129
|
+
if (motionValue && currentValue === undefined) {
|
|
130
|
+
motionValue.set(unresolvedKeyframes[0]);
|
|
131
|
+
}
|
|
140
132
|
}
|
|
133
|
+
fillWildcards(unresolvedKeyframes);
|
|
141
134
|
}
|
|
142
135
|
setFinalKeyframe() { }
|
|
143
136
|
measureInitialState() { }
|
|
144
137
|
renderEndStyles() { }
|
|
145
138
|
measureEndState() { }
|
|
146
|
-
complete() {
|
|
139
|
+
complete(isForced = false) {
|
|
147
140
|
this.isComplete = true;
|
|
148
|
-
this.onComplete(this.unresolvedKeyframes, this.finalKeyframe);
|
|
141
|
+
this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, isForced);
|
|
149
142
|
toResolve.delete(this);
|
|
150
143
|
}
|
|
151
144
|
cancel() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
const isNotNull = (value) => value !== null;
|
|
2
|
-
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
2
|
+
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe, speed = 1) {
|
|
3
3
|
const resolvedKeyframes = keyframes.filter(isNotNull);
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
: resolvedKeyframes.length - 1;
|
|
4
|
+
const useFirstKeyframe = speed < 0 || (repeat && repeatType !== "loop" && repeat % 2 === 1);
|
|
5
|
+
const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1;
|
|
7
6
|
return !index || finalKeyframe === undefined
|
|
8
7
|
? resolvedKeyframes[index]
|
|
9
8
|
: finalKeyframe;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mixNumber } from '
|
|
2
|
-
import { progress } from '
|
|
1
|
+
import { mixNumber } from '../../../utils/mix/number.mjs';
|
|
2
|
+
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
3
3
|
|
|
4
4
|
function fillOffset(offset, remaining) {
|
|
5
5
|
const min = offset[offset.length - 1];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pxValues } from '../../waapi/utils/px-values.mjs';
|
|
2
|
+
|
|
3
|
+
function applyPxDefaults(keyframes, name) {
|
|
4
|
+
for (let i = 0; i < keyframes.length; i++) {
|
|
5
|
+
if (typeof keyframes[i] === "number" && pxValues.has(name)) {
|
|
6
|
+
keyframes[i] = keyframes[i] + "px";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { applyPxDefaults };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { analyseComplexValue } from '../../../value/types/complex/index.mjs';
|
|
2
|
-
import { getAnimatableNone } from '
|
|
2
|
+
import { getAnimatableNone } from '../../../value/types/utils/animatable-none.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* If we encounter keyframes like "none" or "0" and we also have keyframes like
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { parseValueFromTransform } from '../../../render/dom/parse-transform.mjs';
|
|
2
|
+
import { transformPropOrder } from '../../../render/utils/keys-transform.mjs';
|
|
1
3
|
import { number } from '../../../value/types/numbers/index.mjs';
|
|
2
4
|
import { px } from '../../../value/types/numbers/units.mjs';
|
|
3
|
-
import { transformPropOrder } from '../../html/utils/keys-transform.mjs';
|
|
4
|
-
import { parseValueFromTransform } from '../../html/utils/parse-transform.mjs';
|
|
5
5
|
|
|
6
6
|
const isNumOrPxType = (v) => v === number || v === px;
|
|
7
7
|
const transformKeys = new Set(["x", "y", "z"]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class WithPromise {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.count = 0;
|
|
4
|
+
this.updateFinished();
|
|
5
|
+
}
|
|
6
|
+
get finished() {
|
|
7
|
+
return this._finished;
|
|
8
|
+
}
|
|
9
|
+
updateFinished() {
|
|
10
|
+
this.count++;
|
|
11
|
+
this._finished = new Promise((resolve) => {
|
|
12
|
+
this.resolve = resolve;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
notifyFinished() {
|
|
16
|
+
this.resolve();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Allows the animation to be awaited.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated Use `finished` instead.
|
|
22
|
+
*/
|
|
23
|
+
then(onResolve, onReject) {
|
|
24
|
+
return this.finished.then(onResolve, onReject);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { WithPromise };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const animationMaps = new WeakMap();
|
|
2
|
+
const animationMapKey = (name, pseudoElement = "") => `${name}:${pseudoElement}`;
|
|
3
|
+
function getAnimationMap(element) {
|
|
4
|
+
const map = animationMaps.get(element) || new Map();
|
|
5
|
+
animationMaps.set(element, map);
|
|
6
|
+
return map;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { animationMapKey, getAnimationMap };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isGenerator } from '../generators/utils/is-generator.mjs';
|
|
2
|
+
import { isAnimatable } from './is-animatable.mjs';
|
|
3
|
+
import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
4
4
|
|
|
5
5
|
function hasKeyframesChanged(keyframes) {
|
|
6
6
|
const current = keyframes[0];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isNumericalString } from '../../../utils/is-numerical-string.mjs';
|
|
2
1
|
import { isCSSVariableToken } from './is-css-variable.mjs';
|
|
3
|
-
import { invariant } from '
|
|
2
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
3
|
+
import { isNumericalString } from '../../../../../motion-utils/dist/es/is-numerical-string.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Parse Framer's special CSS variable format into a CSS token and a fallback.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { inertia } from '../generators/inertia.mjs';
|
|
2
|
+
import { keyframes } from '../generators/keyframes.mjs';
|
|
3
|
+
import { spring } from '../generators/spring/index.mjs';
|
|
4
|
+
|
|
5
|
+
const transitionTypeMap = {
|
|
6
|
+
decay: inertia,
|
|
7
|
+
inertia,
|
|
8
|
+
tween: keyframes,
|
|
9
|
+
keyframes: keyframes,
|
|
10
|
+
spring,
|
|
11
|
+
};
|
|
12
|
+
function replaceTransitionType(transition) {
|
|
13
|
+
if (typeof transition.type === "string") {
|
|
14
|
+
transition.type = transitionTypeMap[transition.type];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { replaceTransitionType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isBezierDefinition } from '../../../utils/is-bezier-definition.mjs';
|
|
2
1
|
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
|
3
2
|
import { supportedWaapiEasing } from './supported.mjs';
|
|
3
|
+
import { isBezierDefinition } from '../../../../../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs';
|
|
4
4
|
|
|
5
5
|
function isWaapiSupportedEasing(easing) {
|
|
6
6
|
return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { isBezierDefinition } from '../../../utils/is-bezier-definition.mjs';
|
|
2
1
|
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
|
3
2
|
import { generateLinearEasing } from '../utils/linear.mjs';
|
|
4
3
|
import { cubicBezierAsString } from './cubic-bezier.mjs';
|
|
5
4
|
import { supportedWaapiEasing } from './supported.mjs';
|
|
5
|
+
import { isBezierDefinition } from '../../../../../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs';
|
|
6
6
|
|
|
7
7
|
function mapEasingToNativeEasing(easing, duration) {
|
|
8
8
|
if (!easing) {
|
|
9
9
|
return undefined;
|
|
10
10
|
}
|
|
11
|
-
else if (typeof easing === "function"
|
|
12
|
-
return
|
|
11
|
+
else if (typeof easing === "function") {
|
|
12
|
+
return supportsLinearEasing()
|
|
13
|
+
? generateLinearEasing(easing, duration)
|
|
14
|
+
: "ease-out";
|
|
13
15
|
}
|
|
14
16
|
else if (isBezierDefinition(easing)) {
|
|
15
17
|
return cubicBezierAsString(easing);
|
|
@@ -2,7 +2,7 @@ import { activeAnimations } from '../../stats/animation-count.mjs';
|
|
|
2
2
|
import { statsBuffer } from '../../stats/buffer.mjs';
|
|
3
3
|
import { mapEasingToNativeEasing } from './easing/map-easing.mjs';
|
|
4
4
|
|
|
5
|
-
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "
|
|
5
|
+
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeOut", times, } = {}, pseudoElement = undefined) {
|
|
6
6
|
const keyframeOptions = {
|
|
7
7
|
[valueName]: keyframes,
|
|
8
8
|
};
|
|
@@ -17,15 +17,17 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
|
|
|
17
17
|
if (statsBuffer.value) {
|
|
18
18
|
activeAnimations.waapi++;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const options = {
|
|
21
21
|
delay,
|
|
22
22
|
duration,
|
|
23
23
|
easing: !Array.isArray(easing) ? easing : "linear",
|
|
24
24
|
fill: "both",
|
|
25
25
|
iterations: repeat + 1,
|
|
26
26
|
direction: repeatType === "reverse" ? "alternate" : "normal",
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
};
|
|
28
|
+
if (pseudoElement)
|
|
29
|
+
options.pseudoElement = pseudoElement;
|
|
30
|
+
const animation = element.animate(keyframeOptions, options);
|
|
29
31
|
if (statsBuffer.value) {
|
|
30
32
|
animation.finished.finally(() => {
|
|
31
33
|
activeAnimations.waapi--;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { memo } from '../../../../../../motion-utils/dist/es/memo.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A list of values that can be hardware-accelerated.
|
|
5
|
+
*/
|
|
6
|
+
const acceleratedValues = new Set([
|
|
7
|
+
"opacity",
|
|
8
|
+
"clipPath",
|
|
9
|
+
"filter",
|
|
10
|
+
"transform",
|
|
11
|
+
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
12
|
+
// or until we implement support for linear() easing.
|
|
13
|
+
// "background-color"
|
|
14
|
+
]);
|
|
15
|
+
const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
16
|
+
function supportsBrowserAnimation(options) {
|
|
17
|
+
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
18
|
+
if (!motionValue ||
|
|
19
|
+
!motionValue.owner ||
|
|
20
|
+
!(motionValue.owner.current instanceof HTMLElement)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
24
|
+
return (supportsWaapi() &&
|
|
25
|
+
name &&
|
|
26
|
+
acceleratedValues.has(name) &&
|
|
27
|
+
(name !== "transform" || !transformTemplate) &&
|
|
28
|
+
/**
|
|
29
|
+
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
30
|
+
* no way to read the value from WAAPI every frame.
|
|
31
|
+
*/
|
|
32
|
+
!onUpdate &&
|
|
33
|
+
!repeatDelay &&
|
|
34
|
+
repeatType !== "mirror" &&
|
|
35
|
+
damping !== 0 &&
|
|
36
|
+
type !== "inertia");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { supportsBrowserAnimation };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
|
1
2
|
import { isGenerator } from '../../generators/utils/is-generator.mjs';
|
|
2
3
|
|
|
3
4
|
function applyGeneratorOptions({ type, ...options }) {
|
|
4
|
-
if (isGenerator(type)) {
|
|
5
|
+
if (isGenerator(type) && supportsLinearEasing()) {
|
|
5
6
|
return type.applyToOptions(options);
|
|
6
7
|
}
|
|
7
8
|
else {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { anticipate } from '../../../../../../motion-utils/dist/es/easing/anticipate.mjs';
|
|
2
|
+
import { backInOut } from '../../../../../../motion-utils/dist/es/easing/back.mjs';
|
|
3
|
+
import { circInOut } from '../../../../../../motion-utils/dist/es/easing/circ.mjs';
|
|
4
|
+
|
|
5
|
+
const unsupportedEasingFunctions = {
|
|
6
|
+
anticipate,
|
|
7
|
+
backInOut,
|
|
8
|
+
circInOut,
|
|
9
|
+
};
|
|
10
|
+
function isUnsupportedEase(key) {
|
|
11
|
+
return key in unsupportedEasingFunctions;
|
|
12
|
+
}
|
|
13
|
+
function replaceStringEasing(transition) {
|
|
14
|
+
if (typeof transition.ease === "string" &&
|
|
15
|
+
isUnsupportedEase(transition.ease)) {
|
|
16
|
+
transition.ease = unsupportedEasingFunctions[transition.ease];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { replaceStringEasing };
|
|
@@ -16,7 +16,7 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
16
16
|
acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);
|
|
17
17
|
return acc;
|
|
18
18
|
}, {});
|
|
19
|
-
const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
|
|
19
|
+
const { setup, read, resolveKeyframes, update, preRender, render, postRender, } = steps;
|
|
20
20
|
const processBatch = () => {
|
|
21
21
|
const timestamp = MotionGlobalConfig.useManualTiming
|
|
22
22
|
? state.timestamp
|
|
@@ -30,6 +30,7 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
30
30
|
state.timestamp = timestamp;
|
|
31
31
|
state.isProcessing = true;
|
|
32
32
|
// Unrolled render loop for better per-frame performance
|
|
33
|
+
setup.process(state);
|
|
33
34
|
read.process(state);
|
|
34
35
|
resolveKeyframes.process(state);
|
|
35
36
|
update.process(state);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isCSSVar } from './is-css-var.mjs';
|
|
2
|
+
|
|
3
|
+
function getComputedStyle(element, name) {
|
|
4
|
+
const computedStyle = window.getComputedStyle(element);
|
|
5
|
+
return isCSSVar(name)
|
|
6
|
+
? computedStyle.getPropertyValue(name)
|
|
7
|
+
: computedStyle[name];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { getComputedStyle };
|
|
@@ -23,6 +23,6 @@ const transformPropOrder = [
|
|
|
23
23
|
/**
|
|
24
24
|
* A quick lookup for transform props.
|
|
25
25
|
*/
|
|
26
|
-
const transformProps = new Set(transformPropOrder);
|
|
26
|
+
const transformProps = /*@__PURE__*/ (() => new Set(transformPropOrder))();
|
|
27
27
|
|
|
28
28
|
export { transformPropOrder, transformProps };
|