@depup/lottie-react 3.0.0-depup.0 → 3.1.0-depup.0

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.
Files changed (61) hide show
  1. package/README.md +2 -2
  2. package/build/animation/Lottie.cjs +3 -4
  3. package/build/animation/Lottie.js +3 -2
  4. package/build/animation/LottieDisplay.cjs +1 -0
  5. package/build/animation/LottieDisplay.js +1 -0
  6. package/build/animation/LottieLight.cjs +3 -4
  7. package/build/animation/LottieLight.js +3 -2
  8. package/build/animation/LottieSvg.cjs +3 -4
  9. package/build/animation/LottieSvg.js +3 -2
  10. package/build/animation/configureLottie.cjs +50 -0
  11. package/build/animation/configureLottie.d.cts +38 -0
  12. package/build/animation/configureLottie.d.ts +38 -0
  13. package/build/animation/configureLottie.js +48 -0
  14. package/build/animation/createLottieComponent.d.cts +1 -1
  15. package/build/animation/createLottieComponent.d.ts +1 -1
  16. package/build/animation/types.d.cts +20 -4
  17. package/build/animation/types.d.ts +20 -4
  18. package/build/animation/useLottie.cjs +9 -1
  19. package/build/animation/useLottie.d.cts +1 -30
  20. package/build/animation/useLottie.d.ts +1 -30
  21. package/build/animation/useLottie.js +9 -2
  22. package/build/animation/useLottieAnimation.cjs +5 -3
  23. package/build/animation/useLottieAnimation.d.cts +1 -1
  24. package/build/animation/useLottieAnimation.d.ts +1 -1
  25. package/build/animation/useLottieAnimation.js +5 -3
  26. package/build/animation/useLottieInstance.cjs +1 -0
  27. package/build/animation/useLottieInstance.js +1 -0
  28. package/build/animation/useLottieLight.cjs +9 -1
  29. package/build/animation/useLottieLight.d.cts +1 -10
  30. package/build/animation/useLottieLight.d.ts +1 -10
  31. package/build/animation/useLottieLight.js +9 -2
  32. package/build/animation/useLottieSvg.cjs +9 -1
  33. package/build/animation/useLottieSvg.d.cts +1 -8
  34. package/build/animation/useLottieSvg.d.ts +1 -8
  35. package/build/animation/useLottieSvg.js +9 -2
  36. package/build/controls/LottieControls.cjs +1 -0
  37. package/build/controls/LottieControls.js +1 -0
  38. package/build/index.cjs +5 -3
  39. package/build/index.d.cts +2 -1
  40. package/build/index.d.ts +2 -1
  41. package/build/index.js +5 -4
  42. package/build/interactions/LottieInteractions.cjs +1 -0
  43. package/build/interactions/LottieInteractions.js +1 -0
  44. package/build/interactions/lottieInView.cjs +1 -0
  45. package/build/interactions/lottieInView.js +1 -0
  46. package/build/interactions/lottieScrollScrub.cjs +18 -4
  47. package/build/interactions/lottieScrollScrub.d.cts +4 -3
  48. package/build/interactions/lottieScrollScrub.d.ts +4 -3
  49. package/build/interactions/lottieScrollScrub.js +18 -4
  50. package/build/interactions/types.d.cts +5 -1
  51. package/build/interactions/types.d.ts +5 -1
  52. package/build/interactions/useInteractionsRunner.cjs +15 -3
  53. package/build/interactions/useInteractionsRunner.js +15 -3
  54. package/build/interactions/useLottieInteractions.cjs +1 -0
  55. package/build/interactions/useLottieInteractions.js +1 -0
  56. package/build/overlays/LottieError.cjs +1 -0
  57. package/build/overlays/LottieError.js +1 -0
  58. package/build/overlays/LottieLoading.cjs +1 -0
  59. package/build/overlays/LottieLoading.js +1 -0
  60. package/changes.json +1 -1
  61. package/package.json +5 -5
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/lottie-react
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [lottie-react](https://www.npmjs.com/package/lottie-react) @ 3.0.0 |
17
- | Processed | 2026-08-16 |
16
+ | Original | [lottie-react](https://www.npmjs.com/package/lottie-react) @ 3.1.0 |
17
+ | Processed | 2026-08-17 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 0 |
20
20
 
@@ -1,7 +1,6 @@
1
- const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
1
+ "use client";
2
2
  const require_createLottieComponent = require("./createLottieComponent.cjs");
3
- let lottie_web = require("lottie-web");
4
- lottie_web = require_runtime.__toESM(lottie_web, 1);
3
+ const require_useLottie = require("./useLottie.cjs");
5
4
  //#region src/animation/Lottie.tsx
6
5
  /**
7
6
  * Renders an animation.
@@ -34,6 +33,6 @@ lottie_web = require_runtime.__toESM(lottie_web, 1);
34
33
  * animation uses no expressions either: each carries a smaller copy of the
35
34
  * engine.
36
35
  */
37
- const Lottie = require_createLottieComponent.createLottieComponent(lottie_web.default);
36
+ const Lottie = require_createLottieComponent.createLottieComponent(require_useLottie.fullEngine);
38
37
  //#endregion
39
38
  exports.Lottie = Lottie;
@@ -1,5 +1,6 @@
1
+ "use client";
1
2
  import { createLottieComponent } from "./createLottieComponent.js";
2
- import lottie from "lottie-web";
3
+ import { fullEngine } from "./useLottie.js";
3
4
  //#region src/animation/Lottie.tsx
4
5
  /**
5
6
  * Renders an animation.
@@ -32,6 +33,6 @@ import lottie from "lottie-web";
32
33
  * animation uses no expressions either: each carries a smaller copy of the
33
34
  * engine.
34
35
  */
35
- const Lottie = createLottieComponent(lottie);
36
+ const Lottie = createLottieComponent(fullEngine);
36
37
  //#endregion
37
38
  export { Lottie };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const require_mergeRefs = require("../utils/mergeRefs.cjs");
2
3
  const require_polymorphicForwardRef = require("./polymorphicForwardRef.cjs");
3
4
  const require_renderStyledElement = require("./renderStyledElement.cjs");
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { mergeRefs } from "../utils/mergeRefs.js";
2
3
  import { polymorphicForwardRef } from "./polymorphicForwardRef.js";
3
4
  import { renderStyledElement } from "./renderStyledElement.js";
@@ -1,7 +1,6 @@
1
- const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
1
+ "use client";
2
2
  const require_createLottieComponent = require("./createLottieComponent.cjs");
3
- let lottie_web_build_player_lottie_light_js = require("lottie-web/build/player/lottie_light.js");
4
- lottie_web_build_player_lottie_light_js = require_runtime.__toESM(lottie_web_build_player_lottie_light_js, 1);
3
+ const require_useLottieLight = require("./useLottieLight.cjs");
5
4
  //#region src/animation/LottieLight.tsx
6
5
  /**
7
6
  * Renders an animation using the light build of the engine.
@@ -14,6 +13,6 @@ lottie_web_build_player_lottie_light_js = require_runtime.__toESM(lottie_web_bui
14
13
  * drawn at its static value; {@link LottieSvg} is the smaller build that keeps
15
14
  * expressions.
16
15
  */
17
- const LottieLight = require_createLottieComponent.createLottieComponent(lottie_web_build_player_lottie_light_js.default);
16
+ const LottieLight = require_createLottieComponent.createLottieComponent(require_useLottieLight.lightEngine);
18
17
  //#endregion
19
18
  exports.LottieLight = LottieLight;
@@ -1,5 +1,6 @@
1
+ "use client";
1
2
  import { createLottieComponent } from "./createLottieComponent.js";
2
- import lottieLight from "lottie-web/build/player/lottie_light.js";
3
+ import { lightEngine } from "./useLottieLight.js";
3
4
  //#region src/animation/LottieLight.tsx
4
5
  /**
5
6
  * Renders an animation using the light build of the engine.
@@ -12,6 +13,6 @@ import lottieLight from "lottie-web/build/player/lottie_light.js";
12
13
  * drawn at its static value; {@link LottieSvg} is the smaller build that keeps
13
14
  * expressions.
14
15
  */
15
- const LottieLight = createLottieComponent(lottieLight);
16
+ const LottieLight = createLottieComponent(lightEngine);
16
17
  //#endregion
17
18
  export { LottieLight };
@@ -1,7 +1,6 @@
1
- const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
1
+ "use client";
2
2
  const require_createLottieComponent = require("./createLottieComponent.cjs");
3
- let lottie_web_build_player_lottie_svg_js = require("lottie-web/build/player/lottie_svg.js");
4
- lottie_web_build_player_lottie_svg_js = require_runtime.__toESM(lottie_web_build_player_lottie_svg_js, 1);
3
+ const require_useLottieSvg = require("./useLottieSvg.cjs");
5
4
  //#region src/animation/LottieSvg.tsx
6
5
  /**
7
6
  * Renders an animation using the svg build of the engine.
@@ -15,6 +14,6 @@ lottie_web_build_player_lottie_svg_js = require_runtime.__toESM(lottie_web_build
15
14
  * expression engine, so an animation whose properties are driven by
16
15
  * expressions plays as designed.
17
16
  */
18
- const LottieSvg = require_createLottieComponent.createLottieComponent(lottie_web_build_player_lottie_svg_js.default);
17
+ const LottieSvg = require_createLottieComponent.createLottieComponent(require_useLottieSvg.svgEngine);
19
18
  //#endregion
20
19
  exports.LottieSvg = LottieSvg;
@@ -1,5 +1,6 @@
1
+ "use client";
1
2
  import { createLottieComponent } from "./createLottieComponent.js";
2
- import lottieSvg from "lottie-web/build/player/lottie_svg.js";
3
+ import { svgEngine } from "./useLottieSvg.js";
3
4
  //#region src/animation/LottieSvg.tsx
4
5
  /**
5
6
  * Renders an animation using the svg build of the engine.
@@ -13,6 +14,6 @@ import lottieSvg from "lottie-web/build/player/lottie_svg.js";
13
14
  * expression engine, so an animation whose properties are driven by
14
15
  * expressions plays as designed.
15
16
  */
16
- const LottieSvg = createLottieComponent(lottieSvg);
17
+ const LottieSvg = createLottieComponent(svgEngine);
17
18
  //#endregion
18
19
  export { LottieSvg };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ //#region src/animation/configureLottie.ts
3
+ /**
4
+ * The engine builds by the name lottie-web gives each, which is the suffix a
5
+ * build's element IDs carry.
6
+ */
7
+ const LottieEngineName = {
8
+ full: "lottie",
9
+ svg: "lottie_svg",
10
+ light: "lottie_light"
11
+ };
12
+ let idPrefix = "lottie-react";
13
+ let quality;
14
+ const engines = /* @__PURE__ */ new Map();
15
+ function apply(player, name) {
16
+ player.setIDPrefix(`${idPrefix}-${name}`);
17
+ if (quality !== void 0) player.setQuality(quality);
18
+ }
19
+ /**
20
+ * Sets what is global to the engine rather than to one animation: the prefix
21
+ * of the element IDs it mints, and how finely it draws curves.
22
+ *
23
+ * ```ts
24
+ * configureLottie({ idPrefix: "crm", quality: "low" });
25
+ * ```
26
+ *
27
+ * Set it once, at startup, before animations load. It takes effect at once on
28
+ * every engine that has loaded an animation, and on the others when they first
29
+ * do, and it reaches what is already on screen: element IDs for everything the
30
+ * engines build from then on, the drawing quality of every animation on them.
31
+ * A field left out keeps its value.
32
+ */
33
+ function configureLottie(options) {
34
+ if (options.idPrefix !== void 0) idPrefix = options.idPrefix;
35
+ if (options.quality !== void 0) quality = options.quality;
36
+ for (const [player, name] of engines) apply(player, name);
37
+ }
38
+ /**
39
+ * Brings one engine up to the current settings and remembers it for later
40
+ * calls to {@link configureLottie}. The load path calls it right before
41
+ * `loadAnimation`.
42
+ */
43
+ function applyEngineSettings(engine) {
44
+ engines.set(engine.player, engine.name);
45
+ apply(engine.player, engine.name);
46
+ }
47
+ //#endregion
48
+ exports.LottieEngineName = LottieEngineName;
49
+ exports.applyEngineSettings = applyEngineSettings;
50
+ exports.configureLottie = configureLottie;
@@ -0,0 +1,38 @@
1
+ import "lottie-web";
2
+ //#region src/animation/configureLottie.d.ts
3
+ /** What {@link configureLottie} can be told. */
4
+ interface ConfigureLottieOptions {
5
+ /**
6
+ * The base of every element ID the engine mints, so that two copies of the
7
+ * library on one page can be told apart. Each engine build appends its own
8
+ * suffix (`-lottie`, `-lottie_svg`, `-lottie_light`), so the three builds
9
+ * never share an ID with each other. `lottie-react` unless set.
10
+ */
11
+ idPrefix?: string;
12
+ /**
13
+ * How finely curves are drawn: `low`, `medium`, `high`, or a number of
14
+ * segments above 1. Left alone, the engine draws with 150, between `medium`
15
+ * (50) and `high` (200); the named levels trade smoothness for work. Set it
16
+ * once, before animations load: the engine reads it whenever it builds a
17
+ * curve, so a change reaches every animation on the engine, running ones
18
+ * included.
19
+ */
20
+ quality?: "low" | "medium" | "high" | number;
21
+ }
22
+ /**
23
+ * Sets what is global to the engine rather than to one animation: the prefix
24
+ * of the element IDs it mints, and how finely it draws curves.
25
+ *
26
+ * ```ts
27
+ * configureLottie({ idPrefix: "crm", quality: "low" });
28
+ * ```
29
+ *
30
+ * Set it once, at startup, before animations load. It takes effect at once on
31
+ * every engine that has loaded an animation, and on the others when they first
32
+ * do, and it reaches what is already on screen: element IDs for everything the
33
+ * engines build from then on, the drawing quality of every animation on them.
34
+ * A field left out keeps its value.
35
+ */
36
+ declare function configureLottie(options: ConfigureLottieOptions): void;
37
+ //#endregion
38
+ export { ConfigureLottieOptions, configureLottie };
@@ -0,0 +1,38 @@
1
+ import "lottie-web";
2
+ //#region src/animation/configureLottie.d.ts
3
+ /** What {@link configureLottie} can be told. */
4
+ interface ConfigureLottieOptions {
5
+ /**
6
+ * The base of every element ID the engine mints, so that two copies of the
7
+ * library on one page can be told apart. Each engine build appends its own
8
+ * suffix (`-lottie`, `-lottie_svg`, `-lottie_light`), so the three builds
9
+ * never share an ID with each other. `lottie-react` unless set.
10
+ */
11
+ idPrefix?: string;
12
+ /**
13
+ * How finely curves are drawn: `low`, `medium`, `high`, or a number of
14
+ * segments above 1. Left alone, the engine draws with 150, between `medium`
15
+ * (50) and `high` (200); the named levels trade smoothness for work. Set it
16
+ * once, before animations load: the engine reads it whenever it builds a
17
+ * curve, so a change reaches every animation on the engine, running ones
18
+ * included.
19
+ */
20
+ quality?: "low" | "medium" | "high" | number;
21
+ }
22
+ /**
23
+ * Sets what is global to the engine rather than to one animation: the prefix
24
+ * of the element IDs it mints, and how finely it draws curves.
25
+ *
26
+ * ```ts
27
+ * configureLottie({ idPrefix: "crm", quality: "low" });
28
+ * ```
29
+ *
30
+ * Set it once, at startup, before animations load. It takes effect at once on
31
+ * every engine that has loaded an animation, and on the others when they first
32
+ * do, and it reaches what is already on screen: element IDs for everything the
33
+ * engines build from then on, the drawing quality of every animation on them.
34
+ * A field left out keeps its value.
35
+ */
36
+ declare function configureLottie(options: ConfigureLottieOptions): void;
37
+ //#endregion
38
+ export { ConfigureLottieOptions, configureLottie };
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ //#region src/animation/configureLottie.ts
3
+ /**
4
+ * The engine builds by the name lottie-web gives each, which is the suffix a
5
+ * build's element IDs carry.
6
+ */
7
+ const LottieEngineName = {
8
+ full: "lottie",
9
+ svg: "lottie_svg",
10
+ light: "lottie_light"
11
+ };
12
+ let idPrefix = "lottie-react";
13
+ let quality;
14
+ const engines = /* @__PURE__ */ new Map();
15
+ function apply(player, name) {
16
+ player.setIDPrefix(`${idPrefix}-${name}`);
17
+ if (quality !== void 0) player.setQuality(quality);
18
+ }
19
+ /**
20
+ * Sets what is global to the engine rather than to one animation: the prefix
21
+ * of the element IDs it mints, and how finely it draws curves.
22
+ *
23
+ * ```ts
24
+ * configureLottie({ idPrefix: "crm", quality: "low" });
25
+ * ```
26
+ *
27
+ * Set it once, at startup, before animations load. It takes effect at once on
28
+ * every engine that has loaded an animation, and on the others when they first
29
+ * do, and it reaches what is already on screen: element IDs for everything the
30
+ * engines build from then on, the drawing quality of every animation on them.
31
+ * A field left out keeps its value.
32
+ */
33
+ function configureLottie(options) {
34
+ if (options.idPrefix !== void 0) idPrefix = options.idPrefix;
35
+ if (options.quality !== void 0) quality = options.quality;
36
+ for (const [player, name] of engines) apply(player, name);
37
+ }
38
+ /**
39
+ * Brings one engine up to the current settings and remembers it for later
40
+ * calls to {@link configureLottie}. The load path calls it right before
41
+ * `loadAnimation`.
42
+ */
43
+ function applyEngineSettings(engine) {
44
+ engines.set(engine.player, engine.name);
45
+ apply(engine.player, engine.name);
46
+ }
47
+ //#endregion
48
+ export { LottieEngineName, applyEngineSettings, configureLottie };
@@ -1,6 +1,6 @@
1
+ import "./configureLottie.cjs";
1
2
  import { AnyTag, ElementProps, LottieHandle, LottieRenderer } from "./types.cjs";
2
3
  import { UseLottieOptions } from "./useLottieAnimation.cjs";
3
- import "lottie-web";
4
4
  import { ReactNode, Ref } from "react";
5
5
  //#region src/animation/createLottieComponent.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
+ import "./configureLottie.js";
1
2
  import { AnyTag, ElementProps, LottieHandle, LottieRenderer } from "./types.js";
2
3
  import { UseLottieOptions } from "./useLottieAnimation.js";
3
- import "lottie-web";
4
4
  import { ReactNode, Ref } from "react";
5
5
  //#region src/animation/createLottieComponent.d.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { SubscriptionManager } from "../utils/SubscriptionManager.cjs";
2
- import { AnimationItem, CanvasRendererConfig, HTMLRendererConfig, SVGRendererConfig } from "lottie-web";
2
+ import { AnimationItem, CanvasRendererConfig, FilterSizeConfig, HTMLRendererConfig, SVGRendererConfig } from "lottie-web";
3
3
  import { ComponentPropsWithoutRef, JSX, RefCallback } from "react";
4
4
  //#region src/animation/types.d.ts
5
5
  /**
@@ -111,23 +111,39 @@ type LottieSubscriptions = {
111
111
  interface RendererRows {
112
112
  svg: {
113
113
  puts: "inline";
114
- settings: SVGRendererConfig;
114
+ settings: SVGRendererConfig & SettingsTheEngineReads & SvgSizeSettings;
115
115
  inSvg: true;
116
116
  inLight: true;
117
117
  };
118
118
  canvas: {
119
119
  puts: "inline";
120
- settings: CanvasRendererConfig;
120
+ settings: CanvasRendererConfig & SettingsTheEngineReads;
121
121
  inSvg: false;
122
122
  inLight: false;
123
123
  };
124
124
  html: {
125
125
  puts: "block";
126
- settings: HTMLRendererConfig;
126
+ settings: HTMLRendererConfig & Pick<SettingsTheEngineReads, "runExpressions"> & {
127
+ /** The filter region for effects; declared on svg, read by html too. */
128
+ filterSize?: FilterSizeConfig;
129
+ };
127
130
  inSvg: false;
128
131
  inLight: false;
129
132
  };
