@moontra/moonui-pro 3.3.29 → 3.4.1
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.css +1 -1
- package/dist/cdn/index.css.map +1 -1
- package/dist/cdn/index.global.js +198 -198
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +585 -220
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -86692,7 +86692,7 @@ var Meteors = (props) => {
|
|
|
86692
86692
|
Meteors.displayName = "Meteors";
|
|
86693
86693
|
|
|
86694
86694
|
// src/components/backgrounds/aurora-background.css
|
|
86695
|
-
styleInject("@keyframes aurora-wave-1 {\n 0%, 100% {\n transform: translateX(-50%) translateY(-50%) rotate(0deg) scale(1);\n }\n 33% {\n transform: translateX(-45%) translateY(-55%) rotate(60deg) scale(1.1);\n }\n 66% {\n transform: translateX(-55%) translateY(-45%) rotate(-60deg) scale(0.9);\n }\n}\n@keyframes aurora-wave-2 {\n 0%, 100% {\n transform: translateX(-50%) translateY(-50%) rotate(45deg) scale(1.2);\n }\n 33% {\n transform: translateX(-55%) translateY(-45%) rotate(105deg) scale(1);\n }\n 66% {\n transform: translateX(-45%) translateY(-55%) rotate(-15deg) scale(1.3);\n }\n}\n@keyframes aurora-wave-3 {\n 0%, 100% {\n transform: translateX(-50%) translateY(-50%) rotate(-45deg) scale(0.8);\n }\n 33% {\n transform: translateX(-40%) translateY(-50%) rotate(15deg) scale(1.2);\n }\n 66% {\n transform: translateX(-60%) translateY(-50%) rotate(-105deg) scale(1);\n }\n}\n@keyframes aurora-shimmer {\n 0%, 100% {\n opacity: 0.3;\n }\n 50% {\n opacity: 0.8;\n }\n}\n.aurora-layer {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 200%;\n height: 200%;\n filter: blur(80px);\n mix-blend-mode: screen;\n pointer-events: none;\n}\n.aurora-layer-1 {\n background: radial-gradient(ellipse at center, var(--aurora-color-1) 0%, transparent 60%);\n animation: aurora-wave-1 15s ease-in-out infinite;\n}\n.aurora-layer-2 {\n background: radial-gradient(ellipse at center, var(--aurora-color-2) 0%, transparent 50%);\n animation: aurora-wave-2 20s ease-in-out infinite;\n}\n.aurora-layer-3 {\n background: radial-gradient(ellipse at center, var(--aurora-color-3) 0%, transparent 70%);\n animation: aurora-wave-3 25s ease-in-out infinite;\n}\n.aurora-layer-shimmer {\n background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 60%);\n animation: aurora-shimmer 3s ease-in-out infinite;\n}\n.aurora-interactive .aurora-layer {\n transition: transform 0.3s ease-out;\n}\n.aurora-paused .aurora-layer {\n
|
|
86695
|
+
styleInject("@keyframes aurora-wave-1 {\n 0%, 100% {\n transform: translateX(-50%) translateY(-50%) rotate(0deg) scale(1);\n }\n 33% {\n transform: translateX(-45%) translateY(-55%) rotate(60deg) scale(1.1);\n }\n 66% {\n transform: translateX(-55%) translateY(-45%) rotate(-60deg) scale(0.9);\n }\n}\n@keyframes aurora-wave-2 {\n 0%, 100% {\n transform: translateX(-50%) translateY(-50%) rotate(45deg) scale(1.2);\n }\n 33% {\n transform: translateX(-55%) translateY(-45%) rotate(105deg) scale(1);\n }\n 66% {\n transform: translateX(-45%) translateY(-55%) rotate(-15deg) scale(1.3);\n }\n}\n@keyframes aurora-wave-3 {\n 0%, 100% {\n transform: translateX(-50%) translateY(-50%) rotate(-45deg) scale(0.8);\n }\n 33% {\n transform: translateX(-40%) translateY(-50%) rotate(15deg) scale(1.2);\n }\n 66% {\n transform: translateX(-60%) translateY(-50%) rotate(-105deg) scale(1);\n }\n}\n@keyframes aurora-shimmer {\n 0%, 100% {\n opacity: 0.3;\n }\n 50% {\n opacity: 0.8;\n }\n}\n.aurora-layer {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 200%;\n height: 200%;\n filter: blur(80px);\n mix-blend-mode: screen;\n pointer-events: none;\n will-change: transform, opacity;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n}\n.aurora-layer-1 {\n background: radial-gradient(ellipse at center, var(--aurora-color-1) 0%, transparent 60%);\n animation: aurora-wave-1 15s ease-in-out infinite;\n}\n.aurora-layer-2 {\n background: radial-gradient(ellipse at center, var(--aurora-color-2) 0%, transparent 50%);\n animation: aurora-wave-2 20s ease-in-out infinite;\n}\n.aurora-layer-3 {\n background: radial-gradient(ellipse at center, var(--aurora-color-3) 0%, transparent 70%);\n animation: aurora-wave-3 25s ease-in-out infinite;\n}\n.aurora-layer-shimmer {\n background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 60%);\n animation: aurora-shimmer 3s ease-in-out infinite;\n}\n.aurora-interactive .aurora-layer {\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n}\n.aurora-paused .aurora-layer {\n opacity: 0;\n transition: opacity 0.3s ease-out;\n}\n");
|
|
86696
86696
|
var AuroraBackgroundInternal = ({
|
|
86697
86697
|
children,
|
|
86698
86698
|
className,
|
|
@@ -86710,12 +86710,13 @@ var AuroraBackgroundInternal = ({
|
|
|
86710
86710
|
blendMode = "screen",
|
|
86711
86711
|
variant = "default",
|
|
86712
86712
|
fixed = false,
|
|
86713
|
-
pauseWhenHidden =
|
|
86713
|
+
pauseWhenHidden = false
|
|
86714
86714
|
}) => {
|
|
86715
86715
|
const [mousePosition, setMousePosition] = useState({ x: 50, y: 50 });
|
|
86716
86716
|
const [isVisible, setIsVisible] = useState(true);
|
|
86717
|
-
const containerRef =
|
|
86718
|
-
const
|
|
86717
|
+
const containerRef = useRef(null);
|
|
86718
|
+
const observerTimeoutRef = useRef(null);
|
|
86719
|
+
const duration = useMemo(() => {
|
|
86719
86720
|
switch (speed) {
|
|
86720
86721
|
case "slow":
|
|
86721
86722
|
return { layer1: "30s", layer2: "40s", layer3: "50s" };
|
|
@@ -86724,8 +86725,8 @@ var AuroraBackgroundInternal = ({
|
|
|
86724
86725
|
default:
|
|
86725
86726
|
return { layer1: "15s", layer2: "20s", layer3: "25s" };
|
|
86726
86727
|
}
|
|
86727
|
-
};
|
|
86728
|
-
const
|
|
86728
|
+
}, [speed]);
|
|
86729
|
+
const variantColors = useMemo(() => {
|
|
86729
86730
|
switch (variant) {
|
|
86730
86731
|
case "subtle":
|
|
86731
86732
|
return {
|
|
@@ -86748,17 +86749,15 @@ var AuroraBackgroundInternal = ({
|
|
|
86748
86749
|
default:
|
|
86749
86750
|
return colors;
|
|
86750
86751
|
}
|
|
86751
|
-
};
|
|
86752
|
-
const handleMouseMove2 = (e) => {
|
|
86752
|
+
}, [variant, colors]);
|
|
86753
|
+
const handleMouseMove2 = useCallback((e) => {
|
|
86753
86754
|
if (!interactive)
|
|
86754
86755
|
return;
|
|
86755
86756
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
86756
86757
|
const x2 = (e.clientX - rect.left) / rect.width * 100;
|
|
86757
86758
|
const y = (e.clientY - rect.top) / rect.height * 100;
|
|
86758
86759
|
setMousePosition({ x: x2, y });
|
|
86759
|
-
};
|
|
86760
|
-
const duration = getAnimationDuration();
|
|
86761
|
-
const variantColors = getVariantColors();
|
|
86760
|
+
}, [interactive]);
|
|
86762
86761
|
useEffect(() => {
|
|
86763
86762
|
if (!pauseWhenHidden)
|
|
86764
86763
|
return;
|
|
@@ -86768,19 +86767,60 @@ var AuroraBackgroundInternal = ({
|
|
|
86768
86767
|
const observer = new IntersectionObserver(
|
|
86769
86768
|
(entries) => {
|
|
86770
86769
|
entries.forEach((entry) => {
|
|
86771
|
-
|
|
86770
|
+
if (observerTimeoutRef.current) {
|
|
86771
|
+
clearTimeout(observerTimeoutRef.current);
|
|
86772
|
+
}
|
|
86773
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
86774
|
+
setIsVisible(entry.isIntersecting);
|
|
86775
|
+
}, 150);
|
|
86772
86776
|
});
|
|
86773
86777
|
},
|
|
86774
86778
|
{
|
|
86775
|
-
threshold: 0.
|
|
86776
|
-
|
|
86779
|
+
threshold: 0.5
|
|
86780
|
+
// Component must be 50% visible (was 0.1)
|
|
86781
|
+
// Removed rootMargin to prevent premature triggering
|
|
86777
86782
|
}
|
|
86778
86783
|
);
|
|
86779
86784
|
observer.observe(container);
|
|
86780
86785
|
return () => {
|
|
86781
86786
|
observer.disconnect();
|
|
86787
|
+
if (observerTimeoutRef.current) {
|
|
86788
|
+
clearTimeout(observerTimeoutRef.current);
|
|
86789
|
+
}
|
|
86782
86790
|
};
|
|
86783
86791
|
}, [pauseWhenHidden]);
|
|
86792
|
+
const containerStyle = useMemo(() => ({
|
|
86793
|
+
"--aurora-color-1": variantColors.primary,
|
|
86794
|
+
"--aurora-color-2": variantColors.secondary,
|
|
86795
|
+
"--aurora-color-3": variantColors.tertiary,
|
|
86796
|
+
"--aurora-opacity": opacity.toString(),
|
|
86797
|
+
"--aurora-blur": `${blur2}px`
|
|
86798
|
+
}), [variantColors, opacity, blur2]);
|
|
86799
|
+
const backgroundStyle = useMemo(() => ({
|
|
86800
|
+
background: variant === "dark" ? "linear-gradient(to bottom, #0f172a, #020617)" : "linear-gradient(to bottom, #ffffff, #f8fafc)"
|
|
86801
|
+
}), [variant]);
|
|
86802
|
+
const layer1Style = useMemo(() => ({
|
|
86803
|
+
animationDuration: duration.layer1,
|
|
86804
|
+
filter: `blur(${blur2}px)`,
|
|
86805
|
+
mixBlendMode: blendMode,
|
|
86806
|
+
transform: interactive ? `translateX(${-50 + (mousePosition.x - 50) * 0.1}%) translateY(${-50 + (mousePosition.y - 50) * 0.1}%) rotate(0deg) scale(1)` : void 0
|
|
86807
|
+
}), [duration.layer1, blur2, blendMode, interactive, mousePosition]);
|
|
86808
|
+
const layer2Style = useMemo(() => ({
|
|
86809
|
+
animationDuration: duration.layer2,
|
|
86810
|
+
filter: `blur(${blur2 * 1.2}px)`,
|
|
86811
|
+
mixBlendMode: blendMode,
|
|
86812
|
+
transform: interactive ? `translateX(${-50 + (mousePosition.x - 50) * 0.2}%) translateY(${-50 + (mousePosition.y - 50) * 0.2}%) rotate(45deg) scale(1.2)` : void 0
|
|
86813
|
+
}), [duration.layer2, blur2, blendMode, interactive, mousePosition]);
|
|
86814
|
+
const layer3Style = useMemo(() => ({
|
|
86815
|
+
animationDuration: duration.layer3,
|
|
86816
|
+
filter: `blur(${blur2 * 0.8}px)`,
|
|
86817
|
+
mixBlendMode: blendMode,
|
|
86818
|
+
transform: interactive ? `translateX(${-50 + (mousePosition.x - 50) * 0.15}%) translateY(${-50 + (mousePosition.y - 50) * 0.15}%) rotate(-45deg) scale(0.8)` : void 0
|
|
86819
|
+
}), [duration.layer3, blur2, blendMode, interactive, mousePosition]);
|
|
86820
|
+
const shimmerStyle = useMemo(() => ({
|
|
86821
|
+
filter: `blur(${blur2 * 0.5}px)`,
|
|
86822
|
+
mixBlendMode: "overlay"
|
|
86823
|
+
}), [blur2]);
|
|
86784
86824
|
return /* @__PURE__ */ jsxs(
|
|
86785
86825
|
"div",
|
|
86786
86826
|
{
|
|
@@ -86793,70 +86833,14 @@ var AuroraBackgroundInternal = ({
|
|
|
86793
86833
|
containerClassName
|
|
86794
86834
|
),
|
|
86795
86835
|
onMouseMove: handleMouseMove2,
|
|
86796
|
-
style:
|
|
86797
|
-
"--aurora-color-1": variantColors.primary,
|
|
86798
|
-
"--aurora-color-2": variantColors.secondary,
|
|
86799
|
-
"--aurora-color-3": variantColors.tertiary,
|
|
86800
|
-
"--aurora-opacity": opacity.toString(),
|
|
86801
|
-
"--aurora-blur": `${blur2}px`
|
|
86802
|
-
},
|
|
86836
|
+
style: containerStyle,
|
|
86803
86837
|
children: [
|
|
86804
|
-
/* @__PURE__ */ jsx(
|
|
86805
|
-
"div",
|
|
86806
|
-
{
|
|
86807
|
-
className: "absolute inset-0",
|
|
86808
|
-
style: {
|
|
86809
|
-
background: variant === "dark" ? "linear-gradient(to bottom, #0f172a, #020617)" : "linear-gradient(to bottom, #ffffff, #f8fafc)"
|
|
86810
|
-
}
|
|
86811
|
-
}
|
|
86812
|
-
),
|
|
86838
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0", style: backgroundStyle }),
|
|
86813
86839
|
/* @__PURE__ */ jsxs("div", { className: "absolute inset-0", style: { opacity }, children: [
|
|
86814
|
-
/* @__PURE__ */ jsx(
|
|
86815
|
-
|
|
86816
|
-
|
|
86817
|
-
|
|
86818
|
-
style: {
|
|
86819
|
-
animationDuration: duration.layer1,
|
|
86820
|
-
filter: `blur(${blur2}px)`,
|
|
86821
|
-
mixBlendMode: blendMode,
|
|
86822
|
-
transform: interactive ? `translateX(${-50 + (mousePosition.x - 50) * 0.1}%) translateY(${-50 + (mousePosition.y - 50) * 0.1}%) rotate(0deg) scale(1)` : void 0
|
|
86823
|
-
}
|
|
86824
|
-
}
|
|
86825
|
-
),
|
|
86826
|
-
/* @__PURE__ */ jsx(
|
|
86827
|
-
"div",
|
|
86828
|
-
{
|
|
86829
|
-
className: "aurora-layer aurora-layer-2",
|
|
86830
|
-
style: {
|
|
86831
|
-
animationDuration: duration.layer2,
|
|
86832
|
-
filter: `blur(${blur2 * 1.2}px)`,
|
|
86833
|
-
mixBlendMode: blendMode,
|
|
86834
|
-
transform: interactive ? `translateX(${-50 + (mousePosition.x - 50) * 0.2}%) translateY(${-50 + (mousePosition.y - 50) * 0.2}%) rotate(45deg) scale(1.2)` : void 0
|
|
86835
|
-
}
|
|
86836
|
-
}
|
|
86837
|
-
),
|
|
86838
|
-
/* @__PURE__ */ jsx(
|
|
86839
|
-
"div",
|
|
86840
|
-
{
|
|
86841
|
-
className: "aurora-layer aurora-layer-3",
|
|
86842
|
-
style: {
|
|
86843
|
-
animationDuration: duration.layer3,
|
|
86844
|
-
filter: `blur(${blur2 * 0.8}px)`,
|
|
86845
|
-
mixBlendMode: blendMode,
|
|
86846
|
-
transform: interactive ? `translateX(${-50 + (mousePosition.x - 50) * 0.15}%) translateY(${-50 + (mousePosition.y - 50) * 0.15}%) rotate(-45deg) scale(0.8)` : void 0
|
|
86847
|
-
}
|
|
86848
|
-
}
|
|
86849
|
-
),
|
|
86850
|
-
shimmer && /* @__PURE__ */ jsx(
|
|
86851
|
-
"div",
|
|
86852
|
-
{
|
|
86853
|
-
className: "aurora-layer aurora-layer-shimmer",
|
|
86854
|
-
style: {
|
|
86855
|
-
filter: `blur(${blur2 * 0.5}px)`,
|
|
86856
|
-
mixBlendMode: "overlay"
|
|
86857
|
-
}
|
|
86858
|
-
}
|
|
86859
|
-
)
|
|
86840
|
+
/* @__PURE__ */ jsx("div", { className: "aurora-layer aurora-layer-1", style: layer1Style }),
|
|
86841
|
+
/* @__PURE__ */ jsx("div", { className: "aurora-layer aurora-layer-2", style: layer2Style }),
|
|
86842
|
+
/* @__PURE__ */ jsx("div", { className: "aurora-layer aurora-layer-3", style: layer3Style }),
|
|
86843
|
+
shimmer && /* @__PURE__ */ jsx("div", { className: "aurora-layer aurora-layer-shimmer", style: shimmerStyle })
|
|
86860
86844
|
] }),
|
|
86861
86845
|
children && /* @__PURE__ */ jsx("div", { className: cn("relative z-10", className), children })
|
|
86862
86846
|
]
|
|
@@ -86904,15 +86888,19 @@ var ParticlesInternal = ({
|
|
|
86904
86888
|
movement = "random",
|
|
86905
86889
|
gravity = 0.1,
|
|
86906
86890
|
bounce = true,
|
|
86907
|
-
opacity = { min: 0.3, max: 1 }
|
|
86891
|
+
opacity = { min: 0.3, max: 1 },
|
|
86892
|
+
pauseWhenHidden = false
|
|
86908
86893
|
}) => {
|
|
86909
86894
|
const canvasRef = useRef(null);
|
|
86895
|
+
const containerRef = useRef(null);
|
|
86910
86896
|
const animationRef = useRef(void 0);
|
|
86911
86897
|
const particlesRef = useRef([]);
|
|
86912
86898
|
const mouseRef = useRef({ x: 0, y: 0 });
|
|
86913
86899
|
const lastFrameTimeRef = useRef(0);
|
|
86914
86900
|
const frameInterval = 1e3 / fps;
|
|
86915
|
-
const
|
|
86901
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
86902
|
+
const observerTimeoutRef = useRef(null);
|
|
86903
|
+
const drawParticle = useCallback((ctx, particle) => {
|
|
86916
86904
|
ctx.save();
|
|
86917
86905
|
ctx.translate(particle.x, particle.y);
|
|
86918
86906
|
if (particle.angle && shape !== "circle") {
|
|
@@ -86967,8 +86955,8 @@ var ParticlesInternal = ({
|
|
|
86967
86955
|
break;
|
|
86968
86956
|
}
|
|
86969
86957
|
ctx.restore();
|
|
86970
|
-
};
|
|
86971
|
-
const updateParticle = (particle, canvas) => {
|
|
86958
|
+
}, [shape, glow, performanceMode, glowIntensity]);
|
|
86959
|
+
const updateParticle = useCallback((particle, canvas) => {
|
|
86972
86960
|
switch (movement) {
|
|
86973
86961
|
case "linear":
|
|
86974
86962
|
particle.x += particle.vx;
|
|
@@ -87031,8 +87019,8 @@ var ParticlesInternal = ({
|
|
|
87031
87019
|
particle.life = 0;
|
|
87032
87020
|
}
|
|
87033
87021
|
}
|
|
87034
|
-
};
|
|
87035
|
-
const drawConnections = (ctx) => {
|
|
87022
|
+
}, [movement, speed, gravity, shape, interactive, mouseRadius, bounce]);
|
|
87023
|
+
const drawConnections = useCallback((ctx) => {
|
|
87036
87024
|
const particles = particlesRef.current;
|
|
87037
87025
|
for (let i = 0; i < particles.length; i++) {
|
|
87038
87026
|
for (let j = i + 1; j < particles.length; j++) {
|
|
@@ -87050,7 +87038,7 @@ var ParticlesInternal = ({
|
|
|
87050
87038
|
}
|
|
87051
87039
|
}
|
|
87052
87040
|
}
|
|
87053
|
-
};
|
|
87041
|
+
}, [connectDistance, lineOpacity, lineWidth]);
|
|
87054
87042
|
const animate4 = useCallback((currentTime) => {
|
|
87055
87043
|
const canvas = canvasRef.current;
|
|
87056
87044
|
const ctx = canvas?.getContext("2d", {
|
|
@@ -87066,20 +87054,22 @@ var ParticlesInternal = ({
|
|
|
87066
87054
|
return;
|
|
87067
87055
|
}
|
|
87068
87056
|
lastFrameTimeRef.current = currentTime;
|
|
87069
|
-
|
|
87070
|
-
|
|
87071
|
-
|
|
87072
|
-
|
|
87073
|
-
|
|
87074
|
-
|
|
87057
|
+
if (!pauseWhenHidden || isVisible) {
|
|
87058
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
87059
|
+
if (blur2 > 0) {
|
|
87060
|
+
ctx.filter = `blur(${blur2}px)`;
|
|
87061
|
+
}
|
|
87062
|
+
if (showConnections && !performanceMode) {
|
|
87063
|
+
drawConnections(ctx);
|
|
87064
|
+
}
|
|
87065
|
+
const particles = particlesRef.current;
|
|
87066
|
+
particles.forEach((particle) => {
|
|
87067
|
+
updateParticle(particle, canvas);
|
|
87068
|
+
drawParticle(ctx, particle);
|
|
87069
|
+
});
|
|
87075
87070
|
}
|
|
87076
|
-
const particles = particlesRef.current;
|
|
87077
|
-
particles.forEach((particle) => {
|
|
87078
|
-
updateParticle(particle, canvas);
|
|
87079
|
-
drawParticle(ctx, particle);
|
|
87080
|
-
});
|
|
87081
87071
|
animationRef.current = requestAnimationFrame(animate4);
|
|
87082
|
-
}, [showConnections,
|
|
87072
|
+
}, [showConnections, performanceMode, blur2, frameInterval, drawConnections, updateParticle, drawParticle, pauseWhenHidden, isVisible]);
|
|
87083
87073
|
const handleResize = useCallback(() => {
|
|
87084
87074
|
const canvas = canvasRef.current;
|
|
87085
87075
|
if (!canvas)
|
|
@@ -87116,6 +87106,37 @@ var ParticlesInternal = ({
|
|
|
87116
87106
|
y: e.clientY - rect.top
|
|
87117
87107
|
};
|
|
87118
87108
|
}, []);
|
|
87109
|
+
useEffect(() => {
|
|
87110
|
+
if (!pauseWhenHidden)
|
|
87111
|
+
return;
|
|
87112
|
+
const container = containerRef.current;
|
|
87113
|
+
if (!container)
|
|
87114
|
+
return;
|
|
87115
|
+
const observer = new IntersectionObserver(
|
|
87116
|
+
(entries) => {
|
|
87117
|
+
entries.forEach((entry) => {
|
|
87118
|
+
if (observerTimeoutRef.current) {
|
|
87119
|
+
clearTimeout(observerTimeoutRef.current);
|
|
87120
|
+
}
|
|
87121
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
87122
|
+
setIsVisible(entry.isIntersecting);
|
|
87123
|
+
}, 150);
|
|
87124
|
+
});
|
|
87125
|
+
},
|
|
87126
|
+
{
|
|
87127
|
+
threshold: 0.5
|
|
87128
|
+
// Component must be 50% visible
|
|
87129
|
+
// No rootMargin to prevent premature triggering
|
|
87130
|
+
}
|
|
87131
|
+
);
|
|
87132
|
+
observer.observe(container);
|
|
87133
|
+
return () => {
|
|
87134
|
+
observer.disconnect();
|
|
87135
|
+
if (observerTimeoutRef.current) {
|
|
87136
|
+
clearTimeout(observerTimeoutRef.current);
|
|
87137
|
+
}
|
|
87138
|
+
};
|
|
87139
|
+
}, [pauseWhenHidden]);
|
|
87119
87140
|
useEffect(() => {
|
|
87120
87141
|
const canvas = canvasRef.current;
|
|
87121
87142
|
if (canvas) {
|
|
@@ -87154,9 +87175,17 @@ var ParticlesInternal = ({
|
|
|
87154
87175
|
}
|
|
87155
87176
|
};
|
|
87156
87177
|
}, [handleResize, handleMouseMove2, animate4, interactive, count3, size4, colors, speed, opacity]);
|
|
87178
|
+
const canvasStyle = useMemo(() => ({
|
|
87179
|
+
willChange: "transform",
|
|
87180
|
+
transform: "translate3d(0, 0, 0)",
|
|
87181
|
+
backfaceVisibility: "hidden",
|
|
87182
|
+
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
87183
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
87184
|
+
}), [pauseWhenHidden, isVisible]);
|
|
87157
87185
|
return /* @__PURE__ */ jsxs(
|
|
87158
87186
|
"div",
|
|
87159
87187
|
{
|
|
87188
|
+
ref: containerRef,
|
|
87160
87189
|
className: cn(
|
|
87161
87190
|
"relative w-full h-full overflow-hidden",
|
|
87162
87191
|
containerClassName
|
|
@@ -87173,9 +87202,7 @@ var ParticlesInternal = ({
|
|
|
87173
87202
|
"absolute inset-0 w-full h-full",
|
|
87174
87203
|
className
|
|
87175
87204
|
),
|
|
87176
|
-
style:
|
|
87177
|
-
opacity: 1
|
|
87178
|
-
}
|
|
87205
|
+
style: canvasStyle
|
|
87179
87206
|
}
|
|
87180
87207
|
),
|
|
87181
87208
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -87238,7 +87265,8 @@ var StarfieldInternal = ({
|
|
|
87238
87265
|
const needsSortRef = useRef(true);
|
|
87239
87266
|
const sortTimeRef = useRef(0);
|
|
87240
87267
|
const resizeTimeoutRef = useRef(void 0);
|
|
87241
|
-
const
|
|
87268
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
87269
|
+
const observerTimeoutRef = useRef(null);
|
|
87242
87270
|
const containerRef = useRef(null);
|
|
87243
87271
|
const starColors = Array.isArray(starColor) ? starColor : [starColor];
|
|
87244
87272
|
const initializeShootingStars = useCallback(() => {
|
|
@@ -87422,7 +87450,7 @@ var StarfieldInternal = ({
|
|
|
87422
87450
|
});
|
|
87423
87451
|
};
|
|
87424
87452
|
const animate4 = useCallback((currentTime) => {
|
|
87425
|
-
if (!
|
|
87453
|
+
if (!isVisible) {
|
|
87426
87454
|
animationRef.current = requestAnimationFrame(animate4);
|
|
87427
87455
|
return;
|
|
87428
87456
|
}
|
|
@@ -87539,17 +87567,26 @@ var StarfieldInternal = ({
|
|
|
87539
87567
|
const observer = new IntersectionObserver(
|
|
87540
87568
|
(entries) => {
|
|
87541
87569
|
entries.forEach((entry) => {
|
|
87542
|
-
|
|
87570
|
+
if (observerTimeoutRef.current) {
|
|
87571
|
+
clearTimeout(observerTimeoutRef.current);
|
|
87572
|
+
}
|
|
87573
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
87574
|
+
setIsVisible(entry.isIntersecting);
|
|
87575
|
+
}, 150);
|
|
87543
87576
|
});
|
|
87544
87577
|
},
|
|
87545
87578
|
{
|
|
87546
|
-
threshold: 0.
|
|
87547
|
-
|
|
87579
|
+
threshold: 0.5
|
|
87580
|
+
// Component must be 50% visible (was 0.1)
|
|
87581
|
+
// Removed rootMargin to prevent premature triggering
|
|
87548
87582
|
}
|
|
87549
87583
|
);
|
|
87550
87584
|
observer.observe(container);
|
|
87551
87585
|
return () => {
|
|
87552
87586
|
observer.disconnect();
|
|
87587
|
+
if (observerTimeoutRef.current) {
|
|
87588
|
+
clearTimeout(observerTimeoutRef.current);
|
|
87589
|
+
}
|
|
87553
87590
|
};
|
|
87554
87591
|
}, []);
|
|
87555
87592
|
useEffect(() => {
|
|
@@ -87594,6 +87631,11 @@ var StarfieldInternal = ({
|
|
|
87594
87631
|
}
|
|
87595
87632
|
};
|
|
87596
87633
|
}, [handleResize, handleMouseMove2, animate4, mouseParallax, initializeShootingStars, starCount, starSize, starColors, twinkleSpeed]);
|
|
87634
|
+
const canvasStyle = useMemo(() => ({
|
|
87635
|
+
willChange: "transform",
|
|
87636
|
+
transform: "translate3d(0, 0, 0)",
|
|
87637
|
+
backfaceVisibility: "hidden"
|
|
87638
|
+
}), []);
|
|
87597
87639
|
return /* @__PURE__ */ jsxs(
|
|
87598
87640
|
"div",
|
|
87599
87641
|
{
|
|
@@ -87611,7 +87653,8 @@ var StarfieldInternal = ({
|
|
|
87611
87653
|
className: cn(
|
|
87612
87654
|
"absolute inset-0 w-full h-full",
|
|
87613
87655
|
className
|
|
87614
|
-
)
|
|
87656
|
+
),
|
|
87657
|
+
style: canvasStyle
|
|
87615
87658
|
}
|
|
87616
87659
|
),
|
|
87617
87660
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -88051,7 +88094,8 @@ var GridDistortionInternal = ({
|
|
|
88051
88094
|
const mouseRef = useRef({ x: -1e3, y: -1e3 });
|
|
88052
88095
|
const timeRef = useRef(0);
|
|
88053
88096
|
const lastFrameTimeRef = useRef(0);
|
|
88054
|
-
const
|
|
88097
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
88098
|
+
const observerTimeoutRef = useRef(null);
|
|
88055
88099
|
const frameInterval = 1e3 / fps;
|
|
88056
88100
|
const initializeGrid = useCallback(() => {
|
|
88057
88101
|
const points = [];
|
|
@@ -88230,7 +88274,7 @@ var GridDistortionInternal = ({
|
|
|
88230
88274
|
const animate4 = useCallback((timestamp) => {
|
|
88231
88275
|
const canvas = canvasRef.current;
|
|
88232
88276
|
const ctx = canvas?.getContext("2d");
|
|
88233
|
-
if (!canvas || !ctx
|
|
88277
|
+
if (!canvas || !ctx) {
|
|
88234
88278
|
animationRef.current = requestAnimationFrame(animate4);
|
|
88235
88279
|
return;
|
|
88236
88280
|
}
|
|
@@ -88240,11 +88284,13 @@ var GridDistortionInternal = ({
|
|
|
88240
88284
|
return;
|
|
88241
88285
|
}
|
|
88242
88286
|
lastFrameTimeRef.current = timestamp - elapsed % frameInterval;
|
|
88243
|
-
|
|
88244
|
-
|
|
88245
|
-
|
|
88287
|
+
if (isVisible) {
|
|
88288
|
+
timeRef.current += speed * 0.016;
|
|
88289
|
+
applyDistortion(canvas);
|
|
88290
|
+
drawGrid(ctx, canvas);
|
|
88291
|
+
}
|
|
88246
88292
|
animationRef.current = requestAnimationFrame(animate4);
|
|
88247
|
-
}, [applyDistortion, drawGrid, speed, frameInterval]);
|
|
88293
|
+
}, [applyDistortion, drawGrid, speed, frameInterval, isVisible]);
|
|
88248
88294
|
const setupCanvas = useCallback(() => {
|
|
88249
88295
|
const canvas = canvasRef.current;
|
|
88250
88296
|
const container = containerRef.current;
|
|
@@ -88293,13 +88339,25 @@ var GridDistortionInternal = ({
|
|
|
88293
88339
|
if (!container)
|
|
88294
88340
|
return;
|
|
88295
88341
|
const intersectionObserver = new IntersectionObserver(
|
|
88296
|
-
(
|
|
88297
|
-
|
|
88342
|
+
(entries) => {
|
|
88343
|
+
entries.forEach((entry) => {
|
|
88344
|
+
if (observerTimeoutRef.current) {
|
|
88345
|
+
clearTimeout(observerTimeoutRef.current);
|
|
88346
|
+
}
|
|
88347
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
88348
|
+
setIsVisible(entry.isIntersecting);
|
|
88349
|
+
}, 150);
|
|
88350
|
+
});
|
|
88298
88351
|
},
|
|
88299
|
-
{ threshold: 0.
|
|
88352
|
+
{ threshold: 0.5 }
|
|
88300
88353
|
);
|
|
88301
88354
|
intersectionObserver.observe(container);
|
|
88302
|
-
return () =>
|
|
88355
|
+
return () => {
|
|
88356
|
+
intersectionObserver.disconnect();
|
|
88357
|
+
if (observerTimeoutRef.current) {
|
|
88358
|
+
clearTimeout(observerTimeoutRef.current);
|
|
88359
|
+
}
|
|
88360
|
+
};
|
|
88303
88361
|
}, []);
|
|
88304
88362
|
useEffect(() => {
|
|
88305
88363
|
const canvas = canvasRef.current;
|
|
@@ -88322,6 +88380,14 @@ var GridDistortionInternal = ({
|
|
|
88322
88380
|
}
|
|
88323
88381
|
};
|
|
88324
88382
|
}, [setupCanvas, handleMouseMove2, handleMouseLeave2, animate4, interactive]);
|
|
88383
|
+
const canvasStyle = useMemo(() => ({
|
|
88384
|
+
imageRendering: "crisp-edges",
|
|
88385
|
+
willChange: "transform",
|
|
88386
|
+
transform: "translate3d(0, 0, 0)",
|
|
88387
|
+
backfaceVisibility: "hidden",
|
|
88388
|
+
opacity: isVisible ? 1 : 0,
|
|
88389
|
+
transition: "opacity 0.3s ease-out"
|
|
88390
|
+
}), [isVisible]);
|
|
88325
88391
|
return /* @__PURE__ */ jsxs(
|
|
88326
88392
|
"div",
|
|
88327
88393
|
{
|
|
@@ -88342,9 +88408,7 @@ var GridDistortionInternal = ({
|
|
|
88342
88408
|
"absolute inset-0 w-full h-full",
|
|
88343
88409
|
className
|
|
88344
88410
|
),
|
|
88345
|
-
style:
|
|
88346
|
-
imageRendering: "crisp-edges"
|
|
88347
|
-
}
|
|
88411
|
+
style: canvasStyle
|
|
88348
88412
|
}
|
|
88349
88413
|
),
|
|
88350
88414
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -88388,15 +88452,19 @@ var WavesInternal = ({
|
|
|
88388
88452
|
animationType = "continuous",
|
|
88389
88453
|
interactive = false,
|
|
88390
88454
|
mouseRadius = 150,
|
|
88391
|
-
fps = 60
|
|
88455
|
+
fps = 60,
|
|
88456
|
+
pauseWhenHidden = false
|
|
88392
88457
|
}) => {
|
|
88393
88458
|
const canvasRef = useRef(null);
|
|
88459
|
+
const containerRef = useRef(null);
|
|
88394
88460
|
const animationRef = useRef(void 0);
|
|
88395
88461
|
const waveLayersRef = useRef([]);
|
|
88396
88462
|
const mouseRef = useRef({ x: 0, y: 0 });
|
|
88397
88463
|
const timeRef = useRef(0);
|
|
88398
88464
|
const lastFrameTimeRef = useRef(0);
|
|
88399
88465
|
const frameInterval = 1e3 / fps;
|
|
88466
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
88467
|
+
const observerTimeoutRef = useRef(null);
|
|
88400
88468
|
const initializeWaves = useCallback(() => {
|
|
88401
88469
|
const waveLayers = [];
|
|
88402
88470
|
for (let i = 0; i < layers; i++) {
|
|
@@ -88546,20 +88614,22 @@ var WavesInternal = ({
|
|
|
88546
88614
|
return;
|
|
88547
88615
|
}
|
|
88548
88616
|
lastFrameTimeRef.current = currentTime;
|
|
88549
|
-
if (
|
|
88550
|
-
|
|
88551
|
-
|
|
88552
|
-
|
|
88553
|
-
|
|
88554
|
-
|
|
88555
|
-
|
|
88556
|
-
|
|
88557
|
-
|
|
88558
|
-
|
|
88559
|
-
|
|
88617
|
+
if (!pauseWhenHidden || isVisible) {
|
|
88618
|
+
if (animationType === "continuous") {
|
|
88619
|
+
timeRef.current += 1;
|
|
88620
|
+
} else if (animationType === "pulse") {
|
|
88621
|
+
timeRef.current += 1 + Math.sin(currentTime * 1e-3) * 0.5;
|
|
88622
|
+
} else if (animationType === "breathe") {
|
|
88623
|
+
timeRef.current += 0.5 + Math.sin(currentTime * 5e-4) * 0.5;
|
|
88624
|
+
}
|
|
88625
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
88626
|
+
const waveLayers = waveLayersRef.current;
|
|
88627
|
+
for (let i = waveLayers.length - 1; i >= 0; i--) {
|
|
88628
|
+
drawWaveLayer(ctx, waveLayers[i], i, canvas);
|
|
88629
|
+
}
|
|
88560
88630
|
}
|
|
88561
88631
|
animationRef.current = requestAnimationFrame(animate4);
|
|
88562
|
-
}, [frameInterval, animationType]);
|
|
88632
|
+
}, [frameInterval, animationType, pauseWhenHidden, isVisible]);
|
|
88563
88633
|
const handleResize = useCallback(() => {
|
|
88564
88634
|
const canvas = canvasRef.current;
|
|
88565
88635
|
if (!canvas)
|
|
@@ -88600,9 +88670,44 @@ var WavesInternal = ({
|
|
|
88600
88670
|
}
|
|
88601
88671
|
};
|
|
88602
88672
|
}, [initializeWaves, handleResize, handleMouseMove2, animate4, interactive]);
|
|
88673
|
+
useEffect(() => {
|
|
88674
|
+
if (!pauseWhenHidden)
|
|
88675
|
+
return;
|
|
88676
|
+
const container = containerRef.current;
|
|
88677
|
+
if (!container)
|
|
88678
|
+
return;
|
|
88679
|
+
const observer = new IntersectionObserver(
|
|
88680
|
+
(entries) => {
|
|
88681
|
+
entries.forEach((entry) => {
|
|
88682
|
+
if (observerTimeoutRef.current) {
|
|
88683
|
+
clearTimeout(observerTimeoutRef.current);
|
|
88684
|
+
}
|
|
88685
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
88686
|
+
setIsVisible(entry.isIntersecting);
|
|
88687
|
+
}, 150);
|
|
88688
|
+
});
|
|
88689
|
+
},
|
|
88690
|
+
{ threshold: 0.5 }
|
|
88691
|
+
);
|
|
88692
|
+
observer.observe(container);
|
|
88693
|
+
return () => {
|
|
88694
|
+
observer.disconnect();
|
|
88695
|
+
if (observerTimeoutRef.current) {
|
|
88696
|
+
clearTimeout(observerTimeoutRef.current);
|
|
88697
|
+
}
|
|
88698
|
+
};
|
|
88699
|
+
}, [pauseWhenHidden]);
|
|
88700
|
+
const canvasStyle = useMemo(() => ({
|
|
88701
|
+
willChange: "transform",
|
|
88702
|
+
transform: "translate3d(0, 0, 0)",
|
|
88703
|
+
backfaceVisibility: "hidden",
|
|
88704
|
+
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
88705
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
88706
|
+
}), [pauseWhenHidden, isVisible]);
|
|
88603
88707
|
return /* @__PURE__ */ jsxs(
|
|
88604
88708
|
"div",
|
|
88605
88709
|
{
|
|
88710
|
+
ref: containerRef,
|
|
88606
88711
|
className: cn(
|
|
88607
88712
|
"relative w-full h-full overflow-hidden",
|
|
88608
88713
|
containerClassName
|
|
@@ -88618,7 +88723,8 @@ var WavesInternal = ({
|
|
|
88618
88723
|
className: cn(
|
|
88619
88724
|
"absolute inset-0 w-full h-full",
|
|
88620
88725
|
className
|
|
88621
|
-
)
|
|
88726
|
+
),
|
|
88727
|
+
style: canvasStyle
|
|
88622
88728
|
}
|
|
88623
88729
|
),
|
|
88624
88730
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -88662,15 +88768,19 @@ var GradientFlowInternal = ({
|
|
|
88662
88768
|
scale = 1,
|
|
88663
88769
|
blendMode = "normal",
|
|
88664
88770
|
smooth = true,
|
|
88665
|
-
fps = 60
|
|
88771
|
+
fps = 60,
|
|
88772
|
+
pauseWhenHidden = false
|
|
88666
88773
|
}) => {
|
|
88667
88774
|
const canvasRef = useRef(null);
|
|
88775
|
+
const containerRef = useRef(null);
|
|
88668
88776
|
const animationRef = useRef(void 0);
|
|
88669
88777
|
const gradientPointsRef = useRef([]);
|
|
88670
88778
|
const mouseRef = useRef({ x: 0, y: 0 });
|
|
88671
88779
|
const timeRef = useRef(0);
|
|
88672
88780
|
const lastFrameTimeRef = useRef(0);
|
|
88673
88781
|
const frameInterval = 1e3 / fps;
|
|
88782
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
88783
|
+
const observerTimeoutRef = useRef(null);
|
|
88674
88784
|
const initializeGradientPoints = useCallback(() => {
|
|
88675
88785
|
const canvas = canvasRef.current;
|
|
88676
88786
|
if (!canvas)
|
|
@@ -88844,17 +88954,19 @@ var GradientFlowInternal = ({
|
|
|
88844
88954
|
return;
|
|
88845
88955
|
}
|
|
88846
88956
|
lastFrameTimeRef.current = currentTime;
|
|
88847
|
-
|
|
88848
|
-
|
|
88849
|
-
|
|
88850
|
-
|
|
88851
|
-
|
|
88852
|
-
|
|
88853
|
-
|
|
88957
|
+
if (!pauseWhenHidden || isVisible) {
|
|
88958
|
+
timeRef.current += 1;
|
|
88959
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
88960
|
+
if (blur2 > 0) {
|
|
88961
|
+
ctx.filter = `blur(${blur2}px)`;
|
|
88962
|
+
}
|
|
88963
|
+
if (type === "mesh") {
|
|
88964
|
+
updateGradientPoints(canvas);
|
|
88965
|
+
}
|
|
88966
|
+
drawGradient(ctx, canvas);
|
|
88854
88967
|
}
|
|
88855
|
-
drawGradient(ctx, canvas);
|
|
88856
88968
|
animationRef.current = requestAnimationFrame(animate4);
|
|
88857
|
-
}, [frameInterval, smooth, blur2, type, updateGradientPoints, drawGradient]);
|
|
88969
|
+
}, [frameInterval, smooth, blur2, type, updateGradientPoints, drawGradient, pauseWhenHidden, isVisible]);
|
|
88858
88970
|
const handleResize = useCallback(() => {
|
|
88859
88971
|
const canvas = canvasRef.current;
|
|
88860
88972
|
if (!canvas)
|
|
@@ -88913,9 +89025,44 @@ var GradientFlowInternal = ({
|
|
|
88913
89025
|
}
|
|
88914
89026
|
};
|
|
88915
89027
|
}, [type, initializeGradientPoints, handleResize, handleMouseMove2, animate4, interactive]);
|
|
89028
|
+
useEffect(() => {
|
|
89029
|
+
if (!pauseWhenHidden)
|
|
89030
|
+
return;
|
|
89031
|
+
const container = containerRef.current;
|
|
89032
|
+
if (!container)
|
|
89033
|
+
return;
|
|
89034
|
+
const observer = new IntersectionObserver(
|
|
89035
|
+
(entries) => {
|
|
89036
|
+
entries.forEach((entry) => {
|
|
89037
|
+
if (observerTimeoutRef.current) {
|
|
89038
|
+
clearTimeout(observerTimeoutRef.current);
|
|
89039
|
+
}
|
|
89040
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
89041
|
+
setIsVisible(entry.isIntersecting);
|
|
89042
|
+
}, 150);
|
|
89043
|
+
});
|
|
89044
|
+
},
|
|
89045
|
+
{ threshold: 0.5 }
|
|
89046
|
+
);
|
|
89047
|
+
observer.observe(container);
|
|
89048
|
+
return () => {
|
|
89049
|
+
observer.disconnect();
|
|
89050
|
+
if (observerTimeoutRef.current) {
|
|
89051
|
+
clearTimeout(observerTimeoutRef.current);
|
|
89052
|
+
}
|
|
89053
|
+
};
|
|
89054
|
+
}, [pauseWhenHidden]);
|
|
89055
|
+
const canvasStyle = useMemo(() => ({
|
|
89056
|
+
willChange: "transform",
|
|
89057
|
+
transform: "translate3d(0, 0, 0)",
|
|
89058
|
+
backfaceVisibility: "hidden",
|
|
89059
|
+
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
89060
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
89061
|
+
}), [pauseWhenHidden, isVisible]);
|
|
88916
89062
|
return /* @__PURE__ */ jsxs(
|
|
88917
89063
|
"div",
|
|
88918
89064
|
{
|
|
89065
|
+
ref: containerRef,
|
|
88919
89066
|
className: cn(
|
|
88920
89067
|
"relative w-full h-full overflow-hidden",
|
|
88921
89068
|
containerClassName
|
|
@@ -88928,7 +89075,8 @@ var GradientFlowInternal = ({
|
|
|
88928
89075
|
className: cn(
|
|
88929
89076
|
"absolute inset-0 w-full h-full",
|
|
88930
89077
|
className
|
|
88931
|
-
)
|
|
89078
|
+
),
|
|
89079
|
+
style: canvasStyle
|
|
88932
89080
|
}
|
|
88933
89081
|
),
|
|
88934
89082
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -89006,10 +89154,13 @@ var MeshGradientInternal = ({
|
|
|
89006
89154
|
grainOpacity = 0.03,
|
|
89007
89155
|
saturation = 1,
|
|
89008
89156
|
brightness = 1,
|
|
89009
|
-
fps = 60
|
|
89157
|
+
fps = 60,
|
|
89158
|
+
pauseWhenHidden = false
|
|
89010
89159
|
}) => {
|
|
89011
89160
|
const { theme, resolvedTheme } = z();
|
|
89012
89161
|
const currentTheme = theme === "system" ? resolvedTheme : theme;
|
|
89162
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
89163
|
+
const observerTimeoutRef = useRef(null);
|
|
89013
89164
|
const defaultLightColors = [
|
|
89014
89165
|
"#fce7f3",
|
|
89015
89166
|
// Light pink
|
|
@@ -89041,6 +89192,7 @@ var MeshGradientInternal = ({
|
|
|
89041
89192
|
const finalBlur = blur2 ?? defaultBlur;
|
|
89042
89193
|
const finalOpacity = opacity ?? defaultOpacity;
|
|
89043
89194
|
const canvasRef = useRef(null);
|
|
89195
|
+
const containerRef = useRef(null);
|
|
89044
89196
|
const animationRef = useRef(void 0);
|
|
89045
89197
|
const meshPointsRef = useRef([]);
|
|
89046
89198
|
const mouseRef = useRef({ x: 0, y: 0 });
|
|
@@ -89216,7 +89368,7 @@ var MeshGradientInternal = ({
|
|
|
89216
89368
|
return;
|
|
89217
89369
|
}
|
|
89218
89370
|
lastFrameTimeRef.current = currentTime;
|
|
89219
|
-
if (animate4) {
|
|
89371
|
+
if (animate4 && (!pauseWhenHidden || isVisible)) {
|
|
89220
89372
|
timeRef.current += speed * 2.5;
|
|
89221
89373
|
}
|
|
89222
89374
|
updateMeshPoints(canvas);
|
|
@@ -89242,6 +89394,37 @@ var MeshGradientInternal = ({
|
|
|
89242
89394
|
y: e.clientY - rect.top
|
|
89243
89395
|
};
|
|
89244
89396
|
}, []);
|
|
89397
|
+
useEffect(() => {
|
|
89398
|
+
if (!pauseWhenHidden)
|
|
89399
|
+
return;
|
|
89400
|
+
const container = containerRef.current;
|
|
89401
|
+
if (!container)
|
|
89402
|
+
return;
|
|
89403
|
+
const observer = new IntersectionObserver(
|
|
89404
|
+
(entries) => {
|
|
89405
|
+
entries.forEach((entry) => {
|
|
89406
|
+
if (observerTimeoutRef.current) {
|
|
89407
|
+
clearTimeout(observerTimeoutRef.current);
|
|
89408
|
+
}
|
|
89409
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
89410
|
+
setIsVisible(entry.isIntersecting);
|
|
89411
|
+
}, 150);
|
|
89412
|
+
});
|
|
89413
|
+
},
|
|
89414
|
+
{
|
|
89415
|
+
threshold: 0.5
|
|
89416
|
+
// Component must be 50% visible
|
|
89417
|
+
// No rootMargin to prevent premature triggering
|
|
89418
|
+
}
|
|
89419
|
+
);
|
|
89420
|
+
observer.observe(container);
|
|
89421
|
+
return () => {
|
|
89422
|
+
observer.disconnect();
|
|
89423
|
+
if (observerTimeoutRef.current) {
|
|
89424
|
+
clearTimeout(observerTimeoutRef.current);
|
|
89425
|
+
}
|
|
89426
|
+
};
|
|
89427
|
+
}, [pauseWhenHidden]);
|
|
89245
89428
|
useEffect(() => {
|
|
89246
89429
|
const canvas = canvasRef.current;
|
|
89247
89430
|
if (!canvas)
|
|
@@ -89270,9 +89453,17 @@ var MeshGradientInternal = ({
|
|
|
89270
89453
|
}
|
|
89271
89454
|
};
|
|
89272
89455
|
}, [initializeMeshPoints, handleResize, handleMouseMove2, animateLoop, drawMeshGradient, interactive, animate4]);
|
|
89456
|
+
const canvasStyle = useMemo(() => ({
|
|
89457
|
+
willChange: "transform",
|
|
89458
|
+
transform: "translate3d(0, 0, 0)",
|
|
89459
|
+
backfaceVisibility: "hidden",
|
|
89460
|
+
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
89461
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
89462
|
+
}), [pauseWhenHidden, isVisible]);
|
|
89273
89463
|
return /* @__PURE__ */ jsxs(
|
|
89274
89464
|
"div",
|
|
89275
89465
|
{
|
|
89466
|
+
ref: containerRef,
|
|
89276
89467
|
className: cn(
|
|
89277
89468
|
"relative w-full h-full overflow-hidden",
|
|
89278
89469
|
containerClassName
|
|
@@ -89285,7 +89476,8 @@ var MeshGradientInternal = ({
|
|
|
89285
89476
|
className: cn(
|
|
89286
89477
|
"absolute inset-0 w-full h-full",
|
|
89287
89478
|
className
|
|
89288
|
-
)
|
|
89479
|
+
),
|
|
89480
|
+
style: canvasStyle
|
|
89289
89481
|
}
|
|
89290
89482
|
),
|
|
89291
89483
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10 h-full w-full", children })
|
|
@@ -89328,15 +89520,19 @@ var LiquidBackgroundInternal = ({
|
|
|
89328
89520
|
backgroundColor = "transparent",
|
|
89329
89521
|
animationStyle = "float",
|
|
89330
89522
|
gradientOverlay = false,
|
|
89331
|
-
fps = 60
|
|
89523
|
+
fps = 60,
|
|
89524
|
+
pauseWhenHidden = false
|
|
89332
89525
|
}) => {
|
|
89333
89526
|
const canvasRef = useRef(null);
|
|
89527
|
+
const containerRef = useRef(null);
|
|
89334
89528
|
const animationRef = useRef(void 0);
|
|
89335
89529
|
const blobsRef = useRef([]);
|
|
89336
89530
|
const mouseRef = useRef({ x: 0, y: 0, vx: 0, vy: 0 });
|
|
89337
89531
|
const timeRef = useRef(0);
|
|
89338
89532
|
const lastFrameTimeRef = useRef(0);
|
|
89339
89533
|
const frameInterval = 1e3 / fps;
|
|
89534
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
89535
|
+
const observerTimeoutRef = useRef(null);
|
|
89340
89536
|
const initializeBlobs = useCallback(() => {
|
|
89341
89537
|
const canvas = canvasRef.current;
|
|
89342
89538
|
if (!canvas)
|
|
@@ -89506,11 +89702,13 @@ var LiquidBackgroundInternal = ({
|
|
|
89506
89702
|
return;
|
|
89507
89703
|
}
|
|
89508
89704
|
lastFrameTimeRef.current = currentTime;
|
|
89509
|
-
|
|
89510
|
-
|
|
89511
|
-
|
|
89705
|
+
if (!pauseWhenHidden || isVisible) {
|
|
89706
|
+
timeRef.current += 1;
|
|
89707
|
+
updateBlobs(canvas);
|
|
89708
|
+
drawLiquid(ctx, canvas);
|
|
89709
|
+
}
|
|
89512
89710
|
animationRef.current = requestAnimationFrame(animate4);
|
|
89513
|
-
}, [frameInterval, updateBlobs, drawLiquid]);
|
|
89711
|
+
}, [frameInterval, updateBlobs, drawLiquid, pauseWhenHidden, isVisible]);
|
|
89514
89712
|
const handleResize = useCallback(() => {
|
|
89515
89713
|
const canvas = canvasRef.current;
|
|
89516
89714
|
if (!canvas)
|
|
@@ -89553,9 +89751,44 @@ var LiquidBackgroundInternal = ({
|
|
|
89553
89751
|
}
|
|
89554
89752
|
};
|
|
89555
89753
|
}, [initializeBlobs, handleResize, handleMouseMove2, animate4, interactive]);
|
|
89754
|
+
useEffect(() => {
|
|
89755
|
+
if (!pauseWhenHidden)
|
|
89756
|
+
return;
|
|
89757
|
+
const container = containerRef.current;
|
|
89758
|
+
if (!container)
|
|
89759
|
+
return;
|
|
89760
|
+
const observer = new IntersectionObserver(
|
|
89761
|
+
(entries) => {
|
|
89762
|
+
entries.forEach((entry) => {
|
|
89763
|
+
if (observerTimeoutRef.current) {
|
|
89764
|
+
clearTimeout(observerTimeoutRef.current);
|
|
89765
|
+
}
|
|
89766
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
89767
|
+
setIsVisible(entry.isIntersecting);
|
|
89768
|
+
}, 150);
|
|
89769
|
+
});
|
|
89770
|
+
},
|
|
89771
|
+
{ threshold: 0.5 }
|
|
89772
|
+
);
|
|
89773
|
+
observer.observe(container);
|
|
89774
|
+
return () => {
|
|
89775
|
+
observer.disconnect();
|
|
89776
|
+
if (observerTimeoutRef.current) {
|
|
89777
|
+
clearTimeout(observerTimeoutRef.current);
|
|
89778
|
+
}
|
|
89779
|
+
};
|
|
89780
|
+
}, [pauseWhenHidden]);
|
|
89781
|
+
const canvasStyle = useMemo(() => ({
|
|
89782
|
+
willChange: "transform",
|
|
89783
|
+
transform: "translate3d(0, 0, 0)",
|
|
89784
|
+
backfaceVisibility: "hidden",
|
|
89785
|
+
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
89786
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
89787
|
+
}), [pauseWhenHidden, isVisible]);
|
|
89556
89788
|
return /* @__PURE__ */ jsxs(
|
|
89557
89789
|
"div",
|
|
89558
89790
|
{
|
|
89791
|
+
ref: containerRef,
|
|
89559
89792
|
className: cn(
|
|
89560
89793
|
"relative w-full h-full overflow-hidden",
|
|
89561
89794
|
containerClassName
|
|
@@ -89571,7 +89804,8 @@ var LiquidBackgroundInternal = ({
|
|
|
89571
89804
|
className: cn(
|
|
89572
89805
|
"absolute inset-0 w-full h-full",
|
|
89573
89806
|
className
|
|
89574
|
-
)
|
|
89807
|
+
),
|
|
89808
|
+
style: canvasStyle
|
|
89575
89809
|
}
|
|
89576
89810
|
),
|
|
89577
89811
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -89612,14 +89846,18 @@ var MatrixRainInternal = ({
|
|
|
89612
89846
|
fadeLength = 20,
|
|
89613
89847
|
interactive = false,
|
|
89614
89848
|
mouseRadius = 200,
|
|
89615
|
-
fps = 30
|
|
89849
|
+
fps = 30,
|
|
89850
|
+
pauseWhenHidden = false
|
|
89616
89851
|
}) => {
|
|
89617
89852
|
const canvasRef = useRef(null);
|
|
89853
|
+
const containerRef = useRef(null);
|
|
89618
89854
|
const animationRef = useRef(void 0);
|
|
89619
89855
|
const columnsRef = useRef([]);
|
|
89620
89856
|
const mouseRef = useRef({ x: 0, y: 0 });
|
|
89621
89857
|
const lastFrameTimeRef = useRef(0);
|
|
89622
89858
|
const frameInterval = 1e3 / fps;
|
|
89859
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
89860
|
+
const observerTimeoutRef = useRef(null);
|
|
89623
89861
|
const getCharacterSet = useCallback(() => {
|
|
89624
89862
|
switch (charSet) {
|
|
89625
89863
|
case "matrix":
|
|
@@ -89749,10 +89987,12 @@ var MatrixRainInternal = ({
|
|
|
89749
89987
|
return;
|
|
89750
89988
|
}
|
|
89751
89989
|
lastFrameTimeRef.current = currentTime;
|
|
89752
|
-
|
|
89753
|
-
|
|
89990
|
+
if (!pauseWhenHidden || isVisible) {
|
|
89991
|
+
updateColumns2(canvas);
|
|
89992
|
+
drawMatrix(ctx, canvas);
|
|
89993
|
+
}
|
|
89754
89994
|
animationRef.current = requestAnimationFrame(animate4);
|
|
89755
|
-
}, [frameInterval, updateColumns2, drawMatrix]);
|
|
89995
|
+
}, [frameInterval, updateColumns2, drawMatrix, pauseWhenHidden, isVisible]);
|
|
89756
89996
|
const handleResize = useCallback(() => {
|
|
89757
89997
|
const canvas = canvasRef.current;
|
|
89758
89998
|
if (!canvas)
|
|
@@ -89793,9 +90033,44 @@ var MatrixRainInternal = ({
|
|
|
89793
90033
|
}
|
|
89794
90034
|
};
|
|
89795
90035
|
}, [initializeColumns, handleResize, handleMouseMove2, animate4, interactive]);
|
|
90036
|
+
useEffect(() => {
|
|
90037
|
+
if (!pauseWhenHidden)
|
|
90038
|
+
return;
|
|
90039
|
+
const container = containerRef.current;
|
|
90040
|
+
if (!container)
|
|
90041
|
+
return;
|
|
90042
|
+
const observer = new IntersectionObserver(
|
|
90043
|
+
(entries) => {
|
|
90044
|
+
entries.forEach((entry) => {
|
|
90045
|
+
if (observerTimeoutRef.current) {
|
|
90046
|
+
clearTimeout(observerTimeoutRef.current);
|
|
90047
|
+
}
|
|
90048
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
90049
|
+
setIsVisible(entry.isIntersecting);
|
|
90050
|
+
}, 150);
|
|
90051
|
+
});
|
|
90052
|
+
},
|
|
90053
|
+
{ threshold: 0.5 }
|
|
90054
|
+
);
|
|
90055
|
+
observer.observe(container);
|
|
90056
|
+
return () => {
|
|
90057
|
+
observer.disconnect();
|
|
90058
|
+
if (observerTimeoutRef.current) {
|
|
90059
|
+
clearTimeout(observerTimeoutRef.current);
|
|
90060
|
+
}
|
|
90061
|
+
};
|
|
90062
|
+
}, [pauseWhenHidden]);
|
|
90063
|
+
const canvasStyle = useMemo(() => ({
|
|
90064
|
+
willChange: "transform",
|
|
90065
|
+
transform: "translate3d(0, 0, 0)",
|
|
90066
|
+
backfaceVisibility: "hidden",
|
|
90067
|
+
opacity: !pauseWhenHidden || isVisible ? backgroundOpacity : 0,
|
|
90068
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
90069
|
+
}), [pauseWhenHidden, isVisible, backgroundOpacity]);
|
|
89796
90070
|
return /* @__PURE__ */ jsxs(
|
|
89797
90071
|
"div",
|
|
89798
90072
|
{
|
|
90073
|
+
ref: containerRef,
|
|
89799
90074
|
className: cn(
|
|
89800
90075
|
"relative w-full h-full overflow-hidden bg-black",
|
|
89801
90076
|
containerClassName
|
|
@@ -89809,9 +90084,7 @@ var MatrixRainInternal = ({
|
|
|
89809
90084
|
"absolute inset-0 w-full h-full",
|
|
89810
90085
|
className
|
|
89811
90086
|
),
|
|
89812
|
-
style:
|
|
89813
|
-
opacity: backgroundOpacity
|
|
89814
|
-
}
|
|
90087
|
+
style: canvasStyle
|
|
89815
90088
|
}
|
|
89816
90089
|
),
|
|
89817
90090
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -89855,9 +90128,11 @@ var GlitchBackgroundInternal = ({
|
|
|
89855
90128
|
speed = 1,
|
|
89856
90129
|
interactive = false,
|
|
89857
90130
|
mouseRadius = 200,
|
|
89858
|
-
fps = 30
|
|
90131
|
+
fps = 30,
|
|
90132
|
+
pauseWhenHidden = false
|
|
89859
90133
|
}) => {
|
|
89860
90134
|
const canvasRef = useRef(null);
|
|
90135
|
+
const containerRef = useRef(null);
|
|
89861
90136
|
const animationRef = useRef(void 0);
|
|
89862
90137
|
const glitchSlicesRef = useRef([]);
|
|
89863
90138
|
const mouseRef = useRef({ x: 0, y: 0 });
|
|
@@ -89865,6 +90140,8 @@ var GlitchBackgroundInternal = ({
|
|
|
89865
90140
|
const frameInterval = 1e3 / fps;
|
|
89866
90141
|
const timeRef = useRef(0);
|
|
89867
90142
|
const isGlitchingRef = useRef(false);
|
|
90143
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
90144
|
+
const observerTimeoutRef = useRef(null);
|
|
89868
90145
|
const generateGlitchSlices = useCallback((canvas) => {
|
|
89869
90146
|
const slices = [];
|
|
89870
90147
|
const sliceCount = Math.floor(Math.random() * 10 * intensity) + 2;
|
|
@@ -89992,31 +90269,33 @@ var GlitchBackgroundInternal = ({
|
|
|
89992
90269
|
return;
|
|
89993
90270
|
}
|
|
89994
90271
|
lastFrameTimeRef.current = currentTime;
|
|
89995
|
-
|
|
89996
|
-
|
|
89997
|
-
|
|
89998
|
-
isGlitchingRef.current
|
|
89999
|
-
|
|
90000
|
-
|
|
90001
|
-
|
|
90002
|
-
|
|
90003
|
-
|
|
90004
|
-
|
|
90005
|
-
|
|
90006
|
-
|
|
90007
|
-
|
|
90008
|
-
|
|
90009
|
-
|
|
90010
|
-
|
|
90011
|
-
|
|
90012
|
-
|
|
90013
|
-
|
|
90014
|
-
|
|
90015
|
-
|
|
90272
|
+
if (!pauseWhenHidden || isVisible) {
|
|
90273
|
+
timeRef.current += speed;
|
|
90274
|
+
const glitchChance = frequency * 0.1;
|
|
90275
|
+
if (!isGlitchingRef.current && Math.random() < glitchChance) {
|
|
90276
|
+
isGlitchingRef.current = true;
|
|
90277
|
+
generateGlitchSlices(canvas);
|
|
90278
|
+
setTimeout(() => {
|
|
90279
|
+
isGlitchingRef.current = false;
|
|
90280
|
+
}, Math.random() * 200 * intensity + 50);
|
|
90281
|
+
}
|
|
90282
|
+
if (interactive) {
|
|
90283
|
+
const dx = canvas.width / 2 - mouseRef.current.x;
|
|
90284
|
+
const dy = canvas.height / 2 - mouseRef.current.y;
|
|
90285
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
90286
|
+
if (distance < mouseRadius && !isGlitchingRef.current) {
|
|
90287
|
+
const triggerChance = (1 - distance / mouseRadius) * frequency;
|
|
90288
|
+
if (Math.random() < triggerChance * 0.05) {
|
|
90289
|
+
isGlitchingRef.current = true;
|
|
90290
|
+
generateGlitchSlices(canvas);
|
|
90291
|
+
setTimeout(() => {
|
|
90292
|
+
isGlitchingRef.current = false;
|
|
90293
|
+
}, Math.random() * 100 + 50);
|
|
90294
|
+
}
|
|
90016
90295
|
}
|
|
90017
90296
|
}
|
|
90297
|
+
drawGlitch(ctx, canvas);
|
|
90018
90298
|
}
|
|
90019
|
-
drawGlitch(ctx, canvas);
|
|
90020
90299
|
animationRef.current = requestAnimationFrame(animate4);
|
|
90021
90300
|
}, [
|
|
90022
90301
|
frameInterval,
|
|
@@ -90026,7 +90305,9 @@ var GlitchBackgroundInternal = ({
|
|
|
90026
90305
|
interactive,
|
|
90027
90306
|
mouseRadius,
|
|
90028
90307
|
generateGlitchSlices,
|
|
90029
|
-
drawGlitch
|
|
90308
|
+
drawGlitch,
|
|
90309
|
+
pauseWhenHidden,
|
|
90310
|
+
isVisible
|
|
90030
90311
|
]);
|
|
90031
90312
|
const handleResize = useCallback(() => {
|
|
90032
90313
|
const canvas = canvasRef.current;
|
|
@@ -90079,9 +90360,45 @@ var GlitchBackgroundInternal = ({
|
|
|
90079
90360
|
}
|
|
90080
90361
|
};
|
|
90081
90362
|
}, [handleResize, handleMouseMove2, animate4, interactive]);
|
|
90363
|
+
useEffect(() => {
|
|
90364
|
+
if (!pauseWhenHidden)
|
|
90365
|
+
return;
|
|
90366
|
+
const container = containerRef.current;
|
|
90367
|
+
if (!container)
|
|
90368
|
+
return;
|
|
90369
|
+
const observer = new IntersectionObserver(
|
|
90370
|
+
(entries) => {
|
|
90371
|
+
entries.forEach((entry) => {
|
|
90372
|
+
if (observerTimeoutRef.current) {
|
|
90373
|
+
clearTimeout(observerTimeoutRef.current);
|
|
90374
|
+
}
|
|
90375
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
90376
|
+
setIsVisible(entry.isIntersecting);
|
|
90377
|
+
}, 150);
|
|
90378
|
+
});
|
|
90379
|
+
},
|
|
90380
|
+
{ threshold: 0.5 }
|
|
90381
|
+
);
|
|
90382
|
+
observer.observe(container);
|
|
90383
|
+
return () => {
|
|
90384
|
+
observer.disconnect();
|
|
90385
|
+
if (observerTimeoutRef.current) {
|
|
90386
|
+
clearTimeout(observerTimeoutRef.current);
|
|
90387
|
+
}
|
|
90388
|
+
};
|
|
90389
|
+
}, [pauseWhenHidden]);
|
|
90390
|
+
const canvasStyle = useMemo(() => ({
|
|
90391
|
+
willChange: "transform",
|
|
90392
|
+
transform: "translate3d(0, 0, 0)",
|
|
90393
|
+
backfaceVisibility: "hidden",
|
|
90394
|
+
zIndex: 1,
|
|
90395
|
+
opacity: !pauseWhenHidden || isVisible ? 1 : 0,
|
|
90396
|
+
transition: pauseWhenHidden ? "opacity 0.3s ease-out" : "none"
|
|
90397
|
+
}), [pauseWhenHidden, isVisible]);
|
|
90082
90398
|
return /* @__PURE__ */ jsxs(
|
|
90083
90399
|
"div",
|
|
90084
90400
|
{
|
|
90401
|
+
ref: containerRef,
|
|
90085
90402
|
className: cn(
|
|
90086
90403
|
"relative w-full h-full overflow-hidden",
|
|
90087
90404
|
containerClassName
|
|
@@ -90098,7 +90415,7 @@ var GlitchBackgroundInternal = ({
|
|
|
90098
90415
|
"absolute inset-0 w-full h-full pointer-events-none",
|
|
90099
90416
|
className
|
|
90100
90417
|
),
|
|
90101
|
-
style:
|
|
90418
|
+
style: canvasStyle
|
|
90102
90419
|
}
|
|
90103
90420
|
),
|
|
90104
90421
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -90413,7 +90730,12 @@ var FloatingElementsInternal = ({
|
|
|
90413
90730
|
className: cn(
|
|
90414
90731
|
"absolute inset-0 w-full h-full",
|
|
90415
90732
|
className
|
|
90416
|
-
)
|
|
90733
|
+
),
|
|
90734
|
+
style: {
|
|
90735
|
+
willChange: "transform",
|
|
90736
|
+
transform: "translate3d(0, 0, 0)",
|
|
90737
|
+
backfaceVisibility: "hidden"
|
|
90738
|
+
}
|
|
90417
90739
|
}
|
|
90418
90740
|
),
|
|
90419
90741
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -90489,6 +90811,7 @@ var BubbleBackgroundInternal = ({
|
|
|
90489
90811
|
mergeDistance = 30
|
|
90490
90812
|
}) => {
|
|
90491
90813
|
const canvasRef = useRef(null);
|
|
90814
|
+
const containerRef = useRef(null);
|
|
90492
90815
|
const offscreenCanvasRef = useRef(null);
|
|
90493
90816
|
const animationRef = useRef(void 0);
|
|
90494
90817
|
const bubblesRef = useRef([]);
|
|
@@ -90498,6 +90821,8 @@ var BubbleBackgroundInternal = ({
|
|
|
90498
90821
|
const timeRef = useRef(0);
|
|
90499
90822
|
const gradientCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
90500
90823
|
const performanceConfigRef = useRef(PERFORMANCE_PRESETS.medium);
|
|
90824
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
90825
|
+
const observerTimeoutRef = useRef(null);
|
|
90501
90826
|
const detectPerformance = useCallback(() => {
|
|
90502
90827
|
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
90503
90828
|
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
@@ -90768,37 +91093,39 @@ var BubbleBackgroundInternal = ({
|
|
|
90768
91093
|
return;
|
|
90769
91094
|
}
|
|
90770
91095
|
lastFrameTimeRef.current = currentTime;
|
|
90771
|
-
|
|
90772
|
-
|
|
90773
|
-
|
|
90774
|
-
|
|
90775
|
-
|
|
90776
|
-
|
|
90777
|
-
|
|
90778
|
-
|
|
90779
|
-
|
|
90780
|
-
|
|
90781
|
-
|
|
90782
|
-
|
|
90783
|
-
|
|
90784
|
-
|
|
90785
|
-
|
|
90786
|
-
|
|
90787
|
-
offCtx
|
|
90788
|
-
|
|
90789
|
-
|
|
90790
|
-
|
|
91096
|
+
if (isVisible) {
|
|
91097
|
+
timeRef.current += 1;
|
|
91098
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
91099
|
+
if (backgroundColor !== "transparent") {
|
|
91100
|
+
ctx.fillStyle = backgroundColor;
|
|
91101
|
+
ctx.globalAlpha = backgroundOpacity;
|
|
91102
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
91103
|
+
ctx.globalAlpha = 1;
|
|
91104
|
+
}
|
|
91105
|
+
updateBubbles(canvas, deltaTime);
|
|
91106
|
+
if (glow && performanceConfigRef.current.glow) {
|
|
91107
|
+
ctx.shadowBlur = 20 * glowIntensity;
|
|
91108
|
+
ctx.shadowColor = colors[0];
|
|
91109
|
+
}
|
|
91110
|
+
if (blur2 && performanceConfigRef.current.blur && offscreenCanvasRef.current) {
|
|
91111
|
+
const offCtx = offscreenCanvasRef.current.getContext("2d");
|
|
91112
|
+
if (offCtx) {
|
|
91113
|
+
offCtx.filter = `blur(${blurAmount}px)`;
|
|
91114
|
+
offCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
91115
|
+
bubblesRef.current.forEach((bubble) => {
|
|
91116
|
+
drawBubble(offCtx, bubble);
|
|
91117
|
+
});
|
|
91118
|
+
ctx.drawImage(offscreenCanvasRef.current, 0, 0);
|
|
91119
|
+
}
|
|
91120
|
+
} else {
|
|
91121
|
+
const bubbles = bubblesRef.current;
|
|
91122
|
+
bubbles.forEach((bubble) => {
|
|
91123
|
+
drawBubble(ctx, bubble);
|
|
90791
91124
|
});
|
|
90792
|
-
ctx.drawImage(offscreenCanvasRef.current, 0, 0);
|
|
90793
91125
|
}
|
|
90794
|
-
|
|
90795
|
-
|
|
90796
|
-
|
|
90797
|
-
drawBubble(ctx, bubble);
|
|
90798
|
-
});
|
|
90799
|
-
}
|
|
90800
|
-
if (glow && performanceConfigRef.current.glow) {
|
|
90801
|
-
ctx.shadowBlur = 0;
|
|
91126
|
+
if (glow && performanceConfigRef.current.glow) {
|
|
91127
|
+
ctx.shadowBlur = 0;
|
|
91128
|
+
}
|
|
90802
91129
|
}
|
|
90803
91130
|
animationRef.current = requestAnimationFrame(animate4);
|
|
90804
91131
|
}, [
|
|
@@ -90811,7 +91138,8 @@ var BubbleBackgroundInternal = ({
|
|
|
90811
91138
|
glowIntensity,
|
|
90812
91139
|
blur2,
|
|
90813
91140
|
blurAmount,
|
|
90814
|
-
colors
|
|
91141
|
+
colors,
|
|
91142
|
+
isVisible
|
|
90815
91143
|
]);
|
|
90816
91144
|
const handleResize = useCallback(() => {
|
|
90817
91145
|
const canvas = canvasRef.current;
|
|
@@ -90845,6 +91173,31 @@ var BubbleBackgroundInternal = ({
|
|
|
90845
91173
|
y: e.clientY - rect.top
|
|
90846
91174
|
};
|
|
90847
91175
|
}, []);
|
|
91176
|
+
useEffect(() => {
|
|
91177
|
+
const container = containerRef.current;
|
|
91178
|
+
if (!container)
|
|
91179
|
+
return;
|
|
91180
|
+
const intersectionObserver = new IntersectionObserver(
|
|
91181
|
+
(entries) => {
|
|
91182
|
+
entries.forEach((entry) => {
|
|
91183
|
+
if (observerTimeoutRef.current) {
|
|
91184
|
+
clearTimeout(observerTimeoutRef.current);
|
|
91185
|
+
}
|
|
91186
|
+
observerTimeoutRef.current = setTimeout(() => {
|
|
91187
|
+
setIsVisible(entry.isIntersecting);
|
|
91188
|
+
}, 150);
|
|
91189
|
+
});
|
|
91190
|
+
},
|
|
91191
|
+
{ threshold: 0.5 }
|
|
91192
|
+
);
|
|
91193
|
+
intersectionObserver.observe(container);
|
|
91194
|
+
return () => {
|
|
91195
|
+
intersectionObserver.disconnect();
|
|
91196
|
+
if (observerTimeoutRef.current) {
|
|
91197
|
+
clearTimeout(observerTimeoutRef.current);
|
|
91198
|
+
}
|
|
91199
|
+
};
|
|
91200
|
+
}, []);
|
|
90848
91201
|
useEffect(() => {
|
|
90849
91202
|
const canvas = canvasRef.current;
|
|
90850
91203
|
if (!canvas)
|
|
@@ -90885,9 +91238,20 @@ var BubbleBackgroundInternal = ({
|
|
|
90885
91238
|
gradientCacheRef.current.clear();
|
|
90886
91239
|
};
|
|
90887
91240
|
}, []);
|
|
91241
|
+
const canvasStyle = useMemo(() => ({
|
|
91242
|
+
width: "100%",
|
|
91243
|
+
height: "100%",
|
|
91244
|
+
touchAction: "none",
|
|
91245
|
+
willChange: "transform",
|
|
91246
|
+
transform: "translate3d(0, 0, 0)",
|
|
91247
|
+
backfaceVisibility: "hidden",
|
|
91248
|
+
opacity: isVisible ? 1 : 0,
|
|
91249
|
+
transition: "opacity 0.3s ease-out"
|
|
91250
|
+
}), [isVisible]);
|
|
90888
91251
|
return /* @__PURE__ */ jsxs(
|
|
90889
91252
|
"div",
|
|
90890
91253
|
{
|
|
91254
|
+
ref: containerRef,
|
|
90891
91255
|
className: cn(
|
|
90892
91256
|
"relative w-full h-full overflow-hidden",
|
|
90893
91257
|
containerClassName
|
|
@@ -90901,11 +91265,7 @@ var BubbleBackgroundInternal = ({
|
|
|
90901
91265
|
"absolute inset-0 w-full h-full",
|
|
90902
91266
|
className
|
|
90903
91267
|
),
|
|
90904
|
-
style:
|
|
90905
|
-
width: "100%",
|
|
90906
|
-
height: "100%",
|
|
90907
|
-
touchAction: "none"
|
|
90908
|
-
}
|
|
91268
|
+
style: canvasStyle
|
|
90909
91269
|
}
|
|
90910
91270
|
),
|
|
90911
91271
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
@@ -91560,7 +91920,12 @@ var GeometricPatternsInternal = ({
|
|
|
91560
91920
|
className: cn(
|
|
91561
91921
|
"absolute inset-0 w-full h-full",
|
|
91562
91922
|
className
|
|
91563
|
-
)
|
|
91923
|
+
),
|
|
91924
|
+
style: {
|
|
91925
|
+
willChange: "transform",
|
|
91926
|
+
transform: "translate3d(0, 0, 0)",
|
|
91927
|
+
backfaceVisibility: "hidden"
|
|
91928
|
+
}
|
|
91564
91929
|
}
|
|
91565
91930
|
),
|
|
91566
91931
|
children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|