@depup/lottie-react 2.4.1-depup.0 → 3.0.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/LICENSE.md +9 -0
- package/README.md +4 -10
- package/build/_virtual/_rolldown/runtime.cjs +23 -0
- package/build/animation/Lottie.cjs +39 -0
- package/build/animation/Lottie.d.cts +47 -0
- package/build/animation/Lottie.d.ts +47 -0
- package/build/animation/Lottie.js +37 -0
- package/build/animation/LottieDisplay.cjs +55 -0
- package/build/animation/LottieDisplay.d.cts +46 -0
- package/build/animation/LottieDisplay.d.ts +46 -0
- package/build/animation/LottieDisplay.js +53 -0
- package/build/animation/LottieInstanceContext.cjs +16 -0
- package/build/animation/LottieInstanceContext.js +17 -0
- package/build/animation/LottieLight.cjs +19 -0
- package/build/animation/LottieLight.d.cts +23 -0
- package/build/animation/LottieLight.d.ts +23 -0
- package/build/animation/LottieLight.js +17 -0
- package/build/animation/LottieRegistryContext.cjs +36 -0
- package/build/animation/LottieRegistryContext.js +35 -0
- package/build/animation/LottieSvg.cjs +20 -0
- package/build/animation/LottieSvg.d.cts +24 -0
- package/build/animation/LottieSvg.d.ts +24 -0
- package/build/animation/LottieSvg.js +18 -0
- package/build/animation/collectMarkerCrossings.cjs +38 -0
- package/build/animation/collectMarkerCrossings.js +38 -0
- package/build/animation/createLottieComponent.cjs +131 -0
- package/build/animation/createLottieComponent.d.cts +45 -0
- package/build/animation/createLottieComponent.d.ts +45 -0
- package/build/animation/createLottieComponent.js +131 -0
- package/build/animation/hasExpressions.cjs +25 -0
- package/build/animation/hasExpressions.js +25 -0
- package/build/animation/normalizeAnimationSource.cjs +38 -0
- package/build/animation/normalizeAnimationSource.js +38 -0
- package/build/animation/polymorphicForwardRef.cjs +18 -0
- package/build/animation/polymorphicForwardRef.js +19 -0
- package/build/animation/renderStyledElement.cjs +31 -0
- package/build/animation/renderStyledElement.js +31 -0
- package/build/animation/resolveSeekTarget.cjs +97 -0
- package/build/animation/resolveSeekTarget.js +95 -0
- package/build/animation/styleLayer.cjs +24 -0
- package/build/animation/styleLayer.js +24 -0
- package/build/animation/stylePrecedence.cjs +12 -0
- package/build/animation/stylePrecedence.js +12 -0
- package/build/animation/types.cjs +71 -0
- package/build/animation/types.d.cts +461 -0
- package/build/animation/types.d.ts +461 -0
- package/build/animation/types.js +68 -0
- package/build/animation/useLottie.cjs +40 -0
- package/build/animation/useLottie.d.cts +36 -0
- package/build/animation/useLottie.d.ts +36 -0
- package/build/animation/useLottie.js +38 -0
- package/build/animation/useLottieAnimation.cjs +434 -0
- package/build/animation/useLottieAnimation.d.cts +40 -0
- package/build/animation/useLottieAnimation.d.ts +40 -0
- package/build/animation/useLottieAnimation.js +434 -0
- package/build/animation/useLottieInstance.cjs +20 -0
- package/build/animation/useLottieInstance.d.cts +14 -0
- package/build/animation/useLottieInstance.d.ts +14 -0
- package/build/animation/useLottieInstance.js +20 -0
- package/build/animation/useLottieLight.cjs +20 -0
- package/build/animation/useLottieLight.d.cts +16 -0
- package/build/animation/useLottieLight.d.ts +16 -0
- package/build/animation/useLottieLight.js +18 -0
- package/build/animation/useLottieSvg.cjs +18 -0
- package/build/animation/useLottieSvg.d.cts +14 -0
- package/build/animation/useLottieSvg.d.ts +14 -0
- package/build/animation/useLottieSvg.js +16 -0
- package/build/controls/LottieControls.cjs +180 -0
- package/build/controls/LottieControls.d.cts +58 -0
- package/build/controls/LottieControls.d.ts +58 -0
- package/build/controls/LottieControls.js +178 -0
- package/build/controls/LottieDirectionButton.cjs +36 -0
- package/build/controls/LottieDirectionButton.js +35 -0
- package/build/controls/LottieFullscreenButton.cjs +35 -0
- package/build/controls/LottieFullscreenButton.js +34 -0
- package/build/controls/LottieLoopButton.cjs +32 -0
- package/build/controls/LottieLoopButton.js +31 -0
- package/build/controls/LottiePlayButton.cjs +34 -0
- package/build/controls/LottiePlayButton.js +33 -0
- package/build/controls/LottieReadout.cjs +61 -0
- package/build/controls/LottieReadout.d.cts +13 -0
- package/build/controls/LottieReadout.d.ts +13 -0
- package/build/controls/LottieReadout.js +60 -0
- package/build/controls/LottieSeekBar.cjs +87 -0
- package/build/controls/LottieSeekBar.js +86 -0
- package/build/controls/LottieSpeedSelect.cjs +51 -0
- package/build/controls/LottieSpeedSelect.js +50 -0
- package/build/controls/LottieStopButton.cjs +29 -0
- package/build/controls/LottieStopButton.js +28 -0
- package/build/controls/controlIcon.cjs +25 -0
- package/build/controls/controlIcon.js +25 -0
- package/build/controls/useFullscreen.cjs +46 -0
- package/build/controls/useFullscreen.js +46 -0
- package/build/controls/useShortcuts.cjs +70 -0
- package/build/controls/useShortcuts.js +70 -0
- package/build/index.cjs +36 -0
- package/build/index.d.cts +19 -0
- package/build/index.d.ts +19 -80
- package/build/index.js +17 -667
- package/build/interactions/LottieInteractions.cjs +41 -0
- package/build/interactions/LottieInteractions.d.cts +37 -0
- package/build/interactions/LottieInteractions.d.ts +37 -0
- package/build/interactions/LottieInteractions.js +41 -0
- package/build/interactions/coverProgress.cjs +55 -0
- package/build/interactions/coverProgress.js +53 -0
- package/build/interactions/lottieInView.cjs +109 -0
- package/build/interactions/lottieInView.d.cts +44 -0
- package/build/interactions/lottieInView.d.ts +44 -0
- package/build/interactions/lottieInView.js +109 -0
- package/build/interactions/lottieScrollScrub.cjs +152 -0
- package/build/interactions/lottieScrollScrub.d.cts +47 -0
- package/build/interactions/lottieScrollScrub.d.ts +47 -0
- package/build/interactions/lottieScrollScrub.js +152 -0
- package/build/interactions/types.d.cts +46 -0
- package/build/interactions/types.d.ts +46 -0
- package/build/interactions/useInteractionsRunner.cjs +142 -0
- package/build/interactions/useInteractionsRunner.js +141 -0
- package/build/interactions/useLottieInteractions.cjs +21 -0
- package/build/interactions/useLottieInteractions.d.cts +19 -0
- package/build/interactions/useLottieInteractions.d.ts +19 -0
- package/build/interactions/useLottieInteractions.js +21 -0
- package/build/overlays/LottieError.cjs +74 -0
- package/build/overlays/LottieError.d.cts +40 -0
- package/build/overlays/LottieError.d.ts +40 -0
- package/build/overlays/LottieError.js +72 -0
- package/build/overlays/LottieLoading.cjs +89 -0
- package/build/overlays/LottieLoading.d.cts +45 -0
- package/build/overlays/LottieLoading.d.ts +45 -0
- package/build/overlays/LottieLoading.js +87 -0
- package/build/overlays/overlayStyles.cjs +33 -0
- package/build/overlays/overlayStyles.js +33 -0
- package/build/utils/SubscriptionManager.cjs +42 -0
- package/build/utils/SubscriptionManager.d.cts +30 -0
- package/build/utils/SubscriptionManager.d.ts +30 -0
- package/build/utils/SubscriptionManager.js +42 -0
- package/build/utils/createLogger.cjs +25 -0
- package/build/utils/createLogger.js +25 -0
- package/build/utils/isSameJson.cjs +37 -0
- package/build/utils/isSameJson.js +37 -0
- package/build/utils/mergeRefs.cjs +37 -0
- package/build/utils/mergeRefs.js +37 -0
- package/build/utils/useStableValue.cjs +26 -0
- package/build/utils/useStableValue.js +26 -0
- package/changes.json +3 -8
- package/package.json +144 -89
- package/LICENSE +0 -46
- package/build/index.es.js +0 -653
- package/build/index.es.js.map +0 -1
- package/build/index.es.min.js +0 -3
- package/build/index.js.map +0 -1
- package/build/index.min.js +0 -3
- package/build/index.umd.js +0 -670
- package/build/index.umd.js.map +0 -1
- package/build/index.umd.min.js +0 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
let react = require("react");
|
|
2
|
+
//#region src/controls/useFullscreen.ts
|
|
3
|
+
/**
|
|
4
|
+
* Fills the screen with one element, and says whether it currently is.
|
|
5
|
+
*
|
|
6
|
+
* The state follows the browser's own announcement and nothing else, so leaving
|
|
7
|
+
* through the Escape key, through another animation taking the screen, or
|
|
8
|
+
* through anything else the browser offers is reported the same as leaving
|
|
9
|
+
* through this hook. It also means a request the browser refuses changes
|
|
10
|
+
* nothing here, rather than leaving a control claiming something that did not
|
|
11
|
+
* happen.
|
|
12
|
+
*
|
|
13
|
+
* Nothing touches a browser global outside an effect or the toggle itself, so
|
|
14
|
+
* this is safe on a server, and the first client render agrees with the markup
|
|
15
|
+
* a server sent rather than hydrating a button into a place that had none.
|
|
16
|
+
*/
|
|
17
|
+
function useFullscreen(root) {
|
|
18
|
+
const [supported, setSupported] = (0, react.useState)(false);
|
|
19
|
+
const [isFullscreen, setIsFullscreen] = (0, react.useState)(false);
|
|
20
|
+
(0, react.useEffect)(() => {
|
|
21
|
+
setSupported(document.fullscreenEnabled === true);
|
|
22
|
+
}, []);
|
|
23
|
+
(0, react.useEffect)(() => {
|
|
24
|
+
if (root === null) return;
|
|
25
|
+
const onChange = () => {
|
|
26
|
+
setIsFullscreen(document.fullscreenElement === root);
|
|
27
|
+
};
|
|
28
|
+
root.addEventListener("fullscreenchange", onChange);
|
|
29
|
+
return () => {
|
|
30
|
+
root.removeEventListener("fullscreenchange", onChange);
|
|
31
|
+
};
|
|
32
|
+
}, [root]);
|
|
33
|
+
return {
|
|
34
|
+
isFullscreen,
|
|
35
|
+
toggle: (0, react.useMemo)(() => {
|
|
36
|
+
if (!supported || root === null) return null;
|
|
37
|
+
return () => {
|
|
38
|
+
(document.fullscreenElement === root ? document.exitFullscreen() : root.requestFullscreen()).catch((cause) => {
|
|
39
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") console.warn(`[lottie-react] the browser refused to change fullscreen: ${String(cause)}. A request has to come from a click or a key press, and a page in an iframe needs allow="fullscreen".`);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}, [supported, root])
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.useFullscreen = useFullscreen;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
//#region src/controls/useFullscreen.ts
|
|
3
|
+
/**
|
|
4
|
+
* Fills the screen with one element, and says whether it currently is.
|
|
5
|
+
*
|
|
6
|
+
* The state follows the browser's own announcement and nothing else, so leaving
|
|
7
|
+
* through the Escape key, through another animation taking the screen, or
|
|
8
|
+
* through anything else the browser offers is reported the same as leaving
|
|
9
|
+
* through this hook. It also means a request the browser refuses changes
|
|
10
|
+
* nothing here, rather than leaving a control claiming something that did not
|
|
11
|
+
* happen.
|
|
12
|
+
*
|
|
13
|
+
* Nothing touches a browser global outside an effect or the toggle itself, so
|
|
14
|
+
* this is safe on a server, and the first client render agrees with the markup
|
|
15
|
+
* a server sent rather than hydrating a button into a place that had none.
|
|
16
|
+
*/
|
|
17
|
+
function useFullscreen(root) {
|
|
18
|
+
const [supported, setSupported] = useState(false);
|
|
19
|
+
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setSupported(document.fullscreenEnabled === true);
|
|
22
|
+
}, []);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (root === null) return;
|
|
25
|
+
const onChange = () => {
|
|
26
|
+
setIsFullscreen(document.fullscreenElement === root);
|
|
27
|
+
};
|
|
28
|
+
root.addEventListener("fullscreenchange", onChange);
|
|
29
|
+
return () => {
|
|
30
|
+
root.removeEventListener("fullscreenchange", onChange);
|
|
31
|
+
};
|
|
32
|
+
}, [root]);
|
|
33
|
+
return {
|
|
34
|
+
isFullscreen,
|
|
35
|
+
toggle: useMemo(() => {
|
|
36
|
+
if (!supported || root === null) return null;
|
|
37
|
+
return () => {
|
|
38
|
+
(document.fullscreenElement === root ? document.exitFullscreen() : root.requestFullscreen()).catch((cause) => {
|
|
39
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") console.warn(`[lottie-react] the browser refused to change fullscreen: ${String(cause)}. A request has to come from a click or a key press, and a page in an iframe needs allow="fullscreen".`);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}, [supported, root])
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { useFullscreen };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const require_types = require("../animation/types.cjs");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
//#region src/controls/useShortcuts.ts
|
|
4
|
+
/**
|
|
5
|
+
* Whether a key belongs to the element under it rather than to us.
|
|
6
|
+
*
|
|
7
|
+
* The picker is in this list because letters drive its type-ahead, so `l` there
|
|
8
|
+
* is someone looking for an option rather than asking for looping.
|
|
9
|
+
*/
|
|
10
|
+
function isTyping(element) {
|
|
11
|
+
return element.isContentEditable || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The keyboard shortcuts a control bar answers: `k` to play or pause, `l` to
|
|
15
|
+
* loop, `f` to fill the screen.
|
|
16
|
+
*
|
|
17
|
+
* They live with the controls, so a page that renders none has no listener at
|
|
18
|
+
* all. Three keys rather than a media player's set, because letters do not
|
|
19
|
+
* activate a focused button and the seek bar already owns the arrow keys when
|
|
20
|
+
* it has focus, so nothing here has to be taken away from the browser.
|
|
21
|
+
*
|
|
22
|
+
* A key is ours when it happened inside this animation's root element, or when
|
|
23
|
+
* this animation is the one filling the screen. The second half is not
|
|
24
|
+
* theoretical: the animation area itself is not focusable, so clicking the
|
|
25
|
+
* picture leaves focus on the document body, and a request made from anywhere
|
|
26
|
+
* outside the element that filled the screen leaves it there too. Both measured
|
|
27
|
+
* in Chromium. A gate that only asked about focus would therefore be dead in
|
|
28
|
+
* the place where a keyboard is all anyone has. With several animations on one
|
|
29
|
+
* page at most one can pass the gate, and when focus is in none of them nothing
|
|
30
|
+
* happens, which is better than all of them answering at once.
|
|
31
|
+
*/
|
|
32
|
+
function useShortcuts(lottie, options) {
|
|
33
|
+
const latest = (0, react.useRef)({
|
|
34
|
+
lottie,
|
|
35
|
+
options
|
|
36
|
+
});
|
|
37
|
+
latest.current.lottie = lottie;
|
|
38
|
+
latest.current.options = options;
|
|
39
|
+
(0, react.useEffect)(() => {
|
|
40
|
+
const onKeyDown = (event) => {
|
|
41
|
+
const { lottie, options } = latest.current;
|
|
42
|
+
const { root } = lottie;
|
|
43
|
+
if (options.disabled || root === null) return;
|
|
44
|
+
if (event.repeat || event.metaKey || event.ctrlKey || event.altKey) return;
|
|
45
|
+
const target = event.target;
|
|
46
|
+
if (!(target instanceof Node && root.contains(target)) && document.fullscreenElement !== root) return;
|
|
47
|
+
if (target instanceof HTMLElement && isTyping(target)) return;
|
|
48
|
+
switch (event.key.toLowerCase()) {
|
|
49
|
+
case "k":
|
|
50
|
+
if (lottie.state === require_types.LottieState.playing) lottie.pause();
|
|
51
|
+
else lottie.play();
|
|
52
|
+
break;
|
|
53
|
+
case "l":
|
|
54
|
+
options.toggleLoop();
|
|
55
|
+
break;
|
|
56
|
+
case "f":
|
|
57
|
+
options.toggleFullscreen?.();
|
|
58
|
+
break;
|
|
59
|
+
default: return;
|
|
60
|
+
}
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
};
|
|
63
|
+
document.addEventListener("keydown", onKeyDown);
|
|
64
|
+
return () => {
|
|
65
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
66
|
+
};
|
|
67
|
+
}, []);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
exports.useShortcuts = useShortcuts;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { LottieState } from "../animation/types.js";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
//#region src/controls/useShortcuts.ts
|
|
4
|
+
/**
|
|
5
|
+
* Whether a key belongs to the element under it rather than to us.
|
|
6
|
+
*
|
|
7
|
+
* The picker is in this list because letters drive its type-ahead, so `l` there
|
|
8
|
+
* is someone looking for an option rather than asking for looping.
|
|
9
|
+
*/
|
|
10
|
+
function isTyping(element) {
|
|
11
|
+
return element.isContentEditable || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The keyboard shortcuts a control bar answers: `k` to play or pause, `l` to
|
|
15
|
+
* loop, `f` to fill the screen.
|
|
16
|
+
*
|
|
17
|
+
* They live with the controls, so a page that renders none has no listener at
|
|
18
|
+
* all. Three keys rather than a media player's set, because letters do not
|
|
19
|
+
* activate a focused button and the seek bar already owns the arrow keys when
|
|
20
|
+
* it has focus, so nothing here has to be taken away from the browser.
|
|
21
|
+
*
|
|
22
|
+
* A key is ours when it happened inside this animation's root element, or when
|
|
23
|
+
* this animation is the one filling the screen. The second half is not
|
|
24
|
+
* theoretical: the animation area itself is not focusable, so clicking the
|
|
25
|
+
* picture leaves focus on the document body, and a request made from anywhere
|
|
26
|
+
* outside the element that filled the screen leaves it there too. Both measured
|
|
27
|
+
* in Chromium. A gate that only asked about focus would therefore be dead in
|
|
28
|
+
* the place where a keyboard is all anyone has. With several animations on one
|
|
29
|
+
* page at most one can pass the gate, and when focus is in none of them nothing
|
|
30
|
+
* happens, which is better than all of them answering at once.
|
|
31
|
+
*/
|
|
32
|
+
function useShortcuts(lottie, options) {
|
|
33
|
+
const latest = useRef({
|
|
34
|
+
lottie,
|
|
35
|
+
options
|
|
36
|
+
});
|
|
37
|
+
latest.current.lottie = lottie;
|
|
38
|
+
latest.current.options = options;
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const onKeyDown = (event) => {
|
|
41
|
+
const { lottie, options } = latest.current;
|
|
42
|
+
const { root } = lottie;
|
|
43
|
+
if (options.disabled || root === null) return;
|
|
44
|
+
if (event.repeat || event.metaKey || event.ctrlKey || event.altKey) return;
|
|
45
|
+
const target = event.target;
|
|
46
|
+
if (!(target instanceof Node && root.contains(target)) && document.fullscreenElement !== root) return;
|
|
47
|
+
if (target instanceof HTMLElement && isTyping(target)) return;
|
|
48
|
+
switch (event.key.toLowerCase()) {
|
|
49
|
+
case "k":
|
|
50
|
+
if (lottie.state === LottieState.playing) lottie.pause();
|
|
51
|
+
else lottie.play();
|
|
52
|
+
break;
|
|
53
|
+
case "l":
|
|
54
|
+
options.toggleLoop();
|
|
55
|
+
break;
|
|
56
|
+
case "f":
|
|
57
|
+
options.toggleFullscreen?.();
|
|
58
|
+
break;
|
|
59
|
+
default: return;
|
|
60
|
+
}
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
};
|
|
63
|
+
document.addEventListener("keydown", onKeyDown);
|
|
64
|
+
return () => {
|
|
65
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
66
|
+
};
|
|
67
|
+
}, []);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { useShortcuts };
|
package/build/index.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_useLottieInstance = require("./animation/useLottieInstance.cjs");
|
|
3
|
+
const require_LottieDisplay = require("./animation/LottieDisplay.cjs");
|
|
4
|
+
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
|
+
const require_useLottie = require("./animation/useLottie.cjs");
|
|
9
|
+
const require_useLottieLight = require("./animation/useLottieLight.cjs");
|
|
10
|
+
const require_useLottieSvg = require("./animation/useLottieSvg.cjs");
|
|
11
|
+
const require_LottieControls = require("./controls/LottieControls.cjs");
|
|
12
|
+
const require_LottieInteractions = require("./interactions/LottieInteractions.cjs");
|
|
13
|
+
const require_lottieInView = require("./interactions/lottieInView.cjs");
|
|
14
|
+
const require_lottieScrollScrub = require("./interactions/lottieScrollScrub.cjs");
|
|
15
|
+
const require_useLottieInteractions = require("./interactions/useLottieInteractions.cjs");
|
|
16
|
+
const require_LottieError = require("./overlays/LottieError.cjs");
|
|
17
|
+
const require_LottieLoading = require("./overlays/LottieLoading.cjs");
|
|
18
|
+
exports.Lottie = require_Lottie.Lottie;
|
|
19
|
+
exports.LottieControls = require_LottieControls.LottieControls;
|
|
20
|
+
exports.LottieDirection = require_types.LottieDirection;
|
|
21
|
+
exports.LottieDisplay = require_LottieDisplay.LottieDisplay;
|
|
22
|
+
exports.LottieError = require_LottieError.LottieError;
|
|
23
|
+
exports.LottieInteractions = require_LottieInteractions.LottieInteractions;
|
|
24
|
+
exports.LottieLight = require_LottieLight.LottieLight;
|
|
25
|
+
exports.LottieLoading = require_LottieLoading.LottieLoading;
|
|
26
|
+
exports.LottieRenderer = require_types.LottieRenderer;
|
|
27
|
+
exports.LottieState = require_types.LottieState;
|
|
28
|
+
exports.LottieSubscription = require_types.LottieSubscription;
|
|
29
|
+
exports.LottieSvg = require_LottieSvg.LottieSvg;
|
|
30
|
+
exports.lottieInView = require_lottieInView.lottieInView;
|
|
31
|
+
exports.lottieScrollScrub = require_lottieScrollScrub.lottieScrollScrub;
|
|
32
|
+
exports.useLottie = require_useLottie.useLottie;
|
|
33
|
+
exports.useLottieInstance = require_useLottieInstance.useLottieInstance;
|
|
34
|
+
exports.useLottieInteractions = require_useLottieInteractions.useLottieInteractions;
|
|
35
|
+
exports.useLottieLight = require_useLottieLight.useLottieLight;
|
|
36
|
+
exports.useLottieSvg = require_useLottieSvg.useLottieSvg;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LottieDirection, LottieHandle, LottieInstance, LottieRenderer, LottieSeekTarget, LottieSegments, LottieState, LottieSubscription, LottieSubscriptions } from "./animation/types.cjs";
|
|
2
|
+
import { UseLottieOptions } from "./animation/useLottieAnimation.cjs";
|
|
3
|
+
import { Lottie, LottieProps } from "./animation/Lottie.cjs";
|
|
4
|
+
import { LottieDisplay, LottieDisplayProps } from "./animation/LottieDisplay.cjs";
|
|
5
|
+
import { LottieLight, LottieLightProps } from "./animation/LottieLight.cjs";
|
|
6
|
+
import { LottieSvg, LottieSvgProps } from "./animation/LottieSvg.cjs";
|
|
7
|
+
import { useLottie } from "./animation/useLottie.cjs";
|
|
8
|
+
import { useLottieInstance } from "./animation/useLottieInstance.cjs";
|
|
9
|
+
import { useLottieLight } from "./animation/useLottieLight.cjs";
|
|
10
|
+
import { useLottieSvg } from "./animation/useLottieSvg.cjs";
|
|
11
|
+
import { LottieControls, LottieControlsProps } from "./controls/LottieControls.cjs";
|
|
12
|
+
import { LottieInteraction, LottieInteractionContext } from "./interactions/types.cjs";
|
|
13
|
+
import { LottieInteractions, LottieInteractionsProps } from "./interactions/LottieInteractions.cjs";
|
|
14
|
+
import { LottieInViewOptions, lottieInView } from "./interactions/lottieInView.cjs";
|
|
15
|
+
import { LottieScrollScrubOptions, lottieScrollScrub } from "./interactions/lottieScrollScrub.cjs";
|
|
16
|
+
import { useLottieInteractions } from "./interactions/useLottieInteractions.cjs";
|
|
17
|
+
import { LottieError, LottieErrorProps } from "./overlays/LottieError.cjs";
|
|
18
|
+
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 };
|
package/build/index.d.ts
CHANGED
|
@@ -1,80 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
animationLoaded: boolean;
|
|
21
|
-
animationItem: AnimationItem | undefined;
|
|
22
|
-
};
|
|
23
|
-
type LottieRef = MutableRefObject<LottieRefCurrentProps | null>;
|
|
24
|
-
type LottieOptions<T extends RendererType = "svg"> = Omit<AnimationConfigWithData<T>, "container" | "animationData"> & {
|
|
25
|
-
animationData: unknown;
|
|
26
|
-
lottieRef?: LottieRef;
|
|
27
|
-
onComplete?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
28
|
-
onLoopComplete?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
29
|
-
onEnterFrame?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
30
|
-
onSegmentStart?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
31
|
-
onConfigReady?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
32
|
-
onDataReady?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
33
|
-
onDataFailed?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
34
|
-
onLoadedImages?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
35
|
-
onDOMLoaded?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
36
|
-
onDestroy?: AnimationEventCallback<AnimationEvents[AnimationEventName]> | null;
|
|
37
|
-
} & Omit<react__default.HTMLProps<HTMLDivElement>, "loop">;
|
|
38
|
-
type PartialLottieOptions = Omit<LottieOptions, "animationData"> & {
|
|
39
|
-
animationData?: LottieOptions["animationData"];
|
|
40
|
-
};
|
|
41
|
-
type Axis = "x" | "y";
|
|
42
|
-
type Position = {
|
|
43
|
-
[key in Axis]: number | [number, number];
|
|
44
|
-
};
|
|
45
|
-
type Action = {
|
|
46
|
-
type: "seek" | "play" | "stop" | "loop";
|
|
47
|
-
frames: [number] | [number, number];
|
|
48
|
-
visibility?: [number, number];
|
|
49
|
-
position?: Position;
|
|
50
|
-
};
|
|
51
|
-
type InteractivityProps = {
|
|
52
|
-
lottieObj: {
|
|
53
|
-
View: ReactElement;
|
|
54
|
-
} & LottieRefCurrentProps;
|
|
55
|
-
actions: Action[];
|
|
56
|
-
mode: "scroll" | "cursor";
|
|
57
|
-
};
|
|
58
|
-
type LottieComponentProps = LottieOptions & {
|
|
59
|
-
interactivity?: Omit<InteractivityProps, "lottieObj">;
|
|
60
|
-
};
|
|
61
|
-
type PartialLottieComponentProps = Omit<LottieComponentProps, "animationData"> & {
|
|
62
|
-
animationData?: LottieOptions["animationData"];
|
|
63
|
-
};
|
|
64
|
-
type Listener = {
|
|
65
|
-
name: AnimationEventName;
|
|
66
|
-
handler: AnimationEventCallback<AnimationEvents[AnimationEventName]>;
|
|
67
|
-
};
|
|
68
|
-
type PartialListener = Omit<Listener, "handler"> & {
|
|
69
|
-
handler?: Listener["handler"] | null;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
declare const Lottie: (props: LottieComponentProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>;
|
|
73
|
-
|
|
74
|
-
declare const useLottie: <T extends RendererType = "svg">(props: LottieOptions<T>, style?: CSSProperties) => {
|
|
75
|
-
View: ReactElement;
|
|
76
|
-
} & LottieRefCurrentProps;
|
|
77
|
-
|
|
78
|
-
declare const useLottieInteractivity: ({ actions, mode, lottieObj, }: InteractivityProps) => ReactElement;
|
|
79
|
-
|
|
80
|
-
export { Action, Axis, InteractivityProps, Listener, LottieComponentProps, LottieOptions, LottieRef, LottieRefCurrentProps, PartialListener, PartialLottieComponentProps, PartialLottieOptions, Position, Lottie as default, useLottie, useLottieInteractivity };
|
|
1
|
+
import { LottieDirection, LottieHandle, LottieInstance, LottieRenderer, LottieSeekTarget, LottieSegments, LottieState, LottieSubscription, LottieSubscriptions } from "./animation/types.js";
|
|
2
|
+
import { UseLottieOptions } from "./animation/useLottieAnimation.js";
|
|
3
|
+
import { Lottie, LottieProps } from "./animation/Lottie.js";
|
|
4
|
+
import { LottieDisplay, LottieDisplayProps } from "./animation/LottieDisplay.js";
|
|
5
|
+
import { LottieLight, LottieLightProps } from "./animation/LottieLight.js";
|
|
6
|
+
import { LottieSvg, LottieSvgProps } from "./animation/LottieSvg.js";
|
|
7
|
+
import { useLottie } from "./animation/useLottie.js";
|
|
8
|
+
import { useLottieInstance } from "./animation/useLottieInstance.js";
|
|
9
|
+
import { useLottieLight } from "./animation/useLottieLight.js";
|
|
10
|
+
import { useLottieSvg } from "./animation/useLottieSvg.js";
|
|
11
|
+
import { LottieControls, LottieControlsProps } from "./controls/LottieControls.js";
|
|
12
|
+
import { LottieInteraction, LottieInteractionContext } from "./interactions/types.js";
|
|
13
|
+
import { LottieInteractions, LottieInteractionsProps } from "./interactions/LottieInteractions.js";
|
|
14
|
+
import { LottieInViewOptions, lottieInView } from "./interactions/lottieInView.js";
|
|
15
|
+
import { LottieScrollScrubOptions, lottieScrollScrub } from "./interactions/lottieScrollScrub.js";
|
|
16
|
+
import { useLottieInteractions } from "./interactions/useLottieInteractions.js";
|
|
17
|
+
import { LottieError, LottieErrorProps } from "./overlays/LottieError.js";
|
|
18
|
+
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 };
|