@nikitph/flux-ui 0.3.3 → 0.3.5
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 +140 -84
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -236,6 +236,7 @@ Reveal.displayName = "Reveal";
|
|
|
236
236
|
import React3 from "react";
|
|
237
237
|
import { AnimatePresence, motion as motion2 } from "motion/react";
|
|
238
238
|
import { Fragment as Fragment2, jsx as jsx4 } from "react/jsx-runtime";
|
|
239
|
+
var MotionSlot = motion2.create(Slot);
|
|
239
240
|
var Presence = ({
|
|
240
241
|
children,
|
|
241
242
|
enterFrom = "below",
|
|
@@ -279,14 +280,14 @@ var Presence = ({
|
|
|
279
280
|
const animate = { opacity: 1, x: 0, y: 0, scale: 1 };
|
|
280
281
|
return /* @__PURE__ */ jsx4(AnimatePresence, { mode, onExitComplete, children: React3.Children.map(children, (child) => {
|
|
281
282
|
if (!React3.isValidElement(child)) return child;
|
|
282
|
-
const MotionChild = motion2.create(Slot);
|
|
283
283
|
return /* @__PURE__ */ jsx4(
|
|
284
|
-
|
|
284
|
+
MotionSlot,
|
|
285
285
|
{
|
|
286
286
|
initial,
|
|
287
287
|
animate,
|
|
288
288
|
exit: { ...exit, transition: exitSpring },
|
|
289
289
|
transition: enterSpring,
|
|
290
|
+
style: { willChange: "transform, opacity" },
|
|
290
291
|
children: child
|
|
291
292
|
},
|
|
292
293
|
child.key || Math.random().toString(36)
|
|
@@ -298,7 +299,7 @@ var Presence = ({
|
|
|
298
299
|
import React4, { forwardRef as forwardRef3, useEffect as useEffect6, useMemo, useState as useState4 } from "react";
|
|
299
300
|
import { motion as motion3, useInView as useInView3 } from "motion/react";
|
|
300
301
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
301
|
-
var
|
|
302
|
+
var MotionSlot2 = motion3.create(Slot);
|
|
302
303
|
var Stagger = forwardRef3(
|
|
303
304
|
({
|
|
304
305
|
children,
|
|
@@ -366,7 +367,7 @@ var Stagger = forwardRef3(
|
|
|
366
367
|
}
|
|
367
368
|
}
|
|
368
369
|
return /* @__PURE__ */ jsx5(
|
|
369
|
-
|
|
370
|
+
MotionSlot2,
|
|
370
371
|
{
|
|
371
372
|
initial,
|
|
372
373
|
animate: shouldAnimate ? target : initial,
|
|
@@ -574,9 +575,9 @@ var MorphText = forwardRef6(
|
|
|
574
575
|
/* @__PURE__ */ jsx8(AnimatePresence2, { mode: "popLayout", initial: false, children: /* @__PURE__ */ jsx8(
|
|
575
576
|
motion6.span,
|
|
576
577
|
{
|
|
577
|
-
initial: { opacity: 0,
|
|
578
|
-
animate: { opacity: 1,
|
|
579
|
-
exit: { opacity: 0,
|
|
578
|
+
initial: { opacity: 0, y: 10 },
|
|
579
|
+
animate: { opacity: 1, y: 0 },
|
|
580
|
+
exit: { opacity: 0, y: -10 },
|
|
580
581
|
transition: springConfig,
|
|
581
582
|
style: { display: "inline-block" },
|
|
582
583
|
children: currentText
|
|
@@ -670,7 +671,8 @@ var FlipCard = forwardRef7(
|
|
|
670
671
|
width: "100%",
|
|
671
672
|
height: "100%",
|
|
672
673
|
backfaceVisibility: "hidden",
|
|
673
|
-
transformStyle: "preserve-3d"
|
|
674
|
+
transformStyle: "preserve-3d",
|
|
675
|
+
willChange: "transform"
|
|
674
676
|
},
|
|
675
677
|
children: front
|
|
676
678
|
}
|
|
@@ -686,7 +688,8 @@ var FlipCard = forwardRef7(
|
|
|
686
688
|
width: "100%",
|
|
687
689
|
height: "100%",
|
|
688
690
|
backfaceVisibility: "hidden",
|
|
689
|
-
transformStyle: "preserve-3d"
|
|
691
|
+
transformStyle: "preserve-3d",
|
|
692
|
+
willChange: "transform"
|
|
690
693
|
},
|
|
691
694
|
children: back
|
|
692
695
|
}
|
|
@@ -1703,7 +1706,7 @@ var Spotlight = forwardRef17(
|
|
|
1703
1706
|
Spotlight.displayName = "Spotlight";
|
|
1704
1707
|
|
|
1705
1708
|
// src/primitives/18-follow-cursor.tsx
|
|
1706
|
-
import React19, { forwardRef as forwardRef18, useCallback as useCallback5, useEffect as useEffect16, useState as useState11 } from "react";
|
|
1709
|
+
import React19, { forwardRef as forwardRef18, useCallback as useCallback5, useEffect as useEffect16, useRef as useRef9, useState as useState11 } from "react";
|
|
1707
1710
|
import { motion as motion18, useMotionValue as useMotionValue6, useSpring as useSpring7 } from "motion/react";
|
|
1708
1711
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1709
1712
|
var FollowCursor = forwardRef18(
|
|
@@ -1738,6 +1741,7 @@ var FollowCursor = forwardRef18(
|
|
|
1738
1741
|
const smoothY = useSpring7(y, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1739
1742
|
const smoothR = useSpring7(r, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1740
1743
|
const [isVisible, setIsVisible] = useState11(visible && !hideOnLeave);
|
|
1744
|
+
const prevPos = useRef9({ x: 0, y: 0 });
|
|
1741
1745
|
const updatePosition = useCallback5((clientX, clientY) => {
|
|
1742
1746
|
let posX = clientX + offset.x;
|
|
1743
1747
|
let posY = clientY + offset.y;
|
|
@@ -1747,21 +1751,34 @@ var FollowCursor = forwardRef18(
|
|
|
1747
1751
|
posY = clientY - parentRect.top + offset.y;
|
|
1748
1752
|
}
|
|
1749
1753
|
if (rotate) {
|
|
1750
|
-
const dx = posX - x
|
|
1751
|
-
const dy = posY - y
|
|
1754
|
+
const dx = posX - prevPos.current.x;
|
|
1755
|
+
const dy = posY - prevPos.current.y;
|
|
1752
1756
|
if (dx !== 0 || dy !== 0) {
|
|
1753
1757
|
const angle = Math.atan2(dy, dx) * (180 / Math.PI);
|
|
1754
1758
|
r.set(angle);
|
|
1755
1759
|
}
|
|
1756
1760
|
}
|
|
1761
|
+
prevPos.current.x = posX;
|
|
1762
|
+
prevPos.current.y = posY;
|
|
1757
1763
|
x.set(posX);
|
|
1758
1764
|
y.set(posY);
|
|
1759
1765
|
}, [x, y, r, rotate, offset, containTo]);
|
|
1766
|
+
const rafId = useRef9(0);
|
|
1767
|
+
const latestMouse = useRef9(null);
|
|
1768
|
+
const processMouseMove = useCallback5(() => {
|
|
1769
|
+
rafId.current = 0;
|
|
1770
|
+
const e = latestMouse.current;
|
|
1771
|
+
if (!e) return;
|
|
1772
|
+
updatePosition(e.x, e.y);
|
|
1773
|
+
}, [updatePosition]);
|
|
1760
1774
|
useEffect16(() => {
|
|
1761
1775
|
if (disabled || isReducedMotion) return;
|
|
1762
1776
|
const target = containTo === "viewport" ? window : internalRef.current?.parentElement || window;
|
|
1763
1777
|
const handleMouseMove = (e) => {
|
|
1764
|
-
|
|
1778
|
+
latestMouse.current = { x: e.clientX, y: e.clientY };
|
|
1779
|
+
if (!rafId.current) {
|
|
1780
|
+
rafId.current = requestAnimationFrame(processMouseMove);
|
|
1781
|
+
}
|
|
1765
1782
|
if (hideOnLeave && !isVisible) setIsVisible(visible);
|
|
1766
1783
|
};
|
|
1767
1784
|
const handleMouseEnter = () => {
|
|
@@ -1770,15 +1787,16 @@ var FollowCursor = forwardRef18(
|
|
|
1770
1787
|
const handleMouseLeave = () => {
|
|
1771
1788
|
if (hideOnLeave) setIsVisible(false);
|
|
1772
1789
|
};
|
|
1773
|
-
target.addEventListener("mousemove", handleMouseMove);
|
|
1774
|
-
target.addEventListener("mouseenter", handleMouseEnter);
|
|
1775
|
-
target.addEventListener("mouseleave", handleMouseLeave);
|
|
1790
|
+
target.addEventListener("mousemove", handleMouseMove, { passive: true });
|
|
1791
|
+
target.addEventListener("mouseenter", handleMouseEnter, { passive: true });
|
|
1792
|
+
target.addEventListener("mouseleave", handleMouseLeave, { passive: true });
|
|
1776
1793
|
return () => {
|
|
1777
1794
|
target.removeEventListener("mousemove", handleMouseMove);
|
|
1778
1795
|
target.removeEventListener("mouseenter", handleMouseEnter);
|
|
1779
1796
|
target.removeEventListener("mouseleave", handleMouseLeave);
|
|
1797
|
+
if (rafId.current) cancelAnimationFrame(rafId.current);
|
|
1780
1798
|
};
|
|
1781
|
-
}, [disabled, isReducedMotion, containTo,
|
|
1799
|
+
}, [disabled, isReducedMotion, containTo, processMouseMove, hideOnLeave, visible, isVisible]);
|
|
1782
1800
|
useEffect16(() => {
|
|
1783
1801
|
setIsVisible(visible);
|
|
1784
1802
|
}, [visible]);
|
|
@@ -1802,9 +1820,8 @@ var FollowCursor = forwardRef18(
|
|
|
1802
1820
|
rotate: smoothR,
|
|
1803
1821
|
opacity: isVisible ? 1 : 0,
|
|
1804
1822
|
pointerEvents: "none",
|
|
1805
|
-
// Cursor followers typically shouldn't block events
|
|
1806
1823
|
zIndex: 50,
|
|
1807
|
-
|
|
1824
|
+
willChange: "transform",
|
|
1808
1825
|
...style
|
|
1809
1826
|
},
|
|
1810
1827
|
animate: { opacity: isVisible ? 1 : 0 },
|
|
@@ -1863,7 +1880,7 @@ var Morph = forwardRef19(
|
|
|
1863
1880
|
Morph.displayName = "Morph";
|
|
1864
1881
|
|
|
1865
1882
|
// src/primitives/20-fluid-layout.tsx
|
|
1866
|
-
import { forwardRef as forwardRef20, useRef as
|
|
1883
|
+
import { forwardRef as forwardRef20, useRef as useRef10 } from "react";
|
|
1867
1884
|
import { motion as motion20 } from "motion/react";
|
|
1868
1885
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1869
1886
|
var FluidLayout = forwardRef20(
|
|
@@ -1880,7 +1897,7 @@ var FluidLayout = forwardRef20(
|
|
|
1880
1897
|
...props
|
|
1881
1898
|
}, ref) => {
|
|
1882
1899
|
const isReducedMotion = useReducedMotion();
|
|
1883
|
-
const internalRef =
|
|
1900
|
+
const internalRef = useRef10(null);
|
|
1884
1901
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
1885
1902
|
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1886
1903
|
if (disabled || isReducedMotion) {
|
|
@@ -2132,7 +2149,7 @@ function AnimatedListComponent({
|
|
|
2132
2149
|
var AnimatedList = forwardRef23(AnimatedListComponent);
|
|
2133
2150
|
|
|
2134
2151
|
// src/primitives/24-marquee.tsx
|
|
2135
|
-
import { forwardRef as forwardRef24, useEffect as useEffect18, useMemo as useMemo3, useRef as
|
|
2152
|
+
import { forwardRef as forwardRef24, useEffect as useEffect18, useMemo as useMemo3, useRef as useRef11, useState as useState13 } from "react";
|
|
2136
2153
|
import { jsx as jsx26, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2137
2154
|
var Marquee = forwardRef24(
|
|
2138
2155
|
({
|
|
@@ -2151,9 +2168,9 @@ var Marquee = forwardRef24(
|
|
|
2151
2168
|
...props
|
|
2152
2169
|
}, ref) => {
|
|
2153
2170
|
const isReducedMotion = useReducedMotion();
|
|
2154
|
-
const internalRef =
|
|
2155
|
-
const containerRef =
|
|
2156
|
-
const contentRef =
|
|
2171
|
+
const internalRef = useRef11(null);
|
|
2172
|
+
const containerRef = useRef11(null);
|
|
2173
|
+
const contentRef = useRef11(null);
|
|
2157
2174
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2158
2175
|
const [contentSize, setContentSize] = useState13(0);
|
|
2159
2176
|
const [containerSize, setContainerSize] = useState13(0);
|
|
@@ -2259,7 +2276,7 @@ var Marquee = forwardRef24(
|
|
|
2259
2276
|
Marquee.displayName = "Marquee";
|
|
2260
2277
|
|
|
2261
2278
|
// src/primitives/25-dock.tsx
|
|
2262
|
-
import React26, { forwardRef as forwardRef25, useCallback as useCallback6, useMemo as useMemo4, useRef as
|
|
2279
|
+
import React26, { forwardRef as forwardRef25, useCallback as useCallback6, useMemo as useMemo4, useRef as useRef12 } from "react";
|
|
2263
2280
|
import { motion as motion23, useMotionValue as useMotionValue7, useSpring as useSpring8, useTransform as useTransform4 } from "motion/react";
|
|
2264
2281
|
import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2265
2282
|
var DockContext = React26.createContext({
|
|
@@ -2285,12 +2302,12 @@ var DockRoot = forwardRef25(
|
|
|
2285
2302
|
...props
|
|
2286
2303
|
}, ref) => {
|
|
2287
2304
|
const isReducedMotion = useReducedMotion();
|
|
2288
|
-
const internalRef =
|
|
2305
|
+
const internalRef = useRef12(null);
|
|
2289
2306
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2290
2307
|
const mouseX = useMotionValue7(Infinity);
|
|
2291
2308
|
const mouseY = useMotionValue7(Infinity);
|
|
2292
|
-
const rafId =
|
|
2293
|
-
const latestEvent =
|
|
2309
|
+
const rafId = useRef12(0);
|
|
2310
|
+
const latestEvent = useRef12(null);
|
|
2294
2311
|
const processMouseMove = useCallback6(() => {
|
|
2295
2312
|
rafId.current = 0;
|
|
2296
2313
|
const e = latestEvent.current;
|
|
@@ -2343,10 +2360,10 @@ DockRoot.displayName = "Dock";
|
|
|
2343
2360
|
var DockItem = forwardRef25(
|
|
2344
2361
|
({ children, label, onClick, className, style, ...props }, ref) => {
|
|
2345
2362
|
const { mouseX, mouseY, distance, magnification, direction, isReducedMotion } = React26.useContext(DockContext);
|
|
2346
|
-
const itemRef =
|
|
2363
|
+
const itemRef = useRef12(null);
|
|
2347
2364
|
const mergedRef = useMergedRef(ref, itemRef);
|
|
2348
2365
|
const distVar = direction === "horizontal" ? mouseX : mouseY;
|
|
2349
|
-
const rectRef =
|
|
2366
|
+
const rectRef = useRef12(null);
|
|
2350
2367
|
React26.useEffect(() => {
|
|
2351
2368
|
const el = itemRef.current;
|
|
2352
2369
|
if (!el) return;
|
|
@@ -2425,7 +2442,7 @@ DockItem.displayName = "Dock.Item";
|
|
|
2425
2442
|
var Dock = Object.assign(DockRoot, { Item: DockItem });
|
|
2426
2443
|
|
|
2427
2444
|
// src/primitives/26-infinite-scroll.tsx
|
|
2428
|
-
import { forwardRef as forwardRef26, useEffect as useEffect19, useRef as
|
|
2445
|
+
import { forwardRef as forwardRef26, useEffect as useEffect19, useRef as useRef13, useState as useState14 } from "react";
|
|
2429
2446
|
import { jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2430
2447
|
function InfiniteScrollComponent({
|
|
2431
2448
|
items,
|
|
@@ -2444,9 +2461,9 @@ function InfiniteScrollComponent({
|
|
|
2444
2461
|
disabled = false
|
|
2445
2462
|
}, ref) {
|
|
2446
2463
|
const isReducedMotion = useReducedMotion();
|
|
2447
|
-
const internalRef =
|
|
2448
|
-
const scrollRef =
|
|
2449
|
-
const endMarkerRef =
|
|
2464
|
+
const internalRef = useRef13(null);
|
|
2465
|
+
const scrollRef = useRef13(null);
|
|
2466
|
+
const endMarkerRef = useRef13(null);
|
|
2450
2467
|
const mergedRef = useMergedRef(ref, internalRef, scrollRef);
|
|
2451
2468
|
const [isLoading, setIsLoading] = useState14(false);
|
|
2452
2469
|
useEffect19(() => {
|
|
@@ -2491,7 +2508,7 @@ function InfiniteScrollComponent({
|
|
|
2491
2508
|
var InfiniteScroll = forwardRef26(InfiniteScrollComponent);
|
|
2492
2509
|
|
|
2493
2510
|
// src/primitives/27-scroll-progress.tsx
|
|
2494
|
-
import { forwardRef as forwardRef27, useRef as
|
|
2511
|
+
import { forwardRef as forwardRef27, useRef as useRef14 } from "react";
|
|
2495
2512
|
import { motion as motion24, useScroll as useScroll3, useSpring as useSpring9 } from "motion/react";
|
|
2496
2513
|
import { jsx as jsx29, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2497
2514
|
var ScrollProgress = forwardRef27(
|
|
@@ -2509,7 +2526,7 @@ var ScrollProgress = forwardRef27(
|
|
|
2509
2526
|
...props
|
|
2510
2527
|
}, ref) => {
|
|
2511
2528
|
const isReducedMotion = useReducedMotion();
|
|
2512
|
-
const internalRef =
|
|
2529
|
+
const internalRef = useRef14(null);
|
|
2513
2530
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2514
2531
|
const { scrollYProgress, scrollXProgress } = useScroll3({
|
|
2515
2532
|
container: container?.current ? container : void 0
|
|
@@ -2570,7 +2587,7 @@ var ScrollProgress = forwardRef27(
|
|
|
2570
2587
|
ScrollProgress.displayName = "ScrollProgress";
|
|
2571
2588
|
|
|
2572
2589
|
// src/primitives/28-parallax.tsx
|
|
2573
|
-
import { forwardRef as forwardRef28, useRef as
|
|
2590
|
+
import { forwardRef as forwardRef28, useRef as useRef15 } from "react";
|
|
2574
2591
|
import { motion as motion25, useScroll as useScroll4, useTransform as useTransform5 } from "motion/react";
|
|
2575
2592
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2576
2593
|
var Parallax = forwardRef28(
|
|
@@ -2585,7 +2602,7 @@ var Parallax = forwardRef28(
|
|
|
2585
2602
|
...props
|
|
2586
2603
|
}, ref) => {
|
|
2587
2604
|
const isReducedMotion = useReducedMotion();
|
|
2588
|
-
const internalRef =
|
|
2605
|
+
const internalRef = useRef15(null);
|
|
2589
2606
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2590
2607
|
const { scrollYProgress } = useScroll4({
|
|
2591
2608
|
target: internalRef,
|
|
@@ -2618,7 +2635,7 @@ var Parallax = forwardRef28(
|
|
|
2618
2635
|
Parallax.displayName = "Parallax";
|
|
2619
2636
|
|
|
2620
2637
|
// src/primitives/29-sticky-scroll.tsx
|
|
2621
|
-
import { forwardRef as forwardRef29, useEffect as useEffect20, useRef as
|
|
2638
|
+
import { forwardRef as forwardRef29, useEffect as useEffect20, useRef as useRef16, useState as useState15 } from "react";
|
|
2622
2639
|
import { motion as motion26, useScroll as useScroll5 } from "motion/react";
|
|
2623
2640
|
import { jsx as jsx31, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2624
2641
|
var StickyScroll = forwardRef29(
|
|
@@ -2632,7 +2649,7 @@ var StickyScroll = forwardRef29(
|
|
|
2632
2649
|
...props
|
|
2633
2650
|
}, ref) => {
|
|
2634
2651
|
const isReducedMotion = useReducedMotion();
|
|
2635
|
-
const internalRef =
|
|
2652
|
+
const internalRef = useRef16(null);
|
|
2636
2653
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2637
2654
|
const [activeSection, setActiveSection] = useState15(0);
|
|
2638
2655
|
const { scrollYProgress } = useScroll5({
|
|
@@ -2640,16 +2657,30 @@ var StickyScroll = forwardRef29(
|
|
|
2640
2657
|
container: container?.current ? container : void 0,
|
|
2641
2658
|
offset: ["start start", "end end"]
|
|
2642
2659
|
});
|
|
2660
|
+
const lastSectionRef = useRef16(0);
|
|
2643
2661
|
useEffect20(() => {
|
|
2644
|
-
|
|
2662
|
+
let rafId = 0;
|
|
2663
|
+
const unsubscribe = scrollYProgress.on("change", (latest) => {
|
|
2645
2664
|
const cardsCount = content.length;
|
|
2646
2665
|
const progressPerCard = 1 / cardsCount;
|
|
2647
2666
|
const index = Math.min(
|
|
2648
2667
|
Math.floor(latest / progressPerCard),
|
|
2649
2668
|
cardsCount - 1
|
|
2650
2669
|
);
|
|
2651
|
-
|
|
2670
|
+
if (index !== lastSectionRef.current) {
|
|
2671
|
+
lastSectionRef.current = index;
|
|
2672
|
+
if (!rafId) {
|
|
2673
|
+
rafId = requestAnimationFrame(() => {
|
|
2674
|
+
rafId = 0;
|
|
2675
|
+
setActiveSection(index);
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2652
2679
|
});
|
|
2680
|
+
return () => {
|
|
2681
|
+
unsubscribe();
|
|
2682
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
2683
|
+
};
|
|
2653
2684
|
}, [scrollYProgress, content.length]);
|
|
2654
2685
|
if (disabled || isReducedMotion) {
|
|
2655
2686
|
return /* @__PURE__ */ jsx31("div", { ref: mergedRef, className, style: { display: "flex", flexDirection: "column", gap: "2rem", ...style }, ...props, children: content.map((item, i) => /* @__PURE__ */ jsxs11("div", { children: [
|
|
@@ -2688,7 +2719,7 @@ var StickyScroll = forwardRef29(
|
|
|
2688
2719
|
{
|
|
2689
2720
|
initial: { opacity: 0, y: 20 },
|
|
2690
2721
|
animate: { opacity: activeSection === index ? 1 : 0, y: activeSection === index ? 0 : 20 },
|
|
2691
|
-
style: { fontSize: "2rem", fontWeight: "bold", marginBottom: "1rem" },
|
|
2722
|
+
style: { fontSize: "2rem", fontWeight: "bold", marginBottom: "1rem", willChange: "transform, opacity" },
|
|
2692
2723
|
children: item.title
|
|
2693
2724
|
}
|
|
2694
2725
|
),
|
|
@@ -2720,7 +2751,7 @@ var StickyScroll = forwardRef29(
|
|
|
2720
2751
|
StickyScroll.displayName = "StickyScroll";
|
|
2721
2752
|
|
|
2722
2753
|
// src/primitives/30-scroll-snap.tsx
|
|
2723
|
-
import React31, { forwardRef as forwardRef30, useRef as
|
|
2754
|
+
import React31, { forwardRef as forwardRef30, useRef as useRef17 } from "react";
|
|
2724
2755
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2725
2756
|
var ScrollSnapContainer = forwardRef30(
|
|
2726
2757
|
({
|
|
@@ -2735,7 +2766,7 @@ var ScrollSnapContainer = forwardRef30(
|
|
|
2735
2766
|
...props
|
|
2736
2767
|
}, ref) => {
|
|
2737
2768
|
const isReducedMotion = useReducedMotion();
|
|
2738
|
-
const internalRef =
|
|
2769
|
+
const internalRef = useRef17(null);
|
|
2739
2770
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2740
2771
|
return /* @__PURE__ */ jsx32(SnapContext.Provider, { value: { alignment, disabled: disabled || isReducedMotion }, children: /* @__PURE__ */ jsx32(
|
|
2741
2772
|
"div",
|
|
@@ -2780,7 +2811,7 @@ ScrollSnapItem.displayName = "ScrollSnap.Item";
|
|
|
2780
2811
|
var ScrollSnap = Object.assign(ScrollSnapContainer, { Item: ScrollSnapItem });
|
|
2781
2812
|
|
|
2782
2813
|
// src/primitives/31-aurora.tsx
|
|
2783
|
-
import { forwardRef as forwardRef31, useRef as
|
|
2814
|
+
import { forwardRef as forwardRef31, useRef as useRef18 } from "react";
|
|
2784
2815
|
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2785
2816
|
var Aurora = forwardRef31(
|
|
2786
2817
|
({
|
|
@@ -2795,7 +2826,7 @@ var Aurora = forwardRef31(
|
|
|
2795
2826
|
...props
|
|
2796
2827
|
}, ref) => {
|
|
2797
2828
|
const isReducedMotion = useReducedMotion();
|
|
2798
|
-
const internalRef =
|
|
2829
|
+
const internalRef = useRef18(null);
|
|
2799
2830
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2800
2831
|
if (disabled) return null;
|
|
2801
2832
|
const gradientString = `linear-gradient(-45deg, ${colors.join(", ")})`;
|
|
@@ -2849,7 +2880,7 @@ var Aurora = forwardRef31(
|
|
|
2849
2880
|
Aurora.displayName = "Aurora";
|
|
2850
2881
|
|
|
2851
2882
|
// src/primitives/32-mesh-gradient.tsx
|
|
2852
|
-
import { forwardRef as forwardRef32, useRef as
|
|
2883
|
+
import { forwardRef as forwardRef32, useRef as useRef19 } from "react";
|
|
2853
2884
|
import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2854
2885
|
var MeshGradient = forwardRef32(
|
|
2855
2886
|
({
|
|
@@ -2861,7 +2892,7 @@ var MeshGradient = forwardRef32(
|
|
|
2861
2892
|
...props
|
|
2862
2893
|
}, ref) => {
|
|
2863
2894
|
const isReducedMotion = useReducedMotion();
|
|
2864
|
-
const internalRef =
|
|
2895
|
+
const internalRef = useRef19(null);
|
|
2865
2896
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2866
2897
|
if (disabled) return null;
|
|
2867
2898
|
const baseStyle = {
|
|
@@ -2918,7 +2949,7 @@ var MeshGradient = forwardRef32(
|
|
|
2918
2949
|
MeshGradient.displayName = "MeshGradient";
|
|
2919
2950
|
|
|
2920
2951
|
// src/primitives/33-particles.tsx
|
|
2921
|
-
import { forwardRef as forwardRef33, useEffect as useEffect21, useRef as
|
|
2952
|
+
import { forwardRef as forwardRef33, useEffect as useEffect21, useRef as useRef20 } from "react";
|
|
2922
2953
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
2923
2954
|
var Particles = forwardRef33(
|
|
2924
2955
|
({
|
|
@@ -2932,13 +2963,13 @@ var Particles = forwardRef33(
|
|
|
2932
2963
|
...props
|
|
2933
2964
|
}, ref) => {
|
|
2934
2965
|
const isReducedMotion = useReducedMotion();
|
|
2935
|
-
const internalRef =
|
|
2966
|
+
const internalRef = useRef20(null);
|
|
2936
2967
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
2937
|
-
const context =
|
|
2938
|
-
const circles =
|
|
2939
|
-
const mouse =
|
|
2940
|
-
const canvasSize =
|
|
2941
|
-
const animationFrameId =
|
|
2968
|
+
const context = useRef20(null);
|
|
2969
|
+
const circles = useRef20([]);
|
|
2970
|
+
const mouse = useRef20({ x: 0, y: 0 });
|
|
2971
|
+
const canvasSize = useRef20({ w: 0, h: 0 });
|
|
2972
|
+
const animationFrameId = useRef20(0);
|
|
2942
2973
|
useEffect21(() => {
|
|
2943
2974
|
if (disabled || isReducedMotion || !internalRef.current) return;
|
|
2944
2975
|
const canvas = internalRef.current;
|
|
@@ -3117,7 +3148,7 @@ var Noise = forwardRef35(
|
|
|
3117
3148
|
Noise.displayName = "Noise";
|
|
3118
3149
|
|
|
3119
3150
|
// src/primitives/36-streaming-text.tsx
|
|
3120
|
-
import { forwardRef as forwardRef36, useEffect as useEffect22, useRef as
|
|
3151
|
+
import { forwardRef as forwardRef36, useEffect as useEffect22, useRef as useRef21 } from "react";
|
|
3121
3152
|
import { jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3122
3153
|
var StreamingText = forwardRef36(
|
|
3123
3154
|
({
|
|
@@ -3133,11 +3164,11 @@ var StreamingText = forwardRef36(
|
|
|
3133
3164
|
...props
|
|
3134
3165
|
}, ref) => {
|
|
3135
3166
|
const isReducedMotion = useReducedMotion();
|
|
3136
|
-
const internalRef =
|
|
3167
|
+
const internalRef = useRef21(null);
|
|
3137
3168
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
3138
|
-
const textNodeRef =
|
|
3139
|
-
const cursorRef =
|
|
3140
|
-
const onCompleteRef =
|
|
3169
|
+
const textNodeRef = useRef21(null);
|
|
3170
|
+
const cursorRef = useRef21(null);
|
|
3171
|
+
const onCompleteRef = useRef21(onComplete);
|
|
3141
3172
|
onCompleteRef.current = onComplete;
|
|
3142
3173
|
useEffect22(() => {
|
|
3143
3174
|
const el = internalRef.current;
|
|
@@ -3401,7 +3432,7 @@ var AIMessage = forwardRef39(
|
|
|
3401
3432
|
AIMessage.displayName = "AIMessage";
|
|
3402
3433
|
|
|
3403
3434
|
// src/primitives/40-hero-highlight.tsx
|
|
3404
|
-
import React41, { forwardRef as forwardRef40 } from "react";
|
|
3435
|
+
import React41, { forwardRef as forwardRef40, useCallback as useCallback7, useEffect as useEffect23, useRef as useRef22 } from "react";
|
|
3405
3436
|
import { motion as motion30, useMotionTemplate as useMotionTemplate3, useMotionValue as useMotionValue8 } from "motion/react";
|
|
3406
3437
|
import { jsx as jsx42, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3407
3438
|
var HeroHighlight = forwardRef40(
|
|
@@ -3410,7 +3441,6 @@ var HeroHighlight = forwardRef40(
|
|
|
3410
3441
|
containerClassName,
|
|
3411
3442
|
className,
|
|
3412
3443
|
color = "45, 212, 191",
|
|
3413
|
-
// teal-400 equivalent typically
|
|
3414
3444
|
disabled = false,
|
|
3415
3445
|
...props
|
|
3416
3446
|
}, ref) => {
|
|
@@ -3419,12 +3449,50 @@ var HeroHighlight = forwardRef40(
|
|
|
3419
3449
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
3420
3450
|
const mouseX = useMotionValue8(0);
|
|
3421
3451
|
const mouseY = useMotionValue8(0);
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
}
|
|
3452
|
+
const rectRef = useRef22(null);
|
|
3453
|
+
const updateRect = useCallback7(() => {
|
|
3454
|
+
if (internalRef.current) {
|
|
3455
|
+
rectRef.current = internalRef.current.getBoundingClientRect();
|
|
3456
|
+
}
|
|
3457
|
+
}, []);
|
|
3458
|
+
useEffect23(() => {
|
|
3459
|
+
updateRect();
|
|
3460
|
+
window.addEventListener("scroll", updateRect, { passive: true });
|
|
3461
|
+
window.addEventListener("resize", updateRect, { passive: true });
|
|
3462
|
+
return () => {
|
|
3463
|
+
window.removeEventListener("scroll", updateRect);
|
|
3464
|
+
window.removeEventListener("resize", updateRect);
|
|
3465
|
+
};
|
|
3466
|
+
}, [updateRect]);
|
|
3467
|
+
const rafId = useRef22(0);
|
|
3468
|
+
const latestEvent = useRef22(null);
|
|
3469
|
+
const processMouseMove = useCallback7(() => {
|
|
3470
|
+
rafId.current = 0;
|
|
3471
|
+
const e = latestEvent.current;
|
|
3472
|
+
if (!e) return;
|
|
3473
|
+
const rect = rectRef.current;
|
|
3474
|
+
if (!rect) return;
|
|
3475
|
+
mouseX.set(e.clientX - rect.left);
|
|
3476
|
+
mouseY.set(e.clientY - rect.top);
|
|
3477
|
+
}, [mouseX, mouseY]);
|
|
3478
|
+
const handleMouseMove = useCallback7((e) => {
|
|
3479
|
+
latestEvent.current = e;
|
|
3480
|
+
if (!rafId.current) {
|
|
3481
|
+
rafId.current = requestAnimationFrame(processMouseMove);
|
|
3482
|
+
}
|
|
3483
|
+
}, [processMouseMove]);
|
|
3484
|
+
useEffect23(() => {
|
|
3485
|
+
return () => {
|
|
3486
|
+
if (rafId.current) cancelAnimationFrame(rafId.current);
|
|
3487
|
+
};
|
|
3488
|
+
}, []);
|
|
3489
|
+
const maskTemplate = useMotionTemplate3`
|
|
3490
|
+
radial-gradient(
|
|
3491
|
+
200px circle at ${mouseX}px ${mouseY}px,
|
|
3492
|
+
black 0%,
|
|
3493
|
+
transparent 100%
|
|
3494
|
+
)
|
|
3495
|
+
`;
|
|
3428
3496
|
if (disabled || isReducedMotion) {
|
|
3429
3497
|
return /* @__PURE__ */ jsxs16("div", { ref: mergedRef, className: `relative flex items-center justify-center w-full group ${containerClassName || ""}`, ...props, children: [
|
|
3430
3498
|
/* @__PURE__ */ jsx42("div", { className: "absolute inset-0 bg-dot-thick-neutral-300 pointer-events-none" }),
|
|
@@ -3445,20 +3513,8 @@ var HeroHighlight = forwardRef40(
|
|
|
3445
3513
|
{
|
|
3446
3514
|
className: "absolute inset-0 opacity-0 transition duration-300 group-hover:opacity-100 pointer-events-none bg-dot-thick-teal-500",
|
|
3447
3515
|
style: {
|
|
3448
|
-
WebkitMaskImage:
|
|
3449
|
-
|
|
3450
|
-
200px circle at ${mouseX}px ${mouseY}px,
|
|
3451
|
-
black 0%,
|
|
3452
|
-
transparent 100%
|
|
3453
|
-
)
|
|
3454
|
-
`,
|
|
3455
|
-
maskImage: useMotionTemplate3`
|
|
3456
|
-
radial-gradient(
|
|
3457
|
-
200px circle at ${mouseX}px ${mouseY}px,
|
|
3458
|
-
black 0%,
|
|
3459
|
-
transparent 100%
|
|
3460
|
-
)
|
|
3461
|
-
`
|
|
3516
|
+
WebkitMaskImage: maskTemplate,
|
|
3517
|
+
maskImage: maskTemplate
|
|
3462
3518
|
}
|
|
3463
3519
|
}
|
|
3464
3520
|
),
|