@remotion/lottie 3.2.28 → 3.2.30

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/Lottie.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import type { LottieProps } from './types';
3
- export declare const Lottie: ({ animationData, className, direction, loop, playbackRate, style, }: LottieProps) => JSX.Element;
3
+ export declare const Lottie: ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, }: LottieProps) => JSX.Element;
package/dist/Lottie.js CHANGED
@@ -11,7 +11,7 @@ const remotion_1 = require("remotion");
11
11
  const utils_1 = require("./utils");
12
12
  const validate_loop_1 = require("./validate-loop");
13
13
  const validate_playbackrate_1 = require("./validate-playbackrate");
14
- const Lottie = ({ animationData, className, direction, loop, playbackRate, style, }) => {
14
+ const Lottie = ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, }) => {
15
15
  if (typeof animationData !== 'object') {
16
16
  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.');
17
17
  }
@@ -20,9 +20,12 @@ const Lottie = ({ animationData, className, direction, loop, playbackRate, style
20
20
  const animationRef = (0, react_1.useRef)();
21
21
  const lastFrameRef = (0, react_1.useRef)(null);
22
22
  const containerRef = (0, react_1.useRef)(null);
23
+ const onAnimationLoadedRef = (0, react_1.useRef)();
24
+ onAnimationLoadedRef.current = onAnimationLoaded;
23
25
  const [handle] = (0, react_1.useState)(() => (0, remotion_1.delayRender)('Waiting for Lottie animation to load'));
24
26
  const frame = (0, remotion_1.useCurrentFrame)();
25
27
  (0, react_1.useEffect)(() => {
28
+ var _a;
26
29
  if (!containerRef.current) {
27
30
  return;
28
31
  }
@@ -39,6 +42,7 @@ const Lottie = ({ animationData, className, direction, loop, playbackRate, style
39
42
  (0, remotion_1.continueRender)(handle);
40
43
  };
41
44
  animation.addEventListener('DOMLoaded', onComplete);
45
+ (_a = onAnimationLoadedRef.current) === null || _a === void 0 ? void 0 : _a.call(onAnimationLoadedRef, animation);
42
46
  return () => {
43
47
  lastFrameRef.current = animation.currentFrame;
44
48
  animation.removeEventListener('DOMLoaded', onComplete);
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { AnimationItem } from 'lottie-web';
1
2
  import type { CSSProperties } from 'react';
2
3
  export declare type LottieAnimationData = {
3
4
  fr: number;
@@ -30,4 +31,8 @@ export declare type LottieProps = {
30
31
  * CSS properties to apply to the container of the animation.
31
32
  */
32
33
  style?: CSSProperties;
34
+ /**
35
+ * Callback that gets invoked when new animation data has been initialized
36
+ */
37
+ onAnimationLoaded?: (animation: AnimationItem) => void;
33
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lottie",
3
- "version": "3.2.28",
3
+ "version": "3.2.30",
4
4
  "description": "Remotion Lottie",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "license": "SEE LICENSE IN LICENSE.md",
29
29
  "dependencies": {
30
- "remotion": "3.2.28"
30
+ "remotion": "3.2.30"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "lottie-web": "^5",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "49bb70afa503bfb0c89ee51d8bf3386ad1b91ac4"
61
+ "gitHead": "5dc5f4c010c47186c7911b575998296d6a65f7cb"
62
62
  }