aura-ui-library 1.0.35 → 1.0.36
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/index.js +307 -0
- package/dist/index.mjs +305 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
AuraRegister: () => AuraRegister,
|
|
34
34
|
Button: () => Button,
|
|
35
35
|
Canvas: () => Canvas,
|
|
36
|
+
CanvasReveal: () => CanvasReveal,
|
|
36
37
|
Carousel: () => Carousel,
|
|
37
38
|
Footer: () => Footer,
|
|
38
39
|
Grid: () => Grid,
|
|
@@ -49,6 +50,7 @@ __export(index_exports, {
|
|
|
49
50
|
SideBar: () => SideBar,
|
|
50
51
|
Skills: () => Skills,
|
|
51
52
|
Spotlight: () => Spotlight,
|
|
53
|
+
SvgMaskEffect: () => SvgMaskEffect,
|
|
52
54
|
Testimonials: () => Testimonials,
|
|
53
55
|
TextImage: () => TextImage,
|
|
54
56
|
TextWriting: () => TextWriting,
|
|
@@ -6697,12 +6699,316 @@ var ParallaxHero = ({
|
|
|
6697
6699
|
)))
|
|
6698
6700
|
);
|
|
6699
6701
|
};
|
|
6702
|
+
|
|
6703
|
+
// src/components/Marquee/SvgMask.jsx
|
|
6704
|
+
var import_react26 = __toESM(require("react"));
|
|
6705
|
+
var import_gsap26 = require("gsap");
|
|
6706
|
+
var SvgMaskEffect = ({
|
|
6707
|
+
revealContent = /* @__PURE__ */ import_react26.default.createElement("div", { style: { fontSize: "clamp(3rem, 6vw, 6rem)", fontWeight: 900, color: "#6366f1", lineHeight: 1.1 } }, "AURA UI SHIPS ", /* @__PURE__ */ import_react26.default.createElement("br", null), " EXPERIENCES."),
|
|
6708
|
+
baseContent = /* @__PURE__ */ import_react26.default.createElement("div", { style: { fontSize: "clamp(3rem, 6vw, 6rem)", fontWeight: 900, color: "#cbd5e1", lineHeight: 1.1 } }, "AURA UI BUILDS ", /* @__PURE__ */ import_react26.default.createElement("br", null), " INTERFACES."),
|
|
6709
|
+
maskSize = 250,
|
|
6710
|
+
theme = "dark",
|
|
6711
|
+
// "dark" | "light"
|
|
6712
|
+
style = {}
|
|
6713
|
+
}) => {
|
|
6714
|
+
const containerRef = (0, import_react26.useRef)(null);
|
|
6715
|
+
const circleRef = (0, import_react26.useRef)(null);
|
|
6716
|
+
const [isHovered, setIsHovered] = (0, import_react26.useState)(false);
|
|
6717
|
+
const isLight2 = theme === "light";
|
|
6718
|
+
const bgMain = isLight2 ? "#ffffff" : "#020617";
|
|
6719
|
+
const maskId = (0, import_react26.useRef)(`svg-mask-${Math.random().toString(36).substr(2, 9)}`).current;
|
|
6720
|
+
(0, import_react26.useEffect)(() => {
|
|
6721
|
+
const ctx = import_gsap26.gsap.context(() => {
|
|
6722
|
+
import_gsap26.gsap.from(containerRef.current, {
|
|
6723
|
+
opacity: 0,
|
|
6724
|
+
y: 40,
|
|
6725
|
+
duration: 1.2,
|
|
6726
|
+
ease: "power3.out"
|
|
6727
|
+
});
|
|
6728
|
+
}, containerRef);
|
|
6729
|
+
return () => ctx.revert();
|
|
6730
|
+
}, []);
|
|
6731
|
+
const handleMouseMove = (e) => {
|
|
6732
|
+
if (!containerRef.current || !circleRef.current) return;
|
|
6733
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
6734
|
+
const x = e.clientX - rect.left;
|
|
6735
|
+
const y = e.clientY - rect.top;
|
|
6736
|
+
import_gsap26.gsap.to(circleRef.current, {
|
|
6737
|
+
attr: { cx: x, cy: y },
|
|
6738
|
+
duration: 0.3,
|
|
6739
|
+
ease: "power2.out"
|
|
6740
|
+
});
|
|
6741
|
+
};
|
|
6742
|
+
const handleMouseEnter = () => {
|
|
6743
|
+
setIsHovered(true);
|
|
6744
|
+
import_gsap26.gsap.to(circleRef.current, {
|
|
6745
|
+
attr: { r: maskSize },
|
|
6746
|
+
duration: 0.4,
|
|
6747
|
+
ease: "back.out(1.5)"
|
|
6748
|
+
});
|
|
6749
|
+
};
|
|
6750
|
+
const handleMouseLeave = () => {
|
|
6751
|
+
setIsHovered(false);
|
|
6752
|
+
import_gsap26.gsap.to(circleRef.current, {
|
|
6753
|
+
attr: { r: 0 },
|
|
6754
|
+
duration: 0.4,
|
|
6755
|
+
ease: "power3.inOut"
|
|
6756
|
+
});
|
|
6757
|
+
};
|
|
6758
|
+
const styles = {
|
|
6759
|
+
container: {
|
|
6760
|
+
position: "relative",
|
|
6761
|
+
width: "100%",
|
|
6762
|
+
minHeight: "50vh",
|
|
6763
|
+
display: "flex",
|
|
6764
|
+
alignItems: "center",
|
|
6765
|
+
justifyContent: "center",
|
|
6766
|
+
backgroundColor: bgMain,
|
|
6767
|
+
overflow: "hidden",
|
|
6768
|
+
cursor: "none",
|
|
6769
|
+
// Hide default cursor since the mask acts as a cursor
|
|
6770
|
+
fontFamily: '"Inter", -apple-system, sans-serif',
|
|
6771
|
+
padding: "40px",
|
|
6772
|
+
boxSizing: "border-box",
|
|
6773
|
+
...style
|
|
6774
|
+
},
|
|
6775
|
+
layer: {
|
|
6776
|
+
position: "absolute",
|
|
6777
|
+
top: 0,
|
|
6778
|
+
left: 0,
|
|
6779
|
+
width: "100%",
|
|
6780
|
+
height: "100%",
|
|
6781
|
+
display: "flex",
|
|
6782
|
+
alignItems: "center",
|
|
6783
|
+
justifyContent: "center",
|
|
6784
|
+
textAlign: "center",
|
|
6785
|
+
pointerEvents: "none"
|
|
6786
|
+
// Let container handle all mouse events
|
|
6787
|
+
},
|
|
6788
|
+
baseLayer: {
|
|
6789
|
+
zIndex: 1
|
|
6790
|
+
},
|
|
6791
|
+
revealLayer: {
|
|
6792
|
+
zIndex: 2,
|
|
6793
|
+
// Apply the SVG mask
|
|
6794
|
+
WebkitMask: `url(#${maskId})`,
|
|
6795
|
+
mask: `url(#${maskId})`
|
|
6796
|
+
}
|
|
6797
|
+
};
|
|
6798
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
6799
|
+
"div",
|
|
6800
|
+
{
|
|
6801
|
+
ref: containerRef,
|
|
6802
|
+
style: styles.container,
|
|
6803
|
+
onMouseMove: handleMouseMove,
|
|
6804
|
+
onMouseEnter: handleMouseEnter,
|
|
6805
|
+
onMouseLeave: handleMouseLeave
|
|
6806
|
+
},
|
|
6807
|
+
/* @__PURE__ */ import_react26.default.createElement("svg", { style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" } }, /* @__PURE__ */ import_react26.default.createElement("defs", null, /* @__PURE__ */ import_react26.default.createElement("mask", { id: maskId }, /* @__PURE__ */ import_react26.default.createElement("rect", { width: "100%", height: "100%", fill: "black" }), /* @__PURE__ */ import_react26.default.createElement(
|
|
6808
|
+
"circle",
|
|
6809
|
+
{
|
|
6810
|
+
ref: circleRef,
|
|
6811
|
+
cx: "50%",
|
|
6812
|
+
cy: "50%",
|
|
6813
|
+
r: "0",
|
|
6814
|
+
fill: "white"
|
|
6815
|
+
}
|
|
6816
|
+
)))),
|
|
6817
|
+
/* @__PURE__ */ import_react26.default.createElement("div", { style: { ...styles.layer, ...styles.baseLayer } }, baseContent),
|
|
6818
|
+
/* @__PURE__ */ import_react26.default.createElement("div", { style: { ...styles.layer, ...styles.revealLayer } }, revealContent)
|
|
6819
|
+
);
|
|
6820
|
+
};
|
|
6821
|
+
|
|
6822
|
+
// src/components/Canvas/CanvasReveal.jsx
|
|
6823
|
+
var import_react27 = __toESM(require("react"));
|
|
6824
|
+
var import_gsap27 = require("gsap");
|
|
6825
|
+
var import_fi23 = require("react-icons/fi");
|
|
6826
|
+
var CanvasReveal = ({
|
|
6827
|
+
children,
|
|
6828
|
+
dotColor = "#6366f1",
|
|
6829
|
+
dotSize = 1.5,
|
|
6830
|
+
dotSpacing = 24,
|
|
6831
|
+
hoverRadius = 160,
|
|
6832
|
+
hoverMultiplier = 4,
|
|
6833
|
+
// How much dots expand on hover
|
|
6834
|
+
theme = "dark",
|
|
6835
|
+
// "dark" | "light"
|
|
6836
|
+
style = {}
|
|
6837
|
+
}) => {
|
|
6838
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
6839
|
+
const canvasRef = (0, import_react27.useRef)(null);
|
|
6840
|
+
const isLight2 = theme === "light";
|
|
6841
|
+
const bgMain = isLight2 ? "#f8fafc" : "#020617";
|
|
6842
|
+
const borderCol = isLight2 ? "rgba(0,0,0,0.1)" : "rgba(255,255,255,0.1)";
|
|
6843
|
+
const getRgb = (hex) => {
|
|
6844
|
+
let r = 0, g = 0, b = 0;
|
|
6845
|
+
if (hex.length === 4) {
|
|
6846
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
6847
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
6848
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
6849
|
+
} else if (hex.length === 7) {
|
|
6850
|
+
r = parseInt(hex.substring(1, 3), 16);
|
|
6851
|
+
g = parseInt(hex.substring(3, 5), 16);
|
|
6852
|
+
b = parseInt(hex.substring(5, 7), 16);
|
|
6853
|
+
}
|
|
6854
|
+
return `${r}, ${g}, ${b}`;
|
|
6855
|
+
};
|
|
6856
|
+
(0, import_react27.useEffect)(() => {
|
|
6857
|
+
const ctx = import_gsap27.gsap.context(() => {
|
|
6858
|
+
import_gsap27.gsap.from(containerRef.current, {
|
|
6859
|
+
opacity: 0,
|
|
6860
|
+
scale: 0.95,
|
|
6861
|
+
duration: 1.2,
|
|
6862
|
+
ease: "power3.out"
|
|
6863
|
+
});
|
|
6864
|
+
}, containerRef);
|
|
6865
|
+
return () => ctx.revert();
|
|
6866
|
+
}, []);
|
|
6867
|
+
(0, import_react27.useEffect)(() => {
|
|
6868
|
+
const canvas = canvasRef.current;
|
|
6869
|
+
if (!canvas) return;
|
|
6870
|
+
const ctx = canvas.getContext("2d");
|
|
6871
|
+
let animationFrameId;
|
|
6872
|
+
let width = 0;
|
|
6873
|
+
let height = 0;
|
|
6874
|
+
const rgbColor = getRgb(dotColor);
|
|
6875
|
+
const mouse = { x: -1e3, y: -1e3 };
|
|
6876
|
+
const targetMouse = { x: -1e3, y: -1e3 };
|
|
6877
|
+
const resize = () => {
|
|
6878
|
+
const parent = canvas.parentElement;
|
|
6879
|
+
width = parent.clientWidth;
|
|
6880
|
+
height = parent.clientHeight;
|
|
6881
|
+
const dpr = window.devicePixelRatio || 1;
|
|
6882
|
+
canvas.width = width * dpr;
|
|
6883
|
+
canvas.height = height * dpr;
|
|
6884
|
+
ctx.scale(dpr, dpr);
|
|
6885
|
+
};
|
|
6886
|
+
const handleMouseMove = (e) => {
|
|
6887
|
+
const rect = canvas.getBoundingClientRect();
|
|
6888
|
+
targetMouse.x = e.clientX - rect.left;
|
|
6889
|
+
targetMouse.y = e.clientY - rect.top;
|
|
6890
|
+
};
|
|
6891
|
+
const handleMouseLeave = () => {
|
|
6892
|
+
targetMouse.x = -1e3;
|
|
6893
|
+
targetMouse.y = -1e3;
|
|
6894
|
+
};
|
|
6895
|
+
window.addEventListener("resize", resize);
|
|
6896
|
+
canvas.parentElement.addEventListener("mousemove", handleMouseMove);
|
|
6897
|
+
canvas.parentElement.addEventListener("mouseleave", handleMouseLeave);
|
|
6898
|
+
resize();
|
|
6899
|
+
const render = () => {
|
|
6900
|
+
mouse.x += (targetMouse.x - mouse.x) * 0.15;
|
|
6901
|
+
mouse.y += (targetMouse.y - mouse.y) * 0.15;
|
|
6902
|
+
ctx.clearRect(0, 0, width, height);
|
|
6903
|
+
for (let x = 0; x < width; x += dotSpacing) {
|
|
6904
|
+
for (let y = 0; y < height; y += dotSpacing) {
|
|
6905
|
+
const dx = x - mouse.x;
|
|
6906
|
+
const dy = y - mouse.y;
|
|
6907
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
6908
|
+
let radius = dotSize;
|
|
6909
|
+
let opacity = 0.2;
|
|
6910
|
+
if (dist < hoverRadius) {
|
|
6911
|
+
const intensity = 1 - dist / hoverRadius;
|
|
6912
|
+
radius = dotSize + intensity * dotSize * hoverMultiplier;
|
|
6913
|
+
opacity = 0.2 + intensity * 0.8;
|
|
6914
|
+
}
|
|
6915
|
+
ctx.beginPath();
|
|
6916
|
+
ctx.arc(x, y, radius, 0, Math.PI * 2);
|
|
6917
|
+
ctx.fillStyle = `rgba(${rgbColor}, ${opacity})`;
|
|
6918
|
+
ctx.fill();
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6921
|
+
animationFrameId = requestAnimationFrame(render);
|
|
6922
|
+
};
|
|
6923
|
+
render();
|
|
6924
|
+
return () => {
|
|
6925
|
+
var _a, _b;
|
|
6926
|
+
window.removeEventListener("resize", resize);
|
|
6927
|
+
(_a = canvas.parentElement) == null ? void 0 : _a.removeEventListener("mousemove", handleMouseMove);
|
|
6928
|
+
(_b = canvas.parentElement) == null ? void 0 : _b.removeEventListener("mouseleave", handleMouseLeave);
|
|
6929
|
+
cancelAnimationFrame(animationFrameId);
|
|
6930
|
+
};
|
|
6931
|
+
}, [dotColor, dotSize, dotSpacing, hoverRadius, hoverMultiplier]);
|
|
6932
|
+
const styles = {
|
|
6933
|
+
container: {
|
|
6934
|
+
position: "relative",
|
|
6935
|
+
width: "100%",
|
|
6936
|
+
minHeight: "400px",
|
|
6937
|
+
backgroundColor: bgMain,
|
|
6938
|
+
borderRadius: "24px",
|
|
6939
|
+
border: `1px solid ${borderCol}`,
|
|
6940
|
+
overflow: "hidden",
|
|
6941
|
+
display: "flex",
|
|
6942
|
+
alignItems: "center",
|
|
6943
|
+
justifyContent: "center",
|
|
6944
|
+
fontFamily: '"Inter", -apple-system, sans-serif',
|
|
6945
|
+
boxShadow: isLight2 ? "0 20px 40px rgba(0,0,0,0.05)" : "0 20px 40px rgba(0,0,0,0.4)",
|
|
6946
|
+
cursor: "crosshair",
|
|
6947
|
+
...style
|
|
6948
|
+
},
|
|
6949
|
+
canvas: {
|
|
6950
|
+
position: "absolute",
|
|
6951
|
+
top: 0,
|
|
6952
|
+
left: 0,
|
|
6953
|
+
width: "100%",
|
|
6954
|
+
height: "100%",
|
|
6955
|
+
pointerEvents: "none",
|
|
6956
|
+
// Let container capture hover events perfectly
|
|
6957
|
+
zIndex: 1
|
|
6958
|
+
},
|
|
6959
|
+
contentOverlay: {
|
|
6960
|
+
position: "relative",
|
|
6961
|
+
zIndex: 2,
|
|
6962
|
+
pointerEvents: "none",
|
|
6963
|
+
// Hovering over text continues to trigger canvas beneath
|
|
6964
|
+
display: "flex",
|
|
6965
|
+
flexDirection: "column",
|
|
6966
|
+
alignItems: "center",
|
|
6967
|
+
justifyContent: "center"
|
|
6968
|
+
},
|
|
6969
|
+
defaultContent: {
|
|
6970
|
+
padding: "40px",
|
|
6971
|
+
textAlign: "center",
|
|
6972
|
+
color: isLight2 ? "#0f172a" : "#ffffff",
|
|
6973
|
+
display: "flex",
|
|
6974
|
+
flexDirection: "column",
|
|
6975
|
+
alignItems: "center",
|
|
6976
|
+
gap: "16px"
|
|
6977
|
+
},
|
|
6978
|
+
iconBlock: {
|
|
6979
|
+
width: "60px",
|
|
6980
|
+
height: "60px",
|
|
6981
|
+
borderRadius: "16px",
|
|
6982
|
+
backgroundColor: isLight2 ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)",
|
|
6983
|
+
display: "flex",
|
|
6984
|
+
alignItems: "center",
|
|
6985
|
+
justifyContent: "center",
|
|
6986
|
+
color: dotColor,
|
|
6987
|
+
fontSize: "24px",
|
|
6988
|
+
boxShadow: isLight2 ? "0 10px 20px rgba(0,0,0,0.02)" : "0 10px 20px rgba(0,0,0,0.2)"
|
|
6989
|
+
},
|
|
6990
|
+
headline: {
|
|
6991
|
+
margin: 0,
|
|
6992
|
+
fontSize: "32px",
|
|
6993
|
+
fontWeight: "800",
|
|
6994
|
+
letterSpacing: "-0.02em"
|
|
6995
|
+
},
|
|
6996
|
+
subheadline: {
|
|
6997
|
+
margin: 0,
|
|
6998
|
+
fontSize: "16px",
|
|
6999
|
+
fontWeight: "500",
|
|
7000
|
+
color: isLight2 ? "rgba(15,23,42,0.6)" : "rgba(255,255,255,0.6)"
|
|
7001
|
+
}
|
|
7002
|
+
};
|
|
7003
|
+
return /* @__PURE__ */ import_react27.default.createElement("div", { ref: containerRef, style: styles.container }, /* @__PURE__ */ import_react27.default.createElement("canvas", { ref: canvasRef, style: styles.canvas }), /* @__PURE__ */ import_react27.default.createElement("div", { style: styles.contentOverlay }, children || /* @__PURE__ */ import_react27.default.createElement("div", { style: styles.defaultContent }, /* @__PURE__ */ import_react27.default.createElement("div", { style: styles.iconBlock }, /* @__PURE__ */ import_react27.default.createElement(import_fi23.FiCode, null)), /* @__PURE__ */ import_react27.default.createElement("h2", { style: styles.headline }, "Canvas Reveal"), /* @__PURE__ */ import_react27.default.createElement("p", { style: styles.subheadline }, "Hover your mouse to interact dynamically."))));
|
|
7004
|
+
};
|
|
6700
7005
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6701
7006
|
0 && (module.exports = {
|
|
6702
7007
|
AuraLogin,
|
|
6703
7008
|
AuraRegister,
|
|
6704
7009
|
Button,
|
|
6705
7010
|
Canvas,
|
|
7011
|
+
CanvasReveal,
|
|
6706
7012
|
Carousel,
|
|
6707
7013
|
Footer,
|
|
6708
7014
|
Grid,
|
|
@@ -6719,6 +7025,7 @@ var ParallaxHero = ({
|
|
|
6719
7025
|
SideBar,
|
|
6720
7026
|
Skills,
|
|
6721
7027
|
Spotlight,
|
|
7028
|
+
SvgMaskEffect,
|
|
6722
7029
|
Testimonials,
|
|
6723
7030
|
TextImage,
|
|
6724
7031
|
TextWriting,
|
package/dist/index.mjs
CHANGED
|
@@ -6708,11 +6708,315 @@ var ParallaxHero = ({
|
|
|
6708
6708
|
)))
|
|
6709
6709
|
);
|
|
6710
6710
|
};
|
|
6711
|
+
|
|
6712
|
+
// src/components/Marquee/SvgMask.jsx
|
|
6713
|
+
import React26, { useRef as useRef26, useEffect as useEffect26, useState as useState13 } from "react";
|
|
6714
|
+
import { gsap as gsap26 } from "gsap";
|
|
6715
|
+
var SvgMaskEffect = ({
|
|
6716
|
+
revealContent = /* @__PURE__ */ React26.createElement("div", { style: { fontSize: "clamp(3rem, 6vw, 6rem)", fontWeight: 900, color: "#6366f1", lineHeight: 1.1 } }, "AURA UI SHIPS ", /* @__PURE__ */ React26.createElement("br", null), " EXPERIENCES."),
|
|
6717
|
+
baseContent = /* @__PURE__ */ React26.createElement("div", { style: { fontSize: "clamp(3rem, 6vw, 6rem)", fontWeight: 900, color: "#cbd5e1", lineHeight: 1.1 } }, "AURA UI BUILDS ", /* @__PURE__ */ React26.createElement("br", null), " INTERFACES."),
|
|
6718
|
+
maskSize = 250,
|
|
6719
|
+
theme = "dark",
|
|
6720
|
+
// "dark" | "light"
|
|
6721
|
+
style = {}
|
|
6722
|
+
}) => {
|
|
6723
|
+
const containerRef = useRef26(null);
|
|
6724
|
+
const circleRef = useRef26(null);
|
|
6725
|
+
const [isHovered, setIsHovered] = useState13(false);
|
|
6726
|
+
const isLight2 = theme === "light";
|
|
6727
|
+
const bgMain = isLight2 ? "#ffffff" : "#020617";
|
|
6728
|
+
const maskId = useRef26(`svg-mask-${Math.random().toString(36).substr(2, 9)}`).current;
|
|
6729
|
+
useEffect26(() => {
|
|
6730
|
+
const ctx = gsap26.context(() => {
|
|
6731
|
+
gsap26.from(containerRef.current, {
|
|
6732
|
+
opacity: 0,
|
|
6733
|
+
y: 40,
|
|
6734
|
+
duration: 1.2,
|
|
6735
|
+
ease: "power3.out"
|
|
6736
|
+
});
|
|
6737
|
+
}, containerRef);
|
|
6738
|
+
return () => ctx.revert();
|
|
6739
|
+
}, []);
|
|
6740
|
+
const handleMouseMove = (e) => {
|
|
6741
|
+
if (!containerRef.current || !circleRef.current) return;
|
|
6742
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
6743
|
+
const x = e.clientX - rect.left;
|
|
6744
|
+
const y = e.clientY - rect.top;
|
|
6745
|
+
gsap26.to(circleRef.current, {
|
|
6746
|
+
attr: { cx: x, cy: y },
|
|
6747
|
+
duration: 0.3,
|
|
6748
|
+
ease: "power2.out"
|
|
6749
|
+
});
|
|
6750
|
+
};
|
|
6751
|
+
const handleMouseEnter = () => {
|
|
6752
|
+
setIsHovered(true);
|
|
6753
|
+
gsap26.to(circleRef.current, {
|
|
6754
|
+
attr: { r: maskSize },
|
|
6755
|
+
duration: 0.4,
|
|
6756
|
+
ease: "back.out(1.5)"
|
|
6757
|
+
});
|
|
6758
|
+
};
|
|
6759
|
+
const handleMouseLeave = () => {
|
|
6760
|
+
setIsHovered(false);
|
|
6761
|
+
gsap26.to(circleRef.current, {
|
|
6762
|
+
attr: { r: 0 },
|
|
6763
|
+
duration: 0.4,
|
|
6764
|
+
ease: "power3.inOut"
|
|
6765
|
+
});
|
|
6766
|
+
};
|
|
6767
|
+
const styles = {
|
|
6768
|
+
container: {
|
|
6769
|
+
position: "relative",
|
|
6770
|
+
width: "100%",
|
|
6771
|
+
minHeight: "50vh",
|
|
6772
|
+
display: "flex",
|
|
6773
|
+
alignItems: "center",
|
|
6774
|
+
justifyContent: "center",
|
|
6775
|
+
backgroundColor: bgMain,
|
|
6776
|
+
overflow: "hidden",
|
|
6777
|
+
cursor: "none",
|
|
6778
|
+
// Hide default cursor since the mask acts as a cursor
|
|
6779
|
+
fontFamily: '"Inter", -apple-system, sans-serif',
|
|
6780
|
+
padding: "40px",
|
|
6781
|
+
boxSizing: "border-box",
|
|
6782
|
+
...style
|
|
6783
|
+
},
|
|
6784
|
+
layer: {
|
|
6785
|
+
position: "absolute",
|
|
6786
|
+
top: 0,
|
|
6787
|
+
left: 0,
|
|
6788
|
+
width: "100%",
|
|
6789
|
+
height: "100%",
|
|
6790
|
+
display: "flex",
|
|
6791
|
+
alignItems: "center",
|
|
6792
|
+
justifyContent: "center",
|
|
6793
|
+
textAlign: "center",
|
|
6794
|
+
pointerEvents: "none"
|
|
6795
|
+
// Let container handle all mouse events
|
|
6796
|
+
},
|
|
6797
|
+
baseLayer: {
|
|
6798
|
+
zIndex: 1
|
|
6799
|
+
},
|
|
6800
|
+
revealLayer: {
|
|
6801
|
+
zIndex: 2,
|
|
6802
|
+
// Apply the SVG mask
|
|
6803
|
+
WebkitMask: `url(#${maskId})`,
|
|
6804
|
+
mask: `url(#${maskId})`
|
|
6805
|
+
}
|
|
6806
|
+
};
|
|
6807
|
+
return /* @__PURE__ */ React26.createElement(
|
|
6808
|
+
"div",
|
|
6809
|
+
{
|
|
6810
|
+
ref: containerRef,
|
|
6811
|
+
style: styles.container,
|
|
6812
|
+
onMouseMove: handleMouseMove,
|
|
6813
|
+
onMouseEnter: handleMouseEnter,
|
|
6814
|
+
onMouseLeave: handleMouseLeave
|
|
6815
|
+
},
|
|
6816
|
+
/* @__PURE__ */ React26.createElement("svg", { style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" } }, /* @__PURE__ */ React26.createElement("defs", null, /* @__PURE__ */ React26.createElement("mask", { id: maskId }, /* @__PURE__ */ React26.createElement("rect", { width: "100%", height: "100%", fill: "black" }), /* @__PURE__ */ React26.createElement(
|
|
6817
|
+
"circle",
|
|
6818
|
+
{
|
|
6819
|
+
ref: circleRef,
|
|
6820
|
+
cx: "50%",
|
|
6821
|
+
cy: "50%",
|
|
6822
|
+
r: "0",
|
|
6823
|
+
fill: "white"
|
|
6824
|
+
}
|
|
6825
|
+
)))),
|
|
6826
|
+
/* @__PURE__ */ React26.createElement("div", { style: { ...styles.layer, ...styles.baseLayer } }, baseContent),
|
|
6827
|
+
/* @__PURE__ */ React26.createElement("div", { style: { ...styles.layer, ...styles.revealLayer } }, revealContent)
|
|
6828
|
+
);
|
|
6829
|
+
};
|
|
6830
|
+
|
|
6831
|
+
// src/components/Canvas/CanvasReveal.jsx
|
|
6832
|
+
import React27, { useRef as useRef27, useEffect as useEffect27 } from "react";
|
|
6833
|
+
import { gsap as gsap27 } from "gsap";
|
|
6834
|
+
import { FiCode } from "react-icons/fi";
|
|
6835
|
+
var CanvasReveal = ({
|
|
6836
|
+
children,
|
|
6837
|
+
dotColor = "#6366f1",
|
|
6838
|
+
dotSize = 1.5,
|
|
6839
|
+
dotSpacing = 24,
|
|
6840
|
+
hoverRadius = 160,
|
|
6841
|
+
hoverMultiplier = 4,
|
|
6842
|
+
// How much dots expand on hover
|
|
6843
|
+
theme = "dark",
|
|
6844
|
+
// "dark" | "light"
|
|
6845
|
+
style = {}
|
|
6846
|
+
}) => {
|
|
6847
|
+
const containerRef = useRef27(null);
|
|
6848
|
+
const canvasRef = useRef27(null);
|
|
6849
|
+
const isLight2 = theme === "light";
|
|
6850
|
+
const bgMain = isLight2 ? "#f8fafc" : "#020617";
|
|
6851
|
+
const borderCol = isLight2 ? "rgba(0,0,0,0.1)" : "rgba(255,255,255,0.1)";
|
|
6852
|
+
const getRgb = (hex) => {
|
|
6853
|
+
let r = 0, g = 0, b = 0;
|
|
6854
|
+
if (hex.length === 4) {
|
|
6855
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
6856
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
6857
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
6858
|
+
} else if (hex.length === 7) {
|
|
6859
|
+
r = parseInt(hex.substring(1, 3), 16);
|
|
6860
|
+
g = parseInt(hex.substring(3, 5), 16);
|
|
6861
|
+
b = parseInt(hex.substring(5, 7), 16);
|
|
6862
|
+
}
|
|
6863
|
+
return `${r}, ${g}, ${b}`;
|
|
6864
|
+
};
|
|
6865
|
+
useEffect27(() => {
|
|
6866
|
+
const ctx = gsap27.context(() => {
|
|
6867
|
+
gsap27.from(containerRef.current, {
|
|
6868
|
+
opacity: 0,
|
|
6869
|
+
scale: 0.95,
|
|
6870
|
+
duration: 1.2,
|
|
6871
|
+
ease: "power3.out"
|
|
6872
|
+
});
|
|
6873
|
+
}, containerRef);
|
|
6874
|
+
return () => ctx.revert();
|
|
6875
|
+
}, []);
|
|
6876
|
+
useEffect27(() => {
|
|
6877
|
+
const canvas = canvasRef.current;
|
|
6878
|
+
if (!canvas) return;
|
|
6879
|
+
const ctx = canvas.getContext("2d");
|
|
6880
|
+
let animationFrameId;
|
|
6881
|
+
let width = 0;
|
|
6882
|
+
let height = 0;
|
|
6883
|
+
const rgbColor = getRgb(dotColor);
|
|
6884
|
+
const mouse = { x: -1e3, y: -1e3 };
|
|
6885
|
+
const targetMouse = { x: -1e3, y: -1e3 };
|
|
6886
|
+
const resize = () => {
|
|
6887
|
+
const parent = canvas.parentElement;
|
|
6888
|
+
width = parent.clientWidth;
|
|
6889
|
+
height = parent.clientHeight;
|
|
6890
|
+
const dpr = window.devicePixelRatio || 1;
|
|
6891
|
+
canvas.width = width * dpr;
|
|
6892
|
+
canvas.height = height * dpr;
|
|
6893
|
+
ctx.scale(dpr, dpr);
|
|
6894
|
+
};
|
|
6895
|
+
const handleMouseMove = (e) => {
|
|
6896
|
+
const rect = canvas.getBoundingClientRect();
|
|
6897
|
+
targetMouse.x = e.clientX - rect.left;
|
|
6898
|
+
targetMouse.y = e.clientY - rect.top;
|
|
6899
|
+
};
|
|
6900
|
+
const handleMouseLeave = () => {
|
|
6901
|
+
targetMouse.x = -1e3;
|
|
6902
|
+
targetMouse.y = -1e3;
|
|
6903
|
+
};
|
|
6904
|
+
window.addEventListener("resize", resize);
|
|
6905
|
+
canvas.parentElement.addEventListener("mousemove", handleMouseMove);
|
|
6906
|
+
canvas.parentElement.addEventListener("mouseleave", handleMouseLeave);
|
|
6907
|
+
resize();
|
|
6908
|
+
const render = () => {
|
|
6909
|
+
mouse.x += (targetMouse.x - mouse.x) * 0.15;
|
|
6910
|
+
mouse.y += (targetMouse.y - mouse.y) * 0.15;
|
|
6911
|
+
ctx.clearRect(0, 0, width, height);
|
|
6912
|
+
for (let x = 0; x < width; x += dotSpacing) {
|
|
6913
|
+
for (let y = 0; y < height; y += dotSpacing) {
|
|
6914
|
+
const dx = x - mouse.x;
|
|
6915
|
+
const dy = y - mouse.y;
|
|
6916
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
6917
|
+
let radius = dotSize;
|
|
6918
|
+
let opacity = 0.2;
|
|
6919
|
+
if (dist < hoverRadius) {
|
|
6920
|
+
const intensity = 1 - dist / hoverRadius;
|
|
6921
|
+
radius = dotSize + intensity * dotSize * hoverMultiplier;
|
|
6922
|
+
opacity = 0.2 + intensity * 0.8;
|
|
6923
|
+
}
|
|
6924
|
+
ctx.beginPath();
|
|
6925
|
+
ctx.arc(x, y, radius, 0, Math.PI * 2);
|
|
6926
|
+
ctx.fillStyle = `rgba(${rgbColor}, ${opacity})`;
|
|
6927
|
+
ctx.fill();
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6930
|
+
animationFrameId = requestAnimationFrame(render);
|
|
6931
|
+
};
|
|
6932
|
+
render();
|
|
6933
|
+
return () => {
|
|
6934
|
+
var _a, _b;
|
|
6935
|
+
window.removeEventListener("resize", resize);
|
|
6936
|
+
(_a = canvas.parentElement) == null ? void 0 : _a.removeEventListener("mousemove", handleMouseMove);
|
|
6937
|
+
(_b = canvas.parentElement) == null ? void 0 : _b.removeEventListener("mouseleave", handleMouseLeave);
|
|
6938
|
+
cancelAnimationFrame(animationFrameId);
|
|
6939
|
+
};
|
|
6940
|
+
}, [dotColor, dotSize, dotSpacing, hoverRadius, hoverMultiplier]);
|
|
6941
|
+
const styles = {
|
|
6942
|
+
container: {
|
|
6943
|
+
position: "relative",
|
|
6944
|
+
width: "100%",
|
|
6945
|
+
minHeight: "400px",
|
|
6946
|
+
backgroundColor: bgMain,
|
|
6947
|
+
borderRadius: "24px",
|
|
6948
|
+
border: `1px solid ${borderCol}`,
|
|
6949
|
+
overflow: "hidden",
|
|
6950
|
+
display: "flex",
|
|
6951
|
+
alignItems: "center",
|
|
6952
|
+
justifyContent: "center",
|
|
6953
|
+
fontFamily: '"Inter", -apple-system, sans-serif',
|
|
6954
|
+
boxShadow: isLight2 ? "0 20px 40px rgba(0,0,0,0.05)" : "0 20px 40px rgba(0,0,0,0.4)",
|
|
6955
|
+
cursor: "crosshair",
|
|
6956
|
+
...style
|
|
6957
|
+
},
|
|
6958
|
+
canvas: {
|
|
6959
|
+
position: "absolute",
|
|
6960
|
+
top: 0,
|
|
6961
|
+
left: 0,
|
|
6962
|
+
width: "100%",
|
|
6963
|
+
height: "100%",
|
|
6964
|
+
pointerEvents: "none",
|
|
6965
|
+
// Let container capture hover events perfectly
|
|
6966
|
+
zIndex: 1
|
|
6967
|
+
},
|
|
6968
|
+
contentOverlay: {
|
|
6969
|
+
position: "relative",
|
|
6970
|
+
zIndex: 2,
|
|
6971
|
+
pointerEvents: "none",
|
|
6972
|
+
// Hovering over text continues to trigger canvas beneath
|
|
6973
|
+
display: "flex",
|
|
6974
|
+
flexDirection: "column",
|
|
6975
|
+
alignItems: "center",
|
|
6976
|
+
justifyContent: "center"
|
|
6977
|
+
},
|
|
6978
|
+
defaultContent: {
|
|
6979
|
+
padding: "40px",
|
|
6980
|
+
textAlign: "center",
|
|
6981
|
+
color: isLight2 ? "#0f172a" : "#ffffff",
|
|
6982
|
+
display: "flex",
|
|
6983
|
+
flexDirection: "column",
|
|
6984
|
+
alignItems: "center",
|
|
6985
|
+
gap: "16px"
|
|
6986
|
+
},
|
|
6987
|
+
iconBlock: {
|
|
6988
|
+
width: "60px",
|
|
6989
|
+
height: "60px",
|
|
6990
|
+
borderRadius: "16px",
|
|
6991
|
+
backgroundColor: isLight2 ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)",
|
|
6992
|
+
display: "flex",
|
|
6993
|
+
alignItems: "center",
|
|
6994
|
+
justifyContent: "center",
|
|
6995
|
+
color: dotColor,
|
|
6996
|
+
fontSize: "24px",
|
|
6997
|
+
boxShadow: isLight2 ? "0 10px 20px rgba(0,0,0,0.02)" : "0 10px 20px rgba(0,0,0,0.2)"
|
|
6998
|
+
},
|
|
6999
|
+
headline: {
|
|
7000
|
+
margin: 0,
|
|
7001
|
+
fontSize: "32px",
|
|
7002
|
+
fontWeight: "800",
|
|
7003
|
+
letterSpacing: "-0.02em"
|
|
7004
|
+
},
|
|
7005
|
+
subheadline: {
|
|
7006
|
+
margin: 0,
|
|
7007
|
+
fontSize: "16px",
|
|
7008
|
+
fontWeight: "500",
|
|
7009
|
+
color: isLight2 ? "rgba(15,23,42,0.6)" : "rgba(255,255,255,0.6)"
|
|
7010
|
+
}
|
|
7011
|
+
};
|
|
7012
|
+
return /* @__PURE__ */ React27.createElement("div", { ref: containerRef, style: styles.container }, /* @__PURE__ */ React27.createElement("canvas", { ref: canvasRef, style: styles.canvas }), /* @__PURE__ */ React27.createElement("div", { style: styles.contentOverlay }, children || /* @__PURE__ */ React27.createElement("div", { style: styles.defaultContent }, /* @__PURE__ */ React27.createElement("div", { style: styles.iconBlock }, /* @__PURE__ */ React27.createElement(FiCode, null)), /* @__PURE__ */ React27.createElement("h2", { style: styles.headline }, "Canvas Reveal"), /* @__PURE__ */ React27.createElement("p", { style: styles.subheadline }, "Hover your mouse to interact dynamically."))));
|
|
7013
|
+
};
|
|
6711
7014
|
export {
|
|
6712
7015
|
AuraLogin,
|
|
6713
7016
|
AuraRegister,
|
|
6714
7017
|
Button,
|
|
6715
7018
|
Canvas,
|
|
7019
|
+
CanvasReveal,
|
|
6716
7020
|
Carousel,
|
|
6717
7021
|
Footer,
|
|
6718
7022
|
Grid,
|
|
@@ -6729,6 +7033,7 @@ export {
|
|
|
6729
7033
|
SideBar,
|
|
6730
7034
|
Skills,
|
|
6731
7035
|
Spotlight,
|
|
7036
|
+
SvgMaskEffect,
|
|
6732
7037
|
Testimonials,
|
|
6733
7038
|
TextImage,
|
|
6734
7039
|
TextWriting,
|