Skip to content

🎥 Make videos programmatically with React

fix files with prettier style config

ChetanKarwa02c8a0932dc6
diff --git a/packages/animation-utils/.prettierrc.js b/packages/animation-utils/.prettierrc.js
new file mode 100644
index 0000000000..32eb24f3bf
--- /dev/null
+++ b/packages/animation-utils/.prettierrc.js
@@ -0,0 +1,14 @@
+module.exports = {
+ singleQuote: true,
+ bracketSpacing: false,
+ useTabs: true,
+ overrides: [
+ {
+ files: ['*.yml'],
+ options: {
+ singleQuote: false,
+ },
+ },
+ ],
+ plugins: [require.resolve('prettier-plugin-organize-imports')],
+};
diff --git a/packages/animation-utils/package.json b/packages/animation-utils/package.json
index fc9fbd1f40..c81323d81d 100644
--- a/packages/animation-utils/package.json
+++ b/packages/animation-utils/package.json
@@ -1,32 +1,37 @@
{
- "name": "@remotion/animation-utils",
- "author": {
- "name": "Chetan Karwa",
- "email": "[email protected]"
- },
- "version": "4.0.85",
- "description": "A set of animation utilities for Remotion",
- "main": "./dist/index.js",
- "module": "./dist/index.mjs",
- "types": "./dist/index.d.ts",
- "scripts": {
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
- "formatting": "prettier src --check",
- "lint": "eslint src --ext ts,tsx",
- "watch": "tsc -w",
- "build": "tsc -d"
- },
- "dependencies": {
- "remotion": "workspace:*"
- },
- "peerDependencies": {
- "react": ">=16.8.0",
- "react-dom": ">=16.8.0"
- },
- "devDependencies": {
- "@types/react": "18.0.26"
- },
- "publishConfig": {
- "access": "public"
- }
+ "name": "@remotion/animation-utils",
+ "author": {
+ "name": "Chetan Karwa",
+ "email": "[email protected]"
+ },
+ "version": "4.0.85",
+ "description": "A set of animation utilities for Remotion",
+ "main": "./dist/index.js",
+ "module": "./dist/index.mjs",
+ "types": "./dist/index.d.ts",
+ "scripts": {
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
+ "formatting": "prettier src --check",
+ "lint": "eslint src --ext ts,tsx",
+ "watch": "tsc -w",
+ "build": "tsc -d"
+ },
+ "dependencies": {
+ "remotion": "workspace:*"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.0",
+ "react-dom": ">=16.8.0"
+ },
+ "devDependencies": {
+ "@types/react": "18.0.26",
+ "@types/node": "18.14.6",
+ "prettier": "3.1.1",
+ "prettier-plugin-organize-imports": "3.2.4",
+ "eslint": "8.42.0",
+ "@jonny/eslint-config": "3.0.276"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
}
diff --git a/packages/animation-utils/src/index.ts b/packages/animation-utils/src/index.ts
index 383c2914c8..e764a35262 100644
--- a/packages/animation-utils/src/index.ts
+++ b/packages/animation-utils/src/index.ts
@@ -1,10 +1,9 @@
-export * from "./transformation-helpers/make-transform";
-export * from "./transformation-helpers/use-interpolate-styles";
-
+export * from './transformation-helpers/make-transform';
+export * from './transformation-helpers/use-interpolate-styles';
export type {
- LengthUnit,
- LengthPercentageUnit,
- AngleUnit,
- TransformFunction,
- TransformFunctionReturnType,
-} from "./type";
+ AngleUnit,
+ LengthPercentageUnit,
+ LengthUnit,
+ TransformFunction,
+ TransformFunctionReturnType,
+} from './type';
diff --git a/packages/animation-utils/src/transformation-helpers/make-transform/index.ts b/packages/animation-utils/src/transformation-helpers/make-transform/index.ts
index 53a3f01305..e7dca7285c 100644
--- a/packages/animation-utils/src/transformation-helpers/make-transform/index.ts
+++ b/packages/animation-utils/src/transformation-helpers/make-transform/index.ts
@@ -1,54 +1,54 @@
-import type { TransformFunctionReturnType } from "../../type";
+import type {TransformFunctionReturnType} from '../../type';
import {
- matrix,
- matrix3d,
- perspective,
- rotate,
- rotate3d,
- rotateX,
- rotateY,
- rotateZ,
- scale,
- scale3d,
- scaleX,
- scaleY,
- scaleZ,
- skew,
- skewX,
- skewY,
- translate,
- translate3d,
- translateX,
- translateY,
- translateZ,
-} from "./transform-functions";
+ matrix,
+ matrix3d,
+ perspective,
+ rotate,
+ rotate3d,
+ rotateX,
+ rotateY,
+ rotateZ,
+ scale,
+ scale3d,
+ scaleX,
+ scaleY,
+ scaleZ,
+ skew,
+ skewX,
+ skewY,
+ translate,
+ translate3d,
+ translateX,
+ translateY,
+ translateZ,
+} from './transform-functions';
export function makeTransform(
- transforms: TransformFunctionReturnType[]
+ transforms: TransformFunctionReturnType[],
): string {
- return transforms.map((transform) => transform()).join(" ");
+ return transforms.map((transform) => transform()).join(' ');
}
export {
- matrix,
- matrix3d,
- perspective,
- rotate,
- rotate3d,
- rotateX,
- rotateY,
- rotateZ,
- scale,
- scale3d,
- scaleX,
- scaleY,
- scaleZ,
- skew,
- skewX,
- skewY,
- translate,
- translate3d,
- translateX,
- translateY,
- translateZ,
+ matrix,
+ matrix3d,
+ perspective,
+ rotate,
+ rotate3d,
+ rotateX,
+ rotateY,
+ rotateZ,
+ scale,
+ scale3d,
+ scaleX,
+ scaleY,
+ scaleZ,
+ skew,
+ skewX,
+ skewY,
+ translate,
+ translate3d,
+ translateX,
+ translateY,
+ translateZ,
};
diff --git a/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts b/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts
index dd1887e040..ea85726e4e 100644
--- a/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts
+++ b/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts
@@ -1,184 +1,184 @@
/* eslint-disable max-params */
import type {
- TransformFunction,
- LengthUnit,
- LengthPercentageUnit,
- AngleUnit,
-} from "../../type";
+ AngleUnit,
+ LengthPercentageUnit,
+ LengthUnit,
+ TransformFunction,
+} from '../../type';
/* Matrix transformation */
function matrix(
- a: number,
- b: number,
- c: number,
- d: number,
- tx: number,
- ty: number
+ a: number,
+ b: number,
+ c: number,
+ d: number,
+ tx: number,
+ ty: number,
): TransformFunction {
- return () => `matrix(${a}, ${b}, ${c}, ${d}, ${tx}, ${ty})`;
+ return () => `matrix(${a}, ${b}, ${c}, ${d}, ${tx}, ${ty})`;
}
function matrix3d(
- a1: number,
- b1: number,
- c1: number,
- d1: number,
- a2: number,
- b2: number,
- c2: number,
- d2: number,
- a3: number,
- b3: number,
- c3: number,
- d3: number,
- a4: number,
- b4: number,
- c4: number,
- d4: number
+ a1: number,
+ b1: number,
+ c1: number,
+ d1: number,
+ a2: number,
+ b2: number,
+ c2: number,
+ d2: number,
+ a3: number,
+ b3: number,
+ c3: number,
+ d3: number,
+ a4: number,
+ b4: number,
+ c4: number,
+ d4: number,
): TransformFunction {
- return () =>
- `matrix3d(${a1}, ${b1}, ${c1}, ${d1}, ${a2}, ${b2}, ${c2}, ${d2}, ${a3}, ${b3}, ${c3}, ${d3}, ${a4}, ${b4}, ${c4}, ${d4})`;
+ return () =>
+ `matrix3d(${a1}, ${b1}, ${c1}, ${d1}, ${a2}, ${b2}, ${c2}, ${d2}, ${a3}, ${b3}, ${c3}, ${d3}, ${a4}, ${b4}, ${c4}, ${d4})`;
}
/* Perspective */
function perspective(
- length: number,
- unit: LengthUnit = "px"
+ length: number,
+ unit: LengthUnit = 'px',
): TransformFunction {
- return () => `perspective(${length}${unit})`;
+ return () => `perspective(${length}${unit})`;
}
/* Rotation */
-function rotate(angle: number, unit: AngleUnit = "deg"): TransformFunction {
- return () => `rotate(${angle}${unit})`;
+function rotate(angle: number, unit: AngleUnit = 'deg'): TransformFunction {
+ return () => `rotate(${angle}${unit})`;
}
function rotate3d(
- x: number,
- y: number,
- z: number,
- angle: number,
- unit: AngleUnit = "deg"
+ x: number,
+ y: number,
+ z: number,
+ angle: number,
+ unit: AngleUnit = 'deg',
): TransformFunction {
- return () => `rotate3d(${x}, ${y}, ${z}, ${angle}${unit})`;
+ return () => `rotate3d(${x}, ${y}, ${z}, ${angle}${unit})`;
}
-function rotateX(angle: number, unit: AngleUnit = "deg"): TransformFunction {
- return () => `rotateX(${angle}${unit})`;
+function rotateX(angle: number, unit: AngleUnit = 'deg'): TransformFunction {
+ return () => `rotateX(${angle}${unit})`;
}
-function rotateY(angle: number, unit: AngleUnit = "deg"): TransformFunction {
- return () => `rotateY(${angle}${unit})`;
+function rotateY(angle: number, unit: AngleUnit = 'deg'): TransformFunction {
+ return () => `rotateY(${angle}${unit})`;
}
-function rotateZ(angle: number, unit: AngleUnit = "deg"): TransformFunction {
- return () => `rotateZ(${angle}${unit})`;
+function rotateZ(angle: number, unit: AngleUnit = 'deg'): TransformFunction {
+ return () => `rotateZ(${angle}${unit})`;
}
/* Scale */
function scale(x: number, y: number = x): TransformFunction {
- return () => `scale(${x}, ${y})`;
+ return () => `scale(${x}, ${y})`;
}
function scale3d(x: number, y: number, z: number): TransformFunction {
- return () => `scale3d(${x}, ${y}, ${z})`;
+ return () => `scale3d(${x}, ${y}, ${z})`;
}
function scaleX(x: number): TransformFunction {
- return () => `scaleX(${x})`;
+ return () => `scaleX(${x})`;
}
function scaleY(y: number): TransformFunction {
- return () => `scaleY(${y})`;
+ return () => `scaleY(${y})`;
}
function scaleZ(z: number): TransformFunction {
- return () => `scaleZ(${z})`;
+ return () => `scaleZ(${z})`;
}
/* Skew */
function skew(
- x: number,
- y: number = x,
- unit: AngleUnit = "deg"
+ x: number,
+ y: number = x,
+ unit: AngleUnit = 'deg',
): TransformFunction {
- return () => `skew(${x}${unit}, ${y}${unit})`;
+ return () => `skew(${x}${unit}, ${y}${unit})`;
}
-function skewX(angle: number, unit: AngleUnit = "deg"): TransformFunction {
- return () => `skewX(${angle}${unit})`;
+function skewX(angle: number, unit: AngleUnit = 'deg'): TransformFunction {
+ return () => `skewX(${angle}${unit})`;
}
-function skewY(angle: number, unit: AngleUnit = "deg"): TransformFunction {
- return () => `skewY(${angle}${unit})`;
+function skewY(angle: number, unit: AngleUnit = 'deg'): TransformFunction {
+ return () => `skewY(${angle}${unit})`;
}
/* Translation */
function translate(
- x: number,
- y = 0,
- unitX: LengthPercentageUnit = "px",
- unitY: LengthPercentageUnit = unitX
+ x: number,
+ y = 0,
+ unitX: LengthPercentageUnit = 'px',
+ unitY: LengthPercentageUnit = unitX,
): TransformFunction {
- return () => `translate(${x}${unitX}, ${y}${unitY})`;
+ return () => `translate(${x}${unitX}, ${y}${unitY})`;
}
function translate3d(
- x: number,
- y: number,
- z: number,
- unitX: LengthPercentageUnit = "px",
- unitY: LengthPercentageUnit = unitX,
- unitZ: LengthUnit = "px"
+ x: number,
+ y: number,
+ z: number,
+ unitX: LengthPercentageUnit = 'px',
+ unitY: LengthPercentageUnit = unitX,
+ unitZ: LengthUnit = 'px',
): TransformFunction {
- return () => `translate3d(${x}${unitX}, ${y}${unitY}, ${z}${unitZ})`;
+ return () => `translate3d(${x}${unitX}, ${y}${unitY}, ${z}${unitZ})`;
}
function translateX(
- x: number,
- unit: LengthPercentageUnit = "px"
+ x: number,
+ unit: LengthPercentageUnit = 'px',
): TransformFunction {
- return () => `translateX(${x}${unit})`;
+ return () => `translateX(${x}${unit})`;
}
function translateY(
- y: number,
- unit: LengthPercentageUnit = "px"
+ y: number,
+ unit: LengthPercentageUnit = 'px',
): TransformFunction {
- return () => `translateY(${y}${unit})`;
+ return () => `translateY(${y}${unit})`;
}
-function translateZ(z: number, unit: LengthUnit = "px"): TransformFunction {
- return () => `translateZ(${z}${unit})`;
+function translateZ(z: number, unit: LengthUnit = 'px'): TransformFunction {
+ return () => `translateZ(${z}${unit})`;
}
export {
- matrix,
- matrix3d,
- perspective,
- rotate,
- rotate3d,
- rotateX,
- rotateY,
- rotateZ,
- scale,
- scale3d,
- scaleX,
- scaleY,
- scaleZ,
- skew,
- skewX,
- skewY,
- translate,
- translate3d,
- translateX,
- translateY,
- translateZ,
+ matrix,
+ matrix3d,
+ perspective,
+ rotate,
+ rotate3d,
+ rotateX,
+ rotateY,
+ rotateZ,
+ scale,
+ scale3d,
+ scaleX,
+ scaleY,
+ scaleZ,
+ skew,
+ skewX,
+ skewY,
+ translate,
+ translate3d,
+ translateX,
+ translateY,
+ translateZ,
};
diff --git a/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/constants.ts b/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/constants.ts
index 0c24163b43..c73231698f 100644
--- a/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/constants.ts
+++ b/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/constants.ts
@@ -1,157 +1,157 @@
-const NUMBER = "[-+]?\\d*\\.?\\d+";
-const PERCENTAGE = NUMBER + "%";
+const NUMBER = '[-+]?\\d*\\.?\\d+';
+const PERCENTAGE = NUMBER + '%';
const STANDARD_COLOR_NAMES = [
- "transparent",
- "aliceblue",
- "antiquewhite",
- "aqua",
- "aquamarine",
- "azure",
- "beige",
- "bisque",
- "black",
- "blanchedalmond",
- "blue",
- "blueviolet",
- "brown",
- "burlywood",
- "burntsienna",
- "cadetblue",
- "chartreuse",
- "chocolate",
- "coral",
- "cornflowerblue",
- "cornsilk",
- "crimson",
- "cyan",
- "darkblue",
- "darkcyan",
- "darkgoldenrod",
- "darkgray",
- "darkgreen",
- "darkgrey",
- "darkkhaki",
- "darkmagenta",
- "darkolivegreen",
- "darkorange",
- "darkorchid",
- "darkred",
- "darksalmon",
- "darkseagreen",
- "darkslateblue",
- "darkslategray",
- "darkslategrey",
- "darkturquoise",
- "darkviolet",
- "deeppink",
- "deepskyblue",
- "dimgray",
- "dimgrey",
- "dodgerblue",
- "firebrick",
- "floralwhite",
- "forestgreen",
- "fuchsia",
- "gainsboro",
- "ghostwhite",
- "gold",
- "goldenrod",
- "gray",
- "green",
- "greenyellow",
- "grey",
- "honeydew",
- "hotpink",
- "indianred",
- "indigo",
- "ivory",
- "khaki",
- "lavender",
- "lavenderblush",
- "lawngreen",
- "lemonchiffon",
- "lightblue",
- "lightcoral",
- "lightcyan",
- "lightgoldenrodyellow",
- "lightgray",
- "lightgreen",
- "lightgrey",
- "lightpink",
- "lightsalmon",
- "lightseagreen",
- "lightskyblue",
- "lightslategray",
- "lightslategrey",
- "lightsteelblue",
- "lightyellow",
- "lime",
- "limegreen",
- "linen",
- "magenta",
- "maroon",
- "mediumaquamarine",
- "mediumblue",
- "mediumorchid",
- "mediumpurple",
- "mediumseagreen",
- "mediumslateblue",
- "mediumspringgreen",
- "mediumturquoise",
- "mediumvioletred",
- "midnightblue",
- "mintcream",
- "mistyrose",
- "moccasin",
- "navajowhite",
- "navy",
- "oldlace",
- "olive",
- "olivedrab",
- "orange",
- "orangered",
- "orchid",
- "palegoldenrod",
- "palegreen",
- "paleturquoise",
- "palevioletred",
- "papayawhip",
- "peachpuff",
- "peru",
- "pink",
- "plum",
- "powderblue",
- "purple",
- "rebeccapurple",
- "red",
- "rosybrown",
- "royalblue",
- "saddlebrown",
- "salmon",
- "sandybrown",
- "seagreen",
- "seashell",
- "sienna",
- "silver",
- "skyblue",
- "slateblue",
- "slategray",
- "slategrey",
- "snow",
- "springgreen",
- "steelblue",
- "tan",
- "teal",
- "thistle",
- "tomato",
- "turquoise",
- "violet",
- "wheat",
- "white",
- "whitesmoke",
- "yellow",
- "yellowgreen",
+ 'transparent',
+ 'aliceblue',
+ 'antiquewhite',
+ 'aqua',
+ 'aquamarine',
+ 'azure',
+ 'beige',
+ 'bisque',
+ 'black',
+ 'blanchedalmond',
+ 'blue',
+ 'blueviolet',
+ 'brown',
+ 'burlywood',
+ 'burntsienna',
+ 'cadetblue',
+ 'chartreuse',
+ 'chocolate',
+ 'coral',
+ 'cornflowerblue',
+ 'cornsilk',
+ 'crimson',
+ 'cyan',
+ 'darkblue',
+ 'darkcyan',
+ 'darkgoldenrod',
+ 'darkgray',
+ 'darkgreen',
+ 'darkgrey',
+ 'darkkhaki',
+ 'darkmagenta',
+ 'darkolivegreen',
+ 'darkorange',
+ 'darkorchid',
+ 'darkred',
+ 'darksalmon',
+ 'darkseagreen',
+ 'darkslateblue',
+ 'darkslategray',
+ 'darkslategrey',
+ 'darkturquoise',
+ 'darkviolet',
+ 'deeppink',
+ 'deepskyblue',
+ 'dimgray',
+ 'dimgrey',
+ 'dodgerblue',
+ 'firebrick',
+ 'floralwhite',
+ 'forestgreen',
+ 'fuchsia',
+ 'gainsboro',
+ 'ghostwhite',
+ 'gold',
+ 'goldenrod',
+ 'gray',
+ 'green',
+ 'greenyellow',
+ 'grey',
+ 'honeydew',
+ 'hotpink',
+ 'indianred',
+ 'indigo',
+ 'ivory',
+ 'khaki',
+ 'lavender',
+ 'lavenderblush',
+ 'lawngreen',
+ 'lemonchiffon',
+ 'lightblue',
+ 'lightcoral',
+ 'lightcyan',
+ 'lightgoldenrodyellow',
+ 'lightgray',
+ 'lightgreen',
+ 'lightgrey',
+ 'lightpink',
+ 'lightsalmon',
+ 'lightseagreen',
+ 'lightskyblue',
+ 'lightslategray',
+ 'lightslategrey',
+ 'lightsteelblue',
+ 'lightyellow',
+ 'lime',
+ 'limegreen',
+ 'linen',
+ 'magenta',
+ 'maroon',
+ 'mediumaquamarine',
+ 'mediumblue',
+ 'mediumorchid',
+ 'mediumpurple',
+ 'mediumseagreen',
+ 'mediumslateblue',
+ 'mediumspringgreen',
+ 'mediumturquoise',
+ 'mediumvioletred',
+ 'midnightblue',
+ 'mintcream',
+ 'mistyrose',
+ 'moccasin',
+ 'navajowhite',
+ 'navy',
+ 'oldlace',
+ 'olive',
+ 'olivedrab',
+ 'orange',
+ 'orangered',
+ 'orchid',
+ 'palegoldenrod',
+ 'palegreen',
+ 'paleturquoise',
+ 'palevioletred',
+ 'papayawhip',
+ 'peachpuff',
+ 'peru',
+ 'pink',
+ 'plum',
+ 'powderblue',
+ 'purple',
+ 'rebeccapurple',
+ 'red',
+ 'rosybrown',
+ 'royalblue',
+ 'saddlebrown',
+ 'salmon',
+ 'sandybrown',
+ 'seagreen',
+ 'seashell',
+ 'sienna',
+ 'silver',
+ 'skyblue',
+ 'slateblue',
+ 'slategray',
+ 'slategrey',
+ 'snow',
+ 'springgreen',
+ 'steelblue',
+ 'tan',
+ 'teal',
+ 'thistle',
+ 'tomato',
+ 'turquoise',
+ 'violet',
+ 'wheat',
+ 'white',
+ 'whitesmoke',
+ 'yellow',
+ 'yellowgreen',
];
-export { NUMBER, PERCENTAGE, STANDARD_COLOR_NAMES };
+export {NUMBER, PERCENTAGE, STANDARD_COLOR_NAMES};
diff --git a/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/index.tsx b/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/index.tsx
index 3ec4440f8e..18d63bf032 100644
--- a/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/index.tsx
+++ b/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/index.tsx
@@ -1,232 +1,232 @@
-import { useState, useEffect, useMemo } from "react";
+import {useEffect, useMemo, useState} from 'react';
import {
- useCurrentFrame,
- useVideoConfig,
- interpolate,
- interpolateColors,
-} from "remotion";
-import { breakDownValueIntoUnitNumberAndFunctions } from "./utils";
+ interpolate,
+ interpolateColors,
+ useCurrentFrame,
+ useVideoConfig,
+} from 'remotion';
import type {
- CSSPropertiesKey,
- CSSPropertiesValue,
- InterpolateStylesParams,
- Style,
- UnitNumberAndFunction,
-} from "../../type";
+ CSSPropertiesKey,
+ CSSPropertiesValue,
+ InterpolateStylesParams,
+ Style,
+ UnitNumberAndFunction,
+} from '../../type';
+import {breakDownValueIntoUnitNumberAndFunctions} from './utils';
const getInterpolatedPartValue = (
- currentFrame: number,
- inputRange: number[],
- startValuePart: UnitNumberAndFunction,
- endValuePart: UnitNumberAndFunction,
- startValue: CSSPropertiesValue,
- endValue: CSSPropertiesValue
+ currentFrame: number,
+ inputRange: number[],
+ startValuePart: UnitNumberAndFunction,
+ endValuePart: UnitNumberAndFunction,
+ startValue: CSSPropertiesValue,
+ endValue: CSSPropertiesValue,
): string => {
- if (endValuePart === undefined) {
- throw new TypeError(
- `The start and end values must be of the same type. Start value: ${startValue}, end value: ${endValue}`
- );
- }
-
- if (startValuePart.color) {
- if (!endValuePart.color) {
- throw new TypeError(
- `The start and end values must be of the same type. Start value: ${startValue}, end value: ${endValue}`
- );
- }
-
- const interpolatedColor = interpolateColors(currentFrame, inputRange, [
- startValuePart.color,
- endValuePart.color as string,
- ]);
- return `${interpolatedColor}`;
- }
-
- if (startValuePart.function) {
- if (
- !endValuePart?.function ||
- startValuePart.function.name !== endValuePart.function?.name
- ) {
- throw new TypeError(
- `The start and end values must be of the same type. Start value: ${startValue}, end value: ${endValue}`
- );
- }
-
- const endValuePartFunction = endValuePart.function;
- const endValuePartFunctionArgs = endValuePartFunction.values || [];
- const interpolatedFunctionArgs = startValuePart.function.values.reduce(
- (acc: string, startValuePartFunctionArg, index) => {
- const endValuePartFunctionArg = endValuePartFunctionArgs[index];
- const interpolatedArg = getInterpolatedPartValue(
- currentFrame,
- inputRange,
- startValuePartFunctionArg,
- endValuePartFunctionArg,
- startValue,
- endValue
- );
- return `${acc}, ${interpolatedArg}`;
- },
- ""
- );
- return `${startValuePart.function.name}(${interpolatedFunctionArgs.slice(
- 2
- )})`;
- }
-
- if (typeof startValuePart.number === "undefined") {
- return `${startValuePart.unit}`;
- }
-
- if (startValuePart.unit !== endValuePart.unit) {
- throw new TypeError(
- `The units of the start and end values must match. Start value: ${startValue}, end value: ${endValue}`
- );
- }
-
- const startNumber = startValuePart.number;
- const endNumber = endValuePart.number || 0;
- const interpolatedNumber = interpolate(currentFrame, inputRange, [
- startNumber,
- endNumber,
- ]);
- const interpolatedUnit = startValuePart.unit;
- return `${interpolatedNumber}${interpolatedUnit}`;
+ if (endValuePart === undefined) {
+ throw new TypeError(
+ `The start and end values must be of the same type. Start value: ${startValue}, end value: ${endValue}`,
+ );
+ }
+
+ if (startValuePart.color) {
+ if (!endValuePart.color) {
+ throw new TypeError(
+ `The start and end values must be of the same type. Start value: ${startValue}, end value: ${endValue}`,
+ );
+ }
+
+ const interpolatedColor = interpolateColors(currentFrame, inputRange, [
+ startValuePart.color,
+ endValuePart.color as string,
+ ]);
+ return `${interpolatedColor}`;
+ }
+
+ if (startValuePart.function) {
+ if (
+ !endValuePart?.function ||
+ startValuePart.function.name !== endValuePart.function?.name
+ ) {
+ throw new TypeError(
+ `The start and end values must be of the same type. Start value: ${startValue}, end value: ${endValue}`,
+ );
+ }
+
+ const endValuePartFunction = endValuePart.function;
+ const endValuePartFunctionArgs = endValuePartFunction.values || [];
+ const interpolatedFunctionArgs = startValuePart.function.values.reduce(
+ (acc: string, startValuePartFunctionArg, index) => {
+ const endValuePartFunctionArg = endValuePartFunctionArgs[index];
+ const interpolatedArg = getInterpolatedPartValue(
+ currentFrame,
+ inputRange,
+ startValuePartFunctionArg,
+ endValuePartFunctionArg,
+ startValue,
+ endValue,
+ );
+ return `${acc}, ${interpolatedArg}`;
+ },
+ '',
+ );
+ return `${startValuePart.function.name}(${interpolatedFunctionArgs.slice(
+ 2,
+ )})`;
+ }
+
+ if (typeof startValuePart.number === 'undefined') {
+ return `${startValuePart.unit}`;
+ }
+
+ if (startValuePart.unit !== endValuePart.unit) {
+ throw new TypeError(
+ `The units of the start and end values must match. Start value: ${startValue}, end value: ${endValue}`,
+ );
+ }
+
+ const startNumber = startValuePart.number;
+ const endNumber = endValuePart.number || 0;
+ const interpolatedNumber = interpolate(currentFrame, inputRange, [
+ startNumber,
+ endNumber,
+ ]);
+ const interpolatedUnit = startValuePart.unit;
+ return `${interpolatedNumber}${interpolatedUnit}`;
};
const getInterpolatedPropertyValue = (
- currentFrame: number,
- inputRange: number[],
- startValue: CSSPropertiesValue,
- endValue: CSSPropertiesValue
+ currentFrame: number,
+ inputRange: number[],
+ startValue: CSSPropertiesValue,
+ endValue: CSSPropertiesValue,
) => {
- if (typeof startValue !== typeof endValue) {
- return startValue;
- }
-
- if (typeof startValue === "number") {
- return interpolate(currentFrame, inputRange, [
- startValue,
- endValue as number,
- ]);
- }
-
- const startValueParts = breakDownValueIntoUnitNumberAndFunctions(startValue);
- const endValueArray = breakDownValueIntoUnitNumberAndFunctions(endValue);
-
- const interpolatedValue = startValueParts.reduce(
- (acc, startValuePart, index) => {
- const interpolatedValuePart = getInterpolatedPartValue(
- currentFrame,
- inputRange,
- startValuePart,
- endValueArray[index],
- startValue,
- endValue
- );
- return `${acc} ${interpolatedValuePart}`;
- },
- ""
- );
- return interpolatedValue.slice(1);
+ if (typeof startValue !== typeof endValue) {
+ return startValue;
+ }
+
+ if (typeof startValue === 'number') {
+ return interpolate(currentFrame, inputRange, [
+ startValue,
+ endValue as number,
+ ]);
+ }
+
+ const startValueParts = breakDownValueIntoUnitNumberAndFunctions(startValue);
+ const endValueArray = breakDownValueIntoUnitNumberAndFunctions(endValue);
+
+ const interpolatedValue = startValueParts.reduce(
+ (acc, startValuePart, index) => {
+ const interpolatedValuePart = getInterpolatedPartValue(
+ currentFrame,
+ inputRange,
+ startValuePart,
+ endValueArray[index],
+ startValue,
+ endValue,
+ );
+ return `${acc} ${interpolatedValuePart}`;
+ },
+ '',
+ );
+ return interpolatedValue.slice(1);
};
const interpolateStyles = (
- frame: number,
- [startFrame, endFrame]: number[],
- startStyle: Style,
- endStyle: Style
+ frame: number,
+ [startFrame, endFrame]: number[],
+ startStyle: Style,
+ endStyle: Style,
): Style => {
- const interpolatedStyle = Object.keys(startStyle).reduce((acc, key) => {
- const interpolatedValue = getInterpolatedPropertyValue(
- frame,
- [startFrame, endFrame],
- startStyle[key as CSSPropertiesKey],
- endStyle[key as CSSPropertiesKey]
- );
- return {
- ...acc,
- [key]: interpolatedValue,
- };
- }, {});
- return interpolatedStyle;
+ const interpolatedStyle = Object.keys(startStyle).reduce((acc, key) => {
+ const interpolatedValue = getInterpolatedPropertyValue(
+ frame,
+ [startFrame, endFrame],
+ startStyle[key as CSSPropertiesKey],
+ endStyle[key as CSSPropertiesKey],
+ );
+ return {
+ ...acc,
+ [key]: interpolatedValue,
+ };
+ }, {});
+ return interpolatedStyle;
};
export const useInterpolateStyles = ({
- inputRangeInFrames,
- inputRangeInSeconds,
- outputStyles,
+ inputRangeInFrames,
+ inputRangeInSeconds,
+ outputStyles,
}: InterpolateStylesParams) => {
- useEffect(() => {
- console.log("rerendering because of inputRangeInFrames");
- }, [inputRangeInFrames]);
- useEffect(() => {
- console.log("rerendering because of inputRangeInSeconds");
- }, [inputRangeInSeconds]);
- useEffect(() => {
- console.log("rerendering because of outputStyles");
- }, [outputStyles]);
- const [currentStyles, setCurrentStyles] = useState<Style>({});
- const [areInputsValid, setAreInputsValid] = useState(false);
- const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
-
- const interpolateFrameSteps = useMemo(
- () =>
- inputRangeInFrames ||
- inputRangeInSeconds?.map((duration) => Math.round(duration * fps)) ||
- [],
- [fps, inputRangeInFrames, inputRangeInSeconds]
- );
-
- useEffect(() => {
- if (interpolateFrameSteps.length !== outputStyles.length) {
- throw new TypeError(
- `The number of steps in the interpolation must match the number of output styles.`
- );
- } else if (interpolateFrameSteps.length < 2) {
- throw new TypeError(
- `The number of steps in the interpolation must be at least 2.`
- );
- } else {
- setAreInputsValid(true);
- }
- }, [interpolateFrameSteps, outputStyles]);
-
- useEffect(() => {
- const updateCurrentStyles = () => {
- if (!areInputsValid) {
- return outputStyles[0] || {};
- }
-
- if (frame < interpolateFrameSteps[0]) {
- setCurrentStyles(outputStyles[0]);
- return;
- }
-
- if (frame >= interpolateFrameSteps[interpolateFrameSteps.length - 1]) {
- setCurrentStyles(outputStyles[outputStyles.length - 1]);
- return;
- }
-
- const startIndex =
- interpolateFrameSteps.findIndex((step) => frame < step) - 1;
- const endIndex = startIndex + 1;
- const startFrame = interpolateFrameSteps[startIndex];
- const endFrame = interpolateFrameSteps[endIndex];
- const startStyle = outputStyles[startIndex];
- const endStyle = outputStyles[endIndex];
- const currentFrameStyles = interpolateStyles(
- frame,
- [startFrame, endFrame],
- startStyle,
- endStyle
- );
- setCurrentStyles(currentFrameStyles);
- };
-
- updateCurrentStyles();
- }, [areInputsValid, frame, interpolateFrameSteps, outputStyles]);
-
- return currentStyles;
+ useEffect(() => {
+ console.log('rerendering because of inputRangeInFrames');
+ }, [inputRangeInFrames]);
+ useEffect(() => {
+ console.log('rerendering because of inputRangeInSeconds');
+ }, [inputRangeInSeconds]);
+ useEffect(() => {
+ console.log('rerendering because of outputStyles');
+ }, [outputStyles]);
+ const [currentStyles, setCurrentStyles] = useState<Style>({});
+ const [areInputsValid, setAreInputsValid] = useState(false);
+ const frame = useCurrentFrame();
+ const {fps} = useVideoConfig();
+
+ const interpolateFrameSteps = useMemo(
+ () =>
+ inputRangeInFrames ||
+ inputRangeInSeconds?.map((duration) => Math.round(duration * fps)) ||
+ [],
+ [fps, inputRangeInFrames, inputRangeInSeconds],
+ );
+
+ useEffect(() => {
+ if (interpolateFrameSteps.length !== outputStyles.length) {
+ throw new TypeError(
+ `The number of steps in the interpolation must match the number of output styles.`,
+ );
+ } else if (interpolateFrameSteps.length < 2) {
+ throw new TypeError(
+ `The number of steps in the interpolation must be at least 2.`,
+ );
+ } else {
+ setAreInputsValid(true);
+ }
+ }, [interpolateFrameSteps, outputStyles]);
+
+ useEffect(() => {
+ const updateCurrentStyles = () => {
+ if (!areInputsValid) {
+ return outputStyles[0] || {};
+ }
+
+ if (frame < interpolateFrameSteps[0]) {
+ setCurrentStyles(outputStyles[0]);
+ return;
+ }
+
+ if (frame >= interpolateFrameSteps[interpolateFrameSteps.length - 1]) {
+ setCurrentStyles(outputStyles[outputStyles.length - 1]);
+ return;
+ }
+
+ const startIndex =
+ interpolateFrameSteps.findIndex((step) => frame < step) - 1;
+ const endIndex = startIndex + 1;
+ const startFrame = interpolateFrameSteps[startIndex];
+ const endFrame = interpolateFrameSteps[endIndex];
+ const startStyle = outputStyles[startIndex];
+ const endStyle = outputStyles[endIndex];
+ const currentFrameStyles = interpolateStyles(
+ frame,
+ [startFrame, endFrame],
+ startStyle,
+ endStyle,
+ );
+ setCurrentStyles(currentFrameStyles);
+ };
+
+ updateCurrentStyles();
+ }, [areInputsValid, frame, interpolateFrameSteps, outputStyles]);
+
+ return currentStyles;
};
diff --git a/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/utils.ts b/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/utils.ts
index 96773c25a4..6b2286078c 100644
--- a/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/utils.ts
+++ b/packages/animation-utils/src/transformation-helpers/use-interpolate-styles/utils.ts
@@ -1,163 +1,163 @@
-import type { CSSPropertiesValue, ColorMatchers } from "../../type";
-import { NUMBER, PERCENTAGE, STANDARD_COLOR_NAMES } from "./constants";
+import type {ColorMatchers, CSSPropertiesValue} from '../../type';
+import {NUMBER, PERCENTAGE, STANDARD_COLOR_NAMES} from './constants';
function call(...args: unknown[]): string {
- return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
+ return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
}
function getColorMatchers(): ColorMatchers {
- const cachedMatchers: ColorMatchers = {
- rgb: undefined,
- rgba: undefined,
- hsl: undefined,
- hsla: undefined,
- hex3: undefined,
- hex4: undefined,
- hex5: undefined,
- hex6: undefined,
- hex8: undefined,
- };
- if (cachedMatchers.rgb === undefined) {
- cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
- cachedMatchers.rgba = new RegExp(
- "rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER)
- );
- cachedMatchers.hsl = new RegExp(
- "hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)
- );
- cachedMatchers.hsla = new RegExp(
- "hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)
- );
- cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
- cachedMatchers.hex4 =
- /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
- cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
- cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
- }
-
- return cachedMatchers;
+ const cachedMatchers: ColorMatchers = {
+ rgb: undefined,
+ rgba: undefined,
+ hsl: undefined,
+ hsla: undefined,
+ hex3: undefined,
+ hex4: undefined,
+ hex5: undefined,
+ hex6: undefined,
+ hex8: undefined,
+ };
+ if (cachedMatchers.rgb === undefined) {
+ cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
+ cachedMatchers.rgba = new RegExp(
+ 'rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER),
+ );
+ cachedMatchers.hsl = new RegExp(
+ 'hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE),
+ );
+ cachedMatchers.hsla = new RegExp(
+ 'hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER),
+ );
+ cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
+ cachedMatchers.hex4 =
+ /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
+ cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
+ cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
+ }
+
+ return cachedMatchers;
}
const extractOrderedPartsOfValue = (value: string) => {
- const parts = [];
- let remainingValue = value;
-
- while (remainingValue.length > 0) {
- const functionMatch = remainingValue.match(/([a-zA-Z-]+)\(([^)]+)\)/);
-
- // If there's a function, add it to the parts and remove it from the remaining value
- if (functionMatch) {
- const { index } = functionMatch;
- const matchedFunction = functionMatch[0];
-
- // Add any parts before the function
- if ((index || 0) > 0) {
- parts.push(...remainingValue.substring(0, index).trim().split(/\s+/));
- }
-
- parts.push(matchedFunction);
-
- remainingValue = remainingValue.substring(
- (index || 0) + matchedFunction.length
- );
- } else {
- // If there's no function, add the remaining value to the parts
- parts.push(...remainingValue.trim().split(/\s+/));
- break;
- }
- }
-
- return parts.filter((part) => part !== ""); // Filter out any empty strings
+ const parts = [];
+ let remainingValue = value;
+
+ while (remainingValue.length > 0) {
+ const functionMatch = remainingValue.match(/([a-zA-Z-]+)\(([^)]+)\)/);
+
+ // If there's a function, add it to the parts and remove it from the remaining value
+ if (functionMatch) {
+ const {index} = functionMatch;
+ const matchedFunction = functionMatch[0];
+
+ // Add any parts before the function
+ if ((index || 0) > 0) {
+ parts.push(...remainingValue.substring(0, index).trim().split(/\s+/));
+ }
+
+ parts.push(matchedFunction);
+
+ remainingValue = remainingValue.substring(
+ (index || 0) + matchedFunction.length,
+ );
+ } else {
+ // If there's no function, add the remaining value to the parts
+ parts.push(...remainingValue.trim().split(/\s+/));
+ break;
+ }
+ }
+
+ return parts.filter((part) => part !== ''); // Filter out any empty strings
};
const classifyArgsOfFunction = (value: string) => {
- let nestedLevel = 0;
- const values = [];
- let currentValue = "";
-
- for (const char of value) {
- if (char === "(") nestedLevel++;
- else if (char === ")") nestedLevel--;
-
- if (char === "," && nestedLevel === 0) {
- values.push(currentValue.trim());
- currentValue = "";
- } else {
- currentValue += char;
- }
- }
-
- if (currentValue) values.push(currentValue.trim());
-
- // Classify each value
- return values.map((val) => {
- const numberUnitMatch = val.match(/^(\d+(?:\.\d+)?)([a-zA-Z%]*)$/);
- if (numberUnitMatch) {
- const number = parseFloat(numberUnitMatch[1]);
- const unit = numberUnitMatch[2];
- return unit ? { number, unit } : { number };
- }
-
- return { unit: val };
- });
+ let nestedLevel = 0;
+ const values = [];
+ let currentValue = '';
+
+ for (const char of value) {
+ if (char === '(') nestedLevel++;
+ else if (char === ')') nestedLevel--;
+
+ if (char === ',' && nestedLevel === 0) {
+ values.push(currentValue.trim());
+ currentValue = '';
+ } else {
+ currentValue += char;
+ }
+ }
+
+ if (currentValue) values.push(currentValue.trim());
+
+ // Classify each value
+ return values.map((val) => {
+ const numberUnitMatch = val.match(/^(\d+(?:\.\d+)?)([a-zA-Z%]*)$/);
+ if (numberUnitMatch) {
+ const number = parseFloat(numberUnitMatch[1]);
+ const unit = numberUnitMatch[2];
+ return unit ? {number, unit} : {number};
+ }
+
+ return {unit: val};
+ });
};
const isColorValue = (value: string) => {
- if (STANDARD_COLOR_NAMES.includes(value)) {
- return true;
- }
-
- const matchers = getColorMatchers();
- return (
- matchers.rgb?.test(value) ||
- matchers.rgba?.test(value) ||
- matchers.hsl?.test(value) ||
- matchers.hsla?.test(value) ||
- matchers.hex3?.test(value) ||
- matchers.hex4?.test(value) ||
- matchers.hex5?.test(value) ||
- matchers.hex6?.test(value) ||
- matchers.hex8?.test(value)
- );
+ if (STANDARD_COLOR_NAMES.includes(value)) {
+ return true;
+ }
+
+ const matchers = getColorMatchers();
+ return (
+ matchers.rgb?.test(value) ||
+ matchers.rgba?.test(value) ||
+ matchers.hsl?.test(value) ||
+ matchers.hsla?.test(value) ||
+ matchers.hex3?.test(value) ||
+ matchers.hex4?.test(value) ||
+ matchers.hex5?.test(value) ||
+ matchers.hex6?.test(value) ||
+ matchers.hex8?.test(value)
+ );
};
const classifyParts = (parts: string[]) => {
- return parts.map((part) => {
- // Check for a color value like 'red', 'rgba(0, 0, 0, 0)', '#fff', etc.
- if (isColorValue(part)) {
- return { color: part };
- }
-
- // Check for a function like 'translateX(10px)' or 'rotate(90deg)'
- const functionMatch = part.match(/([a-zA-Z-]+)\(([^)]+)\)/);
- if (functionMatch) {
- const functionName = functionMatch[1];
- const functionValues = classifyArgsOfFunction(functionMatch[2]);
- return { function: { name: functionName, values: functionValues } };
- }
-
- // Check for a number possibly followed by a unit
- const numberUnitMatch = part.match(/^(\d+(?:\.\d+)?)([a-zA-Z%]*)$/);
- if (numberUnitMatch) {
- const number = parseFloat(numberUnitMatch[1]);
- const unit = numberUnitMatch[2];
- return unit ? { number, unit } : { number };
- }
-
- // If neither, treat as a unit (like 'solid', 'none', etc.)
- return { unit: part };
- });
+ return parts.map((part) => {
+ // Check for a color value like 'red', 'rgba(0, 0, 0, 0)', '#fff', etc.
+ if (isColorValue(part)) {
+ return {color: part};
+ }
+
+ // Check for a function like 'translateX(10px)' or 'rotate(90deg)'
+ const functionMatch = part.match(/([a-zA-Z-]+)\(([^)]+)\)/);
+ if (functionMatch) {
+ const functionName = functionMatch[1];
+ const functionValues = classifyArgsOfFunction(functionMatch[2]);
+ return {function: {name: functionName, values: functionValues}};
+ }
+
+ // Check for a number possibly followed by a unit
+ const numberUnitMatch = part.match(/^(\d+(?:\.\d+)?)([a-zA-Z%]*)$/);
+ if (numberUnitMatch) {
+ const number = parseFloat(numberUnitMatch[1]);
+ const unit = numberUnitMatch[2];
+ return unit ? {number, unit} : {number};
+ }
+
+ // If neither, treat as a unit (like 'solid', 'none', etc.)
+ return {unit: part};
+ });
};
const breakDownValueIntoUnitNumberAndFunctions = (
- value: CSSPropertiesValue
+ value: CSSPropertiesValue,
) => {
- if (typeof value !== "string") {
- return [];
- }
+ if (typeof value !== 'string') {
+ return [];
+ }
- const valueParts = extractOrderedPartsOfValue(value);
- return classifyParts(valueParts);
+ const valueParts = extractOrderedPartsOfValue(value);
+ return classifyParts(valueParts);
};
-export { getColorMatchers, breakDownValueIntoUnitNumberAndFunctions };
+export {getColorMatchers, breakDownValueIntoUnitNumberAndFunctions};
diff --git a/packages/animation-utils/src/type.ts b/packages/animation-utils/src/type.ts
index b8bee85116..34c5af9ab2 100644
--- a/packages/animation-utils/src/type.ts
+++ b/packages/animation-utils/src/type.ts
@@ -1,98 +1,98 @@
import type {
- matrix,
- matrix3d,
- perspective,
- rotate,
- rotate3d,
- rotateX,
- rotateY,
- rotateZ,
- scale,
- scale3d,
- scaleX,
- scaleY,
- scaleZ,
- skew,
- skewX,
- skewY,
- translate,
- translate3d,
- translateX,
- translateY,
- translateZ,
-} from "./transformation-helpers/make-transform";
-import type { breakDownValueIntoUnitNumberAndFunctions } from "./transformation-helpers/use-interpolate-styles/utils";
+ matrix,
+ matrix3d,
+ perspective,
+ rotate,
+ rotate3d,
+ rotateX,
+ rotateY,
+ rotateZ,
+ scale,
+ scale3d,
+ scaleX,
+ scaleY,
+ scaleZ,
+ skew,
+ skewX,
+ skewY,
+ translate,
+ translate3d,
+ translateX,
+ translateY,
+ translateZ,
+} from './transformation-helpers/make-transform';
+import type {breakDownValueIntoUnitNumberAndFunctions} from './transformation-helpers/use-interpolate-styles/utils';
type TransformFunction = () => string;
type LengthUnit =
- | "cap"
- | "ch"
- | "em"
- | "ex"
- | "ic"
- | "lh"
- | "rem"
- | "rlh"
- | "vh"
- | "vw"
- | "vmax"
- | "vmin"
- | "vb"
- | "vi"
- | "cqw"
- | "cqh"
- | "cqi"
- | "cqb"
- | "cqmin"
- | "cqmax"
- | "px"
- | "cm"
- | "mm"
- | "Q"
- | "in"
- | "pc"
- | "pt";
+ | 'cap'
+ | 'ch'
+ | 'em'
+ | 'ex'
+ | 'ic'
+ | 'lh'
+ | 'rem'
+ | 'rlh'
+ | 'vh'
+ | 'vw'
+ | 'vmax'
+ | 'vmin'
+ | 'vb'
+ | 'vi'
+ | 'cqw'
+ | 'cqh'
+ | 'cqi'
+ | 'cqb'
+ | 'cqmin'
+ | 'cqmax'
+ | 'px'
+ | 'cm'
+ | 'mm'
+ | 'Q'
+ | 'in'
+ | 'pc'
+ | 'pt';
-type LengthPercentageUnit = LengthUnit | "%";
+type LengthPercentageUnit = LengthUnit | '%';
-type AngleUnit = "deg" | "grad" | "rad" | "turn";
+type AngleUnit = 'deg' | 'grad' | 'rad' | 'turn';
type TransformFunctionReturnType = ReturnType<
- | typeof matrix
- | typeof matrix3d
- | typeof perspective
- | typeof rotate
- | typeof rotate3d
- | typeof rotateX
- | typeof rotateY
- | typeof rotateZ
- | typeof scale
- | typeof scale3d
- | typeof scaleX
- | typeof scaleY
- | typeof scaleZ
- | typeof skew
- | typeof skewX
- | typeof skewY
- | typeof translate
- | typeof translate3d
- | typeof translateX
- | typeof translateY
- | typeof translateZ
+ | typeof matrix
+ | typeof matrix3d
+ | typeof perspective
+ | typeof rotate
+ | typeof rotate3d
+ | typeof rotateX
+ | typeof rotateY
+ | typeof rotateZ
+ | typeof scale
+ | typeof scale3d
+ | typeof scaleX
+ | typeof scaleY
+ | typeof scaleZ
+ | typeof skew
+ | typeof skewX
+ | typeof skewY
+ | typeof translate
+ | typeof translate3d
+ | typeof translateX
+ | typeof translateY
+ | typeof translateZ
>;
type MatcherType = RegExp | undefined;
type ColorMatchers = {
- rgb: MatcherType;
- rgba: MatcherType;
- hsl: MatcherType;
- hsla: MatcherType;
- hex3: MatcherType;
- hex4: MatcherType;
- hex5: MatcherType;
- hex6: MatcherType;
- hex8: MatcherType;
+ rgb: MatcherType;
+ rgba: MatcherType;
+ hsl: MatcherType;
+ hsla: MatcherType;
+ hex3: MatcherType;
+ hex4: MatcherType;
+ hex5: MatcherType;
+ hex6: MatcherType;
+ hex8: MatcherType;
};
type Style = React.CSSProperties;
@@ -100,33 +100,33 @@ type CSSPropertiesKey = keyof Style;
type CSSPropertiesValue = Style[CSSPropertiesKey];
type InterpolateStylesParams =
- | {
- inputRangeInFrames: number[];
- inputRangeInSeconds?: number[];
- outputStyles: Style[];
- }
- | {
- inputRangeInFrames?: number[];
- inputRangeInSeconds: number[];
- outputStyles: Style[];
- };
+ | {
+ inputRangeInFrames: number[];
+ inputRangeInSeconds?: number[];
+ outputStyles: Style[];
+ }
+ | {
+ inputRangeInFrames?: number[];
+ inputRangeInSeconds: number[];
+ outputStyles: Style[];
+ };
type UnitNumberAndFunctions = ReturnType<
- typeof breakDownValueIntoUnitNumberAndFunctions
+ typeof breakDownValueIntoUnitNumberAndFunctions
>;
type UnitNumberAndFunction = UnitNumberAndFunctions[0];
export type {
- TransformFunction,
- LengthUnit,
- LengthPercentageUnit,
- AngleUnit,
- TransformFunctionReturnType,
- ColorMatchers,
- Style,
- CSSPropertiesKey,
- CSSPropertiesValue,
- InterpolateStylesParams,
- UnitNumberAndFunction,
+ TransformFunction,
+ LengthUnit,
+ LengthPercentageUnit,
+ AngleUnit,
+ TransformFunctionReturnType,
+ ColorMatchers,
+ Style,
+ CSSPropertiesKey,
+ CSSPropertiesValue,
+ InterpolateStylesParams,
+ UnitNumberAndFunction,
};
diff --git a/packages/animation-utils/tsconfig.json b/packages/animation-utils/tsconfig.json
index 861a42175f..a240a1c212 100644
--- a/packages/animation-utils/tsconfig.json
+++ b/packages/animation-utils/tsconfig.json
@@ -1,9 +1,9 @@
{
- "extends": "../tsconfig.settings.json",
- "compilerOptions": {
- "rootDir": "src",
- "outDir": "dist"
- },
- "include": ["src"],
- "references": [{ "path": "../core" }]
+ "extends": "../tsconfig.settings.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "dist"
+ },
+ "include": ["src"],
+ "references": [{"path": "../core"}]
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e08f7d4caf..f1f75c700d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -31,9 +31,24 @@ importers:
specifier: workspace:*
version: link:../core
devDependencies:
+ '@jonny/eslint-config':
+ specifier: 3.0.276
+ '@types/node':
+ specifier: 18.14.6
+ version: 18.14.6
'@types/react':
specifier: 18.0.26
version: 18.0.26
+ eslint:
+ specifier: 8.42.0
+ version: 8.42.0
+ prettier:
+ specifier: 3.1.1
+ version: 3.1.1
+ prettier-plugin-organize-imports:
+ specifier: 3.2.4
packages/astro-example:
dependencies:
@@ -13231,7 +13246,7 @@ packages:
glob-parent: 6.0.2
globals: 13.20.0
graphemer: 1.4.0
- ignore: 5.2.0
+ ignore: 5.2.4
import-fresh: 3.3.0
imurmurhash: 0.1.4
is-glob: 4.0.3
@@ -14785,10 +14800,6 @@ packages:
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
- resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==}
- engines: {node: '>= 4'}
-
resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==}
engines: {node: '>= 4'}