130
133
  }
134
+ interface SettingsTheEngineReads {
135
+ /** Whether expressions in the file are evaluated. On unless turned off. */
136
+ runExpressions?: boolean;
137
+ /** The `content-visibility` the renderer sets on what it draws. */
138
+ contentVisibility?: string;
139
+ /** The `id` the renderer puts on the element it draws. */
140
+ id?: string;
141
+ }
142
+ /** The svg renderer alone sizes its `<svg>` from these, as attribute values. */
143
+ interface SvgSizeSettings {
144
+ width?: number | string;
145
+ height?: number | string;
146
+ }
131
147
  /**
132
148
  * The renderers the svg build of the engine contains.
133
149
  *
@@ -1,6 +1,6 @@
1
1
  import { SubscriptionManager } from "../utils/SubscriptionManager.js";
2
- import { AnimationItem, CanvasRendererConfig, HTMLRendererConfig, SVGRendererConfig } from "lottie-web";
3
2
  import { ComponentPropsWithoutRef, JSX, RefCallback } from "react";
3
+ import { AnimationItem, CanvasRendererConfig, FilterSizeConfig, HTMLRendererConfig, SVGRendererConfig } from "lottie-web";
4
4
  //#region src/animation/types.d.ts
5
5
  /**
6
6
  * The renderers lottie-web can draw an animation with.
@@ -111,23 +111,39 @@ type LottieSubscriptions = {
111
111
  interface RendererRows {
112
112
  svg: {
113
113
  puts: "inline";
114
- settings: SVGRendererConfig;
114
+ settings: SVGRendererConfig & SettingsTheEngineReads & SvgSizeSettings;
115
115
  inSvg: true;
116
116
  inLight: true;
117
117
  };
118
118
  canvas: {
119
119
  puts: "inline";
120
- settings: CanvasRendererConfig;
120
+ settings: CanvasRendererConfig & SettingsTheEngineReads;
121
121
  inSvg: false;
122
122
  inLight: false;
123
123
  };
124
124
  html: {
125
125
  puts: "block";
126
- settings: HTMLRendererConfig;
126
+ settings: HTMLRendererConfig & Pick<SettingsTheEngineReads, "runExpressions"> & {
127
+ /** The filter region for effects; declared on svg, read by html too. */
128
+ filterSize?: FilterSizeConfig;
129
+ };
127
130
  inSvg: false;
