@remotion/animation-utils 4.0.90

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.
Files changed (30) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +7 -0
  3. package/dist/esm/index.d.ts +3 -0
  4. package/dist/esm/index.mjs +662 -0
  5. package/dist/esm/test/interpolate-styles.test.d.ts +1 -0
  6. package/dist/esm/test/make-transform.test.d.ts +1 -0
  7. package/dist/esm/transformation-helpers/interpolate-styles/constants.d.ts +3 -0
  8. package/dist/esm/transformation-helpers/interpolate-styles/index.d.ts +8 -0
  9. package/dist/esm/transformation-helpers/interpolate-styles/utils.d.ts +41 -0
  10. package/dist/esm/transformation-helpers/make-transform/index.d.ts +4 -0
  11. package/dist/esm/transformation-helpers/make-transform/is-unit-with-string.d.ts +1 -0
  12. package/dist/esm/transformation-helpers/make-transform/transform-functions.d.ts +46 -0
  13. package/dist/esm/type.d.ts +31 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.js +18 -0
  16. package/dist/transformation-helpers/interpolate-styles/constants.d.ts +3 -0
  17. package/dist/transformation-helpers/interpolate-styles/constants.js +7 -0
  18. package/dist/transformation-helpers/interpolate-styles/index.d.ts +8 -0
  19. package/dist/transformation-helpers/interpolate-styles/index.js +191 -0
  20. package/dist/transformation-helpers/interpolate-styles/utils.d.ts +41 -0
  21. package/dist/transformation-helpers/interpolate-styles/utils.js +150 -0
  22. package/dist/transformation-helpers/make-transform/index.d.ts +4 -0
  23. package/dist/transformation-helpers/make-transform/index.js +29 -0
  24. package/dist/transformation-helpers/make-transform/is-unit-with-string.d.ts +1 -0
  25. package/dist/transformation-helpers/make-transform/is-unit-with-string.js +18 -0
  26. package/dist/transformation-helpers/make-transform/transform-functions.d.ts +46 -0
  27. package/dist/transformation-helpers/make-transform/transform-functions.js +302 -0
  28. package/dist/type.d.ts +31 -0
  29. package/dist/type.js +34 -0
  30. package/package.json +58 -0
