@remotion/web-renderer 4.0.496 → 4.0.497

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.
@@ -0,0 +1 @@
1
+ export declare const makeDOMMatrix: (transform?: string | undefined) => DOMMatrix;
@@ -1945,6 +1945,69 @@ var hasAnyTransformCssValue = (style) => {
1945
1945
  return hasTransformCssValue(style) || hasRotateCssValue(style) || hasScaleCssValue(style);
1946
1946
  };
1947
1947
 
1948
+ // src/drawing/make-dom-matrix.ts
1949
+ var parseScaleComponent = (component) => {
1950
+ if (component.endsWith("%")) {
1951
+ return Number(component.slice(0, -1)) / 100;
1952
+ }
1953
+ return Number(component);
1954
+ };
1955
+ var parseScale = (transform) => {
1956
+ const match = /^scale\((.*)\)$/.exec(transform);
1957
+ if (!match) {
1958
+ return null;
1959
+ }
1960
+ const scaleValue = match[1].trim();
1961
+ if (scaleValue === "") {
1962
+ return null;
1963
+ }
1964
+ const components = scaleValue.split(/\s+/).map(parseScaleComponent);
1965
+ if (components.length < 1 || components.length > 3 || components.some((component) => !Number.isFinite(component))) {
1966
+ return null;
1967
+ }
1968
+ return {
1969
+ x: components[0],
1970
+ y: components[1] ?? components[0],
1971
+ z: components[2] ?? 1
1972
+ };
1973
+ };
1974
+ var parseAxisRotate = (transform) => {
1975
+ const match = /^rotate\((.*)\)$/.exec(transform);
1976
+ if (!match) {
1977
+ return null;
1978
+ }
1979
+ const rotateValue = match[1].trim();
1980
+ const keywordAxis = /^(x|y|z)\s+(.+)$/i.exec(rotateValue);
1981
+ if (keywordAxis) {
1982
+ const axisKeyword = keywordAxis[1].toLowerCase();
1983
+ const angle = keywordAxis[2];
1984
+ const rotateFunction = axisKeyword === "x" ? "rotateX" : axisKeyword === "y" ? "rotateY" : "rotate";
1985
+ return `${rotateFunction}(${angle})`;
1986
+ }
1987
+ const vectorAxis = /^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/.exec(rotateValue);
1988
+ if (!vectorAxis) {
1989
+ return null;
1990
+ }
1991
+ const axisVector = vectorAxis.slice(1, 4).map(Number);
1992
+ if (axisVector.some((component) => !Number.isFinite(component))) {
1993
+ return null;
1994
+ }
1995
+ return `rotate3d(${axisVector.join(", ")}, ${vectorAxis[4]})`;
1996
+ };
1997
+ var makeDOMMatrix = (transform) => {
1998
+ if (transform) {
1999
+ const scale = parseScale(transform);
2000
+ if (scale) {
2001
+ return new DOMMatrix().scale(scale.x, scale.y, scale.z);
2002
+ }
2003
+ const axisRotate = parseAxisRotate(transform);
2004
+ if (axisRotate) {
2005
+ return new DOMMatrix(axisRotate);
2006
+ }
2007
+ }
2008
+ return new DOMMatrix(transform);
2009
+ };
2010
+
1948
2011
  // src/drawing/parse-linear-gradient.ts
1949
2012
  import { NoReactInternals as NoReactInternals2 } from "remotion/no-react";
1950
2013
  var isValidColor = (color) => {
@@ -2350,15 +2413,15 @@ var calculateTransforms = ({
2350
2413
  const hasApplicableTransformCssValue = canApplyCssTransforms({ computedStyle: transformStyle, element: parent }) && hasAnyTransformCssValue(transformStyle);
2351
2414
  if (hasApplicableTransformCssValue || parent === element) {
2352
2415
  const toParse = hasApplicableTransformCssValue && hasTransformCssValue(transformStyle) ? transformStyle.transform : undefined;
2353
- const matrix = new DOMMatrix(toParse);
2416
+ const matrix = makeDOMMatrix(toParse);
2354
2417
  const resetTransforms = makeTransformResetter(parent);
2355
2418
  const { scale, rotate } = parent.style;
2356
2419
  const additionalMatrices = [];
2357
2420
  if (hasApplicableTransformCssValue && rotate !== "" && rotate !== "none") {
2358
- additionalMatrices.push(new DOMMatrix(`rotate(${rotate})`));
2421
+ additionalMatrices.push(makeDOMMatrix(`rotate(${rotate})`));
2359
2422
  }
2360
2423
  if (hasApplicableTransformCssValue && scale !== "" && scale !== "none") {
2361
- additionalMatrices.push(new DOMMatrix(`scale(${scale})`));
2424
+ additionalMatrices.push(makeDOMMatrix(`scale(${scale})`));
2362
2425
  }
2363
2426
  additionalMatrices.push(matrix);
2364
2427
  const cleanup = resetTransforms(hasApplicableTransformCssValue);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/web-renderer"
4
4
  },
5
5
  "name": "@remotion/web-renderer",
6
- "version": "4.0.496",
6
+ "version": "4.0.497",
7
7
  "main": "dist/index.js",
8
8
  "type": "module",
9
9
  "scripts": {
@@ -22,20 +22,20 @@
22
22
  "@mediabunny/mp3-encoder": "1.50.8",
23
23
  "@mediabunny/aac-encoder": "1.50.8",
24
24
  "@mediabunny/flac-encoder": "1.50.8",
25
- "@remotion/licensing": "4.0.496",
26
- "remotion": "4.0.496",
25
+ "@remotion/licensing": "4.0.497",
26
+ "remotion": "4.0.497",
27
27
  "mediabunny": "1.50.8"
28
28
  },
29
29
  "devDependencies": {
30
- "@remotion/effects": "4.0.496",
30
+ "@remotion/effects": "4.0.497",
31
31
  "@react-three/fiber": "9.2.0",
32
- "@remotion/eslint-config-internal": "4.0.496",
33
- "@remotion/paths": "4.0.496",
34
- "@remotion/player": "4.0.496",
35
- "@remotion/media": "4.0.496",
36
- "@remotion/shapes": "4.0.496",
37
- "@remotion/three": "4.0.496",
38
- "@remotion/transitions": "4.0.496",
32
+ "@remotion/eslint-config-internal": "4.0.497",
33
+ "@remotion/paths": "4.0.497",
34
+ "@remotion/player": "4.0.497",
35
+ "@remotion/media": "4.0.497",
36
+ "@remotion/shapes": "4.0.497",
37
+ "@remotion/three": "4.0.497",
38
+ "@remotion/transitions": "4.0.497",
39
39
  "@types/three": "0.170.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1",
41
41
  "@vitejs/plugin-react": "4.3.4",