128
131
  inLight: false;
129
132
  };
130
133
  }
134
+ interface SettingsTheEngineReads {
135
+ /** Whether expressions in the file are evaluated. On unless turned off. */
136
+ runExpressions?: boolean;
137
+ /** The `content-visibility` the renderer sets on what it draws. */
138
+ contentVisibility?: string;
139
+ /** The `id` the renderer puts on the element it draws. */
140
+ id?: string;
141
+ }
142
+ /** The svg renderer alone sizes its `<svg>` from these, as attribute values. */
143
+ interface SvgSizeSettings {
144
+ width?: number | string;
145
+ height?: number | string;
146
+ }
131
147
  /**
132
148
  * The renderers the svg build of the engine contains.
133
149
  *
@@ -1,4 +1,6 @@
1
+ "use client";
1
2
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_configureLottie = require("./configureLottie.cjs");
2
4
  const require_useLottieAnimation = require("./useLottieAnimation.cjs");
3
5
  let lottie_web = require("lottie-web");
4
6
  lottie_web = require_runtime.__toESM(lottie_web, 1);
@@ -33,8 +35,14 @@ lottie_web = require_runtime.__toESM(lottie_web, 1);
33
35
  * the animation uses no expressions either: each carries a smaller copy of the
34
36
  * engine.
35
37
  */
