@remotion/lottie 4.0.534 → 4.0.535
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.
- package/dist/cjs/Lottie.js +7 -12
- package/dist/esm/index.mjs +11 -14
- package/package.json +3 -3
package/dist/cjs/Lottie.js
CHANGED
|
@@ -22,20 +22,14 @@ const LottieContent = ({ animationData, className, direction, style, onAnimation
|
|
|
22
22
|
const onAnimationLoadedRef = (0, react_1.useRef)(onAnimationLoaded);
|
|
23
23
|
onAnimationLoadedRef.current = onAnimationLoaded;
|
|
24
24
|
const { delayRender, continueRender } = (0, remotion_1.useDelayRender)();
|
|
25
|
-
const [handle] = (0, react_1.useState)(() => delayRender('Waiting for Lottie animation to load'));
|
|
26
|
-
// If component unmounts, continue the render
|
|
27
|
-
(0, react_1.useEffect)(() => {
|
|
28
|
-
return () => {
|
|
29
|
-
continueRender(handle);
|
|
30
|
-
};
|
|
31
|
-
}, [handle, continueRender]);
|
|
32
25
|
const frame = (0, remotion_1.useCurrentFrame)();
|
|
33
26
|
currentFrameRef.current = frame;
|
|
34
|
-
(0, react_1.
|
|
27
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
35
28
|
var _a;
|
|
36
29
|
if (!containerRef.current) {
|
|
37
30
|
return;
|
|
38
31
|
}
|
|
32
|
+
const handle = delayRender('Waiting for Lottie animation to load');
|
|
39
33
|
animationRef.current = lottie_web_1.default.loadAnimation({
|
|
40
34
|
container: containerRef.current,
|
|
41
35
|
autoplay: false,
|
|
@@ -68,22 +62,23 @@ const LottieContent = ({ animationData, className, direction, style, onAnimation
|
|
|
68
62
|
return () => {
|
|
69
63
|
animation.removeEventListener('DOMLoaded', onComplete);
|
|
70
64
|
animation.destroy();
|
|
65
|
+
continueRender(handle);
|
|
71
66
|
};
|
|
72
67
|
}, [
|
|
73
68
|
animationData,
|
|
74
69
|
assetsPath,
|
|
75
70
|
direction,
|
|
76
|
-
handle,
|
|
77
71
|
preserveAspectRatio,
|
|
78
72
|
renderer,
|
|
79
73
|
continueRender,
|
|
74
|
+
delayRender,
|
|
80
75
|
]);
|
|
81
|
-
(0, react_1.
|
|
76
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
82
77
|
if (animationRef.current && direction) {
|
|
83
78
|
animationRef.current.setDirection(direction === 'backward' ? -1 : 1);
|
|
84
79
|
}
|
|
85
80
|
}, [direction]);
|
|
86
|
-
(0, react_1.
|
|
81
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
87
82
|
var _a;
|
|
88
83
|
if (!animationRef.current) {
|
|
89
84
|
return;
|
|
@@ -136,6 +131,6 @@ const Lottie = ({ animationData, from, durationInFrames, trimBefore, playbackRat
|
|
|
136
131
|
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
137
132
|
hideWhilePremounted: 'opacity',
|
|
138
133
|
});
|
|
139
|
-
return (jsx_runtime_1.jsx(remotion_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, durationInFrames: sequenceDurationInFrames, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Lottie>', showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : false, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(LottieContent, { ...props, animationData: animationData, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined }) }) }));
|
|
134
|
+
return (jsx_runtime_1.jsx(remotion_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, durationInFrames: sequenceDurationInFrames, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Lottie>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/lottie/lottie", showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : false, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(LottieContent, { ...props, animationData: animationData, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined }) }) }));
|
|
140
135
|
};
|
|
141
136
|
exports.Lottie = Lottie;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ var getLottieMetadata = (animationData) => {
|
|
|
17
17
|
};
|
|
18
18
|
// src/Lottie.tsx
|
|
19
19
|
import lottie from "lottie-web";
|
|
20
|
-
import {
|
|
20
|
+
import { useLayoutEffect, useRef } from "react";
|
|
21
21
|
import {
|
|
22
22
|
Freeze,
|
|
23
23
|
Sequence,
|
|
@@ -84,18 +84,13 @@ var LottieContent = ({
|
|
|
84
84
|
const onAnimationLoadedRef = useRef(onAnimationLoaded);
|
|
85
85
|
onAnimationLoadedRef.current = onAnimationLoaded;
|
|
86
86
|
const { delayRender, continueRender } = useDelayRender();
|
|
87
|
-
const [handle] = useState(() => delayRender("Waiting for Lottie animation to load"));
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
return () => {
|
|
90
|
-
continueRender(handle);
|
|
91
|
-
};
|
|
92
|
-
}, [handle, continueRender]);
|
|
93
87
|
const frame = useCurrentFrame();
|
|
94
88
|
currentFrameRef.current = frame;
|
|
95
|
-
|
|
89
|
+
useLayoutEffect(() => {
|
|
96
90
|
if (!containerRef.current) {
|
|
97
91
|
return;
|
|
98
92
|
}
|
|
93
|
+
const handle = delayRender("Waiting for Lottie animation to load");
|
|
99
94
|
animationRef.current = lottie.loadAnimation({
|
|
100
95
|
container: containerRef.current,
|
|
101
96
|
autoplay: false,
|
|
@@ -124,22 +119,23 @@ var LottieContent = ({
|
|
|
124
119
|
return () => {
|
|
125
120
|
animation.removeEventListener("DOMLoaded", onComplete);
|
|
126
121
|
animation.destroy();
|
|
122
|
+
continueRender(handle);
|
|
127
123
|
};
|
|
128
124
|
}, [
|
|
129
125
|
animationData,
|
|
130
126
|
assetsPath,
|
|
131
127
|
direction,
|
|
132
|
-
handle,
|
|
133
128
|
preserveAspectRatio,
|
|
134
129
|
renderer,
|
|
135
|
-
continueRender
|
|
130
|
+
continueRender,
|
|
131
|
+
delayRender
|
|
136
132
|
]);
|
|
137
|
-
|
|
133
|
+
useLayoutEffect(() => {
|
|
138
134
|
if (animationRef.current && direction) {
|
|
139
135
|
animationRef.current.setDirection(direction === "backward" ? -1 : 1);
|
|
140
136
|
}
|
|
141
137
|
}, [direction]);
|
|
142
|
-
|
|
138
|
+
useLayoutEffect(() => {
|
|
143
139
|
if (!animationRef.current) {
|
|
144
140
|
return;
|
|
145
141
|
}
|
|
@@ -228,6 +224,7 @@ var Lottie = ({
|
|
|
228
224
|
freeze,
|
|
229
225
|
hidden,
|
|
230
226
|
name: name ?? "<Lottie>",
|
|
227
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/lottie/lottie",
|
|
231
228
|
showInTimeline: showInTimeline ?? false,
|
|
232
229
|
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
233
230
|
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
@@ -242,6 +239,6 @@ var Lottie = ({
|
|
|
242
239
|
});
|
|
243
240
|
};
|
|
244
241
|
export {
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
Lottie,
|
|
243
|
+
getLottieMetadata
|
|
247
244
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/lottie"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/lottie",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.535",
|
|
7
7
|
"description": "Include Lottie animations in Remotion",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"remotion": "4.0.
|
|
28
|
+
"remotion": "4.0.535"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"lottie-web": "^5",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react": "19.2.3",
|
|
46
46
|
"react-dom": "19.2.3",
|
|
47
47
|
"lottie-web": "5.13.0",
|
|
48
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
48
|
+
"@remotion/eslint-config-internal": "4.0.535",
|
|
49
49
|
"eslint": "9.19.0",
|
|
50
50
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
51
51
|
},
|