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
|
@@ -44,6 +44,7 @@ function reportStats() {
|
|
|
44
44
|
cancelFrame(record);
|
|
45
45
|
const summary = {
|
|
46
46
|
frameloop: {
|
|
47
|
+
setup: summarise(value.frameloop.setup),
|
|
47
48
|
rate: summarise(value.frameloop.rate),
|
|
48
49
|
read: summarise(value.frameloop.read),
|
|
49
50
|
resolveKeyframes: summarise(value.frameloop.resolveKeyframes),
|
|
@@ -81,6 +82,7 @@ function recordStats() {
|
|
|
81
82
|
const newStatsBuffer = statsBuffer;
|
|
82
83
|
newStatsBuffer.value = {
|
|
83
84
|
frameloop: {
|
|
85
|
+
setup: [],
|
|
84
86
|
rate: [],
|
|
85
87
|
read: [],
|
|
86
88
|
resolveKeyframes: [],
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { clamp } from './clamp.mjs';
|
|
2
1
|
import { mix } from './mix/index.mjs';
|
|
3
|
-
import { pipe } from './pipe.mjs';
|
|
4
2
|
import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
3
|
+
import { clamp } from '../../../../motion-utils/dist/es/clamp.mjs';
|
|
4
|
+
import { MotionGlobalConfig } from '../../../../motion-utils/dist/es/global-config.mjs';
|
|
5
5
|
import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
|
|
6
|
+
import { pipe } from '../../../../motion-utils/dist/es/pipe.mjs';
|
|
6
7
|
import { progress } from '../../../../motion-utils/dist/es/progress.mjs';
|
|
7
8
|
|
|
8
9
|
function createMixers(output, ease, customMixer) {
|
|
9
10
|
const mixers = [];
|
|
10
|
-
const mixerFactory = customMixer || mix;
|
|
11
|
+
const mixerFactory = customMixer || MotionGlobalConfig.mix || mix;
|
|
11
12
|
const numMixers = output.length - 1;
|
|
12
13
|
for (let i = 0; i < numMixers; i++) {
|
|
13
14
|
let mixer = mixerFactory(output[i], output[i + 1]);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { mixNumber } from './number.mjs';
|
|
2
|
-
import { hslaToRgba } from '../hsla-to-rgba.mjs';
|
|
3
1
|
import { hex } from '../../value/types/color/hex.mjs';
|
|
4
|
-
import { rgba } from '../../value/types/color/rgba.mjs';
|
|
5
2
|
import { hsla } from '../../value/types/color/hsla.mjs';
|
|
3
|
+
import { hslaToRgba } from '../../value/types/color/hsla-to-rgba.mjs';
|
|
4
|
+
import { rgba } from '../../value/types/color/rgba.mjs';
|
|
6
5
|
import { mixImmediate } from './immediate.mjs';
|
|
6
|
+
import { mixNumber } from './number.mjs';
|
|
7
7
|
import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
8
8
|
|
|
9
9
|
// Linear color space blending
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { mixColor } from './color.mjs';
|
|
3
|
-
import { pipe } from '../pipe.mjs';
|
|
1
|
+
import { isCSSVariableToken } from '../../animation/utils/is-css-variable.mjs';
|
|
4
2
|
import { color } from '../../value/types/color/index.mjs';
|
|
5
3
|
import { complex, analyseComplexValue } from '../../value/types/complex/index.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import { invisibleValues, mixVisibility } from './visibility.mjs';
|
|
4
|
+
import { mixColor } from './color.mjs';
|
|
8
5
|
import { mixImmediate } from './immediate.mjs';
|
|
6
|
+
import { mixNumber as mixNumber$1 } from './number.mjs';
|
|
7
|
+
import { invisibleValues, mixVisibility } from './visibility.mjs';
|
|
8
|
+
import { pipe } from '../../../../../motion-utils/dist/es/pipe.mjs';
|
|
9
9
|
import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
10
10
|
|
|
11
11
|
function mixNumber(a, b) {
|
|
@@ -32,7 +32,7 @@ class MotionValue {
|
|
|
32
32
|
* This will be replaced by the build step with the latest version number.
|
|
33
33
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
34
34
|
*/
|
|
35
|
-
this.version = "12.7.
|
|
35
|
+
this.version = "12.7.5-alpha.0";
|
|
36
36
|
/**
|
|
37
37
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
38
38
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -176,6 +176,8 @@ class MotionValue {
|
|
|
176
176
|
* @public
|
|
177
177
|
*/
|
|
178
178
|
set(v, render = true) {
|
|
179
|
+
if (v === "none")
|
|
180
|
+
console.trace();
|
|
179
181
|
if (!render || !this.passiveEffect) {
|
|
180
182
|
this.updateAndNotify(v, render);
|
|
181
183
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { alpha, number } from '../numbers/index.mjs';
|
|
1
|
+
import { number, alpha } from '../numbers/index.mjs';
|
|
3
2
|
import { sanitize } from '../utils/sanitize.mjs';
|
|
4
3
|
import { isColorString, splitColor } from './utils.mjs';
|
|
4
|
+
import { clamp } from '../../../../../../motion-utils/dist/es/clamp.mjs';
|
|
5
5
|
|
|
6
6
|
const clampRgbUnit = (v) => clamp(0, 255, v);
|
|
7
7
|
const rgbUnit = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { auto } from './auto.mjs';
|
|
2
|
+
import { number } from './numbers/index.mjs';
|
|
3
|
+
import { px, percent, degrees, vw, vh } from './numbers/units.mjs';
|
|
3
4
|
import { testValueType } from './test.mjs';
|
|
4
|
-
import { auto } from './type-auto.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A list of value types commonly used for dimensions
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { color } from '
|
|
2
|
-
import { filter } from '
|
|
1
|
+
import { color } from '../color/index.mjs';
|
|
2
|
+
import { filter } from '../complex/filter.mjs';
|
|
3
3
|
import { numberValueTypes } from './number.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { int } from '../int.mjs';
|
|
2
|
+
import { alpha } from '../numbers/index.mjs';
|
|
3
|
+
import { px } from '../numbers/units.mjs';
|
|
4
|
+
import { transformValueTypes } from './transform.mjs';
|
|
2
5
|
|
|
3
|
-
const
|
|
6
|
+
const numberValueTypes = {
|
|
4
7
|
// Border props
|
|
5
8
|
borderWidth: px,
|
|
6
9
|
borderTopWidth: px,
|
|
@@ -36,6 +39,13 @@ const browserNumberValueTypes = {
|
|
|
36
39
|
// Misc
|
|
37
40
|
backgroundPositionX: px,
|
|
38
41
|
backgroundPositionY: px,
|
|
42
|
+
...transformValueTypes,
|
|
43
|
+
zIndex: int,
|
|
44
|
+
size: px,
|
|
45
|
+
// SVG
|
|
46
|
+
fillOpacity: alpha,
|
|
47
|
+
strokeOpacity: alpha,
|
|
48
|
+
numOctaves: int,
|
|
39
49
|
};
|
|
40
50
|
|
|
41
|
-
export {
|
|
51
|
+
export { numberValueTypes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { scale, alpha } from '
|
|
2
|
-
import { degrees, px, progressPercentage } from '
|
|
1
|
+
import { scale, alpha } from '../numbers/index.mjs';
|
|
2
|
+
import { degrees, px, progressPercentage } from '../numbers/units.mjs';
|
|
3
3
|
|
|
4
4
|
const transformValueTypes = {
|
|
5
5
|
rotate: degrees,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
1
2
|
const createUnitType = (unit) => ({
|
|
2
3
|
test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
|
|
3
4
|
parse: parseFloat,
|
|
@@ -8,10 +9,10 @@ const percent = /*@__PURE__*/ createUnitType("%");
|
|
|
8
9
|
const px = /*@__PURE__*/ createUnitType("px");
|
|
9
10
|
const vh = /*@__PURE__*/ createUnitType("vh");
|
|
10
11
|
const vw = /*@__PURE__*/ createUnitType("vw");
|
|
11
|
-
const progressPercentage = {
|
|
12
|
+
const progressPercentage = /*@__PURE__*/ (() => ({
|
|
12
13
|
...percent,
|
|
13
14
|
parse: (v) => percent.parse(v) / 100,
|
|
14
15
|
transform: (v) => percent.transform(v * 100),
|
|
15
|
-
};
|
|
16
|
+
}))();
|
|
16
17
|
|
|
17
18
|
export { degrees, percent, progressPercentage, px, vh, vw };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { complex } from '
|
|
2
|
-
import { filter } from '
|
|
3
|
-
import { getDefaultValueType } from '
|
|
1
|
+
import { complex } from '../complex/index.mjs';
|
|
2
|
+
import { filter } from '../complex/filter.mjs';
|
|
3
|
+
import { getDefaultValueType } from '../maps/defaults.mjs';
|
|
4
4
|
|
|
5
5
|
function getAnimatableNone(key, value) {
|
|
6
6
|
let defaultValueType = getDefaultValueType(key);
|
|
7
7
|
if (defaultValueType !== filter)
|
|
8
8
|
defaultValueType = complex;
|
|
9
|
-
// If value is not recognised as animatable, ie "
|
|
9
|
+
// If value is not recognised as animatable, ie "one", create an animatable version origin based on the target
|
|
10
10
|
return defaultValueType.getAnimatableNone
|
|
11
11
|
? defaultValueType.getAnimatableNone(value)
|
|
12
12
|
: undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { color } from '
|
|
2
|
-
import { complex } from '
|
|
3
|
-
import { dimensionValueTypes } from '
|
|
4
|
-
import { testValueType } from '
|
|
1
|
+
import { color } from '../color/index.mjs';
|
|
2
|
+
import { complex } from '../complex/index.mjs';
|
|
3
|
+
import { dimensionValueTypes } from '../dimensions.mjs';
|
|
4
|
+
import { testValueType } from '../test.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A list of all ValueTypes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { addToQueue } from './queue.mjs';
|
|
2
|
+
import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
|
|
4
|
+
class ViewTransitionBuilder {
|
|
5
|
+
constructor(update, options = {}) {
|
|
6
|
+
this.currentTarget = "root";
|
|
7
|
+
this.targets = new Map();
|
|
8
|
+
this.notifyReady = noop;
|
|
9
|
+
this.readyPromise = new Promise((resolve) => {
|
|
10
|
+
this.notifyReady = resolve;
|
|
11
|
+
});
|
|
12
|
+
this.update = update;
|
|
13
|
+
this.options = {
|
|
14
|
+
interrupt: "wait",
|
|
15
|
+
...options,
|
|
16
|
+
};
|
|
17
|
+
addToQueue(this);
|
|
18
|
+
}
|
|
19
|
+
get(selector) {
|
|
20
|
+
this.currentTarget = selector;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
layout(keyframes, options) {
|
|
24
|
+
this.updateTarget("layout", keyframes, options);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
new(keyframes, options) {
|
|
28
|
+
this.updateTarget("new", keyframes, options);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
old(keyframes, options) {
|
|
32
|
+
this.updateTarget("old", keyframes, options);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
enter(keyframes, options) {
|
|
36
|
+
this.updateTarget("enter", keyframes, options);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
exit(keyframes, options) {
|
|
40
|
+
this.updateTarget("exit", keyframes, options);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
crossfade(options) {
|
|
44
|
+
this.updateTarget("enter", { opacity: 1 }, options);
|
|
45
|
+
this.updateTarget("exit", { opacity: 0 }, options);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
updateTarget(target, keyframes, options = {}) {
|
|
49
|
+
const { currentTarget, targets } = this;
|
|
50
|
+
if (!targets.has(currentTarget)) {
|
|
51
|
+
targets.set(currentTarget, {});
|
|
52
|
+
}
|
|
53
|
+
const targetData = targets.get(currentTarget);
|
|
54
|
+
targetData[target] = { keyframes, options };
|
|
55
|
+
}
|
|
56
|
+
then(resolve, reject) {
|
|
57
|
+
return this.readyPromise.then(resolve, reject);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function animateView(update, defaultOptions = {}) {
|
|
61
|
+
return new ViewTransitionBuilder(update, defaultOptions);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { ViewTransitionBuilder, animateView };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { microtask } from '../frameloop/microtask.mjs';
|
|
2
|
+
import { startViewAnimation } from './start.mjs';
|
|
3
|
+
import { removeItem } from '../../../../motion-utils/dist/es/array.mjs';
|
|
4
|
+
|
|
5
|
+
let builders = [];
|
|
6
|
+
let current = null;
|
|
7
|
+
function next() {
|
|
8
|
+
current = null;
|
|
9
|
+
const [nextBuilder] = builders;
|
|
10
|
+
if (nextBuilder)
|
|
11
|
+
start(nextBuilder);
|
|
12
|
+
}
|
|
13
|
+
function start(builder) {
|
|
14
|
+
removeItem(builders, builder);
|
|
15
|
+
current = builder;
|
|
16
|
+
startViewAnimation(builder).then((animation) => {
|
|
17
|
+
builder.notifyReady(animation);
|
|
18
|
+
animation.finished.finally(next);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function processQueue() {
|
|
22
|
+
/**
|
|
23
|
+
* Iterate backwards over the builders array. We can ignore the
|
|
24
|
+
* "wait" animations. If we have an interrupting animation in the
|
|
25
|
+
* queue then we need to batch all preceeding animations into it.
|
|
26
|
+
* Currently this only batches the update functions but will also
|
|
27
|
+
* need to batch the targets.
|
|
28
|
+
*/
|
|
29
|
+
for (let i = builders.length - 1; i >= 0; i--) {
|
|
30
|
+
const builder = builders[i];
|
|
31
|
+
const { interrupt } = builder.options;
|
|
32
|
+
if (interrupt === "immediate") {
|
|
33
|
+
const batchedUpdates = builders.slice(0, i + 1).map((b) => b.update);
|
|
34
|
+
const remaining = builders.slice(i + 1);
|
|
35
|
+
builder.update = () => {
|
|
36
|
+
batchedUpdates.forEach((update) => update());
|
|
37
|
+
};
|
|
38
|
+
// Put the current builder at the front, followed by any "wait" builders
|
|
39
|
+
builders = [builder, ...remaining];
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!current || builders[0]?.options.interrupt === "immediate") {
|
|
44
|
+
next();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function addToQueue(builder) {
|
|
48
|
+
builders.push(builder);
|
|
49
|
+
microtask.render(processQueue);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { addToQueue };
|
|
@@ -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,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 };
|
|
@@ -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 '
|
|
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 (
|
|
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,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 };
|