@remotion/web-renderer 4.0.495 → 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;
@@ -1170,6 +1170,7 @@ function createScaffold({
1170
1170
  wrapper.style.inset = "0";
1171
1171
  wrapper.style.overflow = "hidden";
1172
1172
  wrapper.style.visibility = "hidden";
1173
+ wrapper.style.filter = "opacity(0)";
1173
1174
  wrapper.style.pointerEvents = "none";
1174
1175
  wrapper.style.zIndex = "-9999";
1175
1176
  const div = document.createElement("div");
@@ -1187,6 +1188,14 @@ function createScaffold({
1187
1188
  wrapper.appendChild(div);
1188
1189
  document.body.appendChild(wrapper);
1189
1190
  const htmlInCanvasContext = useHtmlInCanvas ? setupHtmlInCanvas({ wrapper, div, width, height }) : null;
1191
+ const updateFallbackScaffoldVisibility = () => {
1192
+ if (htmlInCanvasContext) {
1193
+ return;
1194
+ }
1195
+ div.style.visibility = containsLayoutSubtreeCanvas(div) ? "visible" : "";
1196
+ };
1197
+ const fallbackScaffoldObserver = htmlInCanvasContext ? null : new MutationObserver(updateFallbackScaffoldVisibility);
1198
+ fallbackScaffoldObserver?.observe(div, { childList: true, subtree: true });
1190
1199
  const errorHolder = { error: null };
1191
1200
  const root = ReactDOM.createRoot(div, {
1192
1201
  onUncaughtError: (err, errorInfo) => {
@@ -1277,12 +1286,14 @@ function createScaffold({
1277
1286
  })
1278
1287
  }));
1279
1288
  });
1289
+ updateFallbackScaffoldVisibility();
1280
1290
  return {
1281
1291
  delayRenderScope,
1282
1292
  div,
1283
1293
  errorHolder,
1284
1294
  htmlInCanvasContext,
1285
1295
  [Symbol.dispose]: () => {
1296
+ fallbackScaffoldObserver?.disconnect();
1286
1297
  root.unmount();
1287
1298
  if (htmlInCanvasContext) {
1288
1299
  teardownHtmlInCanvas({ htmlInCanvasContext, wrapper, div });
@@ -1934,6 +1945,69 @@ var hasAnyTransformCssValue = (style) => {
1934
1945
  return hasTransformCssValue(style) || hasRotateCssValue(style) || hasScaleCssValue(style);
1935
1946
  };
1936
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
+
1937
2011
  // src/drawing/parse-linear-gradient.ts
1938
2012
  import { NoReactInternals as NoReactInternals2 } from "remotion/no-react";
1939
2013
  var isValidColor = (color) => {
@@ -2339,15 +2413,15 @@ var calculateTransforms = ({
2339
2413
  const hasApplicableTransformCssValue = canApplyCssTransforms({ computedStyle: transformStyle, element: parent }) && hasAnyTransformCssValue(transformStyle);
2340
2414
  if (hasApplicableTransformCssValue || parent === element) {
2341
2415
  const toParse = hasApplicableTransformCssValue && hasTransformCssValue(transformStyle) ? transformStyle.transform : undefined;
2342
- const matrix = new DOMMatrix(toParse);
2416
+ const matrix = makeDOMMatrix(toParse);
2343
2417
  const resetTransforms = makeTransformResetter(parent);
2344
2418
  const { scale, rotate } = parent.style;
2345
2419
  const additionalMatrices = [];
2346
2420
  if (hasApplicableTransformCssValue && rotate !== "" && rotate !== "none") {
2347
- additionalMatrices.push(new DOMMatrix(`rotate(${rotate})`));
2421
+ additionalMatrices.push(makeDOMMatrix(`rotate(${rotate})`));
2348
2422
  }
2349
2423
  if (hasApplicableTransformCssValue && scale !== "" && scale !== "none") {
2350
- additionalMatrices.push(new DOMMatrix(`scale(${scale})`));
2424
+ additionalMatrices.push(makeDOMMatrix(`scale(${scale})`));
2351
2425
  }
2352
2426
  additionalMatrices.push(matrix);
2353
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.495",
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.495",
26
- "remotion": "4.0.495",
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.495",
30
+ "@remotion/effects": "4.0.497",
31
31
  "@react-three/fiber": "9.2.0",
32
- "@remotion/eslint-config-internal": "4.0.495",
33
- "@remotion/paths": "4.0.495",
34
- "@remotion/player": "4.0.495",
35
- "@remotion/media": "4.0.495",
36
- "@remotion/shapes": "4.0.495",
37
- "@remotion/three": "4.0.495",
38
- "@remotion/transitions": "4.0.495",
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",