@remotion/transitions 4.0.519 → 4.0.521

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.
@@ -66,7 +66,7 @@ const HtmlInCanvasPresentation = ({ children, onElementImage, onUnmount, present
66
66
  };
67
67
  }, [instance]);
68
68
  const chainState = remotion_1.Internals.useEffectChainState();
69
- const { delayRender, continueRender } = (0, remotion_1.useDelayRender)();
69
+ const { delayRender, continueRender, cancelRender } = (0, remotion_1.useDelayRender)();
70
70
  const draw = (0, react_1.useCallback)(async (prevImage, nextImage, progress) => {
71
71
  var _a, _b, _c, _d, _e;
72
72
  const outputCanvas = outputCanvasRef.current;
@@ -74,47 +74,59 @@ const HtmlInCanvasPresentation = ({ children, onElementImage, onUnmount, present
74
74
  throw new Error('Canvas not found');
75
75
  }
76
76
  const handle = delayRender('onPaint');
77
- const clearOutput = () => {
78
- const context = outputCanvas.getContext('2d');
79
- if (!context) {
80
- throw new Error('Failed to create output canvas context');
77
+ try {
78
+ const clearOutput = () => {
79
+ const context = outputCanvas.getContext('2d');
80
+ if (!context) {
81
+ throw new Error('Failed to create output canvas context');
82
+ }
83
+ context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
84
+ };
85
+ if (!prevImage && !nextImage) {
86
+ instance.clear();
87
+ clearOutput();
88
+ continueRender(handle);
89
+ return;
81
90
  }
82
- context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
83
- };
84
- if (!prevImage && !nextImage) {
85
- instance.clear();
86
- clearOutput();
91
+ const width = (_b = (_a = prevImage === null || prevImage === void 0 ? void 0 : prevImage.width) !== null && _a !== void 0 ? _a : nextImage === null || nextImage === void 0 ? void 0 : nextImage.width) !== null && _b !== void 0 ? _b : 0;
92
+ const height = (_d = (_c = prevImage === null || prevImage === void 0 ? void 0 : prevImage.height) !== null && _c !== void 0 ? _c : nextImage === null || nextImage === void 0 ? void 0 : nextImage.height) !== null && _d !== void 0 ? _d : 0;
93
+ if (width === 0 || height === 0) {
94
+ instance.clear();
95
+ clearOutput();
96
+ continueRender(handle);
97
+ return;
98
+ }
99
+ shaderCanvas.width = width;
100
+ shaderCanvas.height = height;
101
+ instance.draw({
102
+ prevImage,
103
+ nextImage,
104
+ width,
105
+ height,
106
+ time: progress,
107
+ passedProps: passedPropsRef.current,
108
+ });
109
+ await remotion_1.Internals.runEffectChain({
110
+ state: chainState.get(width, height),
111
+ source: shaderCanvas,
112
+ effects: (_e = effectsRef.current) !== null && _e !== void 0 ? _e : [],
113
+ width,
114
+ height,
115
+ output: outputCanvas,
116
+ });
87
117
  continueRender(handle);
88
- return;
89
118
  }
90
- const width = (_b = (_a = prevImage === null || prevImage === void 0 ? void 0 : prevImage.width) !== null && _a !== void 0 ? _a : nextImage === null || nextImage === void 0 ? void 0 : nextImage.width) !== null && _b !== void 0 ? _b : 0;
91
- const height = (_d = (_c = prevImage === null || prevImage === void 0 ? void 0 : prevImage.height) !== null && _c !== void 0 ? _c : nextImage === null || nextImage === void 0 ? void 0 : nextImage.height) !== null && _d !== void 0 ? _d : 0;
92
- if (width === 0 || height === 0) {
93
- instance.clear();
94
- clearOutput();
95
- continueRender(handle);
96
- return;
119
+ catch (error) {
120
+ cancelRender(error);
97
121
  }
98
- shaderCanvas.width = width;
99
- shaderCanvas.height = height;
100
- instance.draw({
101
- prevImage,
102
- nextImage,
103
- width,
104
- height,
105
- time: progress,
106
- passedProps: passedPropsRef.current,
107
- });
108
- await remotion_1.Internals.runEffectChain({
109
- state: chainState.get(width, height),
110
- source: shaderCanvas,
111
- effects: (_e = effectsRef.current) !== null && _e !== void 0 ? _e : [],
112
- width,
113
- height,
114
- output: outputCanvas,
115
- });
116
- continueRender(handle);
117
- }, [chainState, continueRender, delayRender, instance, shaderCanvas]);
122
+ }, [
123
+ cancelRender,
124
+ chainState,
125
+ continueRender,
126
+ delayRender,
127
+ instance,
128
+ shaderCanvas,
129
+ ]);
118
130
  const passThrough = bothEnteringAndExiting && presentationDirection === 'exiting';
119
131
  (0, react_1.useLayoutEffect)(() => {
120
132
  if (passThrough) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/transitions"
4
4
  },
5
5
  "name": "@remotion/transitions",
6
- "version": "4.0.519",
6
+ "version": "4.0.521",
7
7
  "description": "Library for creating transitions in Remotion",
8
8
  "main": "dist/esm/index.mjs",
9
9
  "module": "dist/esm/index.js",
@@ -22,18 +22,18 @@
22
22
  "url": "https://github.com/remotion-dev/remotion/issues"
23
23
  },
24
24
  "dependencies": {
25
- "remotion": "4.0.519",
26
- "@remotion/shapes": "4.0.519",
27
- "@remotion/paths": "4.0.519"
25
+ "remotion": "4.0.521",
26
+ "@remotion/shapes": "4.0.521",
27
+ "@remotion/paths": "4.0.521"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@happy-dom/global-registrator": "14.5.1",
31
- "remotion": "4.0.519",
31
+ "remotion": "4.0.521",
32
32
  "react": "19.2.3",
33
33
  "react-dom": "19.2.3",
34
- "@remotion/test-utils": "4.0.519",
35
- "@remotion/player": "4.0.519",
36
- "@remotion/eslint-config-internal": "4.0.519",
34
+ "@remotion/test-utils": "4.0.521",
35
+ "@remotion/player": "4.0.521",
36
+ "@remotion/eslint-config-internal": "4.0.521",
37
37
  "eslint": "9.19.0",
38
38
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
39
39
  },