first commit
This commit is contained in:
14
node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs
generated
vendored
Normal file
14
node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* A list of values that can be hardware-accelerated.
|
||||
*/
|
||||
const acceleratedValues = new Set([
|
||||
"opacity",
|
||||
"clipPath",
|
||||
"filter",
|
||||
"transform",
|
||||
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
||||
// or until we implement support for linear() easing.
|
||||
// "background-color"
|
||||
]);
|
||||
|
||||
export { acceleratedValues };
|
||||
15
node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs
generated
vendored
Normal file
15
node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
||||
import { isGenerator } from '../../generators/utils/is-generator.mjs';
|
||||
|
||||
function applyGeneratorOptions({ type, ...options }) {
|
||||
if (isGenerator(type) && supportsLinearEasing()) {
|
||||
return type.applyToOptions(options);
|
||||
}
|
||||
else {
|
||||
options.duration ?? (options.duration = 300);
|
||||
options.ease ?? (options.ease = "easeOut");
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
export { applyGeneratorOptions };
|
||||
12
node_modules/motion-dom/dist/es/animation/waapi/utils/linear.mjs
generated
vendored
Normal file
12
node_modules/motion-dom/dist/es/animation/waapi/utils/linear.mjs
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
const generateLinearEasing = (easing, duration, // as milliseconds
|
||||
resolution = 10 // as milliseconds
|
||||
) => {
|
||||
let points = "";
|
||||
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
points += Math.round(easing(i / (numPoints - 1)) * 10000) / 10000 + ", ";
|
||||
}
|
||||
return `linear(${points.substring(0, points.length - 2)})`;
|
||||
};
|
||||
|
||||
export { generateLinearEasing };
|
||||
39
node_modules/motion-dom/dist/es/animation/waapi/utils/px-values.mjs
generated
vendored
Normal file
39
node_modules/motion-dom/dist/es/animation/waapi/utils/px-values.mjs
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
const pxValues = new Set([
|
||||
// Border props
|
||||
"borderWidth",
|
||||
"borderTopWidth",
|
||||
"borderRightWidth",
|
||||
"borderBottomWidth",
|
||||
"borderLeftWidth",
|
||||
"borderRadius",
|
||||
"radius",
|
||||
"borderTopLeftRadius",
|
||||
"borderTopRightRadius",
|
||||
"borderBottomRightRadius",
|
||||
"borderBottomLeftRadius",
|
||||
// Positioning props
|
||||
"width",
|
||||
"maxWidth",
|
||||
"height",
|
||||
"maxHeight",
|
||||
"top",
|
||||
"right",
|
||||
"bottom",
|
||||
"left",
|
||||
// Spacing props
|
||||
"padding",
|
||||
"paddingTop",
|
||||
"paddingRight",
|
||||
"paddingBottom",
|
||||
"paddingLeft",
|
||||
"margin",
|
||||
"marginTop",
|
||||
"marginRight",
|
||||
"marginBottom",
|
||||
"marginLeft",
|
||||
// Misc
|
||||
"backgroundPositionX",
|
||||
"backgroundPositionY",
|
||||
]);
|
||||
|
||||
export { pxValues };
|
||||
18
node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs
generated
vendored
Normal file
18
node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { anticipate, backInOut, circInOut } from 'motion-utils';
|
||||
|
||||
const unsupportedEasingFunctions = {
|
||||
anticipate,
|
||||
backInOut,
|
||||
circInOut,
|
||||
};
|
||||
function isUnsupportedEase(key) {
|
||||
return key in unsupportedEasingFunctions;
|
||||
}
|
||||
function replaceStringEasing(transition) {
|
||||
if (typeof transition.ease === "string" &&
|
||||
isUnsupportedEase(transition.ease)) {
|
||||
transition.ease = unsupportedEasingFunctions[transition.ease];
|
||||
}
|
||||
}
|
||||
|
||||
export { replaceStringEasing };
|
||||
Reference in New Issue
Block a user