38
+ /** The full engine: every renderer, expressions included. */
39
+ const fullEngine = {
40
+ player: lottie_web.default,
41
+ name: require_configureLottie.LottieEngineName.full
42
+ };
36
43
  function useLottie(options) {
37
- return require_useLottieAnimation.useLottieAnimation(lottie_web.default, options);
44
+ return require_useLottieAnimation.useLottieAnimation(fullEngine, options);
38
45
  }
39
46
  //#endregion
47
+ exports.fullEngine = fullEngine;
40
48
  exports.useLottie = useLottie;
@@ -1,36 +1,7 @@
1
+ import "./configureLottie.cjs";
1
2
  import { LottieInstance, LottieRenderer } from "./types.cjs";
2
3
  import { UseLottieOptions } from "./useLottieAnimation.cjs";
3
4
  //#region src/animation/useLottie.d.ts
4
- /**
5
- * Loads and drives an animation, and hands back everything needed to render it
6
- * and to control it.
7
- *
8
- * Give `setDisplayRef` to the element the animation should be drawn inside;
9
- * nothing appears until you do. Give it a size, too, since the animation fills
10
- * whatever box it is in and a box of no height shows nothing.
11
- *
12
- * ```jsx
13
- * const lottie = useLottie({ src });
14
- * return <div ref={lottie.setDisplayRef} style={{ height: 300 }} />;
15
- * ```
16
- *
17
- * An element takes one `ref`, so reach it and hand it to us in one callback
18
- * when you want both. Wrapping that callback in `useCallback` stops React
19
- * detaching and reattaching it on every render.
20
- *
21
- * ```jsx
22
- * const mine = useRef(null);
23
- * const setRef = useCallback(
24
- * (node) => { mine.current = node; lottie.setDisplayRef(node); },
25
- * [lottie.setDisplayRef],
26
- * );
27
- * ```
28
- *
29
- * This is the full build, so every renderer is available. Reach for
30
- * `useLottieSvg` instead when only `svg` is needed, or `useLottieLight` when
31
- * the animation uses no expressions either: each carries a smaller copy of the
32
- * engine.
33
- */
34
5
  declare function useLottie<Renderer extends LottieRenderer = typeof LottieRenderer.svg>(options: UseLottieOptions<Renderer>): LottieInstance;
