@deriv-web-design/ui 0.1.18 → 0.1.19
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/components.manifest.json +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/components.manifest.json
CHANGED
|
@@ -891,7 +891,7 @@
|
|
|
891
891
|
"name": "DotLottieInView",
|
|
892
892
|
"source": "components/DotLottieInView/DotLottieInView.tsx",
|
|
893
893
|
"props": {},
|
|
894
|
-
"description": "Plays a .lottie once when it scrolls into view. Stops and resets when it leaves view. When it enters view again, it plays once more. Set `enabled={false}` to force stop (e.g. hidden slides) without relying on geometry alone. The player itself is fetched lazily, the first time this instance is
|
|
894
|
+
"description": "Plays a .lottie once when it scrolls into view. Stops and resets when it leaves view. When it enters view again, it plays once more. Set `enabled={false}` to force stop (e.g. hidden slides) without relying on geometry alone. The player itself is fetched lazily, the first time this instance is in view — so a page with no animation never downloads it, and a below-the-fold band does not pay for it during initial load. `enabled` gates playback only: a consumer that crossfades between stacked instances needs them all loaded, not just the one currently showing."
|
|
895
895
|
},
|
|
896
896
|
"DownloadBadge": {
|
|
897
897
|
"name": "DownloadBadge",
|
package/dist/index.d.mts
CHANGED
|
@@ -844,9 +844,11 @@ type DotLottieInViewProps = Omit<ComponentProps<typeof DotLottieReact>, "autopla
|
|
|
844
844
|
* When it enters view again, it plays once more. Set `enabled={false}` to force stop
|
|
845
845
|
* (e.g. hidden slides) without relying on geometry alone.
|
|
846
846
|
*
|
|
847
|
-
* The player itself is fetched lazily, the first time this instance is
|
|
848
|
-
*
|
|
849
|
-
*
|
|
847
|
+
* The player itself is fetched lazily, the first time this instance is in view —
|
|
848
|
+
* so a page with no animation never downloads it, and a below-the-fold band does
|
|
849
|
+
* not pay for it during initial load. `enabled` gates playback only: a consumer
|
|
850
|
+
* that crossfades between stacked instances needs them all loaded, not just the
|
|
851
|
+
* one currently showing.
|
|
850
852
|
*/
|
|
851
853
|
declare function DotLottieInView({ enabled, rootMargin, threshold, className, style, poster, ...dotProps }: DotLottieInViewProps): react_jsx_runtime.JSX.Element;
|
|
852
854
|
|
package/dist/index.d.ts
CHANGED
|
@@ -844,9 +844,11 @@ type DotLottieInViewProps = Omit<ComponentProps<typeof DotLottieReact>, "autopla
|
|
|
844
844
|
* When it enters view again, it plays once more. Set `enabled={false}` to force stop
|
|
845
845
|
* (e.g. hidden slides) without relying on geometry alone.
|
|
846
846
|
*
|
|
847
|
-
* The player itself is fetched lazily, the first time this instance is
|
|
848
|
-
*
|
|
849
|
-
*
|
|
847
|
+
* The player itself is fetched lazily, the first time this instance is in view —
|
|
848
|
+
* so a page with no animation never downloads it, and a below-the-fold band does
|
|
849
|
+
* not pay for it during initial load. `enabled` gates playback only: a consumer
|
|
850
|
+
* that crossfades between stacked instances needs them all loaded, not just the
|
|
851
|
+
* one currently showing.
|
|
850
852
|
*/
|
|
851
853
|
declare function DotLottieInView({ enabled, rootMargin, threshold, className, style, poster, ...dotProps }: DotLottieInViewProps): react_jsx_runtime.JSX.Element;
|
|
852
854
|
|
package/dist/index.js
CHANGED
|
@@ -2676,7 +2676,7 @@ function DotLottieInView({
|
|
|
2676
2676
|
}, [rootMargin, threshold]);
|
|
2677
2677
|
(0, import_react12.useEffect)(() => {
|
|
2678
2678
|
if (mounted) return;
|
|
2679
|
-
if (!
|
|
2679
|
+
if (!inView) return;
|
|
2680
2680
|
if (typeof window === "undefined") return;
|
|
2681
2681
|
let cancelled = false;
|
|
2682
2682
|
const commit = () => {
|
|
@@ -2691,15 +2691,23 @@ function DotLottieInView({
|
|
|
2691
2691
|
}
|
|
2692
2692
|
if (timerId !== null) window.clearTimeout(timerId);
|
|
2693
2693
|
};
|
|
2694
|
-
}, [inView,
|
|
2694
|
+
}, [inView, mounted]);
|
|
2695
2695
|
(0, import_react12.useEffect)(() => {
|
|
2696
2696
|
if (!dotLottie) return;
|
|
2697
2697
|
if (!enabled || !inView) {
|
|
2698
2698
|
dotLottie.stop();
|
|
2699
2699
|
return;
|
|
2700
2700
|
}
|
|
2701
|
-
|
|
2702
|
-
|
|
2701
|
+
const start = () => {
|
|
2702
|
+
dotLottie.stop();
|
|
2703
|
+
dotLottie.play();
|
|
2704
|
+
};
|
|
2705
|
+
if (dotLottie.isLoaded) {
|
|
2706
|
+
start();
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
dotLottie.addEventListener("load", start);
|
|
2710
|
+
return () => dotLottie.removeEventListener("load", start);
|
|
2703
2711
|
}, [dotLottie, enabled, inView]);
|
|
2704
2712
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2705
2713
|
"div",
|