@remotion/lottie 4.0.527 → 4.0.528

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.
@@ -1,6 +1,2 @@
1
1
  import type { LottieProps } from './types';
2
- /**
3
- * @description Part of the @remotion/lottie package.
4
- * @see [Documentation](https://www.remotion.dev/docs/lottie/lottie)
5
- */
6
- export declare const Lottie: ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, renderer, preserveAspectRatio, assetsPath, }: LottieProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Lottie: ({ from, durationInFrames, trimBefore, freeze, hidden, name, showInTimeline, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, style, ...props }: LottieProps) => import("react/jsx-runtime").JSX.Element;
@@ -15,7 +15,7 @@ const validate_playbackrate_1 = require("./validate-playbackrate");
15
15
  * @description Part of the @remotion/lottie package.
16
16
  * @see [Documentation](https://www.remotion.dev/docs/lottie/lottie)
17
17
  */
18
- const Lottie = ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, renderer, preserveAspectRatio, assetsPath, }) => {
18
+ const LottieContent = ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, renderer, preserveAspectRatio, assetsPath, }) => {
19
19
  if (typeof animationData !== 'object') {
20
20
  throw new Error('animationData should be provided as an object. If you only have the path to the JSON file, load it and pass it as animationData. See https://remotion.dev/docs/lottie/lottie#example for more information.');
21
21
  }
@@ -125,4 +125,17 @@ const Lottie = ({ animationData, className, direction, loop, playbackRate, style
125
125
  }, [direction, frame, loop, playbackRate, delayRender, continueRender]);
126
126
  return jsx_runtime_1.jsx("div", { ref: containerRef, className: className, style: style });
127
127
  };
128
+ const Lottie = ({ from, durationInFrames, trimBefore, freeze, hidden, name, showInTimeline, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, style, ...props }) => {
129
+ const { effectivePremountFor, effectivePostmountFor, freezeFrame, isPremountingOrPostmounting, premountingActive, postmountingActive, premountingStyle, } = remotion_1.Internals.usePremounting({
130
+ from: from !== null && from !== void 0 ? from : 0,
131
+ durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity,
132
+ premountFor: premountFor !== null && premountFor !== void 0 ? premountFor : null,
133
+ postmountFor: postmountFor !== null && postmountFor !== void 0 ? postmountFor : null,
134
+ style: style !== null && style !== void 0 ? style : null,
135
+ styleWhilePremounted: styleWhilePremounted !== null && styleWhilePremounted !== void 0 ? styleWhilePremounted : null,
136
+ styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
137
+ hideWhilePremounted: 'opacity',
138
+ });
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: durationInFrames, trimBefore: trimBefore, 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, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined }) }) }));
140
+ };
128
141
  exports.Lottie = Lottie;
@@ -1,5 +1,6 @@
1
1
  import type { AnimationItem } from 'lottie-web';
2
2
  import type { CSSProperties } from 'react';
3
+ import type { InteractiveBaseProps, InteractivePremountProps } from 'remotion';
3
4
  export type LottieAnimationData = {
4
5
  fr: number;
5
6
  w: number;
@@ -7,7 +8,7 @@ export type LottieAnimationData = {
7
8
  op: number;
8
9
  } & Record<string | number | symbol, unknown>;
9
10
  export type AspectRatioConstraint = 'none' | 'xMinYMin' | 'xMidYMin' | 'xMaxYMin' | 'xMinYMid' | 'xMidYMid' | 'xMaxYMid' | 'xMinYMax' | 'xMidYMax';
10
- export type LottieProps = {
11
+ export type LottieProps = Omit<InteractiveBaseProps, 'playbackRate'> & InteractivePremountProps & {
11
12
  /**
12
13
  * JSON object with the animation data.
13
14
  * */
@@ -18,7 +18,13 @@ var getLottieMetadata = (animationData) => {
18
18
  // src/Lottie.tsx
19
19
  import lottie from "lottie-web";
20
20
  import { useEffect, useRef, useState } from "react";
21
- import { useCurrentFrame, useDelayRender } from "remotion";
21
+ import {
22
+ Freeze,
23
+ Sequence,
24
+ Internals,
25
+ useCurrentFrame,
26
+ useDelayRender
27
+ } from "remotion";
22
28
 
23
29
  // src/utils.ts
24
30
  var getLottieFrame = ({
@@ -62,7 +68,7 @@ var validatePlaybackRate = (playbackRate) => {
62
68
 
63
69
  // src/Lottie.tsx
64
70
  import { jsx } from "react/jsx-runtime";
65
- var Lottie = ({
71
+ var LottieContent = ({
66
72
  animationData,
67
73
  className,
68
74
  direction,
@@ -179,6 +185,62 @@ var Lottie = ({
179
185
  style
180
186
  });
181
187
  };
188
+ var Lottie = ({
189
+ from,
190
+ durationInFrames,
191
+ trimBefore,
192
+ freeze,
193
+ hidden,
194
+ name,
195
+ showInTimeline,
196
+ premountFor,
197
+ postmountFor,
198
+ styleWhilePremounted,
199
+ styleWhilePostmounted,
200
+ style,
201
+ ...props
202
+ }) => {
203
+ const {
204
+ effectivePremountFor,
205
+ effectivePostmountFor,
206
+ freezeFrame,
207
+ isPremountingOrPostmounting,
208
+ premountingActive,
209
+ postmountingActive,
210
+ premountingStyle
211
+ } = Internals.usePremounting({
212
+ from: from ?? 0,
213
+ durationInFrames: durationInFrames ?? Infinity,
214
+ premountFor: premountFor ?? null,
215
+ postmountFor: postmountFor ?? null,
216
+ style: style ?? null,
217
+ styleWhilePremounted: styleWhilePremounted ?? null,
218
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
219
+ hideWhilePremounted: "opacity"
220
+ });
221
+ return /* @__PURE__ */ jsx(Freeze, {
222
+ frame: freezeFrame,
223
+ active: isPremountingOrPostmounting,
224
+ children: /* @__PURE__ */ jsx(Sequence, {
225
+ layout: "none",
226
+ from,
227
+ durationInFrames,
228
+ trimBefore,
229
+ freeze,
230
+ hidden,
231
+ name: name ?? "<Lottie>",
232
+ showInTimeline: showInTimeline ?? false,
233
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
234
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
235
+ _remotionInternalIsPremounting: premountingActive,
236
+ _remotionInternalIsPostmounting: postmountingActive,
237
+ children: /* @__PURE__ */ jsx(LottieContent, {
238
+ ...props,
239
+ style: premountingStyle ?? undefined
240
+ })
241
+ })
242
+ });
243
+ };
182
244
  export {
183
245
  getLottieMetadata,
184
246
  Lottie
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.527",
6
+ "version": "4.0.528",
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.527"
28
+ "remotion": "4.0.528"
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.527",
48
+ "@remotion/eslint-config-internal": "4.0.528",
49
49
  "eslint": "9.19.0",
50
50
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
51
51
  },