35
6
  //#endregion
36
7
  export { useLottie };
@@ -1,36 +1,7 @@
1
+ import "./configureLottie.js";
1
2
  import { LottieInstance, LottieRenderer } from "./types.js";
2
3
  import { UseLottieOptions } from "./useLottieAnimation.js";
3
4
  //#region src/animation/useLottie.d.ts
4
- /**
5
- * Loads and drives an animation, and hands back everything needed to render it
6
- * and to control it.
7
- *
8
- * Give `setDisplayRef` to the element the animation should be drawn inside;
9
- * nothing appears until you do. Give it a size, too, since the animation fills
10
- * whatever box it is in and a box of no height shows nothing.
11
- *
12
- * ```jsx
13
- * const lottie = useLottie({ src });
14
- * return <div ref={lottie.setDisplayRef} style={{ height: 300 }} />;
15
- * ```
16
- *
17
- * An element takes one `ref`, so reach it and hand it to us in one callback
18
- * when you want both. Wrapping that callback in `useCallback` stops React
19
- * detaching and reattaching it on every render.
20
- *
21
- * ```jsx
22
- * const mine = useRef(null);
23
- * const setRef = useCallback(
24
- * (node) => { mine.current = node; lottie.setDisplayRef(node); },
25
- * [lottie.setDisplayRef],
26
- * );
27
- * ```
28
- *
29
- * This is the full build, so every renderer is available. Reach for
30
- * `useLottieSvg` instead when only `svg` is needed, or `useLottieLight` when
31
- * the animation uses no expressions either: each carries a smaller copy of the
32
- * engine.
33
- */
34
5
  declare function useLottie<Renderer extends LottieRenderer = typeof LottieRenderer.svg>(options: UseLottieOptions<Renderer>): LottieInstance;
