@moontra/moonui-pro 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/index.global.js +139 -139
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.mjs +44 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -89525,6 +89525,8 @@ var LiquidBackgroundInternal = ({
|
|
|
89525
89525
|
}) => {
|
|
89526
89526
|
const canvasRef = useRef(null);
|
|
89527
89527
|
const containerRef = useRef(null);
|
|
89528
|
+
const offscreenCanvasRef = useRef(null);
|
|
89529
|
+
const offscreenCtxRef = useRef(null);
|
|
89528
89530
|
const animationRef = useRef(void 0);
|
|
89529
89531
|
const blobsRef = useRef([]);
|
|
89530
89532
|
const mouseRef = useRef({ x: 0, y: 0, vx: 0, vy: 0 });
|
|
@@ -89533,6 +89535,12 @@ var LiquidBackgroundInternal = ({
|
|
|
89533
89535
|
const frameInterval = 1e3 / fps;
|
|
89534
89536
|
const [isVisible, setIsVisible] = useState(true);
|
|
89535
89537
|
const observerTimeoutRef = useRef(null);
|
|
89538
|
+
const filterString = useMemo(() => {
|
|
89539
|
+
if (blur2 > 0 && contrast > 0) {
|
|
89540
|
+
return `blur(${blur2}px) contrast(${contrast})`;
|
|
89541
|
+
}
|
|
89542
|
+
return "none";
|
|
89543
|
+
}, [blur2, contrast]);
|
|
89536
89544
|
const initializeBlobs = useCallback(() => {
|
|
89537
89545
|
const canvas = canvasRef.current;
|
|
89538
89546
|
if (!canvas)
|
|
@@ -89637,9 +89645,7 @@ var LiquidBackgroundInternal = ({
|
|
|
89637
89645
|
}, [animationStyle, speed, viscosity, tension, sizeRange, interactive, mouseRadius]);
|
|
89638
89646
|
const drawLiquid = useCallback((ctx, canvas) => {
|
|
89639
89647
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
89640
|
-
|
|
89641
|
-
ctx.filter = `blur(${blur2}px) contrast(${contrast})`;
|
|
89642
|
-
}
|
|
89648
|
+
ctx.filter = filterString;
|
|
89643
89649
|
ctx.globalAlpha = opacity;
|
|
89644
89650
|
const blobs = blobsRef.current;
|
|
89645
89651
|
blobs.forEach((blob) => {
|
|
@@ -89685,14 +89691,17 @@ var LiquidBackgroundInternal = ({
|
|
|
89685
89691
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
89686
89692
|
ctx.globalCompositeOperation = "source-over";
|
|
89687
89693
|
}
|
|
89688
|
-
}, [
|
|
89694
|
+
}, [filterString, opacity, glow, glowIntensity, gradientOverlay]);
|
|
89689
89695
|
const animate4 = useCallback((currentTime) => {
|
|
89690
89696
|
const canvas = canvasRef.current;
|
|
89691
|
-
|
|
89697
|
+
const offscreenCanvas = offscreenCanvasRef.current;
|
|
89698
|
+
const offscreenCtx = offscreenCtxRef.current;
|
|
89699
|
+
if (!canvas || !offscreenCanvas || !offscreenCtx)
|
|
89692
89700
|
return;
|
|
89693
89701
|
const ctx = canvas.getContext("2d", {
|
|
89694
89702
|
alpha: true,
|
|
89695
|
-
desynchronized: true
|
|
89703
|
+
desynchronized: true,
|
|
89704
|
+
willReadFrequently: false
|
|
89696
89705
|
});
|
|
89697
89706
|
if (!ctx)
|
|
89698
89707
|
return;
|
|
@@ -89704,18 +89713,23 @@ var LiquidBackgroundInternal = ({
|
|
|
89704
89713
|
lastFrameTimeRef.current = currentTime;
|
|
89705
89714
|
if (!pauseWhenHidden || isVisible) {
|
|
89706
89715
|
timeRef.current += 1;
|
|
89707
|
-
updateBlobs(
|
|
89708
|
-
drawLiquid(
|
|
89716
|
+
updateBlobs(offscreenCanvas);
|
|
89717
|
+
drawLiquid(offscreenCtx, offscreenCanvas);
|
|
89718
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
89719
|
+
ctx.drawImage(offscreenCanvas, 0, 0);
|
|
89709
89720
|
}
|
|
89710
89721
|
animationRef.current = requestAnimationFrame(animate4);
|
|
89711
89722
|
}, [frameInterval, updateBlobs, drawLiquid, pauseWhenHidden, isVisible]);
|
|
89712
89723
|
const handleResize = useCallback(() => {
|
|
89713
89724
|
const canvas = canvasRef.current;
|
|
89714
|
-
|
|
89725
|
+
const offscreenCanvas = offscreenCanvasRef.current;
|
|
89726
|
+
if (!canvas || !offscreenCanvas)
|
|
89715
89727
|
return;
|
|
89716
89728
|
const rect = canvas.getBoundingClientRect();
|
|
89717
89729
|
canvas.width = rect.width;
|
|
89718
89730
|
canvas.height = rect.height;
|
|
89731
|
+
offscreenCanvas.width = rect.width;
|
|
89732
|
+
offscreenCanvas.height = rect.height;
|
|
89719
89733
|
initializeBlobs();
|
|
89720
89734
|
}, [initializeBlobs]);
|
|
89721
89735
|
const handleMouseMove2 = useCallback((e) => {
|
|
@@ -89734,9 +89748,22 @@ var LiquidBackgroundInternal = ({
|
|
|
89734
89748
|
const canvas = canvasRef.current;
|
|
89735
89749
|
if (!canvas)
|
|
89736
89750
|
return;
|
|
89751
|
+
timeRef.current = Math.random() * 100;
|
|
89752
|
+
const offscreenCanvas = document.createElement("canvas");
|
|
89753
|
+
const offscreenCtx = offscreenCanvas.getContext("2d", {
|
|
89754
|
+
alpha: true,
|
|
89755
|
+
desynchronized: true,
|
|
89756
|
+
willReadFrequently: false
|
|
89757
|
+
});
|
|
89758
|
+
if (!offscreenCtx)
|
|
89759
|
+
return;
|
|
89760
|
+
offscreenCanvasRef.current = offscreenCanvas;
|
|
89761
|
+
offscreenCtxRef.current = offscreenCtx;
|
|
89737
89762
|
const rect = canvas.getBoundingClientRect();
|
|
89738
89763
|
canvas.width = rect.width;
|
|
89739
89764
|
canvas.height = rect.height;
|
|
89765
|
+
offscreenCanvas.width = rect.width;
|
|
89766
|
+
offscreenCanvas.height = rect.height;
|
|
89740
89767
|
initializeBlobs();
|
|
89741
89768
|
window.addEventListener("resize", handleResize);
|
|
89742
89769
|
if (interactive) {
|
|
@@ -89749,6 +89776,8 @@ var LiquidBackgroundInternal = ({
|
|
|
89749
89776
|
if (animationRef.current) {
|
|
89750
89777
|
cancelAnimationFrame(animationRef.current);
|
|
89751
89778
|
}
|
|
89779
|
+
offscreenCanvasRef.current = null;
|
|
89780
|
+
offscreenCtxRef.current = null;
|
|
89752
89781
|
};
|
|
89753
89782
|
}, [initializeBlobs, handleResize, handleMouseMove2, animate4, interactive]);
|
|
89754
89783
|
useEffect(() => {
|
|
@@ -89779,9 +89808,11 @@ var LiquidBackgroundInternal = ({
|
|
|
89779
89808
|
};
|
|
89780
89809
|
}, [pauseWhenHidden]);
|
|
89781
89810
|
const canvasStyle = useMemo(() => ({
|
|
89782
|
-
willChange: "transform",
|
|
89811
|
+
willChange: "transform, opacity",
|
|
89783
89812
|
transform: "translate3d(0, 0, 0)",
|
|
89784
89813
|
backfaceVisibility: "hidden",
|
|
89814
|
+
contain: "paint layout",
|
|
89815
|
+
isolation: "isolate",
|
|
89785
89816
|
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
89786
89817
|
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
89787
89818
|
}), [pauseWhenHidden, isVisible]);
|
|
@@ -89794,7 +89825,9 @@ var LiquidBackgroundInternal = ({
|
|
|
89794
89825
|
containerClassName
|
|
89795
89826
|
),
|
|
89796
89827
|
style: {
|
|
89797
|
-
backgroundColor
|
|
89828
|
+
backgroundColor,
|
|
89829
|
+
contain: "layout style paint",
|
|
89830
|
+
willChange: "contents"
|
|
89798
89831
|
},
|
|
89799
89832
|
children: [
|
|
89800
89833
|
/* @__PURE__ */ jsx(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|