@@ -0,0 +1,46 @@
1
+ import type { AngleUnit, AngleUnitString, LengthPercentageUnit, LengthPercentageUnitString, LengthUnit, LengthUnitString } from '../../type';
2
+ declare function matrix(a: number, b: number, c: number, d: number, tx: number, ty: number): string;
3
+ declare 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): string;
4
+ declare function perspective(length: LengthPercentageUnitString): string;
5
+ declare function perspective(length: number, unit?: LengthUnit): string;
6
+ declare function rotate(angle: AngleUnitString): string;
7
+ declare function rotate(angle: number, unit?: AngleUnit): string;
8
+ declare function rotate3d(x: number, y: number, z: number, angle: number): string;
9
+ declare function rotate3d(x: number, y: number, z: number, angle: AngleUnitString): string;
10
+ declare function rotate3d(x: number, y: number, z: number, angle: number, unit?: AngleUnit): string;
11
+ declare function rotateX(angle: AngleUnitString): string;
12
+ declare function rotateX(angle: number, unit?: AngleUnit): string;
13
+ declare function rotateY(angle: AngleUnitString): string;
14
+ declare function rotateY(angle: number, unit?: AngleUnit): string;
15
+ declare function rotateZ(angle: AngleUnitString): string;
16
+ declare function rotateZ(angle: number, unit?: AngleUnit): string;
17
+ declare function scale(x: number, y?: number): string;
18
+ declare function scale3d(x: number, y: number, z: number): string;
19
+ declare function scaleX(x: number): string;
20
+ declare function scaleY(y: number): string;
21
+ declare function scaleZ(z: number): string;
22
+ declare function skew(angle: number): string;
23
+ declare function skew(angle: AngleUnitString): string;
24
+ declare function skew(angle: AngleUnitString, angle2: AngleUnitString): string;
25
+ declare function skew(angle: number, unit: AngleUnit): string;
26
+ declare function skew(angleX: number, angleY: number): string;
27
+ declare function skew(angleX: number, unitX: AngleUnit, angleY: number, unitY: AngleUnit): string;
28
+ declare function skewX(angle: AngleUnitString): string;
29
+ declare function skewX(angle: number, unit?: AngleUnit): string;
30
+ declare function skewY(angle: AngleUnitString): string;
31
+ declare function skewY(angle: number, unit?: AngleUnit): string;
32
+ declare function translate(x: LengthPercentageUnitString): string;
33
+ declare function translate(x: number): string;
34
+ declare function translate(x: number, y: number): string;
35
+ declare function translate(x: LengthPercentageUnitString, y: LengthPercentageUnitString): string;
36
+ declare function translate(translation: number, unit: LengthPercentageUnit): string;
37
+ declare function translate(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit): string;
38
+ declare function translate3d(x: LengthPercentageUnitString | number, y: LengthPercentageUnitString | number, z: LengthPercentageUnitString | number): string;
39
+ declare function translate3d(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit, z: number, unitZ: LengthUnit): string;
40
+ declare function translateX(x: LengthPercentageUnitString): string;
41
+ declare function translateX(x: number, unit?: LengthPercentageUnit): string;
42
+ declare function translateY(y: LengthPercentageUnitString): string;
43
+ declare function translateY(y: number, unit?: LengthPercentageUnit): string;
44
+ declare function translateZ(z: LengthUnitString): string;
45
+ declare function translateZ(z: number, unit?: LengthUnit): string;
46
+ export { matrix, matrix3d, perspective, rotate, rotate3d, rotateX, rotateY, rotateZ, scale, scale3d, scaleX, scaleY, scaleZ, skew, skewX, skewY, translate, translate3d, translateX, translateY, translateZ, };
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+ /* eslint-disable no-redeclare */
3
+ /* eslint-disable max-params */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.translateZ = exports.translateY = exports.translateX = exports.translate3d = exports.translate = exports.skewY = exports.skewX = exports.skew = exports.scaleZ = exports.scaleY = exports.scaleX = exports.scale3d = exports.scale = exports.rotateZ = exports.rotateY = exports.rotateX = exports.rotate3d = exports.rotate = exports.perspective = exports.matrix3d = exports.matrix = void 0;
6
+ const type_1 = require("../../type");
7
+ const is_unit_with_string_1 = require("./is-unit-with-string");
8
+ /* Matrix transformation */
9
+ const checkNumber = ({ num, param, api, }) => {
10
+ if (typeof num === 'undefined') {
11
+ throw new TypeError(`Argument passed to "${api}" for param "${param}" is undefined`);
12
+ }
13
+ if (typeof num !== 'number') {
14
+ throw new TypeError(`Argument passed to "${api}" for param "${param}" is ${JSON.stringify(num)}`);
15
+ }
16
+ if (!Number.isFinite(num)) {
17
+ throw new TypeError(`Argument passed to "${api}" for param "${param}" is ${JSON.stringify(num)} (must be finite)`);
18
+ }
19
+ };
20
+ function matrix(a, b, c, d, tx, ty) {
21
+ checkNumber({ num: a, param: 'a', api: 'matrix' });
22
+ checkNumber({ num: b, param: 'b', api: 'matrix' });
23
+ checkNumber({ num: c, param: 'c', api: 'matrix' });
24
+ checkNumber({ num: d, param: 'd', api: 'matrix' });
25
+ checkNumber({ num: tx, param: 'tx', api: 'matrix' });
26
+ checkNumber({ num: ty, param: 'ty', api: 'matrix' });
27
+ return `matrix(${a}, ${b}, ${c}, ${d}, ${tx}, ${ty})`;
28
+ }
29
+ exports.matrix = matrix;
30
+ function matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) {
31
+ checkNumber({ num: a1, param: 'a1', api: 'matrix3d' });
32
+ checkNumber({ num: b1, param: 'b1', api: 'matrix3d' });
33
+ checkNumber({ num: c1, param: 'c1', api: 'matrix3d' });
34
+ checkNumber({ num: d1, param: 'd1', api: 'matrix3d' });
35
+ checkNumber({ num: a2, param: 'a2', api: 'matrix3d' });
36
+ checkNumber({ num: b2, param: 'b2', api: 'matrix3d' });
37
+ checkNumber({ num: c2, param: 'c2', api: 'matrix3d' });
38
+ checkNumber({ num: d2, param: 'd2', api: 'matrix3d' });
39
+ checkNumber({ num: a3, param: 'a3', api: 'matrix3d' });
40
+ checkNumber({ num: b3, param: 'b3', api: 'matrix3d' });
41
+ checkNumber({ num: c3, param: 'c3', api: 'matrix3d' });
42
+ checkNumber({ num: d3, param: 'd3', api: 'matrix3d' });
43
+ checkNumber({ num: a4, param: 'a4', api: 'matrix3d' });
44
+ checkNumber({ num: b4, param: 'b4', api: 'matrix3d' });
45
+ checkNumber({ num: c4, param: 'c4', api: 'matrix3d' });
46
+ checkNumber({ num: d4, param: 'd4', api: 'matrix3d' });
47
+ return `matrix3d(${a1}, ${b1}, ${c1}, ${d1}, ${a2}, ${b2}, ${c2}, ${d2}, ${a3}, ${b3}, ${c3}, ${d3}, ${a4}, ${b4}, ${c4}, ${d4})`;
48
+ }
49
+ exports.matrix3d = matrix3d;
50
+ function perspective(length, unit = 'px') {
51
+ if ((0, is_unit_with_string_1.isUnitWithString)(length, type_1.lengthUnits)) {
52
+ return `perspective(${length})`;
53
+ }
54
+ checkNumber({ num: length, param: 'length', api: 'perspective' });
55
+ return `perspective(${length}${unit})`;
56
+ }
57
+ exports.perspective = perspective;
58
+ function rotate(angle, unit = 'deg') {
59
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
60
+ return `rotate(${angle})`;
61
+ }
62
+ checkNumber({ num: angle, param: 'angle', api: 'rotate' });
63
+ return `rotate(${angle}${unit})`;
64
+ }
65
+ exports.rotate = rotate;
66
+ function rotate3d(x, y, z, angle, unit = 'deg') {
67
+ checkNumber({ num: x, param: 'x', api: 'rotate3d' });
68
+ checkNumber({ num: y, param: 'y', api: 'rotate3d' });
69
+ checkNumber({ num: z, param: 'z', api: 'rotate3d' });
70
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
71
+ return `rotate3d(${x}, ${y}, ${z}, ${angle})`;
72
+ }
73
+ checkNumber({ num: angle, param: 'angle', api: 'rotate3d' });
74
+ return `rotate3d(${x}, ${y}, ${z}, ${angle}${unit})`;
75
+ }
76
+ exports.rotate3d = rotate3d;
77
+ function rotateX(angle, unit = 'deg') {
78
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
79
+ return `rotateX(${angle})`;
80
+ }
81
+ checkNumber({ num: angle, param: 'angle', api: 'rotateX' });
82
+ return `rotateX(${angle}${unit})`;
83
+ }
84
+ exports.rotateX = rotateX;
85
+ function rotateY(angle, unit = 'deg') {
86
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
87
+ return `rotateY(${angle})`;
88
+ }
89
+ checkNumber({ num: angle, param: 'angle', api: 'rotateY' });
90
+ return `rotateY(${angle}${unit})`;
91
+ }
92
+ exports.rotateY = rotateY;
93
+ function rotateZ(angle, unit = 'deg') {
94
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
95
+ return `rotateZ(${angle})`;
96
+ }
97
+ checkNumber({ num: angle, param: 'angle', api: 'rotateZ' });
98
+ return `rotateZ(${angle}${unit})`;
99
+ }
100
+ exports.rotateZ = rotateZ;
101
+ /* Scale */
102
+ function scale(x, y = x) {
103
+ checkNumber({ num: x, param: 'x', api: 'scale' });
104
+ return `scale(${x}, ${y})`;
105
+ }
106
+ exports.scale = scale;
107
+ function scale3d(x, y, z) {
108
+ checkNumber({ num: x, param: 'x', api: 'scale3d' });
109
+ checkNumber({ num: y, param: 'y', api: 'scale3d' });
110
+ checkNumber({ num: z, param: 'z', api: 'scale3d' });
111
+ return `scale3d(${x}, ${y}, ${z})`;
112
+ }
113
+ exports.scale3d = scale3d;
114
+ function scaleX(x) {
115
+ checkNumber({ num: x, param: 'x', api: 'scaleX' });
116
+ return `scaleX(${x})`;
117
+ }
118
+ exports.scaleX = scaleX;
119
+ function scaleY(y) {
120
+ checkNumber({ num: y, param: 'y', api: 'scaleY' });
121
+ return `scaleY(${y})`;
122
+ }
123
+ exports.scaleY = scaleY;
124
+ function scaleZ(z) {
125
+ checkNumber({ num: z, param: 'z', api: 'scaleZ' });
126
+ return `scaleZ(${z})`;
127
+ }
128
+ exports.scaleZ = scaleZ;
129
+ function skew(...args) {
130
+ const [arg1, arg2, arg3, arg4] = args;
131
+ if (arguments.length === 1) {
132
+ // Case A
133
+ if ((0, is_unit_with_string_1.isUnitWithString)(arg1, type_1.angleUnits)) {
134
+ return `skew(${arg1}, ${arg1})`;
135
+ }
136
+ // Case Z
137
+ checkNumber({ num: arg1, param: 'angle', api: 'skew' });
138
+ return `skew(${arg1}deg, ${arg1}deg)`;
139
+ }
140
+ if (arguments.length === 2) {
141
+ // Case B
142
+ if ((0, is_unit_with_string_1.isUnitWithString)(arg1, type_1.angleUnits) &&
143
+ (0, is_unit_with_string_1.isUnitWithString)(arg2, type_1.angleUnits)) {
144
+ return `skew(${arg1}, ${arg2})`;
145
+ }
146
+ // Case C
147
+ if (typeof arg1 === 'number' && typeof arg2 !== 'number') {
148
+ checkNumber({ num: arg1, param: 'angle', api: 'skew' });
149
+ return `skew(${arg1}${arg2}, ${arg1}${arg2})`;
150
+ }
151
+ // Case D
152
+ if (typeof arg1 === 'number' && typeof arg2 === 'number') {
153
+ checkNumber({ num: arg1, param: 'angle', api: 'skew' });
154
+ checkNumber({ num: arg2, param: 'angle', api: 'skew' });
155
+ return `skew(${arg1}deg, ${arg2}deg)`;
156
+ }
157
+ }
158
+ if (arguments.length === 4) {
159
+ // Case E
160
+ if (typeof arg1 === 'number' &&
161
+ (0, is_unit_with_string_1.isUnitWithString)(arg2, type_1.angleUnits) &&
162
+ typeof arg3 === 'number' &&
163
+ (0, is_unit_with_string_1.isUnitWithString)(arg4, type_1.angleUnits)) {
164
+ checkNumber({ num: arg1, param: 'angle', api: 'skew' });
165
+ checkNumber({ num: arg3, param: 'angle', api: 'skew' });
166
+ return `skew(${arg1}${arg2}, ${arg3}${arg4})`;
167
+ }
168
+ }
169
+ throw new TypeError([
170
+ 'skew() supports only the following signatures:',
171
+ 'skew(angle: AngleUnitString): string;',
172
+ 'skew(angle: AngleUnitString, angle2: AngleUnitString): string;',
173
+ 'skew(angle: number, unit: AngleUnit): string;',
174
+ 'skew(angleX: number, angleY: number): string;',
175
+ 'skew(angleX: number, unitX: AngleUnit, angleY: number, unitY: AngleUnit): string;',
176
+ ].join('\n'));
177
+ }
178
+ exports.skew = skew;
179
+ function skewX(angle, unit = 'deg') {
180
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
181
+ return `skewX(${angle})`;
182
+ }
183
+ checkNumber({ num: angle, param: 'angle', api: 'skewX' });
184
+ return `skewX(${angle}${unit})`;
185
+ }
186
+ exports.skewX = skewX;
187
+ function skewY(angle, unit = 'deg') {
188
+ if ((0, is_unit_with_string_1.isUnitWithString)(angle, type_1.angleUnits)) {
189
+ return `skewY(${angle})`;
190
+ }
191
+ checkNumber({ num: angle, param: 'angle', api: 'skewY' });
192
+ return `skewY(${angle}${unit})`;
193
+ }
194
+ exports.skewY = skewY;
195
+ function translate(...args) {
196
+ const [arg1, arg2, arg3, arg4] = args;
197
+ if (arguments.length === 1) {
198
+ // Case A
199
+ if ((0, is_unit_with_string_1.isUnitWithString)(arg1, type_1.lengthPercentageUnits)) {
200
+ return `translate(${arg1})`;
201
+ }
202
+ // Case B
203
+ checkNumber({ num: arg1, param: 'x', api: 'translate' });
204
+ return `translate(${arg1}px)`;
205
+ }
206
+ if (arguments.length === 2) {
207
+ // Case C
208
+ if (typeof arg1 === 'number' && typeof arg2 === 'number') {
209
+ checkNumber({ num: arg1, param: 'x', api: 'translate' });
210
+ checkNumber({ num: arg2, param: 'y', api: 'translate' });
211
+ return `translate(${arg1}px, ${arg2}px)`;
212
+ }
213
+ // Case C.1
214
+ if ((0, is_unit_with_string_1.isUnitWithString)(arg1, type_1.lengthPercentageUnits) &&
215
+ (0, is_unit_with_string_1.isUnitWithString)(arg2, type_1.lengthPercentageUnits)) {
216
+ return `translate(${arg1}, ${arg2})`;
217
+ }
218
+ // Case D
219
+ if (typeof arg1 === 'number' && typeof arg2 !== 'number') {
220
+ checkNumber({ num: arg1, param: 'x', api: 'translate' });
221
+ return `translate(${arg1}${arg2})`;
222
+ }
223
+ }
224
+ if (arguments.length === 4) {
225
+ // Case E
226
+ if (typeof arg1 === 'number' && typeof arg3 === 'number') {
227
+ checkNumber({ num: arg1, param: 'x', api: 'translate' });
228
+ checkNumber({ num: arg3, param: 'y', api: 'translate' });
229
+ return `translate(${arg1}${arg2}, ${arg3}${arg4})`;
230
+ }
231
+ }
232
+ throw new TypeError([
233
+ `translate() supports only the following signatures:`,
234
+ `translate(x: LengthPercentageUnitString)`,
235
+ `translate(x: number)`,
236
+ `translate(x: number, y: number)`,
237
+ `translate(translation: number, unit: LengthPercentageUnit)`,
238
+ `translate(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit): string;`,
239
+ ].join('\n'));
240
+ }
241
+ exports.translate = translate;
242
+ function translate3d(...args) {
243
+ if (arguments.length === 3) {
244
+ const [x, y, z] = args;
245
+ const vars = [x, y, z].map((arg, i) => {
246
+ if ((0, is_unit_with_string_1.isUnitWithString)(arg, type_1.lengthPercentageUnits)) {
247
+ return arg;
248
+ }
249
+ checkNumber({
250
+ num: arg,
251
+ param: i === 0 ? 'x' : i === 1 ? 'y' : 'z',
252
+ api: 'translate3d',
253
+ });
254
+ if (typeof arg === 'number') {
255
+ return `${arg}px`;
256
+ }
257
+ return arg;
258
+ });
259
+ return `translate3d(${vars.join(', ')})`;
260
+ }
261
+ if (arguments.length === 6) {
262
+ const [x, unitX, y, unitY, z, unitZ] = args;
263
+ if (typeof x === 'number' &&
264
+ typeof y === 'number' &&
265
+ typeof z === 'number') {
266
+ checkNumber({ num: x, param: 'x', api: 'translate3d' });
267
+ checkNumber({ num: y, param: 'y', api: 'translate3d' });
268
+ checkNumber({ num: z, param: 'z', api: 'translate3d' });
269
+ return `translate3d(${x}${unitX}, ${y}${unitY}, ${z}${unitZ})`;
270
+ }
271
+ }
272
+ throw new TypeError([
273
+ `translate3d() supports only the following signatures:`,
274
+ `translate3d(x: LengthPercentageUnitString, y: LengthPercentageUnitString, z: LengthPercentageUnitString)`,
275
+ `translate3d(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit, z: number, unitZ: LengthUnit)`,
276
+ ].join('\n'));
277
+ }
278
+ exports.translate3d = translate3d;
279
+ function translateX(x, unit = 'px') {
280
+ if ((0, is_unit_with_string_1.isUnitWithString)(x, type_1.lengthPercentageUnits)) {
281
+ return `translateX(${x})`;
282
+ }
283
+ checkNumber({ num: x, param: 'x', api: 'translateX' });
284
+ return `translateX(${x}${unit})`;
285
+ }
286
+ exports.translateX = translateX;
287
+ function translateY(y, unit = 'px') {
288
+ if ((0, is_unit_with_string_1.isUnitWithString)(y, type_1.lengthPercentageUnits)) {
289
+ return `translateY(${y})`;
290
+ }
291
+ checkNumber({ num: y, param: 'y', api: 'translateY' });
292
+ return `translateY(${y}${unit})`;
293
+ }
294
+ exports.translateY = translateY;
295
+ function translateZ(z, unit = 'px') {
296
+ if ((0, is_unit_with_string_1.isUnitWithString)(z, type_1.lengthUnits)) {
297
+ return `translateZ(${z})`;
298
+ }
299
+ checkNumber({ num: z, param: 'z', api: 'translateZ' });
300
+ return `translateZ(${z}${unit})`;
301
+ }
302
+ exports.translateZ = translateZ;
package/dist/type.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import type { breakDownValueIntoUnitNumberAndFunctions } from './transformation-helpers/interpolate-styles/utils';
3
+ 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';
4
+ export declare const lengthUnits: readonly ["px", "em", "rem", "pt", "cap", "ch", "ex", "ic", "lh", "rlh", "vmax", "vmin", "vb", "vi", "cqw", "vh", "vw", "cqh", "cqi", "cqb", "cqmin", "cqmax", "cm", "mm", "Q", "in", "pc"];
5
+ export declare const angleUnits: readonly ["rad", "deg", "grad", "turn"];
6
+ export declare const lengthPercentageUnits: readonly ["%", "px", "em", "rem", "pt", "cap", "ch", "ex", "ic", "lh", "rlh", "vmax", "vmin", "vb", "vi", "cqw", "vh", "vw", "cqh", "cqi", "cqb", "cqmin", "cqmax", "cm", "mm", "Q", "in", "pc"];
7
+ type LengthUnit = (typeof lengthUnits)[number];
8
+ type AngleUnit = (typeof angleUnits)[number];
9
+ type LengthPercentageUnit = (typeof lengthPercentageUnits)[number];
10
+ export type LengthUnitString = `${number}${LengthUnit}`;
11
+ export type LengthPercentageUnitString = `${number}${LengthPercentageUnit}`;
12
+ export type AngleUnitString = `${number}${AngleUnit}`;
13
+ 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>;
14
+ type MatcherType = RegExp | undefined;
15
+ type ColorMatchers = {
16
+ rgb: MatcherType;
17
+ rgba: MatcherType;
18
+ hsl: MatcherType;
19
+ hsla: MatcherType;
20
+ hex3: MatcherType;
21
+ hex4: MatcherType;
22
+ hex5: MatcherType;
23
+ hex6: MatcherType;
24
+ hex8: MatcherType;
25
+ };
26
+ type Style = React.CSSProperties;
27
+ type CSSPropertiesKey = keyof Style;
28
+ type CSSPropertiesValue = Style[CSSPropertiesKey];
29
+ type UnitNumberAndFunctions = ReturnType<typeof breakDownValueIntoUnitNumberAndFunctions>;
30
+ type UnitNumberAndFunction = UnitNumberAndFunctions[0];
31
+ export type { LengthUnit, LengthPercentageUnit, AngleUnit, TransformFunctionReturnType, ColorMatchers, Style, CSSPropertiesKey, CSSPropertiesValue, UnitNumberAndFunction, };
package/dist/type.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lengthPercentageUnits = exports.angleUnits = exports.lengthUnits = void 0;
4
+ exports.lengthUnits = [
5
+ 'px',
6
+ 'em',
7
+ 'rem',
8
+ 'pt',
9
+ 'cap',
10
+ 'ch',
11
+ 'ex',
12
+ 'ic',
13
+ 'lh',
14
+ 'rlh',
15
+ 'vmax',
16
+ 'vmin',
17
+ 'vb',
18
+ 'vi',
19
+ 'cqw',
20
+ 'vh',
21
+ 'vw',
22
+ 'cqh',
23
+ 'cqi',
24
+ 'cqb',
25
+ 'cqmin',
26
+ 'cqmax',
27
+ 'cm',
28
+ 'mm',
29
+ 'Q',
30
+ 'in',
31
+ 'pc',
32
+ ];
33
+ exports.angleUnits = ['rad', 'deg', 'grad', 'turn'];
34
+ exports.lengthPercentageUnits = ['%', ...exports.lengthUnits];
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@remotion/animation-utils",
3
+ "author": {
4
+ "name": "Chetan Karwa",
5
+ "email": "cbkarwa@gmail.com"
6
+ },
7
+ "version": "4.0.90",
8
+ "description": "A set of animation utilities for Remotion",
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.mjs",
11
+ "types": "./dist/index.d.ts",
12
+ "dependencies": {
13
+ "remotion": "4.0.90"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "!dist/tsconfig-esm.tsbuildinfo",
18
+ "!dist/test"
19
+ ],
20
+ "peerDependencies": {
21
+ "react": ">=16.8.0",
22
+ "react-dom": ">=16.8.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/react": "18.2.48",
26
+ "@types/node": "18.14.6",
27
+ "prettier": "3.1.1",
28
+ "prettier-plugin-organize-imports": "3.2.4",
29
+ "eslint": "8.42.0",
30
+ "@jonny/eslint-config": "3.0.276",
31
+ "vitest": "0.31.1",
32
+ "rollup": "^2.70.1"
33
+ },
34
+ "exports": {
35
+ "./package.json": "./package.json",
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "module": "./dist/esm/index.mjs",
39
+ "import": "./dist/esm/index.mjs",
40
+ "require": "./dist/index.js"
41
+ }
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "keywords": [
47
+ "remotion",
48
+ "animation-utils"
49
+ ],
50
+ "scripts": {
51
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
52
+ "formatting": "prettier src --check",
53
+ "lint": "eslint src --ext ts,tsx",
54
+ "watch": "tsc -w",
55
+ "build": "tsc -d && rollup --config rollup.config.js",
56
+ "test": "vitest --run"
57
+ }
58
+ }