35
6
  //#endregion
36
7
  export { useLottie };
@@ -1,3 +1,5 @@
1
+ "use client";
2
+ import { LottieEngineName } from "./configureLottie.js";
1
3
  import { useLottieAnimation } from "./useLottieAnimation.js";
2
4
  import lottie from "lottie-web";
3
5
  //#region src/animation/useLottie.ts
@@ -31,8 +33,13 @@ import lottie from "lottie-web";
31
33
  * the animation uses no expressions either: each carries a smaller copy of the
32
34
  * engine.
33
35
  */
36
+ /** The full engine: every renderer, expressions included. */
37
+ const fullEngine = {
38
+ player: lottie,
39
+ name: LottieEngineName.full
40
+ };
34
41
  function useLottie(options) {
35
- return useLottieAnimation(lottie, options);
42
+ return useLottieAnimation(fullEngine, options);
36
43
  }
37
44
  //#endregion
38
- export { useLottie };
45
+ export { fullEngine, useLottie };
@@ -1,3 +1,4 @@
1
+ const require_configureLottie = require("./configureLottie.cjs");
1
2
  const require_createLogger = require("../utils/createLogger.cjs");
2
3
  const require_SubscriptionManager = require("../utils/SubscriptionManager.cjs");
3
4
  const require_useStableValue = require("../utils/useStableValue.cjs");
