@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.
- package/README.md +2 -2
- package/build/animation/Lottie.cjs +3 -4
- package/build/animation/Lottie.js +3 -2
- package/build/animation/LottieDisplay.cjs +1 -0
- package/build/animation/LottieDisplay.js +1 -0
- package/build/animation/LottieLight.cjs +3 -4
- package/build/animation/LottieLight.js +3 -2
- package/build/animation/LottieSvg.cjs +3 -4
- package/build/animation/LottieSvg.js +3 -2
- package/build/animation/configureLottie.cjs +50 -0
- package/build/animation/configureLottie.d.cts +38 -0
- package/build/animation/configureLottie.d.ts +38 -0
- package/build/animation/configureLottie.js +48 -0
- package/build/animation/createLottieComponent.d.cts +1 -1
- package/build/animation/createLottieComponent.d.ts +1 -1
- package/build/animation/types.d.cts +20 -4
- package/build/animation/types.d.ts +20 -4
- package/build/animation/useLottie.cjs +9 -1
- package/build/animation/useLottie.d.cts +1 -30
- package/build/animation/useLottie.d.ts +1 -30
- package/build/animation/useLottie.js +9 -2
- package/build/animation/useLottieAnimation.cjs +5 -3
- package/build/animation/useLottieAnimation.d.cts +1 -1
- package/build/animation/useLottieAnimation.d.ts +1 -1
- package/build/animation/useLottieAnimation.js +5 -3
- package/build/animation/useLottieInstance.cjs +1 -0
- package/build/animation/useLottieInstance.js +1 -0
- package/build/animation/useLottieLight.cjs +9 -1
- package/build/animation/useLottieLight.d.cts +1 -10
- package/build/animation/useLottieLight.d.ts +1 -10
- package/build/animation/useLottieLight.js +9 -2
- package/build/animation/useLottieSvg.cjs +9 -1
- package/build/animation/useLottieSvg.d.cts +1 -8
- package/build/animation/useLottieSvg.d.ts +1 -8
- package/build/animation/useLottieSvg.js +9 -2
- package/build/controls/LottieControls.cjs +1 -0
- package/build/controls/LottieControls.js +1 -0
- package/build/index.cjs +5 -3
- package/build/index.d.cts +2 -1
- package/build/index.d.ts +2 -1
- package/build/index.js +5 -4
- package/build/interactions/LottieInteractions.cjs +1 -0
- package/build/interactions/LottieInteractions.js +1 -0
- package/build/interactions/lottieInView.cjs +1 -0
- package/build/interactions/lottieInView.js +1 -0
- package/build/interactions/lottieScrollScrub.cjs +18 -4
- package/build/interactions/lottieScrollScrub.d.cts +4 -3
- package/build/interactions/lottieScrollScrub.d.ts +4 -3
- package/build/interactions/lottieScrollScrub.js +18 -4
- package/build/interactions/types.d.cts +5 -1
- package/build/interactions/types.d.ts +5 -1
- package/build/interactions/useInteractionsRunner.cjs +15 -3
- package/build/interactions/useInteractionsRunner.js +15 -3
- package/build/interactions/useLottieInteractions.cjs +1 -0
- package/build/interactions/useLottieInteractions.js +1 -0
- package/build/overlays/LottieError.cjs +1 -0
- package/build/overlays/LottieError.js +1 -0
- package/build/overlays/LottieLoading.cjs +1 -0
- package/build/overlays/LottieLoading.js +1 -0
- package/changes.json +1 -1
- package/package.json +5 -5
|
@@ -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_build_player_lottie_light_js = require("lottie-web/build/player/lottie_light.js");
|
|
4
6
|
lottie_web_build_player_lottie_light_js = require_runtime.__toESM(lottie_web_build_player_lottie_light_js, 1);
|
|
@@ -13,8 +15,14 @@ lottie_web_build_player_lottie_light_js = require_runtime.__toESM(lottie_web_bui
|
|
|
13
15
|
* drawn at its static value; {@link useLottieSvg} is the smaller build that
|
|
14
16
|
* keeps expressions.
|
|
15
17
|
*/
|
|
18
|
+
/** The light engine: svg only, no expressions, no `eval`. */
|
|
19
|
+
const lightEngine = {
|
|
20
|
+
player: lottie_web_build_player_lottie_light_js.default,
|
|
21
|
+
name: require_configureLottie.LottieEngineName.light
|
|
22
|
+
};
|
|
16
23
|
function useLottieLight(options) {
|
|
17
|
-
return require_useLottieAnimation.useLottieAnimation(
|
|
24
|
+
return require_useLottieAnimation.useLottieAnimation(lightEngine, options);
|
|
18
25
|
}
|
|
19
26
|
//#endregion
|
|
27
|
+
exports.lightEngine = lightEngine;
|
|
20
28
|
exports.useLottieLight = useLottieLight;
|
|
@@ -1,16 +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/useLottieLight.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Loads and drives an animation using the light build of the engine.
|
|
6
|
-
*
|
|
7
|
-
* Identical to {@link useLottie} except that `svg` is the only renderer, which
|
|
8
|
-
* the type enforces: the light build does not contain the other two, and asking
|
|
9
|
-
* it for one throws at runtime while its own declarations claim otherwise.
|
|
10
|
-
* It also carries no expression engine, so a property an expression drives is
|
|
11
|
-
* drawn at its static value; {@link useLottieSvg} is the smaller build that
|
|
12
|
-
* keeps expressions.
|
|
13
|
-
*/
|
|
14
5
|
declare function useLottieLight(options: UseLottieOptions<typeof LottieRenderer.svg>): LottieInstance;
|
|
15
6
|
//#endregion
|
|
16
7
|
export { useLottieLight };
|
|
@@ -1,16 +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/useLottieLight.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Loads and drives an animation using the light build of the engine.
|
|
6
|
-
*
|
|
7
|
-
* Identical to {@link useLottie} except that `svg` is the only renderer, which
|
|
8
|
-
* the type enforces: the light build does not contain the other two, and asking
|
|
9
|
-
* it for one throws at runtime while its own declarations claim otherwise.
|
|
10
|
-
* It also carries no expression engine, so a property an expression drives is
|
|
11
|
-
* drawn at its static value; {@link useLottieSvg} is the smaller build that
|
|
12
|
-
* keeps expressions.
|
|
13
|
-
*/
|
|
14
5
|
declare function useLottieLight(options: UseLottieOptions<typeof LottieRenderer.svg>): LottieInstance;
|
|
15
6
|
//#endregion
|
|
16
7
|
export { useLottieLight };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { LottieEngineName } from "./configureLottie.js";
|
|
1
3
|
import { useLottieAnimation } from "./useLottieAnimation.js";
|
|
2
4
|
import lottieLight from "lottie-web/build/player/lottie_light.js";
|
|
3
5
|
//#region src/animation/useLottieLight.ts
|
|
@@ -11,8 +13,13 @@ import lottieLight from "lottie-web/build/player/lottie_light.js";
|
|
|
11
13
|
* drawn at its static value; {@link useLottieSvg} is the smaller build that
|
|
12
14
|
* keeps expressions.
|
|
13
15
|
*/
|
|
16
|
+
/** The light engine: svg only, no expressions, no `eval`. */
|
|
17
|
+
const lightEngine = {
|
|
18
|
+
player: lottieLight,
|
|
19
|
+
name: LottieEngineName.light
|
|
20
|
+
};
|
|
14
21
|
function useLottieLight(options) {
|
|
15
|
-
return useLottieAnimation(
|
|
22
|
+
return useLottieAnimation(lightEngine, options);
|
|
16
23
|
}
|
|
17
24
|
//#endregion
|
|
18
|
-
export { useLottieLight };
|
|
25
|
+
export { lightEngine, useLottieLight };
|
|
@@ -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_build_player_lottie_svg_js = require("lottie-web/build/player/lottie_svg.js");
|
|
4
6
|
lottie_web_build_player_lottie_svg_js = require_runtime.__toESM(lottie_web_build_player_lottie_svg_js, 1);
|
|
@@ -11,8 +13,14 @@ lottie_web_build_player_lottie_svg_js = require_runtime.__toESM(lottie_web_build
|
|
|
11
13
|
* it for one throws at runtime while its own declarations claim otherwise.
|
|
12
14
|
* Unlike {@link useLottieLight} it keeps the expression engine.
|
|
13
15
|
*/
|
|
16
|
+
/** The svg engine: svg only, expressions kept. */
|
|
17
|
+
const svgEngine = {
|
|
18
|
+
player: lottie_web_build_player_lottie_svg_js.default,
|
|
19
|
+
name: require_configureLottie.LottieEngineName.svg
|
|
20
|
+
};
|
|
14
21
|
function useLottieSvg(options) {
|
|
15
|
-
return require_useLottieAnimation.useLottieAnimation(
|
|
22
|
+
return require_useLottieAnimation.useLottieAnimation(svgEngine, options);
|
|
16
23
|
}
|
|
17
24
|
//#endregion
|
|
25
|
+
exports.svgEngine = svgEngine;
|
|
18
26
|
exports.useLottieSvg = useLottieSvg;
|
|
@@ -1,14 +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/useLottieSvg.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Loads and drives an animation using the svg build of the engine.
|
|
6
|
-
*
|
|
7
|
-
* Identical to {@link useLottie} except that `svg` is the only renderer, which
|
|
8
|
-
* the type enforces: the svg build does not contain the other two, and asking
|
|
9
|
-
* it for one throws at runtime while its own declarations claim otherwise.
|
|
10
|
-
* Unlike {@link useLottieLight} it keeps the expression engine.
|
|
11
|
-
*/
|
|
12
5
|
declare function useLottieSvg(options: UseLottieOptions<typeof LottieRenderer.svg>): LottieInstance;
|
|
13
6
|
//#endregion
|
|
14
7
|
export { useLottieSvg };
|
|
@@ -1,14 +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/useLottieSvg.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Loads and drives an animation using the svg build of the engine.
|
|
6
|
-
*
|
|
7
|
-
* Identical to {@link useLottie} except that `svg` is the only renderer, which
|
|
8
|
-
* the type enforces: the svg build does not contain the other two, and asking
|
|
9
|
-
* it for one throws at runtime while its own declarations claim otherwise.
|
|
10
|
-
* Unlike {@link useLottieLight} it keeps the expression engine.
|
|
11
|
-
*/
|
|
12
5
|
declare function useLottieSvg(options: UseLottieOptions<typeof LottieRenderer.svg>): LottieInstance;
|
|
13
6
|
//#endregion
|
|
14
7
|
export { useLottieSvg };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { LottieEngineName } from "./configureLottie.js";
|
|
1
3
|
import { useLottieAnimation } from "./useLottieAnimation.js";
|
|
2
4
|
import lottieSvg from "lottie-web/build/player/lottie_svg.js";
|
|
3
5
|
//#region src/animation/useLottieSvg.ts
|
|
@@ -9,8 +11,13 @@ import lottieSvg from "lottie-web/build/player/lottie_svg.js";
|
|
|
9
11
|
* it for one throws at runtime while its own declarations claim otherwise.
|
|
10
12
|
* Unlike {@link useLottieLight} it keeps the expression engine.
|
|
11
13
|
*/
|
|
14
|
+
/** The svg engine: svg only, expressions kept. */
|
|
15
|
+
const svgEngine = {
|
|
16
|
+
player: lottieSvg,
|
|
17
|
+
name: LottieEngineName.svg
|
|
18
|
+
};
|
|
12
19
|
function useLottieSvg(options) {
|
|
13
|
-
return useLottieAnimation(
|
|
20
|
+
return useLottieAnimation(svgEngine, options);
|
|
14
21
|
}
|
|
15
22
|
//#endregion
|
|
16
|
-
export { useLottieSvg };
|
|
23
|
+
export { svgEngine, useLottieSvg };
|
package/build/index.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_configureLottie = require("./animation/configureLottie.cjs");
|
|
2
3
|
const require_useLottieInstance = require("./animation/useLottieInstance.cjs");
|
|
3
4
|
const require_LottieDisplay = require("./animation/LottieDisplay.cjs");
|
|
4
5
|
const require_types = require("./animation/types.cjs");
|
|
5
|
-
const require_Lottie = require("./animation/Lottie.cjs");
|
|
6
|
-
const require_LottieLight = require("./animation/LottieLight.cjs");
|
|
7
|
-
const require_LottieSvg = require("./animation/LottieSvg.cjs");
|
|
8
6
|
const require_useLottie = require("./animation/useLottie.cjs");
|
|
7
|
+
const require_Lottie = require("./animation/Lottie.cjs");
|
|
9
8
|
const require_useLottieLight = require("./animation/useLottieLight.cjs");
|
|
9
|
+
const require_LottieLight = require("./animation/LottieLight.cjs");
|
|
10
10
|
const require_useLottieSvg = require("./animation/useLottieSvg.cjs");
|
|
11
|
+
const require_LottieSvg = require("./animation/LottieSvg.cjs");
|
|
11
12
|
const require_LottieControls = require("./controls/LottieControls.cjs");
|
|
12
13
|
const require_LottieInteractions = require("./interactions/LottieInteractions.cjs");
|
|
13
14
|
const require_lottieInView = require("./interactions/lottieInView.cjs");
|
|
@@ -27,6 +28,7 @@ exports.LottieRenderer = require_types.LottieRenderer;
|
|
|
27
28
|
exports.LottieState = require_types.LottieState;
|
|
28
29
|
exports.LottieSubscription = require_types.LottieSubscription;
|
|
29
30
|
exports.LottieSvg = require_LottieSvg.LottieSvg;
|
|
31
|
+
exports.configureLottie = require_configureLottie.configureLottie;
|
|
30
32
|
exports.lottieInView = require_lottieInView.lottieInView;
|
|
31
33
|
exports.lottieScrollScrub = require_lottieScrollScrub.lottieScrollScrub;
|
|
32
34
|
exports.useLottie = require_useLottie.useLottie;
|
package/build/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConfigureLottieOptions, configureLottie } from "./animation/configureLottie.cjs";
|
|
1
2
|
import { LottieDirection, LottieHandle, LottieInstance, LottieRenderer, LottieSeekTarget, LottieSegments, LottieState, LottieSubscription, LottieSubscriptions } from "./animation/types.cjs";
|
|
2
3
|
import { UseLottieOptions } from "./animation/useLottieAnimation.cjs";
|
|
3
4
|
import { Lottie, LottieProps } from "./animation/Lottie.cjs";
|
|
@@ -16,4 +17,4 @@ import { LottieScrollScrubOptions, lottieScrollScrub } from "./interactions/lott
|
|
|
16
17
|
import { useLottieInteractions } from "./interactions/useLottieInteractions.cjs";
|
|
17
18
|
import { LottieError, LottieErrorProps } from "./overlays/LottieError.cjs";
|
|
18
19
|
import { LottieLoading, LottieLoadingProps } from "./overlays/LottieLoading.cjs";
|
|
19
|
-
export { Lottie, LottieControls, type LottieControlsProps, LottieDirection, LottieDisplay, type LottieDisplayProps, LottieError, type LottieErrorProps, type LottieHandle, type LottieInViewOptions, type LottieInstance, type LottieInteraction, type LottieInteractionContext, LottieInteractions, type LottieInteractionsProps, LottieLight, type LottieLightProps, LottieLoading, type LottieLoadingProps, type LottieProps, LottieRenderer, type LottieScrollScrubOptions, type LottieSeekTarget, type LottieSegments, LottieState, LottieSubscription, type LottieSubscriptions, LottieSvg, type LottieSvgProps, type UseLottieOptions, lottieInView, lottieScrollScrub, useLottie, useLottieInstance, useLottieInteractions, useLottieLight, useLottieSvg };
|
|
20
|
+
export { type ConfigureLottieOptions, Lottie, LottieControls, type LottieControlsProps, LottieDirection, LottieDisplay, type LottieDisplayProps, LottieError, type LottieErrorProps, type LottieHandle, type LottieInViewOptions, type LottieInstance, type LottieInteraction, type LottieInteractionContext, LottieInteractions, type LottieInteractionsProps, LottieLight, type LottieLightProps, LottieLoading, type LottieLoadingProps, type LottieProps, LottieRenderer, type LottieScrollScrubOptions, type LottieSeekTarget, type LottieSegments, LottieState, LottieSubscription, type LottieSubscriptions, LottieSvg, type LottieSvgProps, type UseLottieOptions, configureLottie, lottieInView, lottieScrollScrub, useLottie, useLottieInstance, useLottieInteractions, useLottieLight, useLottieSvg };
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConfigureLottieOptions, configureLottie } from "./animation/configureLottie.js";
|
|
1
2
|
import { LottieDirection, LottieHandle, LottieInstance, LottieRenderer, LottieSeekTarget, LottieSegments, LottieState, LottieSubscription, LottieSubscriptions } from "./animation/types.js";
|
|
2
3
|
import { UseLottieOptions } from "./animation/useLottieAnimation.js";
|
|
3
4
|
import { Lottie, LottieProps } from "./animation/Lottie.js";
|
|
@@ -16,4 +17,4 @@ import { LottieScrollScrubOptions, lottieScrollScrub } from "./interactions/lott
|
|
|
16
17
|
import { useLottieInteractions } from "./interactions/useLottieInteractions.js";
|
|
17
18
|
import { LottieError, LottieErrorProps } from "./overlays/LottieError.js";
|
|
18
19
|
import { LottieLoading, LottieLoadingProps } from "./overlays/LottieLoading.js";
|
|
19
|
-
export { Lottie, LottieControls, type LottieControlsProps, LottieDirection, LottieDisplay, type LottieDisplayProps, LottieError, type LottieErrorProps, type LottieHandle, type LottieInViewOptions, type LottieInstance, type LottieInteraction, type LottieInteractionContext, LottieInteractions, type LottieInteractionsProps, LottieLight, type LottieLightProps, LottieLoading, type LottieLoadingProps, type LottieProps, LottieRenderer, type LottieScrollScrubOptions, type LottieSeekTarget, type LottieSegments, LottieState, LottieSubscription, type LottieSubscriptions, LottieSvg, type LottieSvgProps, type UseLottieOptions, lottieInView, lottieScrollScrub, useLottie, useLottieInstance, useLottieInteractions, useLottieLight, useLottieSvg };
|
|
20
|
+
export { type ConfigureLottieOptions, Lottie, LottieControls, type LottieControlsProps, LottieDirection, LottieDisplay, type LottieDisplayProps, LottieError, type LottieErrorProps, type LottieHandle, type LottieInViewOptions, type LottieInstance, type LottieInteraction, type LottieInteractionContext, LottieInteractions, type LottieInteractionsProps, LottieLight, type LottieLightProps, LottieLoading, type LottieLoadingProps, type LottieProps, LottieRenderer, type LottieScrollScrubOptions, type LottieSeekTarget, type LottieSegments, LottieState, LottieSubscription, type LottieSubscriptions, LottieSvg, type LottieSvgProps, type UseLottieOptions, configureLottie, lottieInView, lottieScrollScrub, useLottie, useLottieInstance, useLottieInteractions, useLottieLight, useLottieSvg };
|
package/build/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { configureLottie } from "./animation/configureLottie.js";
|
|
1
2
|
import { useLottieInstance } from "./animation/useLottieInstance.js";
|
|
2
3
|
import { LottieDisplay } from "./animation/LottieDisplay.js";
|
|
3
4
|
import { LottieDirection, LottieRenderer, LottieState, LottieSubscription } from "./animation/types.js";
|
|
4
|
-
import { Lottie } from "./animation/Lottie.js";
|
|
5
|
-
import { LottieLight } from "./animation/LottieLight.js";
|
|
6
|
-
import { LottieSvg } from "./animation/LottieSvg.js";
|
|
7
5
|
import { useLottie } from "./animation/useLottie.js";
|
|
6
|
+
import { Lottie } from "./animation/Lottie.js";
|
|
8
7
|
import { useLottieLight } from "./animation/useLottieLight.js";
|
|
8
|
+
import { LottieLight } from "./animation/LottieLight.js";
|
|
9
9
|
import { useLottieSvg } from "./animation/useLottieSvg.js";
|
|
10
|
+
import { LottieSvg } from "./animation/LottieSvg.js";
|
|
10
11
|
import { LottieControls } from "./controls/LottieControls.js";
|
|
11
12
|
import { LottieInteractions } from "./interactions/LottieInteractions.js";
|
|
12
13
|
import { lottieInView } from "./interactions/lottieInView.js";
|
|
@@ -14,4 +15,4 @@ import { lottieScrollScrub } from "./interactions/lottieScrollScrub.js";
|
|
|
14
15
|
import { useLottieInteractions } from "./interactions/useLottieInteractions.js";
|
|
15
16
|
import { LottieError } from "./overlays/LottieError.js";
|
|
16
17
|
import { LottieLoading } from "./overlays/LottieLoading.js";
|
|
17
|
-
export { Lottie, LottieControls, LottieDirection, LottieDisplay, LottieError, LottieInteractions, LottieLight, LottieLoading, LottieRenderer, LottieState, LottieSubscription, LottieSvg, lottieInView, lottieScrollScrub, useLottie, useLottieInstance, useLottieInteractions, useLottieLight, useLottieSvg };
|
|
18
|
+
export { Lottie, LottieControls, LottieDirection, LottieDisplay, LottieError, LottieInteractions, LottieLight, LottieLoading, LottieRenderer, LottieState, LottieSubscription, LottieSvg, configureLottie, lottieInView, lottieScrollScrub, useLottie, useLottieInstance, useLottieInteractions, useLottieLight, useLottieSvg };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
const require_LottieInstanceContext = require("../animation/LottieInstanceContext.cjs");
|
|
2
3
|
const require_LottieRegistryContext = require("../animation/LottieRegistryContext.cjs");
|
|
3
4
|
const require_useInteractionsRunner = require("./useInteractionsRunner.cjs");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { LottieInstanceContext } from "../animation/LottieInstanceContext.js";
|
|
2
3
|
import { LottieRegistryContext, createLottieRegistry } from "../animation/LottieRegistryContext.js";
|
|
3
4
|
import { useInteractionsRunner, useSingleInstanceSource } from "./useInteractionsRunner.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
const require_types = require("../animation/types.cjs");
|
|
2
3
|
const require_coverProgress = require("./coverProgress.cjs");
|
|
3
4
|
//#region src/interactions/lottieScrollScrub.ts
|
|
@@ -11,6 +12,15 @@ function isScrubOptions(value) {
|
|
|
11
12
|
if ("onRangeEnter" in value && typeof value.onRangeEnter !== "function") return false;
|
|
12
13
|
return !("onRangeLeave" in value && typeof value.onRangeLeave !== "function");
|
|
13
14
|
}
|
|
15
|
+
/** Whether an element has anything to scroll along the axis right now. */
|
|
16
|
+
function canScrollAlong(element, axis) {
|
|
17
|
+
return axis === "inline" ? element.scrollWidth > element.clientWidth : element.scrollHeight > element.clientHeight;
|
|
18
|
+
}
|
|
19
|
+
function timelineIsUsable(timeline, axis) {
|
|
20
|
+
const source = timeline.source;
|
|
21
|
+
if (source === null || source === document.scrollingElement) return true;
|
|
22
|
+
return canScrollAlong(source, axis);
|
|
23
|
+
}
|
|
14
24
|
function attachScrollScrub(context, raw) {
|
|
15
25
|
const options = isScrubOptions(raw) ? raw : {};
|
|
16
26
|
const range = options.range ?? [0, 1];
|
|
@@ -18,13 +28,14 @@ function attachScrollScrub(context, raw) {
|
|
|
18
28
|
let observer = null;
|
|
19
29
|
let observedRoot = null;
|
|
20
30
|
let timeline = null;
|
|
31
|
+
let useTimeline = false;
|
|
21
32
|
let frameHandle = null;
|
|
22
33
|
let scrubbing = false;
|
|
23
34
|
let gestureStarted = false;
|
|
24
35
|
let previousBand = null;
|
|
25
36
|
let warnedInactive = false;
|
|
26
37
|
const readProgress = (root) => {
|
|
27
|
-
if (timeline !== null) {
|
|
38
|
+
if (useTimeline && timeline !== null) {
|
|
28
39
|
const time = timeline.currentTime;
|
|
29
40
|
if (typeof time === "number") return Math.min(Math.max(time / 100, 0), 1);
|
|
30
41
|
if (time !== null && typeof time === "object" && "value" in time && typeof time.value === "number") return Math.min(Math.max(time.value / 100, 0), 1);
|
|
@@ -64,6 +75,7 @@ function attachScrollScrub(context, raw) {
|
|
|
64
75
|
if (scrubbing) return;
|
|
65
76
|
scrubbing = true;
|
|
66
77
|
previousBand = null;
|
|
78
|
+
useTimeline = timeline !== null && timelineIsUsable(timeline, axis);
|
|
67
79
|
if (context.lottie.state !== require_types.LottieState.loading) {
|
|
68
80
|
gestureStarted = true;
|
|
69
81
|
context.lottie.scrubStart();
|
|
@@ -93,6 +105,7 @@ function attachScrollScrub(context, raw) {
|
|
|
93
105
|
observer?.disconnect();
|
|
94
106
|
observer = null;
|
|
95
107
|
timeline = null;
|
|
108
|
+
useTimeline = false;
|
|
96
109
|
observedRoot = root;
|
|
97
110
|
if (root === null) return;
|
|
98
111
|
const ViewTimelineCtor = globalThis.ViewTimeline;
|
|
@@ -136,9 +149,10 @@ function attachScrollScrub(context, raw) {
|
|
|
136
149
|
* </LottieInteractions>
|
|
137
150
|
* ```
|
|
138
151
|
*
|
|
139
|
-
* Progress is the platform's own scroll timeline where the browser has one
|
|
140
|
-
* and
|
|
141
|
-
*
|
|
152
|
+
* Progress is the platform's own scroll timeline where the browser has one
|
|
153
|
+
* and its scroller is one that scrolls, and the same arithmetic measured by
|
|
154
|
+
* hand against the viewport where it does not; the numbers agree by
|
|
155
|
+
* construction. While the animation is out of view nothing samples
|
|
142
156
|
* at all, and playback state is held by the scrub gesture, so whatever was
|
|
143
157
|
* true before the scrub is restored when it leaves.
|
|
144
158
|
*/
|
|
@@ -36,9 +36,10 @@ interface LottieScrollScrubOptions {
|
|
|
36
36
|
* </LottieInteractions>
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* Progress is the platform's own scroll timeline where the browser has one
|
|
40
|
-
* and
|
|
41
|
-
*
|
|
39
|
+
* Progress is the platform's own scroll timeline where the browser has one
|
|
40
|
+
* and its scroller is one that scrolls, and the same arithmetic measured by
|
|
41
|
+
* hand against the viewport where it does not; the numbers agree by
|
|
42
|
+
* construction. While the animation is out of view nothing samples
|
|
42
43
|
* at all, and playback state is held by the scrub gesture, so whatever was
|
|
43
44
|
* true before the scrub is restored when it leaves.
|
|
44
45
|
*/
|
|
@@ -36,9 +36,10 @@ interface LottieScrollScrubOptions {
|
|
|
36
36
|
* </LottieInteractions>
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* Progress is the platform's own scroll timeline where the browser has one
|
|
40
|
-
* and
|
|
41
|
-
*
|
|
39
|
+
* Progress is the platform's own scroll timeline where the browser has one
|
|
40
|
+
* and its scroller is one that scrolls, and the same arithmetic measured by
|
|
41
|
+
* hand against the viewport where it does not; the numbers agree by
|
|
42
|
+
* construction. While the animation is out of view nothing samples
|
|
42
43
|
* at all, and playback state is held by the scrub gesture, so whatever was
|
|
43
44
|
* true before the scrub is restored when it leaves.
|
|
44
45
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { LottieState } from "../animation/types.js";
|
|
2
3
|
import { bandEdges, bandProgress, coverProgress } from "./coverProgress.js";
|
|
3
4
|
//#region src/interactions/lottieScrollScrub.ts
|
|
@@ -11,6 +12,15 @@ function isScrubOptions(value) {
|
|
|
11
12
|
if ("onRangeEnter" in value && typeof value.onRangeEnter !== "function") return false;
|
|
12
13
|
return !("onRangeLeave" in value && typeof value.onRangeLeave !== "function");
|
|
13
14
|
}
|
|
15
|
+
/** Whether an element has anything to scroll along the axis right now. */
|
|
16
|
+
function canScrollAlong(element, axis) {
|
|
17
|
+
return axis === "inline" ? element.scrollWidth > element.clientWidth : element.scrollHeight > element.clientHeight;
|
|
18
|
+
}
|
|
19
|
+
function timelineIsUsable(timeline, axis) {
|
|
20
|
+
const source = timeline.source;
|
|
21
|
+
if (source === null || source === document.scrollingElement) return true;
|
|
22
|
+
return canScrollAlong(source, axis);
|
|
23
|
+
}
|
|
14
24
|
function attachScrollScrub(context, raw) {
|
|
15
25
|
const options = isScrubOptions(raw) ? raw : {};
|
|
16
26
|
const range = options.range ?? [0, 1];
|
|
@@ -18,13 +28,14 @@ function attachScrollScrub(context, raw) {
|
|
|
18
28
|
let observer = null;
|
|
19
29
|
let observedRoot = null;
|
|
20
30
|
let timeline = null;
|
|
31
|
+
let useTimeline = false;
|
|
21
32
|
let frameHandle = null;
|
|
22
33
|
let scrubbing = false;
|
|
23
34
|
let gestureStarted = false;
|
|
24
35
|
let previousBand = null;
|
|
25
36
|
let warnedInactive = false;
|
|
26
37
|
const readProgress = (root) => {
|
|
27
|
-
if (timeline !== null) {
|
|
38
|
+
if (useTimeline && timeline !== null) {
|
|
28
39
|
const time = timeline.currentTime;
|
|
29
40
|
if (typeof time === "number") return Math.min(Math.max(time / 100, 0), 1);
|
|
30
41
|
if (time !== null && typeof time === "object" && "value" in time && typeof time.value === "number") return Math.min(Math.max(time.value / 100, 0), 1);
|
|
@@ -64,6 +75,7 @@ function attachScrollScrub(context, raw) {
|
|
|
64
75
|
if (scrubbing) return;
|
|
65
76
|
scrubbing = true;
|
|
66
77
|
previousBand = null;
|
|
78
|
+
useTimeline = timeline !== null && timelineIsUsable(timeline, axis);
|
|
67
79
|
if (context.lottie.state !== LottieState.loading) {
|
|
68
80
|
gestureStarted = true;
|
|
69
81
|
context.lottie.scrubStart();
|
|
@@ -93,6 +105,7 @@ function attachScrollScrub(context, raw) {
|
|
|
93
105
|
observer?.disconnect();
|
|
94
106
|
observer = null;
|
|
95
107
|
timeline = null;
|
|
108
|
+
useTimeline = false;
|
|
96
109
|
observedRoot = root;
|
|
97
110
|
if (root === null) return;
|
|
98
111
|
const ViewTimelineCtor = globalThis.ViewTimeline;
|
|
@@ -136,9 +149,10 @@ function attachScrollScrub(context, raw) {
|
|
|
136
149
|
* </LottieInteractions>
|
|
137
150
|
* ```
|
|
138
151
|
*
|
|
139
|
-
* Progress is the platform's own scroll timeline where the browser has one
|
|
140
|
-
* and
|
|
141
|
-
*
|
|
152
|
+
* Progress is the platform's own scroll timeline where the browser has one
|
|
153
|
+
* and its scroller is one that scrolls, and the same arithmetic measured by
|
|
154
|
+
* hand against the viewport where it does not; the numbers agree by
|
|
155
|
+
* construction. While the animation is out of view nothing samples
|
|
142
156
|
* at all, and playback state is held by the scrub gesture, so whatever was
|
|
143
157
|
* true before the scrub is restored when it leaves.
|
|
144
158
|
*/
|
|
@@ -10,7 +10,11 @@ import { LottieInstance } from "../animation/types.cjs";
|
|
|
10
10
|
* at the moment an event fires without the behaviour ever re-attaching.
|
|
11
11
|
*/
|
|
12
12
|
interface LottieInteractionContext {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The animation: values, commands, `subscribe`, `root`. Live: every member
|
|
15
|
+
* answers the current animation, so keeping or destructuring it is safe; a
|
|
16
|
+
* value pulled out of it is a copy of that moment.
|
|
17
|
+
*/
|
|
14
18
|
readonly lottie: LottieInstance;
|
|
15
19
|
/** The descriptor's options as they are right now. */
|
|
16
20
|
options: () => unknown;
|
|
@@ -10,7 +10,11 @@ import { LottieInstance } from "../animation/types.js";
|
|
|
10
10
|
* at the moment an event fires without the behaviour ever re-attaching.
|
|
11
11
|
*/
|
|
12
12
|
interface LottieInteractionContext {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The animation: values, commands, `subscribe`, `root`. Live: every member
|
|
15
|
+
* answers the current animation, so keeping or destructuring it is safe; a
|
|
16
|
+
* value pulled out of it is a copy of that moment.
|
|
17
|
+
*/
|
|
14
18
|
readonly lottie: LottieInstance;
|
|
15
19
|
/** The descriptor's options as they are right now. */
|
|
16
20
|
options: () => unknown;
|
|
@@ -3,6 +3,14 @@ const require_useStableValue = require("../utils/useStableValue.cjs");
|
|
|
3
3
|
const require_LottieRegistryContext = require("../animation/LottieRegistryContext.cjs");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
//#region src/interactions/useInteractionsRunner.ts
|
|
6
|
+
function createLiveInstanceView(box) {
|
|
7
|
+
const view = {};
|
|
8
|
+
for (const key of Object.keys(box.current)) Object.defineProperty(view, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: () => box.current[key]
|
|
11
|
+
});
|
|
12
|
+
return view;
|
|
13
|
+
}
|
|
6
14
|
function isRecord(value) {
|
|
7
15
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
16
|
}
|
|
@@ -41,6 +49,7 @@ function useInteractionsRunner(source, interactions) {
|
|
|
41
49
|
options: projectData(interaction.options)
|
|
42
50
|
})));
|
|
43
51
|
const runtime = (0, react.useRef)(/* @__PURE__ */ new Map()).current;
|
|
52
|
+
const views = (0, react.useRef)(/* @__PURE__ */ new WeakMap()).current;
|
|
44
53
|
const armSlot = (box, slot, memory) => {
|
|
45
54
|
const interaction = latest.current[slot];
|
|
46
55
|
const record = {
|
|
@@ -50,10 +59,13 @@ function useInteractionsRunner(source, interactions) {
|
|
|
50
59
|
listeners: /* @__PURE__ */ new Set(),
|
|
51
60
|
memory: memory ?? {}
|
|
52
61
|
};
|
|
62
|
+
let view = views.get(box);
|
|
63
|
+
if (view === void 0) {
|
|
64
|
+
view = createLiveInstanceView(box);
|
|
65
|
+
views.set(box, view);
|
|
66
|
+
}
|
|
53
67
|
const context = {
|
|
54
|
-
|
|
55
|
-
return box.current;
|
|
56
|
-
},
|
|
68
|
+
lottie: view,
|
|
57
69
|
options: () => latest.current[slot]?.options,
|
|
58
70
|
onChange: (listener) => {
|
|
59
71
|
record.listeners.add(listener);
|
|
@@ -3,6 +3,14 @@ import { useStableValue } from "../utils/useStableValue.js";
|
|
|
3
3
|
import { createLottieRegistry } from "../animation/LottieRegistryContext.js";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
//#region src/interactions/useInteractionsRunner.ts
|
|
6
|
+
function createLiveInstanceView(box) {
|
|
7
|
+
const view = {};
|
|
8
|
+
for (const key of Object.keys(box.current)) Object.defineProperty(view, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: () => box.current[key]
|
|
11
|
+
});
|
|
12
|
+
return view;
|
|
13
|
+
}
|
|
6
14
|
function isRecord(value) {
|
|
7
15
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
16
|
}
|
|
@@ -41,6 +49,7 @@ function useInteractionsRunner(source, interactions) {
|
|
|
41
49
|
options: projectData(interaction.options)
|
|
42
50
|
})));
|
|
43
51
|
const runtime = useRef(/* @__PURE__ */ new Map()).current;
|
|
52
|
+
const views = useRef(/* @__PURE__ */ new WeakMap()).current;
|
|
44
53
|
const armSlot = (box, slot, memory) => {
|
|
45
54
|
const interaction = latest.current[slot];
|
|
46
55
|
const record = {
|
|
@@ -50,10 +59,13 @@ function useInteractionsRunner(source, interactions) {
|
|
|
50
59
|
listeners: /* @__PURE__ */ new Set(),
|
|
51
60
|
memory: memory ?? {}
|
|
52
61
|
};
|
|
62
|
+
let view = views.get(box);
|
|
63
|
+
if (view === void 0) {
|
|
64
|
+
view = createLiveInstanceView(box);
|
|
65
|
+
views.set(box, view);
|
|
66
|
+
}
|
|
53
67
|
const context = {
|
|
54
|
-
|
|
55
|
-
return box.current;
|
|
56
|
-
},
|
|
68
|
+
lottie: view,
|
|
57
69
|
options: () => latest.current[slot]?.options,
|
|
58
70
|
onChange: (listener) => {
|
|
59
71
|
record.listeners.add(listener);
|
package/changes.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/lottie-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0-depup.0",
|
|
4
4
|
"description": "Lottie animations in React: one component for the easy path, the whole engine when you need control. (with updated dependencies)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lottie-react",
|
|
@@ -156,13 +156,13 @@
|
|
|
156
156
|
"@size-limit/preset-small-lib": "^13.0.3",
|
|
157
157
|
"@testing-library/jest-dom": "^7.0.1",
|
|
158
158
|
"@testing-library/react": "^16.3.2",
|
|
159
|
-
"@testing-library/user-event": "^14.6.
|
|
159
|
+
"@testing-library/user-event": "^14.6.4",
|
|
160
160
|
"@types/node": "^26.2.0",
|
|
161
161
|
"@types/react": "^19.2.18",
|
|
162
162
|
"@types/react-dom": "^19.2.4",
|
|
163
163
|
"@vitejs/plugin-react": "^6.0.5",
|
|
164
164
|
"@vitest/coverage-v8": "^4.1.10",
|
|
165
|
-
"concurrently": "^10.0.
|
|
165
|
+
"concurrently": "^10.0.5",
|
|
166
166
|
"happy-dom": "^20.11.2",
|
|
167
167
|
"publint": "^0.3.23",
|
|
168
168
|
"size-limit": "^13.0.3",
|
|
@@ -174,8 +174,8 @@
|
|
|
174
174
|
"changes": {},
|
|
175
175
|
"depsUpdated": 0,
|
|
176
176
|
"originalPackage": "lottie-react",
|
|
177
|
-
"originalVersion": "3.
|
|
178
|
-
"processedAt": "2026-08-
|
|
177
|
+
"originalVersion": "3.1.0",
|
|
178
|
+
"processedAt": "2026-08-17T00:14:54.679Z",
|
|
179
179
|
"smokeTest": "passed"
|
|
180
180
|
}
|
|
181
181
|
}
|