motion-dom 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.
- package/dist/cjs/index.js +2946 -475
- package/dist/es/animation/AsyncMotionValueAnimation.mjs +178 -0
- package/dist/es/animation/GroupAnimation.mjs +6 -15
- package/dist/es/animation/JSAnimation.mjs +346 -0
- package/dist/es/animation/NativeAnimation.mjs +64 -67
- package/dist/es/animation/NativeAnimationExtended.mjs +65 -0
- package/dist/es/animation/NativeAnimationWrapper.mjs +14 -0
- package/dist/es/animation/drivers/driver-frameloop.mjs +17 -0
- package/dist/es/animation/generators/inertia.mjs +87 -0
- package/dist/es/animation/generators/keyframes.mjs +49 -0
- package/dist/es/animation/generators/spring/defaults.mjs +27 -0
- package/dist/es/animation/generators/spring/find.mjs +84 -0
- package/dist/es/animation/generators/spring/index.mjs +175 -0
- package/dist/es/animation/generators/utils/velocity.mjs +9 -0
- package/dist/es/animation/keyframes/DOMKeyframesResolver.mjs +131 -0
- package/dist/es/animation/keyframes/KeyframesResolver.mjs +156 -0
- package/dist/es/animation/keyframes/get-final.mjs +3 -4
- package/dist/es/animation/keyframes/offsets/default.mjs +9 -0
- package/dist/es/animation/keyframes/offsets/fill.mjs +12 -0
- package/dist/es/animation/keyframes/offsets/time.mjs +5 -0
- package/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +11 -0
- package/dist/es/animation/keyframes/utils/fill-wildcards.mjs +7 -0
- package/dist/es/animation/keyframes/utils/is-none.mjs +15 -0
- package/dist/es/animation/keyframes/utils/make-none-animatable.mjs +30 -0
- package/dist/es/animation/keyframes/utils/unit-conversion.mjs +36 -0
- package/dist/es/animation/utils/WithPromise.mjs +28 -0
- package/dist/es/animation/utils/active-animations.mjs +9 -0
- package/dist/es/animation/utils/can-animate.mjs +42 -0
- package/dist/es/animation/utils/css-variables-conversion.mjs +41 -0
- package/dist/es/animation/utils/is-animatable.mjs +30 -0
- package/dist/es/animation/utils/is-css-variable.mjs +15 -0
- package/dist/es/animation/utils/replace-transition-type.mjs +18 -0
- package/dist/es/animation/waapi/easing/is-supported.mjs +1 -1
- package/dist/es/animation/waapi/easing/map-easing.mjs +5 -3
- package/dist/es/animation/waapi/start-waapi-animation.mjs +6 -4
- package/dist/es/animation/waapi/supports/waapi.mjs +39 -0
- package/dist/es/animation/waapi/utils/accelerated-values.mjs +14 -0
- package/dist/es/animation/waapi/utils/apply-generator.mjs +2 -1
- package/dist/es/animation/waapi/utils/unsupported-easing.mjs +18 -0
- package/dist/es/frameloop/batcher.mjs +2 -1
- package/dist/es/frameloop/order.mjs +1 -0
- package/dist/es/index.mjs +49 -2
- package/dist/es/render/dom/is-css-var.mjs +3 -0
- package/dist/es/render/dom/parse-transform.mjs +83 -0
- package/dist/es/render/dom/style-computed.mjs +10 -0
- package/dist/es/render/dom/style-set.mjs +9 -0
- package/dist/es/render/utils/keys-position.mjs +13 -0
- package/dist/es/render/utils/keys-transform.mjs +28 -0
- package/dist/es/scroll/observe.mjs +18 -0
- package/dist/es/stats/index.mjs +2 -0
- package/dist/es/utils/interpolate.mjs +74 -0
- package/dist/es/utils/mix/color.mjs +47 -0
- package/dist/es/utils/mix/complex.mjs +92 -0
- package/dist/es/utils/mix/immediate.mjs +5 -0
- package/dist/es/utils/mix/index.mjs +14 -0
- package/dist/es/utils/mix/number.mjs +26 -0
- package/dist/es/utils/mix/visibility.mjs +16 -0
- package/dist/es/value/index.mjs +3 -1
- package/dist/es/value/types/auto.mjs +9 -0
- package/dist/es/value/types/color/hex.mjs +40 -0
- package/dist/es/value/types/color/hsla-to-rgba.mjs +42 -0
- package/dist/es/value/types/color/hsla.mjs +22 -0
- package/dist/es/value/types/color/index.mjs +27 -0
- package/dist/es/value/types/color/rgba.mjs +25 -0
- package/dist/es/value/types/color/utils.mjs +29 -0
- package/dist/es/value/types/complex/filter.mjs +30 -0
- package/dist/es/value/types/complex/index.mjs +91 -0
- package/dist/es/value/types/dimensions.mjs +15 -0
- package/dist/es/value/types/int.mjs +8 -0
- package/dist/es/value/types/maps/defaults.mjs +30 -0
- package/dist/es/value/types/maps/number.mjs +51 -0
- package/dist/es/value/types/maps/transform.mjs +31 -0
- package/dist/es/value/types/numbers/index.mjs +17 -0
- package/dist/es/value/types/numbers/units.mjs +18 -0
- package/dist/es/value/types/test.mjs +6 -0
- package/dist/es/value/types/utils/animatable-none.mjs +15 -0
- package/dist/es/value/types/utils/color-regex.mjs +3 -0
- package/dist/es/value/types/utils/find.mjs +15 -0
- package/dist/es/value/types/utils/float-regex.mjs +3 -0
- package/dist/es/value/types/utils/get-as-type.mjs +10 -0
- package/dist/es/value/types/utils/is-nullish.mjs +5 -0
- package/dist/es/value/types/utils/sanitize.mjs +5 -0
- package/dist/es/value/types/utils/single-color-regex.mjs +3 -0
- package/dist/es/view/start.mjs +4 -3
- package/dist/index.d.ts +945 -444
- package/dist/motion-dom.dev.js +2945 -475
- package/dist/motion-dom.js +1 -1
- package/package.json +3 -3
- package/dist/es/animation/keyframes/hydrate.mjs +0 -26
- package/dist/es/animation/waapi/utils/attach-timeline.mjs +0 -6
- package/dist/es/render/dom/style.mjs +0 -15
- package/dist/es/utils/is-bezier-definition.mjs +0 -3
|
@@ -0,0 +1,51 @@
|
|
|
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';
|
|
5
|
+
|
|
6
|
+
const numberValueTypes = {
|
|
7
|
+
// Border props
|
|
8
|
+
borderWidth: px,
|
|
9
|
+
borderTopWidth: px,
|
|
10
|
+
borderRightWidth: px,
|
|
11
|
+
borderBottomWidth: px,
|
|
12
|
+
borderLeftWidth: px,
|
|
13
|
+
borderRadius: px,
|
|
14
|
+
radius: px,
|
|
15
|
+
borderTopLeftRadius: px,
|
|
16
|
+
borderTopRightRadius: px,
|
|
17
|
+
borderBottomRightRadius: px,
|
|
18
|
+
borderBottomLeftRadius: px,
|
|
19
|
+
// Positioning props
|
|
20
|
+
width: px,
|
|
21
|
+
maxWidth: px,
|
|
22
|
+
height: px,
|
|
23
|
+
maxHeight: px,
|
|
24
|
+
top: px,
|
|
25
|
+
right: px,
|
|
26
|
+
bottom: px,
|
|
27
|
+
left: px,
|
|
28
|
+
// Spacing props
|
|
29
|
+
padding: px,
|
|
30
|
+
paddingTop: px,
|
|
31
|
+
paddingRight: px,
|
|
32
|
+
paddingBottom: px,
|
|
33
|
+
paddingLeft: px,
|
|
34
|
+
margin: px,
|
|
35
|
+
marginTop: px,
|
|
36
|
+
marginRight: px,
|
|
37
|
+
marginBottom: px,
|
|
38
|
+
marginLeft: px,
|
|
39
|
+
// Misc
|
|
40
|
+
backgroundPositionX: px,
|
|
41
|
+
backgroundPositionY: px,
|
|
42
|
+
...transformValueTypes,
|
|
43
|
+
zIndex: int,
|
|
44
|
+
size: px,
|
|
45
|
+
// SVG
|
|
46
|
+
fillOpacity: alpha,
|
|
47
|
+
strokeOpacity: alpha,
|
|
48
|
+
numOctaves: int,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { numberValueTypes };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { scale, alpha } from '../numbers/index.mjs';
|
|
2
|
+
import { degrees, px, progressPercentage } from '../numbers/units.mjs';
|
|
3
|
+
|
|
4
|
+
const transformValueTypes = {
|
|
5
|
+
rotate: degrees,
|
|
6
|
+
rotateX: degrees,
|
|
7
|
+
rotateY: degrees,
|
|
8
|
+
rotateZ: degrees,
|
|
9
|
+
scale,
|
|
10
|
+
scaleX: scale,
|
|
11
|
+
scaleY: scale,
|
|
12
|
+
scaleZ: scale,
|
|
13
|
+
skew: degrees,
|
|
14
|
+
skewX: degrees,
|
|
15
|
+
skewY: degrees,
|
|
16
|
+
distance: px,
|
|
17
|
+
translateX: px,
|
|
18
|
+
translateY: px,
|
|
19
|
+
translateZ: px,
|
|
20
|
+
x: px,
|
|
21
|
+
y: px,
|
|
22
|
+
z: px,
|
|
23
|
+
perspective: px,
|
|
24
|
+
transformPerspective: px,
|
|
25
|
+
opacity: alpha,
|
|
26
|
+
originX: progressPercentage,
|
|
27
|
+
originY: progressPercentage,
|
|
28
|
+
originZ: px,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { transformValueTypes };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { clamp } from 'motion-utils';
|
|
2
|
+
|
|
3
|
+
const number = {
|
|
4
|
+
test: (v) => typeof v === "number",
|
|
5
|
+
parse: parseFloat,
|
|
6
|
+
transform: (v) => v,
|
|
7
|
+
};
|
|
8
|
+
const alpha = {
|
|
9
|
+
...number,
|
|
10
|
+
transform: (v) => clamp(0, 1, v),
|
|
11
|
+
};
|
|
12
|
+
const scale = {
|
|
13
|
+
...number,
|
|
14
|
+
default: 1,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { alpha, number, scale };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
2
|
+
const createUnitType = (unit) => ({
|
|
3
|
+
test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
|
|
4
|
+
parse: parseFloat,
|
|
5
|
+
transform: (v) => `${v}${unit}`,
|
|
6
|
+
});
|
|
7
|
+
const degrees = /*@__PURE__*/ createUnitType("deg");
|
|
8
|
+
const percent = /*@__PURE__*/ createUnitType("%");
|
|
9
|
+
const px = /*@__PURE__*/ createUnitType("px");
|
|
10
|
+
const vh = /*@__PURE__*/ createUnitType("vh");
|
|
11
|
+
const vw = /*@__PURE__*/ createUnitType("vw");
|
|
12
|
+
const progressPercentage = /*@__PURE__*/ (() => ({
|
|
13
|
+
...percent,
|
|
14
|
+
parse: (v) => percent.parse(v) / 100,
|
|
15
|
+
transform: (v) => percent.transform(v * 100),
|
|
16
|
+
}))();
|
|
17
|
+
|
|
18
|
+
export { degrees, percent, progressPercentage, px, vh, vw };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { complex } from '../complex/index.mjs';
|
|
2
|
+
import { filter } from '../complex/filter.mjs';
|
|
3
|
+
import { getDefaultValueType } from '../maps/defaults.mjs';
|
|
4
|
+
|
|
5
|
+
function getAnimatableNone(key, value) {
|
|
6
|
+
let defaultValueType = getDefaultValueType(key);
|
|
7
|
+
if (defaultValueType !== filter)
|
|
8
|
+
defaultValueType = complex;
|
|
9
|
+
// If value is not recognised as animatable, ie "one", create an animatable version origin based on the target
|
|
10
|
+
return defaultValueType.getAnimatableNone
|
|
11
|
+
? defaultValueType.getAnimatableNone(value)
|
|
12
|
+
: undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getAnimatableNone };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A list of all ValueTypes
|
|
8
|
+
*/
|
|
9
|
+
const valueTypes = [...dimensionValueTypes, color, complex];
|
|
10
|
+
/**
|
|
11
|
+
* Tests a value against the list of ValueTypes
|
|
12
|
+
*/
|
|
13
|
+
const findValueType = (v) => valueTypes.find(testValueType(v));
|
|
14
|
+
|
|
15
|
+
export { findValueType };
|
package/dist/es/view/start.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { secondsToMilliseconds } from 'motion-utils';
|
|
2
2
|
import { GroupAnimation } from '../animation/GroupAnimation.mjs';
|
|
3
3
|
import { NativeAnimation } from '../animation/NativeAnimation.mjs';
|
|
4
|
+
import { NativeAnimationWrapper } from '../animation/NativeAnimationWrapper.mjs';
|
|
4
5
|
import { getValueTransition } from '../animation/utils/get-value-transition.mjs';
|
|
5
6
|
import { mapEasingToNativeEasing } from '../animation/waapi/easing/map-easing.mjs';
|
|
6
7
|
import { applyGeneratorOptions } from '../animation/waapi/utils/apply-generator.mjs';
|
|
@@ -85,11 +86,11 @@ function startViewAnimation(builder) {
|
|
|
85
86
|
valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));
|
|
86
87
|
valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));
|
|
87
88
|
const animation = new NativeAnimation({
|
|
89
|
+
...valueOptions,
|
|
88
90
|
element: document.documentElement,
|
|
89
91
|
name: valueName,
|
|
90
92
|
pseudoElement: `::view-transition-${type}(${target})`,
|
|
91
93
|
keyframes: valueKeyframes,
|
|
92
|
-
transition: valueOptions,
|
|
93
94
|
});
|
|
94
95
|
animations.push(animation);
|
|
95
96
|
}
|
|
@@ -130,14 +131,14 @@ function startViewAnimation(builder) {
|
|
|
130
131
|
duration: animationTransition.duration,
|
|
131
132
|
easing,
|
|
132
133
|
});
|
|
133
|
-
animations.push(new
|
|
134
|
+
animations.push(new NativeAnimationWrapper(animation));
|
|
134
135
|
}
|
|
135
136
|
else if (hasOpacity(targetDefinition, "enter") &&
|
|
136
137
|
hasOpacity(targetDefinition, "exit") &&
|
|
137
138
|
effect
|
|
138
139
|
.getKeyframes()
|
|
139
140
|
.some((keyframe) => keyframe.mixBlendMode)) {
|
|
140
|
-
animations.push(new
|
|
141
|
+
animations.push(new NativeAnimationWrapper(animation));
|
|
141
142
|
}
|
|
142
143
|
else {
|
|
143
144
|
animation.cancel();
|