@@ -20,7 +21,7 @@ function toError(cause) {
20
21
  * Reach it through `useLottie`, `useLottieSvg` or `useLottieLight` rather than
21
22
  * directly.
22
23
  */
23
- function useLottieAnimation(lottie, options) {
24
+ function useLottieAnimation(engine, options) {
24
25
  const { src, renderer, rendererSettings, loop, speed, direction, autoplay = false, segment, assetsPath, debug = false, subscriptions } = options;
25
26
  const [manager] = (0, react.useState)(() => new require_SubscriptionManager.SubscriptionManager());
26
27
  const [display, setDisplay] = (0, react.useState)(null);
@@ -291,9 +292,10 @@ function useLottieAnimation(lottie, options) {
291
292
  loop: valuesRef.current.loop,
292
293
  segment: loadConfig.segment
293
294
  });
295
+ require_configureLottie.applyEngineSettings(engine);
294
296
  let item;
295
297
  try {
296
- item = lottie.loadAnimation({
298
+ item = engine.player.loadAnimation({
297
299
  ...normalized,
298
300
  container: display,
299
301
  renderer: chosenRenderer,
@@ -380,7 +382,7 @@ function useLottieAnimation(lottie, options) {
380
382
  display,
381
383
  source,
382
384
  loadConfig,
383
- lottie,
385
+ engine,
384
386
  manager,
385
387
  refreshRange,
386
388
  loadAttempt
@@ -1,5 +1,5 @@
1
+ import "./configureLottie.cjs";
1
2
  import { LottieDirection, LottieRenderer, LottieSubscriptions, RendererRows } from "./types.cjs";
2
- import "lottie-web";
3
3
  //#region src/animation/useLottieAnimation.d.ts
4
4
  /** The options both public hooks take. */
5
5
  interface UseLottieOptions<Renderer extends LottieRenderer = typeof LottieRenderer.svg> {
@@ -1,5 +1,5 @@
1
+ import "./configureLottie.js";
1
2
  import { LottieDirection, LottieRenderer, LottieSubscriptions, RendererRows } from "./types.js";
2
- import "lottie-web";
3
3
  //#region src/animation/useLottieAnimation.d.ts
4
4
  /** The options both public hooks take. */
5
5
  interface UseLottieOptions<Renderer extends LottieRenderer = typeof LottieRenderer.svg> {
@@ -1,3 +1,4 @@
1
+ import { applyEngineSettings } from "./configureLottie.js";
1
2
  import { createLogger } from "../utils/createLogger.js";
2
3
  import { SubscriptionManager } from "../utils/SubscriptionManager.js";
3
4
  import { useStableValue } from "../utils/useStableValue.js";
@@ -20,7 +21,7 @@ function toError(cause) {
20
21
  * Reach it through `useLottie`, `useLottieSvg` or `useLottieLight` rather than
21
22
  * directly.
22
23
  */
23
- function useLottieAnimation(lottie, options) {
24
+ function useLottieAnimation(engine, options) {
24
25
  const { src, renderer, rendererSettings, loop, speed, direction, autoplay = false, segment, assetsPath, debug = false, subscriptions } = options;
25
26
  const [manager] = useState(() => new SubscriptionManager());
26
27
  const [display, setDisplay] = useState(null);
@@ -291,9 +292,10 @@ function useLottieAnimation(lottie, options) {
291
292
  loop: valuesRef.current.loop,
292
293
  segment: loadConfig.segment
293
294
  });
295
+ applyEngineSettings(engine);
294
296
  let item;
295
297
  try {
296
- item = lottie.loadAnimation({
298
+ item = engine.player.loadAnimation({
297
299
  ...normalized,
298
300
  container: display,
299
301
  renderer: chosenRenderer,
@@ -380,7 +382,7 @@ function useLottieAnimation(lottie, options) {
380
382
  display,
381
383
  source,
382
384
  loadConfig,
383
- lottie,
385
+ engine,
384
386
  manager,
385
387
  refreshRange,
386
388
  loadAttempt
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const require_LottieInstanceContext = require("./LottieInstanceContext.cjs");
2
3
  let react = require("react");
3
4
  //#region src/animation/useLottieInstance.ts
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { LottieInstanceContext } from "./LottieInstanceContext.js";
2
3
  import { useContext } from "react";
3
4
  //#region src/animation/useLottieInstance.ts