@nikitph/flux-ui 0.1.0
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/LICENSE +21 -0
- package/README.md +310 -0
- package/dist/config/flux.config.d.ts +36 -0
- package/dist/context/FluxProvider.d.ts +11 -0
- package/dist/hooks/useAnimationBudget.d.ts +7 -0
- package/dist/hooks/useInView.d.ts +3 -0
- package/dist/hooks/useIsClient.d.ts +1 -0
- package/dist/hooks/useMergedRef.d.ts +2 -0
- package/dist/hooks/usePhysics.d.ts +7 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +1 -0
- package/dist/hooks/useReducedMotion.d.ts +1 -0
- package/dist/hooks/useScrollProgress.d.ts +2 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +3330 -0
- package/dist/index.js.map +7 -0
- package/dist/primitives/01-reveal.d.ts +22 -0
- package/dist/primitives/02-presence.d.ts +15 -0
- package/dist/primitives/03-stagger.d.ts +23 -0
- package/dist/primitives/04-text-reveal.d.ts +21 -0
- package/dist/primitives/05-count-up.d.ts +22 -0
- package/dist/primitives/06-morph-text.d.ts +19 -0
- package/dist/primitives/07-flip-card.d.ts +17 -0
- package/dist/primitives/08-collapse.d.ts +16 -0
- package/dist/primitives/09-magnetic.d.ts +14 -0
- package/dist/primitives/10-hover-scale.d.ts +16 -0
- package/dist/primitives/11-tilt.d.ts +20 -0
- package/dist/primitives/12-drag.d.ts +31 -0
- package/dist/primitives/13-swipe.d.ts +20 -0
- package/dist/primitives/14-long-press.d.ts +18 -0
- package/dist/primitives/15-hover-3d.d.ts +23 -0
- package/dist/primitives/16-scroll-velocity.d.ts +15 -0
- package/dist/primitives/17-spotlight.d.ts +17 -0
- package/dist/primitives/18-follow-cursor.d.ts +20 -0
- package/dist/primitives/19-morph.d.ts +14 -0
- package/dist/primitives/20-fluid-layout.d.ts +14 -0
- package/dist/primitives/21-reorder.d.ts +25 -0
- package/dist/primitives/22-page-transition.d.ts +16 -0
- package/dist/primitives/23-animated-list.d.ts +20 -0
- package/dist/primitives/24-marquee.d.ts +16 -0
- package/dist/primitives/25-dock.d.ts +25 -0
- package/dist/primitives/26-infinite-scroll.d.ts +21 -0
- package/dist/primitives/27-scroll-progress.d.ts +14 -0
- package/dist/primitives/28-parallax.d.ts +11 -0
- package/dist/primitives/29-sticky-scroll.d.ts +14 -0
- package/dist/primitives/30-scroll-snap.d.ts +22 -0
- package/dist/primitives/31-aurora.d.ts +12 -0
- package/dist/primitives/32-mesh-gradient.d.ts +9 -0
- package/dist/primitives/33-particles.d.ts +11 -0
- package/dist/primitives/34-grid-pattern.d.ts +10 -0
- package/dist/primitives/35-noise.d.ts +9 -0
- package/dist/primitives/36-streaming-text.d.ts +14 -0
- package/dist/primitives/37-typing-indicator.d.ts +10 -0
- package/dist/primitives/38-skeleton.d.ts +13 -0
- package/dist/primitives/39-ai-message.d.ts +13 -0
- package/dist/primitives/40-hero-highlight.d.ts +13 -0
- package/dist/utils/clamp.d.ts +1 -0
- package/dist/utils/resolveMotion.d.ts +2 -0
- package/dist/utils/slot.d.ts +4 -0
- package/package.json +86 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3330 @@
|
|
|
1
|
+
// src/config/flux.config.ts
|
|
2
|
+
var physics = {
|
|
3
|
+
snappy: { type: "spring", stiffness: 500, damping: 30, mass: 0.5 },
|
|
4
|
+
smooth: { type: "spring", stiffness: 200, damping: 20, mass: 1 },
|
|
5
|
+
gentle: { type: "spring", stiffness: 120, damping: 14, mass: 1 },
|
|
6
|
+
dramatic: { type: "spring", stiffness: 80, damping: 10, mass: 1.5 },
|
|
7
|
+
bouncy: { type: "spring", stiffness: 400, damping: 15, mass: 1 },
|
|
8
|
+
cinematic: { type: "spring", stiffness: 50, damping: 12, mass: 2 },
|
|
9
|
+
instant: { type: "spring", stiffness: 800, damping: 40, mass: 0.3 }
|
|
10
|
+
};
|
|
11
|
+
var motionScale = {
|
|
12
|
+
distance: { xs: 4, sm: 8, md: 16, lg: 32, xl: 64, "2xl": 128 },
|
|
13
|
+
rotation: { xs: 1, sm: 3, md: 6, lg: 12, xl: 24 },
|
|
14
|
+
scale: { xs: 0.98, sm: 0.95, md: 0.9, lg: 0.8 },
|
|
15
|
+
stagger: { fast: 0.03, normal: 0.06, slow: 0.12, cascade: 0.08 }
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/context/FluxProvider.tsx
|
|
19
|
+
import { createContext, useContext } from "react";
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
var FluxContext = createContext({});
|
|
22
|
+
function FluxProvider({
|
|
23
|
+
children,
|
|
24
|
+
motionLevel
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(FluxContext.Provider, { value: { motionLevel }, children });
|
|
27
|
+
}
|
|
28
|
+
function useFluxContext() {
|
|
29
|
+
return useContext(FluxContext);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/hooks/usePhysics.ts
|
|
33
|
+
function usePhysics(preset = "smooth") {
|
|
34
|
+
return physics[preset] || physics.smooth;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/hooks/usePrefersReducedMotion.ts
|
|
38
|
+
import { useEffect, useState } from "react";
|
|
39
|
+
function usePrefersReducedMotion() {
|
|
40
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const mediaQueryList = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
43
|
+
setPrefersReducedMotion(mediaQueryList.matches);
|
|
44
|
+
const listener = (event) => {
|
|
45
|
+
setPrefersReducedMotion(event.matches);
|
|
46
|
+
};
|
|
47
|
+
mediaQueryList.addEventListener("change", listener);
|
|
48
|
+
return () => mediaQueryList.removeEventListener("change", listener);
|
|
49
|
+
}, []);
|
|
50
|
+
return prefersReducedMotion;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/hooks/useReducedMotion.ts
|
|
54
|
+
function useReducedMotion() {
|
|
55
|
+
const { motionLevel } = useFluxContext();
|
|
56
|
+
const prefersReduced = usePrefersReducedMotion();
|
|
57
|
+
if (motionLevel === "none" || motionLevel === "reduced") {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (motionLevel === "full") {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return prefersReduced;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/hooks/useIsClient.ts
|
|
67
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
68
|
+
function useIsClient() {
|
|
69
|
+
const [isClient, setIsClient] = useState2(false);
|
|
70
|
+
useEffect2(() => {
|
|
71
|
+
setIsClient(true);
|
|
72
|
+
}, []);
|
|
73
|
+
return isClient;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/hooks/useMergedRef.ts
|
|
77
|
+
import { useRef, useEffect as useEffect3 } from "react";
|
|
78
|
+
function useMergedRef(...refs) {
|
|
79
|
+
const targetRef = useRef(null);
|
|
80
|
+
useEffect3(() => {
|
|
81
|
+
refs.forEach((ref) => {
|
|
82
|
+
if (!ref) return;
|
|
83
|
+
if (typeof ref === "function") {
|
|
84
|
+
ref(targetRef.current);
|
|
85
|
+
} else {
|
|
86
|
+
ref.current = targetRef.current;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}, [refs]);
|
|
90
|
+
return targetRef;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/hooks/useInView.ts
|
|
94
|
+
import { useInView as useFramerInView } from "motion/react";
|
|
95
|
+
function useInView(ref, options) {
|
|
96
|
+
return useFramerInView(ref, options);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/hooks/useScrollProgress.ts
|
|
100
|
+
import { useScroll } from "motion/react";
|
|
101
|
+
function useScrollProgress(options) {
|
|
102
|
+
const { scrollYProgress } = useScroll(options);
|
|
103
|
+
return scrollYProgress;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/hooks/useAnimationBudget.ts
|
|
107
|
+
import { useEffect as useEffect4 } from "react";
|
|
108
|
+
var activeAnimations = 0;
|
|
109
|
+
function useAnimationBudget(_options = {}) {
|
|
110
|
+
useEffect4(() => {
|
|
111
|
+
activeAnimations++;
|
|
112
|
+
return () => {
|
|
113
|
+
activeAnimations--;
|
|
114
|
+
};
|
|
115
|
+
}, []);
|
|
116
|
+
return { activeAnimations, isWithinBudget: true };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/utils/resolveMotion.ts
|
|
120
|
+
function resolveMotion(preset, overrideSpring, isReducedMotion) {
|
|
121
|
+
if (isReducedMotion) {
|
|
122
|
+
return { type: "tween", duration: 0.15, ease: "linear" };
|
|
123
|
+
}
|
|
124
|
+
if (overrideSpring) {
|
|
125
|
+
return overrideSpring;
|
|
126
|
+
}
|
|
127
|
+
const physicsKey = preset || "smooth";
|
|
128
|
+
return physics[physicsKey] || physics.smooth;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/utils/slot.tsx
|
|
132
|
+
import React, { forwardRef } from "react";
|
|
133
|
+
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
|
134
|
+
var Slot = forwardRef(
|
|
135
|
+
({ children, ...props }, ref) => {
|
|
136
|
+
if (React.isValidElement(children)) {
|
|
137
|
+
return React.cloneElement(children, {
|
|
138
|
+
...props,
|
|
139
|
+
...children.props,
|
|
140
|
+
ref: (node) => {
|
|
141
|
+
if (typeof ref === "function") ref(node);
|
|
142
|
+
else if (ref) ref.current = node;
|
|
143
|
+
const childRef = children.ref;
|
|
144
|
+
if (typeof childRef === "function") childRef(node);
|
|
145
|
+
else if (childRef) childRef.current = node;
|
|
146
|
+
},
|
|
147
|
+
style: {
|
|
148
|
+
...props.style,
|
|
149
|
+
...children.props.style
|
|
150
|
+
},
|
|
151
|
+
className: [props.className, children.props.className].filter(Boolean).join(" ")
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return /* @__PURE__ */ jsx2(Fragment, { children });
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
Slot.displayName = "Slot";
|
|
158
|
+
|
|
159
|
+
// src/utils/clamp.ts
|
|
160
|
+
function clamp(val, min, max) {
|
|
161
|
+
return Math.min(Math.max(val, min), max);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/primitives/01-reveal.tsx
|
|
165
|
+
import React2, { forwardRef as forwardRef2, useEffect as useEffect5, useState as useState3 } from "react";
|
|
166
|
+
import { motion, useInView as useInView2 } from "motion/react";
|
|
167
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
168
|
+
var Reveal = forwardRef2(
|
|
169
|
+
({
|
|
170
|
+
children,
|
|
171
|
+
physics: physics2 = "gentle",
|
|
172
|
+
disabled = false,
|
|
173
|
+
className,
|
|
174
|
+
style,
|
|
175
|
+
asChild = false,
|
|
176
|
+
from = "below",
|
|
177
|
+
distance = motionScale.distance.md,
|
|
178
|
+
fade = true,
|
|
179
|
+
scale = false,
|
|
180
|
+
rotate = false,
|
|
181
|
+
trigger = "viewport",
|
|
182
|
+
threshold = 0.2,
|
|
183
|
+
once = true,
|
|
184
|
+
delay = 0,
|
|
185
|
+
show = true,
|
|
186
|
+
onReveal,
|
|
187
|
+
...props
|
|
188
|
+
}, ref) => {
|
|
189
|
+
const isReducedMotion = useReducedMotion();
|
|
190
|
+
const internalRef = React2.useRef(null);
|
|
191
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
192
|
+
const inView = useInView2(internalRef, { amount: threshold, once });
|
|
193
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
194
|
+
const [hasRevealed, setHasRevealed] = useState3(false);
|
|
195
|
+
if (disabled) {
|
|
196
|
+
if (asChild) return /* @__PURE__ */ jsx3(Slot, { ref: mergedRef, className, style, ...props, children });
|
|
197
|
+
return /* @__PURE__ */ jsx3("div", { ref: mergedRef, className, style, ...props, children });
|
|
198
|
+
}
|
|
199
|
+
const initial = {
|
|
200
|
+
opacity: fade ? isReducedMotion ? 0 : 0 : 1,
|
|
201
|
+
x: isReducedMotion ? 0 : from === "left" ? -distance : from === "right" ? distance : 0,
|
|
202
|
+
y: isReducedMotion ? 0 : from === "below" ? distance : from === "above" ? -distance : 0,
|
|
203
|
+
scale: isReducedMotion ? 1 : scale !== false ? scale : 1,
|
|
204
|
+
rotate: isReducedMotion ? 0 : rotate !== false ? rotate : 0
|
|
205
|
+
};
|
|
206
|
+
const target = { opacity: 1, x: 0, y: 0, scale: 1, rotate: 0 };
|
|
207
|
+
let shouldAnimate = false;
|
|
208
|
+
if (trigger === "mount") shouldAnimate = true;
|
|
209
|
+
else if (trigger === "viewport") shouldAnimate = inView;
|
|
210
|
+
else if (trigger === "manual") shouldAnimate = show;
|
|
211
|
+
useEffect5(() => {
|
|
212
|
+
if (shouldAnimate && !hasRevealed) {
|
|
213
|
+
setHasRevealed(true);
|
|
214
|
+
onReveal?.();
|
|
215
|
+
}
|
|
216
|
+
}, [shouldAnimate, hasRevealed, onReveal]);
|
|
217
|
+
const MotionComponent = asChild ? motion.create(Slot) : motion.div;
|
|
218
|
+
return /* @__PURE__ */ jsx3(
|
|
219
|
+
MotionComponent,
|
|
220
|
+
{
|
|
221
|
+
ref: mergedRef,
|
|
222
|
+
initial,
|
|
223
|
+
animate: shouldAnimate ? target : initial,
|
|
224
|
+
transition: { ...springConfig, delay: isReducedMotion ? 0 : delay },
|
|
225
|
+
className,
|
|
226
|
+
style,
|
|
227
|
+
...props,
|
|
228
|
+
children
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
Reveal.displayName = "Reveal";
|
|
234
|
+
|
|
235
|
+
// src/primitives/02-presence.tsx
|
|
236
|
+
import React3 from "react";
|
|
237
|
+
import { AnimatePresence, motion as motion2 } from "motion/react";
|
|
238
|
+
import { Fragment as Fragment2, jsx as jsx4 } from "react/jsx-runtime";
|
|
239
|
+
var Presence = ({
|
|
240
|
+
children,
|
|
241
|
+
enterFrom = "below",
|
|
242
|
+
exitTo,
|
|
243
|
+
distance = motionScale.distance.md,
|
|
244
|
+
fade = true,
|
|
245
|
+
physics: physics2 = "smooth",
|
|
246
|
+
exitPhysics = "snappy",
|
|
247
|
+
mode = "sync",
|
|
248
|
+
onExitComplete,
|
|
249
|
+
disabled = false
|
|
250
|
+
}) => {
|
|
251
|
+
const isReducedMotion = useReducedMotion();
|
|
252
|
+
const enterSpring = resolveMotion(physics2, void 0, isReducedMotion);
|
|
253
|
+
const exitSpring = resolveMotion(exitPhysics, void 0, isReducedMotion);
|
|
254
|
+
if (disabled) {
|
|
255
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children });
|
|
256
|
+
}
|
|
257
|
+
const effectiveExitTo = exitTo ?? enterFrom;
|
|
258
|
+
const getVariant = (direction, _directionExit = false) => {
|
|
259
|
+
if (isReducedMotion) return { opacity: 0, x: 0, y: 0, scale: 1 };
|
|
260
|
+
switch (direction) {
|
|
261
|
+
case "below":
|
|
262
|
+
return { opacity: fade ? 0 : 1, y: distance, x: 0, scale: 1 };
|
|
263
|
+
case "above":
|
|
264
|
+
return { opacity: fade ? 0 : 1, y: -distance, x: 0, scale: 1 };
|
|
265
|
+
case "left":
|
|
266
|
+
return { opacity: fade ? 0 : 1, y: 0, x: -distance, scale: 1 };
|
|
267
|
+
case "right":
|
|
268
|
+
return { opacity: fade ? 0 : 1, y: 0, x: distance, scale: 1 };
|
|
269
|
+
case "scale":
|
|
270
|
+
return { opacity: fade ? 0 : 1, y: 0, x: 0, scale: 0.9 };
|
|
271
|
+
case "none":
|
|
272
|
+
return { opacity: fade ? 0 : 1, y: 0, x: 0, scale: 1 };
|
|
273
|
+
default:
|
|
274
|
+
return { opacity: fade ? 0 : 1, y: 0, x: 0, scale: 1 };
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
const initial = getVariant(enterFrom);
|
|
278
|
+
const exit = getVariant(effectiveExitTo, true);
|
|
279
|
+
const animate = { opacity: 1, x: 0, y: 0, scale: 1 };
|
|
280
|
+
return /* @__PURE__ */ jsx4(AnimatePresence, { mode, onExitComplete, children: React3.Children.map(children, (child) => {
|
|
281
|
+
if (!React3.isValidElement(child)) return child;
|
|
282
|
+
const MotionChild = motion2.create(Slot);
|
|
283
|
+
return /* @__PURE__ */ jsx4(
|
|
284
|
+
MotionChild,
|
|
285
|
+
{
|
|
286
|
+
initial,
|
|
287
|
+
animate,
|
|
288
|
+
exit: { ...exit, transition: exitSpring },
|
|
289
|
+
transition: enterSpring,
|
|
290
|
+
children: child
|
|
291
|
+
},
|
|
292
|
+
child.key || Math.random().toString(36)
|
|
293
|
+
);
|
|
294
|
+
}) });
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// src/primitives/03-stagger.tsx
|
|
298
|
+
import React4, { forwardRef as forwardRef3, useEffect as useEffect6, useState as useState4 } from "react";
|
|
299
|
+
import { motion as motion3, useInView as useInView3 } from "motion/react";
|
|
300
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
301
|
+
var Stagger = forwardRef3(
|
|
302
|
+
({
|
|
303
|
+
children,
|
|
304
|
+
interval = motionScale.stagger.normal,
|
|
305
|
+
from = "first",
|
|
306
|
+
reveal = { from: "below", distance: motionScale.distance.md, fade: true, scale: false },
|
|
307
|
+
trigger = "viewport",
|
|
308
|
+
threshold = 0.1,
|
|
309
|
+
once = true,
|
|
310
|
+
show = true,
|
|
311
|
+
physics: physics2 = "gentle",
|
|
312
|
+
className,
|
|
313
|
+
style,
|
|
314
|
+
asChild = false,
|
|
315
|
+
disabled = false,
|
|
316
|
+
...props
|
|
317
|
+
}, ref) => {
|
|
318
|
+
const isReducedMotion = useReducedMotion();
|
|
319
|
+
const internalRef = React4.useRef(null);
|
|
320
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
321
|
+
const inView = useInView3(internalRef, { amount: threshold, once });
|
|
322
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
323
|
+
const [hasRevealed, setHasRevealed] = useState4(false);
|
|
324
|
+
if (disabled) {
|
|
325
|
+
if (asChild) return /* @__PURE__ */ jsx5(Slot, { ref: mergedRef, className, style, ...props, children });
|
|
326
|
+
return /* @__PURE__ */ jsx5("div", { ref: mergedRef, className, style, ...props, children });
|
|
327
|
+
}
|
|
328
|
+
let shouldAnimate = false;
|
|
329
|
+
if (trigger === "mount") shouldAnimate = true;
|
|
330
|
+
else if (trigger === "viewport") shouldAnimate = inView;
|
|
331
|
+
else if (trigger === "manual") shouldAnimate = show;
|
|
332
|
+
useEffect6(() => {
|
|
333
|
+
if (shouldAnimate && !hasRevealed) {
|
|
334
|
+
setHasRevealed(true);
|
|
335
|
+
}
|
|
336
|
+
}, [shouldAnimate, hasRevealed]);
|
|
337
|
+
const childrenArray = React4.Children.toArray(children);
|
|
338
|
+
const count = childrenArray.length;
|
|
339
|
+
let randomSeed = 0.5;
|
|
340
|
+
const getInitial = () => {
|
|
341
|
+
if (isReducedMotion) return { opacity: 0, x: 0, y: 0, scale: 1 };
|
|
342
|
+
const rFrom = reveal.from || "below";
|
|
343
|
+
const rDist = reveal.distance || motionScale.distance.md;
|
|
344
|
+
const rFade = reveal.fade ?? true;
|
|
345
|
+
const rScale = reveal.scale ?? false;
|
|
346
|
+
return {
|
|
347
|
+
opacity: rFade ? 0 : 1,
|
|
348
|
+
y: rFrom === "below" ? rDist : rFrom === "above" ? -rDist : 0,
|
|
349
|
+
x: rFrom === "left" ? -rDist : rFrom === "right" ? rDist : 0,
|
|
350
|
+
scale: rScale !== false ? rScale : 1
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
const target = { opacity: 1, x: 0, y: 0, scale: 1 };
|
|
354
|
+
const initial = getInitial();
|
|
355
|
+
const renderChildren = childrenArray.map((child, i) => {
|
|
356
|
+
if (!React4.isValidElement(child)) return child;
|
|
357
|
+
let delay = 0;
|
|
358
|
+
if (!isReducedMotion) {
|
|
359
|
+
if (from === "first") delay = i * interval;
|
|
360
|
+
else if (from === "last") delay = (count - 1 - i) * interval;
|
|
361
|
+
else if (from === "center") delay = Math.abs(i - Math.floor(count / 2)) * interval;
|
|
362
|
+
else if (from === "random") {
|
|
363
|
+
randomSeed = (randomSeed * 9301 + 49297) % 233280;
|
|
364
|
+
delay = randomSeed / 233280 * count * interval;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const MotionChild = motion3.create(Slot);
|
|
368
|
+
return /* @__PURE__ */ jsx5(
|
|
369
|
+
MotionChild,
|
|
370
|
+
{
|
|
371
|
+
initial,
|
|
372
|
+
animate: shouldAnimate ? target : initial,
|
|
373
|
+
transition: { ...springConfig, delay },
|
|
374
|
+
children: child
|
|
375
|
+
},
|
|
376
|
+
child.key || i
|
|
377
|
+
);
|
|
378
|
+
});
|
|
379
|
+
const Comp = asChild ? Slot : "div";
|
|
380
|
+
return /* @__PURE__ */ jsx5(Comp, { ref: mergedRef, className, style, ...props, children: renderChildren });
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
Stagger.displayName = "Stagger";
|
|
384
|
+
|
|
385
|
+
// src/primitives/04-text-reveal.tsx
|
|
386
|
+
import React5, { forwardRef as forwardRef4, useEffect as useEffect7, useState as useState5 } from "react";
|
|
387
|
+
import { motion as motion4, useInView as useInView4 } from "motion/react";
|
|
388
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
389
|
+
var TextReveal = forwardRef4(
|
|
390
|
+
({
|
|
391
|
+
children,
|
|
392
|
+
by = "word",
|
|
393
|
+
stagger,
|
|
394
|
+
from = "below",
|
|
395
|
+
distance,
|
|
396
|
+
fade = true,
|
|
397
|
+
blur = false,
|
|
398
|
+
trigger = "viewport",
|
|
399
|
+
threshold = 0.2,
|
|
400
|
+
once = true,
|
|
401
|
+
show = true,
|
|
402
|
+
tag: Tag = "p",
|
|
403
|
+
physics: physics2 = "gentle",
|
|
404
|
+
className,
|
|
405
|
+
style,
|
|
406
|
+
disabled = false,
|
|
407
|
+
...props
|
|
408
|
+
}, ref) => {
|
|
409
|
+
const isReducedMotion = useReducedMotion();
|
|
410
|
+
const internalRef = React5.useRef(null);
|
|
411
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
412
|
+
const inView = useInView4(internalRef, { amount: threshold, once });
|
|
413
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
414
|
+
const [hasRevealed, setHasRevealed] = useState5(false);
|
|
415
|
+
let shouldAnimate = false;
|
|
416
|
+
if (trigger === "mount") shouldAnimate = true;
|
|
417
|
+
else if (trigger === "viewport") shouldAnimate = inView;
|
|
418
|
+
else if (trigger === "manual") shouldAnimate = show;
|
|
419
|
+
useEffect7(() => {
|
|
420
|
+
if (shouldAnimate && !hasRevealed) setHasRevealed(true);
|
|
421
|
+
}, [shouldAnimate, hasRevealed]);
|
|
422
|
+
if (disabled || typeof children !== "string") {
|
|
423
|
+
const Comp = motion4[Tag];
|
|
424
|
+
return /* @__PURE__ */ jsx6(Comp, { ref: mergedRef, className, style, ...props, children });
|
|
425
|
+
}
|
|
426
|
+
const resolvedStagger = stagger ?? (by === "char" ? 0.02 : by === "word" ? 0.04 : 0.08);
|
|
427
|
+
const resolvedDistance = distance ?? (by === "char" ? 8 : 16);
|
|
428
|
+
const getInitial = () => {
|
|
429
|
+
if (isReducedMotion) return { opacity: 0, filter: "blur(0px)" };
|
|
430
|
+
return {
|
|
431
|
+
opacity: fade ? 0 : 1,
|
|
432
|
+
y: from === "below" ? resolvedDistance : from === "above" ? -resolvedDistance : 0,
|
|
433
|
+
x: from === "left" ? -resolvedDistance : from === "right" ? resolvedDistance : 0,
|
|
434
|
+
filter: blur !== false ? `blur(${blur}px)` : "blur(0px)"
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
const initial = getInitial();
|
|
438
|
+
const target = { opacity: 1, x: 0, y: 0, filter: "blur(0px)" };
|
|
439
|
+
let tokens = [];
|
|
440
|
+
if (by === "char") tokens = children.split("");
|
|
441
|
+
else if (by === "word") tokens = children.split(/(\s+)/);
|
|
442
|
+
else if (by === "line") tokens = children.split("\n");
|
|
443
|
+
const MotionTag = motion4[Tag];
|
|
444
|
+
return /* @__PURE__ */ jsx6(MotionTag, { ref: mergedRef, className, style, ...props, children: tokens.map((token, i) => {
|
|
445
|
+
if (by === "char" && token === " ") {
|
|
446
|
+
return /* @__PURE__ */ jsx6("span", { children: "\xA0" }, i);
|
|
447
|
+
}
|
|
448
|
+
if (by === "word" && token.trim() === "") {
|
|
449
|
+
return /* @__PURE__ */ jsx6("span", { children: token }, i);
|
|
450
|
+
}
|
|
451
|
+
const displayStyle = by === "line" ? "block" : "inline-block";
|
|
452
|
+
return /* @__PURE__ */ jsx6(
|
|
453
|
+
motion4.span,
|
|
454
|
+
{
|
|
455
|
+
style: { display: displayStyle, whiteSpace: "pre-wrap" },
|
|
456
|
+
initial,
|
|
457
|
+
animate: shouldAnimate ? target : initial,
|
|
458
|
+
transition: isReducedMotion ? void 0 : { ...springConfig, delay: i * resolvedStagger },
|
|
459
|
+
children: token
|
|
460
|
+
},
|
|
461
|
+
i
|
|
462
|
+
);
|
|
463
|
+
}) });
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
TextReveal.displayName = "TextReveal";
|
|
467
|
+
|
|
468
|
+
// src/primitives/05-count-up.tsx
|
|
469
|
+
import React6, { forwardRef as forwardRef5, useEffect as useEffect8 } from "react";
|
|
470
|
+
import { motion as motion5, useInView as useInView5, useMotionValue, useSpring, useTransform } from "motion/react";
|
|
471
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
472
|
+
var CountUp = forwardRef5(
|
|
473
|
+
({
|
|
474
|
+
from = 0,
|
|
475
|
+
to,
|
|
476
|
+
duration,
|
|
477
|
+
decimals = 0,
|
|
478
|
+
prefix = "",
|
|
479
|
+
suffix = "",
|
|
480
|
+
separator = ",",
|
|
481
|
+
trigger = "viewport",
|
|
482
|
+
threshold = 0.2,
|
|
483
|
+
once = true,
|
|
484
|
+
show = true,
|
|
485
|
+
tag: Tag = "span",
|
|
486
|
+
formatFn,
|
|
487
|
+
physics: physics2 = "smooth",
|
|
488
|
+
className,
|
|
489
|
+
style,
|
|
490
|
+
disabled = false,
|
|
491
|
+
...props
|
|
492
|
+
}, ref) => {
|
|
493
|
+
const isReducedMotion = useReducedMotion();
|
|
494
|
+
const internalRef = React6.useRef(null);
|
|
495
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
496
|
+
const inView = useInView5(internalRef, { amount: threshold, once });
|
|
497
|
+
let shouldAnimate = false;
|
|
498
|
+
if (trigger === "mount") shouldAnimate = true;
|
|
499
|
+
else if (trigger === "viewport") shouldAnimate = inView;
|
|
500
|
+
else if (trigger === "manual") shouldAnimate = show;
|
|
501
|
+
const baseValue = useMotionValue(from);
|
|
502
|
+
const springConfig = duration ? { duration } : resolveMotion(physics2, void 0, isReducedMotion);
|
|
503
|
+
const animatedValue = useSpring(baseValue, duration ? void 0 : springConfig);
|
|
504
|
+
useEffect8(() => {
|
|
505
|
+
if (shouldAnimate) {
|
|
506
|
+
if (isReducedMotion || disabled) {
|
|
507
|
+
baseValue.jump(to);
|
|
508
|
+
} else {
|
|
509
|
+
baseValue.set(to);
|
|
510
|
+
}
|
|
511
|
+
} else {
|
|
512
|
+
baseValue.set(from);
|
|
513
|
+
}
|
|
514
|
+
}, [shouldAnimate, isReducedMotion, disabled, to, from, baseValue]);
|
|
515
|
+
const display = useTransform(animatedValue, (val) => {
|
|
516
|
+
if (formatFn) return formatFn(val);
|
|
517
|
+
const parts = Number(val).toFixed(decimals).split(".");
|
|
518
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
519
|
+
return `${prefix}${parts.join(".")}${suffix}`;
|
|
520
|
+
});
|
|
521
|
+
const MotionTag = motion5[Tag];
|
|
522
|
+
return /* @__PURE__ */ jsx7(MotionTag, { ref: mergedRef, className, style, ...props, children: display });
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
CountUp.displayName = "CountUp";
|
|
526
|
+
|
|
527
|
+
// src/primitives/06-morph-text.tsx
|
|
528
|
+
import React7, { forwardRef as forwardRef6, useEffect as useEffect9, useState as useState6 } from "react";
|
|
529
|
+
import { motion as motion6, AnimatePresence as AnimatePresence2 } from "motion/react";
|
|
530
|
+
import { jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
531
|
+
var MorphText = forwardRef6(
|
|
532
|
+
({
|
|
533
|
+
texts,
|
|
534
|
+
interval = 3,
|
|
535
|
+
mode = "crossfade",
|
|
536
|
+
stagger = 0.02,
|
|
537
|
+
scrambleChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%",
|
|
538
|
+
scrambleDuration = 0.6,
|
|
539
|
+
loop = true,
|
|
540
|
+
pause = false,
|
|
541
|
+
tag: Tag = "span",
|
|
542
|
+
onTextChange,
|
|
543
|
+
physics: physics2 = "smooth",
|
|
544
|
+
className,
|
|
545
|
+
style,
|
|
546
|
+
disabled = false,
|
|
547
|
+
...props
|
|
548
|
+
}, ref) => {
|
|
549
|
+
const isReducedMotion = useReducedMotion();
|
|
550
|
+
const internalRef = React7.useRef(null);
|
|
551
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
552
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
553
|
+
const [currentIndex, setCurrentIndex] = useState6(0);
|
|
554
|
+
useEffect9(() => {
|
|
555
|
+
if (disabled || pause || texts.length <= 1) return;
|
|
556
|
+
if (!loop && currentIndex === texts.length - 1) return;
|
|
557
|
+
const timer = setTimeout(() => {
|
|
558
|
+
const nextIndex = (currentIndex + 1) % texts.length;
|
|
559
|
+
setCurrentIndex(nextIndex);
|
|
560
|
+
onTextChange?.(nextIndex);
|
|
561
|
+
}, interval * 1e3);
|
|
562
|
+
return () => clearTimeout(timer);
|
|
563
|
+
}, [currentIndex, texts, interval, loop, pause, disabled, onTextChange]);
|
|
564
|
+
if (disabled || isReducedMotion) {
|
|
565
|
+
const Comp = Tag;
|
|
566
|
+
return /* @__PURE__ */ jsx8(Comp, { ref: mergedRef, className, style, ...props, children: texts[currentIndex] });
|
|
567
|
+
}
|
|
568
|
+
const currentText = texts[currentIndex];
|
|
569
|
+
const MotionTag = motion6[Tag];
|
|
570
|
+
if (mode === "crossfade") {
|
|
571
|
+
return /* @__PURE__ */ jsxs(MotionTag, { "aria-live": "polite", ref: mergedRef, className, style, ...props, children: [
|
|
572
|
+
/* @__PURE__ */ jsx8("span", { style: { position: "absolute", width: 1, height: 1, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", border: 0 }, children: currentText }),
|
|
573
|
+
/* @__PURE__ */ jsx8(AnimatePresence2, { mode: "popLayout", initial: false, children: /* @__PURE__ */ jsx8(
|
|
574
|
+
motion6.span,
|
|
575
|
+
{
|
|
576
|
+
initial: { opacity: 0, filter: "blur(4px)", y: 10 },
|
|
577
|
+
animate: { opacity: 1, filter: "blur(0px)", y: 0 },
|
|
578
|
+
exit: { opacity: 0, filter: "blur(4px)", y: -10 },
|
|
579
|
+
transition: springConfig,
|
|
580
|
+
style: { display: "inline-block" },
|
|
581
|
+
children: currentText
|
|
582
|
+
},
|
|
583
|
+
currentIndex
|
|
584
|
+
) })
|
|
585
|
+
] });
|
|
586
|
+
}
|
|
587
|
+
return /* @__PURE__ */ jsx8(MotionTag, { "aria-live": "polite", ref: mergedRef, className, style, ...props, children: /* @__PURE__ */ jsx8(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx8(
|
|
588
|
+
motion6.span,
|
|
589
|
+
{
|
|
590
|
+
initial: { opacity: 0 },
|
|
591
|
+
animate: { opacity: 1 },
|
|
592
|
+
exit: { opacity: 0 },
|
|
593
|
+
transition: springConfig,
|
|
594
|
+
children: currentText
|
|
595
|
+
},
|
|
596
|
+
currentIndex
|
|
597
|
+
) }) });
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
MorphText.displayName = "MorphText";
|
|
601
|
+
|
|
602
|
+
// src/primitives/07-flip-card.tsx
|
|
603
|
+
import React8, { forwardRef as forwardRef7, useState as useState7 } from "react";
|
|
604
|
+
import { motion as motion7 } from "motion/react";
|
|
605
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
606
|
+
var FlipCard = forwardRef7(
|
|
607
|
+
({
|
|
608
|
+
front,
|
|
609
|
+
back,
|
|
610
|
+
flipped: controlledFlipped,
|
|
611
|
+
direction = "horizontal",
|
|
612
|
+
trigger = "click",
|
|
613
|
+
perspective = 1e3,
|
|
614
|
+
height = "100%",
|
|
615
|
+
width = "100%",
|
|
616
|
+
physics: physics2 = "smooth",
|
|
617
|
+
className,
|
|
618
|
+
style,
|
|
619
|
+
disabled = false,
|
|
620
|
+
...props
|
|
621
|
+
}, ref) => {
|
|
622
|
+
const isReducedMotion = useReducedMotion();
|
|
623
|
+
const internalRef = React8.useRef(null);
|
|
624
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
625
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
626
|
+
const [isFlippedState, setFlipped] = useState7(false);
|
|
627
|
+
const isFlipped = controlledFlipped !== void 0 ? controlledFlipped : isFlippedState;
|
|
628
|
+
if (disabled) {
|
|
629
|
+
return /* @__PURE__ */ jsx9("div", { ref: mergedRef, className, style: { ...style, height, width }, ...props, children: isFlipped ? back : front });
|
|
630
|
+
}
|
|
631
|
+
const handleInteraction = () => {
|
|
632
|
+
if (trigger === "click") {
|
|
633
|
+
setFlipped((prev) => !prev);
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
const handleHoverStart = () => {
|
|
637
|
+
if (trigger === "hover") setFlipped(true);
|
|
638
|
+
};
|
|
639
|
+
const handleHoverEnd = () => {
|
|
640
|
+
if (trigger === "hover") setFlipped(false);
|
|
641
|
+
};
|
|
642
|
+
const rotateAxis = direction === "horizontal" ? "rotateY" : "rotateX";
|
|
643
|
+
const frontRotate = isFlipped ? 180 : 0;
|
|
644
|
+
const backRotate = isFlipped ? 360 : 180;
|
|
645
|
+
return /* @__PURE__ */ jsxs2(
|
|
646
|
+
"div",
|
|
647
|
+
{
|
|
648
|
+
ref: mergedRef,
|
|
649
|
+
className,
|
|
650
|
+
style: {
|
|
651
|
+
perspective: `${perspective}px`,
|
|
652
|
+
position: "relative",
|
|
653
|
+
height,
|
|
654
|
+
width,
|
|
655
|
+
...style
|
|
656
|
+
},
|
|
657
|
+
onClick: handleInteraction,
|
|
658
|
+
onMouseEnter: handleHoverStart,
|
|
659
|
+
onMouseLeave: handleHoverEnd,
|
|
660
|
+
...props,
|
|
661
|
+
children: [
|
|
662
|
+
/* @__PURE__ */ jsx9(
|
|
663
|
+
motion7.div,
|
|
664
|
+
{
|
|
665
|
+
animate: isReducedMotion ? void 0 : { [rotateAxis]: frontRotate, opacity: isReducedMotion ? isFlipped ? 0 : 1 : 1 },
|
|
666
|
+
transition: springConfig,
|
|
667
|
+
style: {
|
|
668
|
+
position: "absolute",
|
|
669
|
+
width: "100%",
|
|
670
|
+
height: "100%",
|
|
671
|
+
backfaceVisibility: "hidden",
|
|
672
|
+
transformStyle: "preserve-3d"
|
|
673
|
+
},
|
|
674
|
+
children: front
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
/* @__PURE__ */ jsx9(
|
|
678
|
+
motion7.div,
|
|
679
|
+
{
|
|
680
|
+
animate: isReducedMotion ? void 0 : { [rotateAxis]: backRotate, opacity: isReducedMotion ? isFlipped ? 1 : 0 : 1 },
|
|
681
|
+
transition: springConfig,
|
|
682
|
+
initial: { [rotateAxis]: 180, opacity: isReducedMotion ? 0 : 1 },
|
|
683
|
+
style: {
|
|
684
|
+
position: "absolute",
|
|
685
|
+
width: "100%",
|
|
686
|
+
height: "100%",
|
|
687
|
+
backfaceVisibility: "hidden",
|
|
688
|
+
transformStyle: "preserve-3d"
|
|
689
|
+
},
|
|
690
|
+
children: back
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
FlipCard.displayName = "FlipCard";
|
|
699
|
+
|
|
700
|
+
// src/primitives/08-collapse.tsx
|
|
701
|
+
import { forwardRef as forwardRef8, useEffect as useEffect10, useRef as useRef2, useState as useState8 } from "react";
|
|
702
|
+
import { motion as motion8 } from "motion/react";
|
|
703
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
704
|
+
var Collapse = forwardRef8(
|
|
705
|
+
({
|
|
706
|
+
children,
|
|
707
|
+
open,
|
|
708
|
+
initialHeight = 0,
|
|
709
|
+
fade = true,
|
|
710
|
+
overflow = "hidden",
|
|
711
|
+
onOpenComplete,
|
|
712
|
+
onCloseComplete,
|
|
713
|
+
physics: physics2 = "smooth",
|
|
714
|
+
className,
|
|
715
|
+
style,
|
|
716
|
+
disabled = false,
|
|
717
|
+
...props
|
|
718
|
+
}, ref) => {
|
|
719
|
+
const isReducedMotion = useReducedMotion();
|
|
720
|
+
const internalRef = useRef2(null);
|
|
721
|
+
const contentRef = useRef2(null);
|
|
722
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
723
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
724
|
+
const [contentHeight, setContentHeight] = useState8(initialHeight);
|
|
725
|
+
useEffect10(() => {
|
|
726
|
+
if (!contentRef.current) return;
|
|
727
|
+
if (open) {
|
|
728
|
+
const height = contentRef.current.getBoundingClientRect().height;
|
|
729
|
+
setContentHeight(height);
|
|
730
|
+
} else {
|
|
731
|
+
const height = contentRef.current.getBoundingClientRect().height;
|
|
732
|
+
setContentHeight(height);
|
|
733
|
+
requestAnimationFrame(() => {
|
|
734
|
+
setContentHeight(initialHeight);
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}, [open, initialHeight]);
|
|
738
|
+
const handleAnimationComplete = () => {
|
|
739
|
+
if (open) {
|
|
740
|
+
setContentHeight("auto");
|
|
741
|
+
onOpenComplete?.();
|
|
742
|
+
} else {
|
|
743
|
+
onCloseComplete?.();
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
if (disabled) {
|
|
747
|
+
if (!open && initialHeight === 0) return null;
|
|
748
|
+
return /* @__PURE__ */ jsx10("div", { ref: mergedRef, className, style: { height: open ? "auto" : initialHeight, overflow: open ? overflow : "hidden", ...style }, ...props, children });
|
|
749
|
+
}
|
|
750
|
+
return /* @__PURE__ */ jsx10(
|
|
751
|
+
motion8.div,
|
|
752
|
+
{
|
|
753
|
+
ref: mergedRef,
|
|
754
|
+
className,
|
|
755
|
+
initial: { height: initialHeight, opacity: fade ? 0 : 1 },
|
|
756
|
+
animate: {
|
|
757
|
+
height: contentHeight,
|
|
758
|
+
opacity: open ? 1 : fade ? 0 : 1
|
|
759
|
+
},
|
|
760
|
+
transition: springConfig,
|
|
761
|
+
onAnimationComplete: handleAnimationComplete,
|
|
762
|
+
style: { overflow, ...style },
|
|
763
|
+
...props,
|
|
764
|
+
children: /* @__PURE__ */ jsx10("div", { ref: contentRef, children })
|
|
765
|
+
}
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
);
|
|
769
|
+
Collapse.displayName = "Collapse";
|
|
770
|
+
|
|
771
|
+
// src/primitives/09-magnetic.tsx
|
|
772
|
+
import React10, { forwardRef as forwardRef9, useCallback, useEffect as useEffect11, useRef as useRef3 } from "react";
|
|
773
|
+
import { motion as motion9, useMotionValue as useMotionValue2, useSpring as useSpring2 } from "motion/react";
|
|
774
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
775
|
+
var Magnetic = forwardRef9(
|
|
776
|
+
({
|
|
777
|
+
children,
|
|
778
|
+
strength = 0.3,
|
|
779
|
+
radius = 150,
|
|
780
|
+
maxDisplacement = 20,
|
|
781
|
+
spring = "snappy",
|
|
782
|
+
disableOnTouch = true,
|
|
783
|
+
className,
|
|
784
|
+
style,
|
|
785
|
+
asChild = false,
|
|
786
|
+
...props
|
|
787
|
+
}, ref) => {
|
|
788
|
+
const isReducedMotion = useReducedMotion();
|
|
789
|
+
const internalRef = useRef3(null);
|
|
790
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
791
|
+
const springConfig = resolveMotion(spring, void 0, isReducedMotion);
|
|
792
|
+
const [isTouchDevice, setIsTouchDevice] = React10.useState(false);
|
|
793
|
+
useEffect11(() => {
|
|
794
|
+
setIsTouchDevice(window.matchMedia("(pointer: coarse)").matches);
|
|
795
|
+
}, []);
|
|
796
|
+
const x = useMotionValue2(0);
|
|
797
|
+
const y = useMotionValue2(0);
|
|
798
|
+
const springX = useSpring2(x, isReducedMotion ? { duration: 0 } : springConfig);
|
|
799
|
+
const springY = useSpring2(y, isReducedMotion ? { duration: 0 } : springConfig);
|
|
800
|
+
const handleMouseMove = useCallback((e) => {
|
|
801
|
+
if (isReducedMotion || disableOnTouch && isTouchDevice) return;
|
|
802
|
+
if (!internalRef.current) return;
|
|
803
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
804
|
+
const centerX = rect.left + rect.width / 2;
|
|
805
|
+
const centerY = rect.top + rect.height / 2;
|
|
806
|
+
const deltaX = e.clientX - centerX;
|
|
807
|
+
const deltaY = e.clientY - centerY;
|
|
808
|
+
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
809
|
+
if (distance <= radius) {
|
|
810
|
+
const moveX = Math.max(-maxDisplacement, Math.min(maxDisplacement, deltaX * strength));
|
|
811
|
+
const moveY = Math.max(-maxDisplacement, Math.min(maxDisplacement, deltaY * strength));
|
|
812
|
+
x.set(moveX);
|
|
813
|
+
y.set(moveY);
|
|
814
|
+
} else {
|
|
815
|
+
x.set(0);
|
|
816
|
+
y.set(0);
|
|
817
|
+
}
|
|
818
|
+
}, [x, y, radius, maxDisplacement, strength, isTouchDevice, disableOnTouch, isReducedMotion]);
|
|
819
|
+
const handleMouseLeave = () => {
|
|
820
|
+
x.set(0);
|
|
821
|
+
y.set(0);
|
|
822
|
+
};
|
|
823
|
+
useEffect11(() => {
|
|
824
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
825
|
+
return () => {
|
|
826
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
827
|
+
};
|
|
828
|
+
}, [handleMouseMove]);
|
|
829
|
+
const MotionComponent = asChild ? motion9.create(Slot) : motion9.div;
|
|
830
|
+
return /* @__PURE__ */ jsx11(
|
|
831
|
+
MotionComponent,
|
|
832
|
+
{
|
|
833
|
+
ref: mergedRef,
|
|
834
|
+
className,
|
|
835
|
+
style: { ...style, x: springX, y: springY },
|
|
836
|
+
onMouseLeave: handleMouseLeave,
|
|
837
|
+
...props,
|
|
838
|
+
children
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
Magnetic.displayName = "Magnetic";
|
|
844
|
+
|
|
845
|
+
// src/primitives/10-hover-scale.tsx
|
|
846
|
+
import React11, { forwardRef as forwardRef10 } from "react";
|
|
847
|
+
import { motion as motion10 } from "motion/react";
|
|
848
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
849
|
+
var HoverScale = forwardRef10(
|
|
850
|
+
({
|
|
851
|
+
children,
|
|
852
|
+
hoverScale = 1.03,
|
|
853
|
+
pressScale = 0.97,
|
|
854
|
+
hoverRotate = 0,
|
|
855
|
+
liftShadow = false,
|
|
856
|
+
shadowColor = "rgba(0,0,0,0.15)",
|
|
857
|
+
physics: physics2 = "snappy",
|
|
858
|
+
className,
|
|
859
|
+
style,
|
|
860
|
+
asChild = false,
|
|
861
|
+
disabled = false,
|
|
862
|
+
...props
|
|
863
|
+
}, ref) => {
|
|
864
|
+
const isReducedMotion = useReducedMotion();
|
|
865
|
+
const internalRef = React11.useRef(null);
|
|
866
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
867
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
868
|
+
if (disabled) {
|
|
869
|
+
if (asChild) return /* @__PURE__ */ jsx12(Slot, { ref: mergedRef, className, style, ...props, children });
|
|
870
|
+
return /* @__PURE__ */ jsx12("div", { ref: mergedRef, className, style, ...props, children });
|
|
871
|
+
}
|
|
872
|
+
const whileHover = isReducedMotion ? { opacity: 0.8 } : {
|
|
873
|
+
scale: hoverScale,
|
|
874
|
+
rotate: hoverRotate,
|
|
875
|
+
boxShadow: liftShadow ? `0 10px 30px ${shadowColor}` : void 0
|
|
876
|
+
};
|
|
877
|
+
const whileTap = isReducedMotion ? { opacity: 0.6 } : { scale: pressScale };
|
|
878
|
+
const MotionComponent = asChild ? motion10.create(Slot) : motion10.div;
|
|
879
|
+
return /* @__PURE__ */ jsx12(
|
|
880
|
+
MotionComponent,
|
|
881
|
+
{
|
|
882
|
+
ref: mergedRef,
|
|
883
|
+
className,
|
|
884
|
+
style,
|
|
885
|
+
whileHover,
|
|
886
|
+
whileTap,
|
|
887
|
+
transition: springConfig,
|
|
888
|
+
...props,
|
|
889
|
+
children
|
|
890
|
+
}
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
);
|
|
894
|
+
HoverScale.displayName = "HoverScale";
|
|
895
|
+
|
|
896
|
+
// src/primitives/11-tilt.tsx
|
|
897
|
+
import React12, { forwardRef as forwardRef11, useCallback as useCallback2, useEffect as useEffect12, useRef as useRef4 } from "react";
|
|
898
|
+
import { motion as motion11, useMotionValue as useMotionValue3, useSpring as useSpring3, useMotionTemplate } from "motion/react";
|
|
899
|
+
import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
900
|
+
var Tilt = forwardRef11(
|
|
901
|
+
({
|
|
902
|
+
children,
|
|
903
|
+
maxTilt = 15,
|
|
904
|
+
perspective = 1e3,
|
|
905
|
+
scale = 1.02,
|
|
906
|
+
glare = false,
|
|
907
|
+
glareOpacity = 0.15,
|
|
908
|
+
glareColor = "white",
|
|
909
|
+
reverse = false,
|
|
910
|
+
resetOnLeave = true,
|
|
911
|
+
disableOnTouch = true,
|
|
912
|
+
axis = "both",
|
|
913
|
+
physics: physics2 = "snappy",
|
|
914
|
+
className,
|
|
915
|
+
style,
|
|
916
|
+
disabled = false,
|
|
917
|
+
...props
|
|
918
|
+
}, ref) => {
|
|
919
|
+
const isReducedMotion = useReducedMotion();
|
|
920
|
+
const internalRef = useRef4(null);
|
|
921
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
922
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
923
|
+
const [isTouchDevice, setIsTouchDevice] = React12.useState(false);
|
|
924
|
+
useEffect12(() => setIsTouchDevice(window.matchMedia("(pointer: coarse)").matches), []);
|
|
925
|
+
const x = useMotionValue3(0);
|
|
926
|
+
const y = useMotionValue3(0);
|
|
927
|
+
const glareX = useMotionValue3(50);
|
|
928
|
+
const glareY = useMotionValue3(50);
|
|
929
|
+
const s = useMotionValue3(1);
|
|
930
|
+
const rotateX = useSpring3(x, isReducedMotion ? { duration: 0 } : springConfig);
|
|
931
|
+
const rotateY = useSpring3(y, isReducedMotion ? { duration: 0 } : springConfig);
|
|
932
|
+
const scaleVal = useSpring3(s, isReducedMotion ? { duration: 0 } : springConfig);
|
|
933
|
+
const gX = useSpring3(glareX, isReducedMotion ? { duration: 0 } : springConfig);
|
|
934
|
+
const gY = useSpring3(glareY, isReducedMotion ? { duration: 0 } : springConfig);
|
|
935
|
+
const handleMouseMove = useCallback2((e) => {
|
|
936
|
+
if (disabled || isReducedMotion || disableOnTouch && isTouchDevice) return;
|
|
937
|
+
if (!internalRef.current) return;
|
|
938
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
939
|
+
const centerX = rect.left + rect.width / 2;
|
|
940
|
+
const centerY = rect.top + rect.height / 2;
|
|
941
|
+
const mouseX = (e.clientX - centerX) / rect.width;
|
|
942
|
+
const mouseY = (e.clientY - centerY) / rect.height;
|
|
943
|
+
const multiplier = reverse ? -1 : 1;
|
|
944
|
+
if (axis === "both" || axis === "y") {
|
|
945
|
+
x.set(-mouseY * maxTilt * 2 * multiplier);
|
|
946
|
+
}
|
|
947
|
+
if (axis === "both" || axis === "x") {
|
|
948
|
+
y.set(mouseX * maxTilt * 2 * multiplier);
|
|
949
|
+
}
|
|
950
|
+
s.set(scale);
|
|
951
|
+
if (glare) {
|
|
952
|
+
glareX.set((e.clientX - rect.left) / rect.width * 100);
|
|
953
|
+
glareY.set((e.clientY - rect.top) / rect.height * 100);
|
|
954
|
+
}
|
|
955
|
+
}, [x, y, s, glareX, glareY, maxTilt, reverse, axis, scale, glare, disabled, isReducedMotion, disableOnTouch, isTouchDevice]);
|
|
956
|
+
const handleMouseLeave = useCallback2(() => {
|
|
957
|
+
if (disabled || isReducedMotion) return;
|
|
958
|
+
if (resetOnLeave) {
|
|
959
|
+
x.set(0);
|
|
960
|
+
y.set(0);
|
|
961
|
+
}
|
|
962
|
+
s.set(1);
|
|
963
|
+
}, [x, y, s, resetOnLeave, disabled, isReducedMotion]);
|
|
964
|
+
const glareBackground = useMotionTemplate`radial-gradient(circle at ${gX}% ${gY}%, ${glareColor} 0%, transparent 80%)`;
|
|
965
|
+
if (disabled || isReducedMotion) {
|
|
966
|
+
return /* @__PURE__ */ jsx13("div", { ref: mergedRef, className, style, ...props, children });
|
|
967
|
+
}
|
|
968
|
+
return /* @__PURE__ */ jsx13(
|
|
969
|
+
"div",
|
|
970
|
+
{
|
|
971
|
+
ref: mergedRef,
|
|
972
|
+
className,
|
|
973
|
+
style: { perspective: `${perspective}px`, transformStyle: "preserve-3d", position: "relative", ...style },
|
|
974
|
+
onMouseMove: handleMouseMove,
|
|
975
|
+
onMouseLeave: handleMouseLeave,
|
|
976
|
+
...props,
|
|
977
|
+
children: /* @__PURE__ */ jsxs3(
|
|
978
|
+
motion11.div,
|
|
979
|
+
{
|
|
980
|
+
style: { rotateX, rotateY, scale: scaleVal, transformStyle: "preserve-3d", width: "100%", height: "100%" },
|
|
981
|
+
children: [
|
|
982
|
+
children,
|
|
983
|
+
glare && /* @__PURE__ */ jsx13(
|
|
984
|
+
motion11.div,
|
|
985
|
+
{
|
|
986
|
+
style: {
|
|
987
|
+
position: "absolute",
|
|
988
|
+
top: 0,
|
|
989
|
+
left: 0,
|
|
990
|
+
right: 0,
|
|
991
|
+
bottom: 0,
|
|
992
|
+
background: glareBackground,
|
|
993
|
+
opacity: glareOpacity,
|
|
994
|
+
pointerEvents: "none",
|
|
995
|
+
borderRadius: "inherit"
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
)
|
|
999
|
+
]
|
|
1000
|
+
}
|
|
1001
|
+
)
|
|
1002
|
+
}
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
);
|
|
1006
|
+
Tilt.displayName = "Tilt";
|
|
1007
|
+
|
|
1008
|
+
// src/primitives/12-drag.tsx
|
|
1009
|
+
import React13, { forwardRef as forwardRef12 } from "react";
|
|
1010
|
+
import { motion as motion12 } from "motion/react";
|
|
1011
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1012
|
+
var Drag = forwardRef12(
|
|
1013
|
+
({
|
|
1014
|
+
children,
|
|
1015
|
+
axis = "both",
|
|
1016
|
+
constraints,
|
|
1017
|
+
snapBack = false,
|
|
1018
|
+
snapPoints,
|
|
1019
|
+
snapThreshold = 50,
|
|
1020
|
+
dragElastic = 0.2,
|
|
1021
|
+
onDragStart,
|
|
1022
|
+
onDrag,
|
|
1023
|
+
onDragEnd,
|
|
1024
|
+
cursor = "grab",
|
|
1025
|
+
handle,
|
|
1026
|
+
physics: physics2 = "smooth",
|
|
1027
|
+
className,
|
|
1028
|
+
style,
|
|
1029
|
+
asChild = false,
|
|
1030
|
+
disabled = false,
|
|
1031
|
+
...props
|
|
1032
|
+
}, ref) => {
|
|
1033
|
+
const isReducedMotion = useReducedMotion();
|
|
1034
|
+
const internalRef = React13.useRef(null);
|
|
1035
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1036
|
+
if (disabled) {
|
|
1037
|
+
if (asChild) return /* @__PURE__ */ jsx14(Slot, { ref: mergedRef, className, style, ...props, children });
|
|
1038
|
+
return /* @__PURE__ */ jsx14("div", { ref: mergedRef, className, style, ...props, children });
|
|
1039
|
+
}
|
|
1040
|
+
const handleDragEnd = (e, info) => {
|
|
1041
|
+
onDragEnd?.(e, info);
|
|
1042
|
+
};
|
|
1043
|
+
const MotionComponent = asChild ? motion12.create(Slot) : motion12.div;
|
|
1044
|
+
return /* @__PURE__ */ jsx14(
|
|
1045
|
+
MotionComponent,
|
|
1046
|
+
{
|
|
1047
|
+
ref: mergedRef,
|
|
1048
|
+
drag: axis === "both" ? true : axis,
|
|
1049
|
+
dragConstraints: constraints,
|
|
1050
|
+
dragElastic,
|
|
1051
|
+
dragSnapToOrigin: snapBack,
|
|
1052
|
+
dragTransition: { bounceStiffness: isReducedMotion ? 0 : 600, bounceDamping: 20 },
|
|
1053
|
+
whileDrag: { cursor: cursor === "grab" ? "grabbing" : cursor },
|
|
1054
|
+
onDragStart,
|
|
1055
|
+
onDrag,
|
|
1056
|
+
onDragEnd: handleDragEnd,
|
|
1057
|
+
dragControls: void 0,
|
|
1058
|
+
dragListener: !handle,
|
|
1059
|
+
className,
|
|
1060
|
+
style: { cursor, ...style },
|
|
1061
|
+
...props,
|
|
1062
|
+
children
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
Drag.displayName = "Drag";
|
|
1068
|
+
|
|
1069
|
+
// src/primitives/13-swipe.tsx
|
|
1070
|
+
import React14, { forwardRef as forwardRef13, useState as useState9 } from "react";
|
|
1071
|
+
import { motion as motion13, useAnimation } from "motion/react";
|
|
1072
|
+
import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1073
|
+
var Swipe = forwardRef13(
|
|
1074
|
+
({
|
|
1075
|
+
children,
|
|
1076
|
+
direction = "horizontal",
|
|
1077
|
+
threshold = 0.4,
|
|
1078
|
+
velocityThreshold = 500,
|
|
1079
|
+
rubberBand = true,
|
|
1080
|
+
rubberBandFactor = 0.2,
|
|
1081
|
+
onSwipe,
|
|
1082
|
+
onSwipeStart,
|
|
1083
|
+
renderBackground,
|
|
1084
|
+
snapBack = true,
|
|
1085
|
+
exitAnimation = true,
|
|
1086
|
+
physics: physics2 = "smooth",
|
|
1087
|
+
className,
|
|
1088
|
+
style,
|
|
1089
|
+
disabled = false,
|
|
1090
|
+
...props
|
|
1091
|
+
}, ref) => {
|
|
1092
|
+
const isReducedMotion = useReducedMotion();
|
|
1093
|
+
const internalRef = React14.useRef(null);
|
|
1094
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1095
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1096
|
+
const controls = useAnimation();
|
|
1097
|
+
const [swipeProgress, setSwipeProgress] = useState9(0);
|
|
1098
|
+
const [swipeDirection, setSwipeDirection] = useState9(null);
|
|
1099
|
+
if (disabled) {
|
|
1100
|
+
return /* @__PURE__ */ jsx15("div", { ref: mergedRef, className, style: { position: "relative", ...style }, ...props, children });
|
|
1101
|
+
}
|
|
1102
|
+
const dragProp = direction === "horizontal" ? "x" : direction === "vertical" ? "y" : true;
|
|
1103
|
+
const handleDrag = (_, info) => {
|
|
1104
|
+
if (!internalRef.current) return;
|
|
1105
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
1106
|
+
const progress = Math.min(Math.max(info.offset.x / rect.width, -1), 1);
|
|
1107
|
+
setSwipeProgress(Math.abs(progress));
|
|
1108
|
+
setSwipeDirection(progress > 0 ? "right" : progress < 0 ? "left" : null);
|
|
1109
|
+
};
|
|
1110
|
+
const handleDragEnd = async (_, info) => {
|
|
1111
|
+
if (!internalRef.current) return;
|
|
1112
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
1113
|
+
const offset = direction === "vertical" ? info.offset.y : info.offset.x;
|
|
1114
|
+
const velocity = direction === "vertical" ? info.velocity.y : info.velocity.x;
|
|
1115
|
+
const size = direction === "vertical" ? rect.height : rect.width;
|
|
1116
|
+
const isBeyondThreshold = Math.abs(offset) > size * threshold;
|
|
1117
|
+
const isFastEnough = Math.abs(velocity) > velocityThreshold;
|
|
1118
|
+
if (isBeyondThreshold || isFastEnough) {
|
|
1119
|
+
const swipedDir = offset > 0 ? direction === "vertical" ? "down" : "right" : direction === "vertical" ? "up" : "left";
|
|
1120
|
+
onSwipe?.(swipedDir);
|
|
1121
|
+
if (exitAnimation) {
|
|
1122
|
+
const exitDistance = offset > 0 ? size : -size;
|
|
1123
|
+
await controls.start(
|
|
1124
|
+
isReducedMotion ? { opacity: 0 } : { [direction === "vertical" ? "y" : "x"]: exitDistance, opacity: 0 },
|
|
1125
|
+
springConfig
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
} else if (snapBack) {
|
|
1129
|
+
controls.start({ x: 0, y: 0 }, springConfig);
|
|
1130
|
+
}
|
|
1131
|
+
setSwipeProgress(0);
|
|
1132
|
+
};
|
|
1133
|
+
return /* @__PURE__ */ jsxs4("div", { ref: mergedRef, className, style: { position: "relative", ...style }, ...props, children: [
|
|
1134
|
+
renderBackground && swipeDirection && /* @__PURE__ */ jsx15("div", { style: { position: "absolute", inset: 0, zIndex: 0 }, children: renderBackground(swipeDirection, swipeProgress) }),
|
|
1135
|
+
/* @__PURE__ */ jsx15(
|
|
1136
|
+
motion13.div,
|
|
1137
|
+
{
|
|
1138
|
+
drag: dragProp,
|
|
1139
|
+
dragConstraints: { left: 0, right: 0, top: 0, bottom: 0 },
|
|
1140
|
+
dragElastic: rubberBand ? rubberBandFactor : 0,
|
|
1141
|
+
onDrag: handleDrag,
|
|
1142
|
+
onDragEnd: handleDragEnd,
|
|
1143
|
+
animate: controls,
|
|
1144
|
+
style: { zIndex: 1, position: "relative" },
|
|
1145
|
+
children
|
|
1146
|
+
}
|
|
1147
|
+
)
|
|
1148
|
+
] });
|
|
1149
|
+
}
|
|
1150
|
+
);
|
|
1151
|
+
Swipe.displayName = "Swipe";
|
|
1152
|
+
|
|
1153
|
+
// src/primitives/14-long-press.tsx
|
|
1154
|
+
import { forwardRef as forwardRef14, useRef as useRef5, useState as useState10 } from "react";
|
|
1155
|
+
import { motion as motion14, useAnimation as useAnimation2 } from "motion/react";
|
|
1156
|
+
import { jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1157
|
+
var LongPress = forwardRef14(
|
|
1158
|
+
({
|
|
1159
|
+
children,
|
|
1160
|
+
duration = 0.8,
|
|
1161
|
+
onLongPress,
|
|
1162
|
+
onPressStart,
|
|
1163
|
+
onPressEnd,
|
|
1164
|
+
feedback = "ring",
|
|
1165
|
+
feedbackColor = "currentColor",
|
|
1166
|
+
cancelOnMove = true,
|
|
1167
|
+
haptic = false,
|
|
1168
|
+
physics: physics2 = "smooth",
|
|
1169
|
+
className,
|
|
1170
|
+
style,
|
|
1171
|
+
disabled = false,
|
|
1172
|
+
...props
|
|
1173
|
+
}, ref) => {
|
|
1174
|
+
const isReducedMotion = useReducedMotion();
|
|
1175
|
+
const internalRef = useRef5(null);
|
|
1176
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1177
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1178
|
+
const controls = useAnimation2();
|
|
1179
|
+
const timerRef = useRef5(null);
|
|
1180
|
+
const [isPressed, setIsPressed] = useState10(false);
|
|
1181
|
+
if (disabled) {
|
|
1182
|
+
return /* @__PURE__ */ jsx16("div", { ref: mergedRef, className, style: { position: "relative", ...style }, ...props, children });
|
|
1183
|
+
}
|
|
1184
|
+
const handlePointerDown = () => {
|
|
1185
|
+
setIsPressed(true);
|
|
1186
|
+
onPressStart?.();
|
|
1187
|
+
if (feedback === "scale" && !isReducedMotion) {
|
|
1188
|
+
controls.start({ scale: 0.95 }, { duration });
|
|
1189
|
+
} else if (feedback === "ring" && !isReducedMotion) {
|
|
1190
|
+
controls.start({ strokeDashoffset: 0 }, { duration, ease: "linear" });
|
|
1191
|
+
} else if (feedback === "fill" && !isReducedMotion) {
|
|
1192
|
+
controls.start({ scaleX: 1 }, { duration, ease: "linear" });
|
|
1193
|
+
}
|
|
1194
|
+
timerRef.current = setTimeout(() => {
|
|
1195
|
+
setIsPressed(false);
|
|
1196
|
+
onLongPress?.();
|
|
1197
|
+
if (haptic && typeof navigator !== "undefined" && navigator.vibrate) {
|
|
1198
|
+
navigator.vibrate(50);
|
|
1199
|
+
}
|
|
1200
|
+
}, duration * 1e3);
|
|
1201
|
+
};
|
|
1202
|
+
const handlePointerUp = () => {
|
|
1203
|
+
if (timerRef.current) {
|
|
1204
|
+
clearTimeout(timerRef.current);
|
|
1205
|
+
timerRef.current = null;
|
|
1206
|
+
}
|
|
1207
|
+
setIsPressed(false);
|
|
1208
|
+
onPressEnd?.();
|
|
1209
|
+
if (!isReducedMotion) {
|
|
1210
|
+
if (feedback === "scale") controls.start({ scale: 1 }, springConfig);
|
|
1211
|
+
if (feedback === "ring") controls.start({ strokeDashoffset: 100 }, springConfig);
|
|
1212
|
+
if (feedback === "fill") controls.start({ scaleX: 0 }, springConfig);
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
return /* @__PURE__ */ jsxs5(
|
|
1216
|
+
"div",
|
|
1217
|
+
{
|
|
1218
|
+
ref: mergedRef,
|
|
1219
|
+
className,
|
|
1220
|
+
style: { position: "relative", userSelect: "none", ...style },
|
|
1221
|
+
onPointerDown: handlePointerDown,
|
|
1222
|
+
onPointerUp: handlePointerUp,
|
|
1223
|
+
onPointerLeave: handlePointerUp,
|
|
1224
|
+
onPointerMove: cancelOnMove ? () => {
|
|
1225
|
+
if (isPressed) handlePointerUp();
|
|
1226
|
+
} : void 0,
|
|
1227
|
+
...props,
|
|
1228
|
+
children: [
|
|
1229
|
+
/* @__PURE__ */ jsx16(motion14.div, { animate: controls, style: feedback === "scale" ? { originX: 0.5, originY: 0.5 } : {}, children }),
|
|
1230
|
+
feedback === "ring" && /* @__PURE__ */ jsx16("svg", { style: { position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none" }, children: /* @__PURE__ */ jsx16(
|
|
1231
|
+
motion14.rect,
|
|
1232
|
+
{
|
|
1233
|
+
width: "100%",
|
|
1234
|
+
height: "100%",
|
|
1235
|
+
fill: "none",
|
|
1236
|
+
stroke: feedbackColor,
|
|
1237
|
+
strokeWidth: "4",
|
|
1238
|
+
rx: "8",
|
|
1239
|
+
strokeDasharray: "100 100",
|
|
1240
|
+
initial: { strokeDashoffset: 100 },
|
|
1241
|
+
animate: controls
|
|
1242
|
+
}
|
|
1243
|
+
) }),
|
|
1244
|
+
feedback === "fill" && /* @__PURE__ */ jsx16(
|
|
1245
|
+
motion14.div,
|
|
1246
|
+
{
|
|
1247
|
+
style: {
|
|
1248
|
+
position: "absolute",
|
|
1249
|
+
inset: 0,
|
|
1250
|
+
backgroundColor: feedbackColor,
|
|
1251
|
+
opacity: 0.2,
|
|
1252
|
+
originX: 0,
|
|
1253
|
+
pointerEvents: "none"
|
|
1254
|
+
},
|
|
1255
|
+
initial: { scaleX: 0 },
|
|
1256
|
+
animate: controls
|
|
1257
|
+
}
|
|
1258
|
+
)
|
|
1259
|
+
]
|
|
1260
|
+
}
|
|
1261
|
+
);
|
|
1262
|
+
}
|
|
1263
|
+
);
|
|
1264
|
+
LongPress.displayName = "LongPress";
|
|
1265
|
+
|
|
1266
|
+
// src/primitives/15-hover-3d.tsx
|
|
1267
|
+
import React16, { createContext as createContext2, forwardRef as forwardRef15, useCallback as useCallback3, useContext as useContext2, useEffect as useEffect13, useRef as useRef6 } from "react";
|
|
1268
|
+
import { motion as motion15, useMotionValue as useMotionValue4, useSpring as useSpring4 } from "motion/react";
|
|
1269
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1270
|
+
var Hover3DContext = createContext2({
|
|
1271
|
+
mouseX: null,
|
|
1272
|
+
mouseY: null,
|
|
1273
|
+
maxMovement: 0,
|
|
1274
|
+
isReducedMotion: false
|
|
1275
|
+
});
|
|
1276
|
+
var Hover3DRoot = forwardRef15(
|
|
1277
|
+
({
|
|
1278
|
+
children,
|
|
1279
|
+
perspective = 1200,
|
|
1280
|
+
maxMovement = 20,
|
|
1281
|
+
layers,
|
|
1282
|
+
disableOnTouch = true,
|
|
1283
|
+
physics: physics2 = "snappy",
|
|
1284
|
+
className,
|
|
1285
|
+
style,
|
|
1286
|
+
disabled = false,
|
|
1287
|
+
...props
|
|
1288
|
+
}, ref) => {
|
|
1289
|
+
const isReducedMotion = useReducedMotion();
|
|
1290
|
+
const internalRef = useRef6(null);
|
|
1291
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1292
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1293
|
+
const [isTouchDevice, setIsTouchDevice] = React16.useState(false);
|
|
1294
|
+
useEffect13(() => setIsTouchDevice(window.matchMedia("(pointer: coarse)").matches), []);
|
|
1295
|
+
const x = useMotionValue4(0);
|
|
1296
|
+
const y = useMotionValue4(0);
|
|
1297
|
+
const mouseX = useSpring4(x, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1298
|
+
const mouseY = useSpring4(y, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1299
|
+
const handleMouseMove = useCallback3((e) => {
|
|
1300
|
+
if (disabled || isReducedMotion || disableOnTouch && isTouchDevice) return;
|
|
1301
|
+
if (!internalRef.current) return;
|
|
1302
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
1303
|
+
const centerX = rect.left + rect.width / 2;
|
|
1304
|
+
const centerY = rect.top + rect.height / 2;
|
|
1305
|
+
const offsetX = (e.clientX - centerX) / rect.width;
|
|
1306
|
+
const offsetY = (e.clientY - centerY) / rect.height;
|
|
1307
|
+
x.set(offsetX * 2);
|
|
1308
|
+
y.set(offsetY * 2);
|
|
1309
|
+
}, [x, y, disabled, isReducedMotion, disableOnTouch, isTouchDevice]);
|
|
1310
|
+
const handleMouseLeave = useCallback3(() => {
|
|
1311
|
+
x.set(0);
|
|
1312
|
+
y.set(0);
|
|
1313
|
+
}, [x, y]);
|
|
1314
|
+
if (disabled) {
|
|
1315
|
+
return /* @__PURE__ */ jsx17("div", { ref: mergedRef, className, style: { position: "relative", ...style }, ...props, children });
|
|
1316
|
+
}
|
|
1317
|
+
const childrenArray = React16.Children.toArray(children);
|
|
1318
|
+
const numLayers = layers || childrenArray.length;
|
|
1319
|
+
const renderedChildren = React16.Children.map(childrenArray, (child, index) => {
|
|
1320
|
+
if (!React16.isValidElement(child)) return child;
|
|
1321
|
+
if (child.type === Hover3DLayer || child.props && child.props.depth !== void 0) {
|
|
1322
|
+
const depth = child.props.depth ?? (numLayers > 1 ? index / (numLayers - 1) : 0);
|
|
1323
|
+
return React16.cloneElement(child, { depth });
|
|
1324
|
+
}
|
|
1325
|
+
return child;
|
|
1326
|
+
});
|
|
1327
|
+
return /* @__PURE__ */ jsx17(Hover3DContext.Provider, { value: { mouseX, mouseY, maxMovement, isReducedMotion }, children: /* @__PURE__ */ jsx17(
|
|
1328
|
+
"div",
|
|
1329
|
+
{
|
|
1330
|
+
ref: mergedRef,
|
|
1331
|
+
className,
|
|
1332
|
+
style: { perspective: `${perspective}px`, position: "relative", transformStyle: "preserve-3d", ...style },
|
|
1333
|
+
onMouseMove: handleMouseMove,
|
|
1334
|
+
onMouseLeave: handleMouseLeave,
|
|
1335
|
+
...props,
|
|
1336
|
+
children: renderedChildren
|
|
1337
|
+
}
|
|
1338
|
+
) });
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
Hover3DRoot.displayName = "Hover3D";
|
|
1342
|
+
var Hover3DLayer = forwardRef15(
|
|
1343
|
+
({ children, depth = 0, className, style, ...props }, ref) => {
|
|
1344
|
+
const { mouseX, mouseY, maxMovement, isReducedMotion } = useContext2(Hover3DContext);
|
|
1345
|
+
if (isReducedMotion || mouseX === null) {
|
|
1346
|
+
return /* @__PURE__ */ jsx17("div", { ref, className, style: { position: "absolute", inset: 0, ...style }, ...props, children });
|
|
1347
|
+
}
|
|
1348
|
+
return /* @__PURE__ */ jsx17(
|
|
1349
|
+
motion15.div,
|
|
1350
|
+
{
|
|
1351
|
+
ref,
|
|
1352
|
+
className,
|
|
1353
|
+
style: {
|
|
1354
|
+
position: "absolute",
|
|
1355
|
+
inset: 0,
|
|
1356
|
+
x: useMotionValue4(0),
|
|
1357
|
+
// Will be overridden by style calculation
|
|
1358
|
+
y: useMotionValue4(0),
|
|
1359
|
+
transformStyle: "preserve-3d",
|
|
1360
|
+
...style
|
|
1361
|
+
},
|
|
1362
|
+
...{
|
|
1363
|
+
style: {
|
|
1364
|
+
x: depth > 0 ? mouseX.get() * maxMovement * depth : 0,
|
|
1365
|
+
y: depth > 0 ? mouseY.get() * maxMovement * depth : 0,
|
|
1366
|
+
position: "absolute",
|
|
1367
|
+
inset: 0,
|
|
1368
|
+
...style
|
|
1369
|
+
}
|
|
1370
|
+
},
|
|
1371
|
+
...props,
|
|
1372
|
+
children
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
Hover3DLayer.displayName = "Hover3D.Layer";
|
|
1378
|
+
var Hover3D = Object.assign(Hover3DRoot, { Layer: Hover3DLayer });
|
|
1379
|
+
|
|
1380
|
+
// src/primitives/16-scroll-velocity.tsx
|
|
1381
|
+
import React17, { forwardRef as forwardRef16, useEffect as useEffect14, useRef as useRef7 } from "react";
|
|
1382
|
+
import { motion as motion16, useScroll as useScroll2, useVelocity, useSpring as useSpring5, useTransform as useTransform2 } from "motion/react";
|
|
1383
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1384
|
+
var ScrollVelocity = forwardRef16(
|
|
1385
|
+
({
|
|
1386
|
+
children,
|
|
1387
|
+
effect = "speed",
|
|
1388
|
+
sensitivity = 1,
|
|
1389
|
+
maxEffect,
|
|
1390
|
+
direction = "y",
|
|
1391
|
+
smoothing = 0.5,
|
|
1392
|
+
physics: physics2 = "smooth",
|
|
1393
|
+
className,
|
|
1394
|
+
style,
|
|
1395
|
+
disabled = false,
|
|
1396
|
+
...props
|
|
1397
|
+
}, ref) => {
|
|
1398
|
+
const isReducedMotion = useReducedMotion();
|
|
1399
|
+
const internalRef = useRef7(null);
|
|
1400
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1401
|
+
if (disabled || isReducedMotion) {
|
|
1402
|
+
return /* @__PURE__ */ jsx18("div", { ref: mergedRef, className, style, ...props, children: typeof children === "function" ? children(0) : children });
|
|
1403
|
+
}
|
|
1404
|
+
const { scrollY, scrollX } = useScroll2();
|
|
1405
|
+
const scrollValue = direction === "y" ? scrollY : scrollX;
|
|
1406
|
+
const velocity = useVelocity(scrollValue);
|
|
1407
|
+
const smoothedVelocity = useSpring5(velocity, {
|
|
1408
|
+
damping: 50,
|
|
1409
|
+
stiffness: 400
|
|
1410
|
+
});
|
|
1411
|
+
const maxEffectVal = maxEffect ?? (effect === "blur" ? 10 : effect === "stretch" ? 1.5 : effect === "skew" ? 15 : effect === "speed" ? 100 : 1);
|
|
1412
|
+
const filter = useTransform2(smoothedVelocity, (v) => {
|
|
1413
|
+
if (effect !== "blur") return "none";
|
|
1414
|
+
const val = Math.min(Math.abs(v) * sensitivity * 0.01, maxEffectVal);
|
|
1415
|
+
return `blur(${val}px)`;
|
|
1416
|
+
});
|
|
1417
|
+
const scaleY = useTransform2(smoothedVelocity, (v) => {
|
|
1418
|
+
if (effect !== "stretch") return 1;
|
|
1419
|
+
const val = Math.min(1 + Math.abs(v) * sensitivity * 1e-3, maxEffectVal);
|
|
1420
|
+
return val;
|
|
1421
|
+
});
|
|
1422
|
+
const skewY = useTransform2(smoothedVelocity, (v) => {
|
|
1423
|
+
if (effect !== "skew") return 0;
|
|
1424
|
+
const sign = Math.sign(v);
|
|
1425
|
+
const val = Math.min(Math.abs(v) * sensitivity * 0.1, maxEffectVal);
|
|
1426
|
+
return `${sign * val}deg`;
|
|
1427
|
+
});
|
|
1428
|
+
useEffect14(() => {
|
|
1429
|
+
if (effect === "speed" && internalRef.current) {
|
|
1430
|
+
return smoothedVelocity.on("change", (latest) => {
|
|
1431
|
+
if (internalRef.current) {
|
|
1432
|
+
internalRef.current.style.setProperty("--scroll-velocity", Math.min(Math.abs(latest * sensitivity), maxEffectVal).toString());
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
}, [effect, smoothedVelocity, sensitivity, maxEffectVal]);
|
|
1437
|
+
const [currentVelocity, setCurrentVelocity] = React17.useState(0);
|
|
1438
|
+
useEffect14(() => {
|
|
1439
|
+
if (typeof children === "function") {
|
|
1440
|
+
return smoothedVelocity.on("change", setCurrentVelocity);
|
|
1441
|
+
}
|
|
1442
|
+
}, [children, smoothedVelocity]);
|
|
1443
|
+
return /* @__PURE__ */ jsx18(
|
|
1444
|
+
motion16.div,
|
|
1445
|
+
{
|
|
1446
|
+
ref: mergedRef,
|
|
1447
|
+
className,
|
|
1448
|
+
style: {
|
|
1449
|
+
...style,
|
|
1450
|
+
filter,
|
|
1451
|
+
scaleY,
|
|
1452
|
+
transformOrigin: direction === "y" ? "center" : "left"
|
|
1453
|
+
// Framer doesn't cleanly map skewY string like this, using standard inline style is safer
|
|
1454
|
+
},
|
|
1455
|
+
animate: effect === "skew" ? { skewY: skewY.get() } : void 0,
|
|
1456
|
+
...props,
|
|
1457
|
+
children: typeof children === "function" ? children(currentVelocity) : children
|
|
1458
|
+
}
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
);
|
|
1462
|
+
ScrollVelocity.displayName = "ScrollVelocity";
|
|
1463
|
+
|
|
1464
|
+
// src/primitives/17-spotlight.tsx
|
|
1465
|
+
import React18, { forwardRef as forwardRef17, useCallback as useCallback4, useEffect as useEffect15, useRef as useRef8 } from "react";
|
|
1466
|
+
import { motion as motion17, useMotionValue as useMotionValue5, useSpring as useSpring6, useMotionTemplate as useMotionTemplate2 } from "motion/react";
|
|
1467
|
+
import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1468
|
+
var Spotlight = forwardRef17(
|
|
1469
|
+
({
|
|
1470
|
+
children,
|
|
1471
|
+
size = 200,
|
|
1472
|
+
color = "rgba(255,255,255,0.1)",
|
|
1473
|
+
borderColor,
|
|
1474
|
+
opacity = 0.15,
|
|
1475
|
+
blur = 40,
|
|
1476
|
+
mode = "glow",
|
|
1477
|
+
disableOnTouch = true,
|
|
1478
|
+
physics: physics2 = "snappy",
|
|
1479
|
+
className,
|
|
1480
|
+
style,
|
|
1481
|
+
disabled = false,
|
|
1482
|
+
...props
|
|
1483
|
+
}, ref) => {
|
|
1484
|
+
const isReducedMotion = useReducedMotion();
|
|
1485
|
+
const internalRef = useRef8(null);
|
|
1486
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1487
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1488
|
+
const [isTouchDevice, setIsTouchDevice] = React18.useState(false);
|
|
1489
|
+
useEffect15(() => setIsTouchDevice(window.matchMedia("(pointer: coarse)").matches), []);
|
|
1490
|
+
const mouseX = useMotionValue5(0);
|
|
1491
|
+
const mouseY = useMotionValue5(0);
|
|
1492
|
+
const x = useSpring6(mouseX, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1493
|
+
const y = useSpring6(mouseY, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1494
|
+
const handleMouseMove = useCallback4((e) => {
|
|
1495
|
+
if (disabled || isReducedMotion || disableOnTouch && isTouchDevice) return;
|
|
1496
|
+
if (!internalRef.current) return;
|
|
1497
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
1498
|
+
mouseX.set(e.clientX - rect.left);
|
|
1499
|
+
mouseY.set(e.clientY - rect.top);
|
|
1500
|
+
}, [mouseX, mouseY, disabled, isReducedMotion, disableOnTouch, isTouchDevice]);
|
|
1501
|
+
if (disabled || isReducedMotion) {
|
|
1502
|
+
return /* @__PURE__ */ jsx19("div", { ref: mergedRef, className, style: { position: "relative", ...style }, ...props, children });
|
|
1503
|
+
}
|
|
1504
|
+
const background = useMotionTemplate2`radial-gradient(${size}px circle at ${x}px ${y}px, ${color}, transparent 100%)`;
|
|
1505
|
+
const borderBackground = borderColor ? useMotionTemplate2`radial-gradient(${size}px circle at ${x}px ${y}px, ${borderColor}, transparent 100%)` : background;
|
|
1506
|
+
return /* @__PURE__ */ jsxs6(
|
|
1507
|
+
"div",
|
|
1508
|
+
{
|
|
1509
|
+
ref: mergedRef,
|
|
1510
|
+
className,
|
|
1511
|
+
style: { position: "relative", ...style },
|
|
1512
|
+
onMouseMove: handleMouseMove,
|
|
1513
|
+
...props,
|
|
1514
|
+
children: [
|
|
1515
|
+
mode === "border" && /* @__PURE__ */ jsx19(
|
|
1516
|
+
motion17.div,
|
|
1517
|
+
{
|
|
1518
|
+
style: {
|
|
1519
|
+
position: "absolute",
|
|
1520
|
+
inset: -1,
|
|
1521
|
+
// Adjust based on desired border width
|
|
1522
|
+
background: borderBackground,
|
|
1523
|
+
opacity,
|
|
1524
|
+
zIndex: 0,
|
|
1525
|
+
pointerEvents: "none",
|
|
1526
|
+
borderRadius: "inherit",
|
|
1527
|
+
maskImage: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
|
|
1528
|
+
maskComposite: "exclude"
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
),
|
|
1532
|
+
/* @__PURE__ */ jsx19("div", { style: { position: "relative", zIndex: 1 }, children }),
|
|
1533
|
+
(mode === "glow" || mode === "reveal") && /* @__PURE__ */ jsx19(
|
|
1534
|
+
motion17.div,
|
|
1535
|
+
{
|
|
1536
|
+
style: {
|
|
1537
|
+
position: "absolute",
|
|
1538
|
+
inset: 0,
|
|
1539
|
+
background,
|
|
1540
|
+
opacity,
|
|
1541
|
+
zIndex: 2,
|
|
1542
|
+
pointerEvents: "none",
|
|
1543
|
+
borderRadius: "inherit",
|
|
1544
|
+
mixBlendMode: mode === "reveal" ? "overlay" : "normal",
|
|
1545
|
+
filter: `blur(${blur}px)`
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
)
|
|
1549
|
+
]
|
|
1550
|
+
}
|
|
1551
|
+
);
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1554
|
+
Spotlight.displayName = "Spotlight";
|
|
1555
|
+
|
|
1556
|
+
// src/primitives/18-follow-cursor.tsx
|
|
1557
|
+
import React19, { forwardRef as forwardRef18, useCallback as useCallback5, useEffect as useEffect16, useState as useState11 } from "react";
|
|
1558
|
+
import { motion as motion18, useMotionValue as useMotionValue6, useSpring as useSpring7 } from "motion/react";
|
|
1559
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1560
|
+
var FollowCursor = forwardRef18(
|
|
1561
|
+
({
|
|
1562
|
+
children,
|
|
1563
|
+
offset = { x: 16, y: 16 },
|
|
1564
|
+
lag = 0.2,
|
|
1565
|
+
rotate = false,
|
|
1566
|
+
hideOnLeave = true,
|
|
1567
|
+
containTo = "parent",
|
|
1568
|
+
visible = true,
|
|
1569
|
+
physics: physics2 = "smooth",
|
|
1570
|
+
className,
|
|
1571
|
+
style,
|
|
1572
|
+
asChild = false,
|
|
1573
|
+
disabled = false,
|
|
1574
|
+
...props
|
|
1575
|
+
}, ref) => {
|
|
1576
|
+
const isReducedMotion = useReducedMotion();
|
|
1577
|
+
const internalRef = React19.useRef(null);
|
|
1578
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1579
|
+
const customPhysics = {
|
|
1580
|
+
type: "spring",
|
|
1581
|
+
stiffness: 400 * (1 - lag),
|
|
1582
|
+
damping: 30 * (1 - lag)
|
|
1583
|
+
};
|
|
1584
|
+
const springConfig = resolveMotion(void 0, customPhysics, isReducedMotion);
|
|
1585
|
+
const x = useMotionValue6(0);
|
|
1586
|
+
const y = useMotionValue6(0);
|
|
1587
|
+
const r = useMotionValue6(0);
|
|
1588
|
+
const smoothX = useSpring7(x, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1589
|
+
const smoothY = useSpring7(y, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1590
|
+
const smoothR = useSpring7(r, isReducedMotion ? { duration: 0 } : springConfig);
|
|
1591
|
+
const [isVisible, setIsVisible] = useState11(visible && !hideOnLeave);
|
|
1592
|
+
const updatePosition = useCallback5((clientX, clientY) => {
|
|
1593
|
+
let posX = clientX + offset.x;
|
|
1594
|
+
let posY = clientY + offset.y;
|
|
1595
|
+
if (containTo === "parent" && internalRef.current?.parentElement) {
|
|
1596
|
+
const parentRect = internalRef.current.parentElement.getBoundingClientRect();
|
|
1597
|
+
posX = clientX - parentRect.left + offset.x;
|
|
1598
|
+
posY = clientY - parentRect.top + offset.y;
|
|
1599
|
+
}
|
|
1600
|
+
if (rotate) {
|
|
1601
|
+
const dx = posX - x.get();
|
|
1602
|
+
const dy = posY - y.get();
|
|
1603
|
+
if (dx !== 0 || dy !== 0) {
|
|
1604
|
+
const angle = Math.atan2(dy, dx) * (180 / Math.PI);
|
|
1605
|
+
r.set(angle);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
x.set(posX);
|
|
1609
|
+
y.set(posY);
|
|
1610
|
+
}, [x, y, r, rotate, offset, containTo]);
|
|
1611
|
+
useEffect16(() => {
|
|
1612
|
+
if (disabled || isReducedMotion) return;
|
|
1613
|
+
const target = containTo === "viewport" ? window : internalRef.current?.parentElement || window;
|
|
1614
|
+
const handleMouseMove = (e) => {
|
|
1615
|
+
updatePosition(e.clientX, e.clientY);
|
|
1616
|
+
if (hideOnLeave && !isVisible) setIsVisible(visible);
|
|
1617
|
+
};
|
|
1618
|
+
const handleMouseEnter = () => {
|
|
1619
|
+
if (hideOnLeave) setIsVisible(visible);
|
|
1620
|
+
};
|
|
1621
|
+
const handleMouseLeave = () => {
|
|
1622
|
+
if (hideOnLeave) setIsVisible(false);
|
|
1623
|
+
};
|
|
1624
|
+
target.addEventListener("mousemove", handleMouseMove);
|
|
1625
|
+
target.addEventListener("mouseenter", handleMouseEnter);
|
|
1626
|
+
target.addEventListener("mouseleave", handleMouseLeave);
|
|
1627
|
+
return () => {
|
|
1628
|
+
target.removeEventListener("mousemove", handleMouseMove);
|
|
1629
|
+
target.removeEventListener("mouseenter", handleMouseEnter);
|
|
1630
|
+
target.removeEventListener("mouseleave", handleMouseLeave);
|
|
1631
|
+
};
|
|
1632
|
+
}, [disabled, isReducedMotion, containTo, updatePosition, hideOnLeave, visible, isVisible]);
|
|
1633
|
+
useEffect16(() => {
|
|
1634
|
+
setIsVisible(visible);
|
|
1635
|
+
}, [visible]);
|
|
1636
|
+
if (disabled) {
|
|
1637
|
+
if (asChild) return /* @__PURE__ */ jsx20(Slot, { ref: mergedRef, className, style, ...props, children });
|
|
1638
|
+
return /* @__PURE__ */ jsx20("div", { ref: mergedRef, className, style, ...props, children });
|
|
1639
|
+
}
|
|
1640
|
+
const MotionComponent = asChild ? motion18.create(Slot) : motion18.div;
|
|
1641
|
+
const positionStyle = containTo === "viewport" ? "fixed" : "absolute";
|
|
1642
|
+
return /* @__PURE__ */ jsx20(
|
|
1643
|
+
MotionComponent,
|
|
1644
|
+
{
|
|
1645
|
+
ref: mergedRef,
|
|
1646
|
+
className,
|
|
1647
|
+
style: {
|
|
1648
|
+
position: positionStyle,
|
|
1649
|
+
top: 0,
|
|
1650
|
+
left: 0,
|
|
1651
|
+
x: smoothX,
|
|
1652
|
+
y: smoothY,
|
|
1653
|
+
rotate: smoothR,
|
|
1654
|
+
opacity: isVisible ? 1 : 0,
|
|
1655
|
+
pointerEvents: "none",
|
|
1656
|
+
// Cursor followers typically shouldn't block events
|
|
1657
|
+
zIndex: 50,
|
|
1658
|
+
// Usually want cursor follow to be high up
|
|
1659
|
+
...style
|
|
1660
|
+
},
|
|
1661
|
+
animate: { opacity: isVisible ? 1 : 0 },
|
|
1662
|
+
transition: { opacity: { duration: 0.2 } },
|
|
1663
|
+
...props,
|
|
1664
|
+
children
|
|
1665
|
+
}
|
|
1666
|
+
);
|
|
1667
|
+
}
|
|
1668
|
+
);
|
|
1669
|
+
FollowCursor.displayName = "FollowCursor";
|
|
1670
|
+
|
|
1671
|
+
// src/primitives/19-morph.tsx
|
|
1672
|
+
import React20, { forwardRef as forwardRef19 } from "react";
|
|
1673
|
+
import { motion as motion19 } from "motion/react";
|
|
1674
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1675
|
+
var Morph = forwardRef19(
|
|
1676
|
+
({
|
|
1677
|
+
children,
|
|
1678
|
+
layoutId,
|
|
1679
|
+
tag: Tag = "div",
|
|
1680
|
+
mode = "both",
|
|
1681
|
+
physics: physics2 = "smooth",
|
|
1682
|
+
className,
|
|
1683
|
+
style,
|
|
1684
|
+
asChild = false,
|
|
1685
|
+
disabled = false,
|
|
1686
|
+
...props
|
|
1687
|
+
}, ref) => {
|
|
1688
|
+
const isReducedMotion = useReducedMotion();
|
|
1689
|
+
const internalRef = React20.useRef(null);
|
|
1690
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1691
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1692
|
+
if (disabled || isReducedMotion) {
|
|
1693
|
+
if (asChild) return /* @__PURE__ */ jsx21(Slot, { ref: mergedRef, className, style, ...props, children });
|
|
1694
|
+
const Comp = Tag;
|
|
1695
|
+
return /* @__PURE__ */ jsx21(Comp, { ref: mergedRef, className, style, ...props, children });
|
|
1696
|
+
}
|
|
1697
|
+
const layoutProp = mode === "both" ? true : mode;
|
|
1698
|
+
const MotionComponent = asChild ? motion19.create(Slot) : Tag ? motion19(Tag) : motion19.div;
|
|
1699
|
+
return /* @__PURE__ */ jsx21(
|
|
1700
|
+
MotionComponent,
|
|
1701
|
+
{
|
|
1702
|
+
ref: mergedRef,
|
|
1703
|
+
layoutId,
|
|
1704
|
+
layout: layoutProp,
|
|
1705
|
+
transition: springConfig,
|
|
1706
|
+
className,
|
|
1707
|
+
style,
|
|
1708
|
+
...props,
|
|
1709
|
+
children
|
|
1710
|
+
}
|
|
1711
|
+
);
|
|
1712
|
+
}
|
|
1713
|
+
);
|
|
1714
|
+
Morph.displayName = "Morph";
|
|
1715
|
+
|
|
1716
|
+
// src/primitives/20-fluid-layout.tsx
|
|
1717
|
+
import { forwardRef as forwardRef20, useRef as useRef9 } from "react";
|
|
1718
|
+
import { motion as motion20 } from "motion/react";
|
|
1719
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1720
|
+
var FluidLayout = forwardRef20(
|
|
1721
|
+
({
|
|
1722
|
+
children,
|
|
1723
|
+
axis = "both",
|
|
1724
|
+
overflow = "hidden",
|
|
1725
|
+
tag: Tag = "div",
|
|
1726
|
+
debounce = 0,
|
|
1727
|
+
physics: physics2 = "smooth",
|
|
1728
|
+
className,
|
|
1729
|
+
style,
|
|
1730
|
+
disabled = false,
|
|
1731
|
+
...props
|
|
1732
|
+
}, ref) => {
|
|
1733
|
+
const isReducedMotion = useReducedMotion();
|
|
1734
|
+
const internalRef = useRef9(null);
|
|
1735
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1736
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1737
|
+
if (disabled || isReducedMotion) {
|
|
1738
|
+
const Comp = Tag;
|
|
1739
|
+
return /* @__PURE__ */ jsx22(Comp, { ref: mergedRef, className, style: { ...style, overflow: overflow === "hidden" ? "hidden" : "visible" }, ...props, children });
|
|
1740
|
+
}
|
|
1741
|
+
const layoutProp = axis === "both" ? true : axis === "width" ? "position" : "size";
|
|
1742
|
+
const MotionComponent = motion20[Tag];
|
|
1743
|
+
return /* @__PURE__ */ jsx22(
|
|
1744
|
+
MotionComponent,
|
|
1745
|
+
{
|
|
1746
|
+
ref: mergedRef,
|
|
1747
|
+
layout: layoutProp,
|
|
1748
|
+
transition: springConfig,
|
|
1749
|
+
className,
|
|
1750
|
+
style: { ...style, overflow },
|
|
1751
|
+
...props,
|
|
1752
|
+
children
|
|
1753
|
+
}
|
|
1754
|
+
);
|
|
1755
|
+
}
|
|
1756
|
+
);
|
|
1757
|
+
FluidLayout.displayName = "FluidLayout";
|
|
1758
|
+
|
|
1759
|
+
// src/primitives/21-reorder.tsx
|
|
1760
|
+
import React22, { forwardRef as forwardRef21 } from "react";
|
|
1761
|
+
import { Reorder as MotionReorder, useDragControls } from "motion/react";
|
|
1762
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1763
|
+
function ReorderComponent({
|
|
1764
|
+
items,
|
|
1765
|
+
onReorder,
|
|
1766
|
+
axis = "y",
|
|
1767
|
+
gap = 8,
|
|
1768
|
+
renderItem,
|
|
1769
|
+
dragHandle = false,
|
|
1770
|
+
physics: physics2 = "bouncy",
|
|
1771
|
+
className,
|
|
1772
|
+
style,
|
|
1773
|
+
disabled = false
|
|
1774
|
+
}, ref) {
|
|
1775
|
+
const isReducedMotion = useReducedMotion();
|
|
1776
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1777
|
+
if (disabled) {
|
|
1778
|
+
return /* @__PURE__ */ jsx23("ul", { ref, className, style: { display: "flex", flexDirection: axis === "x" ? "row" : "column", gap, ...style }, children: items.map((item, index) => /* @__PURE__ */ jsx23("li", { style: { listStyle: "none" }, children: renderItem(item, index, false) }, item.id)) });
|
|
1779
|
+
}
|
|
1780
|
+
return /* @__PURE__ */ jsx23(
|
|
1781
|
+
MotionReorder.Group,
|
|
1782
|
+
{
|
|
1783
|
+
ref,
|
|
1784
|
+
axis,
|
|
1785
|
+
values: items,
|
|
1786
|
+
onReorder,
|
|
1787
|
+
className,
|
|
1788
|
+
style: { display: "flex", flexDirection: axis === "x" ? "row" : "column", gap, listStyle: "none", ...style },
|
|
1789
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx23(
|
|
1790
|
+
ReorderItem,
|
|
1791
|
+
{
|
|
1792
|
+
item,
|
|
1793
|
+
index,
|
|
1794
|
+
renderItem,
|
|
1795
|
+
dragHandle,
|
|
1796
|
+
springConfig
|
|
1797
|
+
},
|
|
1798
|
+
item.id
|
|
1799
|
+
))
|
|
1800
|
+
}
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
var ReorderItem = ({ item, index, renderItem, dragHandle, springConfig }) => {
|
|
1804
|
+
const [isDragging, setIsDragging] = React22.useState(false);
|
|
1805
|
+
const controls = useDragControls();
|
|
1806
|
+
return /* @__PURE__ */ jsx23(
|
|
1807
|
+
MotionReorder.Item,
|
|
1808
|
+
{
|
|
1809
|
+
value: item,
|
|
1810
|
+
onDragStart: () => setIsDragging(true),
|
|
1811
|
+
onDragEnd: () => setIsDragging(false),
|
|
1812
|
+
dragListener: !dragHandle,
|
|
1813
|
+
dragControls: controls,
|
|
1814
|
+
layout: true,
|
|
1815
|
+
transition: springConfig,
|
|
1816
|
+
style: { position: "relative" },
|
|
1817
|
+
children: dragHandle ? /* @__PURE__ */ jsx23(ReorderContext.Provider, { value: controls, children: renderItem(item, index, isDragging) }) : renderItem(item, index, isDragging)
|
|
1818
|
+
}
|
|
1819
|
+
);
|
|
1820
|
+
};
|
|
1821
|
+
var ReorderContext = React22.createContext(null);
|
|
1822
|
+
function ReorderDragHandle({ children, className, style }) {
|
|
1823
|
+
const controls = React22.useContext(ReorderContext);
|
|
1824
|
+
return /* @__PURE__ */ jsx23(
|
|
1825
|
+
"div",
|
|
1826
|
+
{
|
|
1827
|
+
onPointerDown: (e) => controls?.start(e),
|
|
1828
|
+
style: { cursor: "grab", touchAction: "none", ...style },
|
|
1829
|
+
className,
|
|
1830
|
+
children
|
|
1831
|
+
}
|
|
1832
|
+
);
|
|
1833
|
+
}
|
|
1834
|
+
var Reorder = forwardRef21(ReorderComponent);
|
|
1835
|
+
Reorder.Handle = ReorderDragHandle;
|
|
1836
|
+
|
|
1837
|
+
// src/primitives/22-page-transition.tsx
|
|
1838
|
+
import React23, { forwardRef as forwardRef22 } from "react";
|
|
1839
|
+
import { motion as motion21, AnimatePresence as AnimatePresence3 } from "motion/react";
|
|
1840
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1841
|
+
var PageTransition = forwardRef22(
|
|
1842
|
+
({
|
|
1843
|
+
children,
|
|
1844
|
+
mode = "fade",
|
|
1845
|
+
direction = "auto",
|
|
1846
|
+
physics: physics2 = "smooth",
|
|
1847
|
+
exitBeforeEnter = true,
|
|
1848
|
+
onTransitionStart,
|
|
1849
|
+
onTransitionComplete,
|
|
1850
|
+
className,
|
|
1851
|
+
style,
|
|
1852
|
+
layoutId,
|
|
1853
|
+
disabled = false,
|
|
1854
|
+
...props
|
|
1855
|
+
}, ref) => {
|
|
1856
|
+
const isReducedMotion = useReducedMotion();
|
|
1857
|
+
const internalRef = React23.useRef(null);
|
|
1858
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1859
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1860
|
+
if (disabled || isReducedMotion || mode === "none") {
|
|
1861
|
+
return /* @__PURE__ */ jsx24("div", { ref: mergedRef, className, style, ...props, children });
|
|
1862
|
+
}
|
|
1863
|
+
const getVariants = () => {
|
|
1864
|
+
const distance = 40;
|
|
1865
|
+
switch (mode) {
|
|
1866
|
+
case "fade":
|
|
1867
|
+
case "crossfade":
|
|
1868
|
+
return {
|
|
1869
|
+
initial: { opacity: 0 },
|
|
1870
|
+
animate: { opacity: 1 },
|
|
1871
|
+
exit: { opacity: 0 }
|
|
1872
|
+
};
|
|
1873
|
+
case "slide":
|
|
1874
|
+
const xOffset = direction === "left" ? distance : direction === "right" ? -distance : 0;
|
|
1875
|
+
const yOffset = direction === "up" ? distance : direction === "down" ? -distance : direction === "auto" ? distance : 0;
|
|
1876
|
+
return {
|
|
1877
|
+
initial: { opacity: 0, x: xOffset, y: yOffset },
|
|
1878
|
+
animate: { opacity: 1, x: 0, y: 0 },
|
|
1879
|
+
exit: { opacity: 0, x: -xOffset, y: -yOffset }
|
|
1880
|
+
};
|
|
1881
|
+
case "morph":
|
|
1882
|
+
return {
|
|
1883
|
+
initial: { opacity: 0 },
|
|
1884
|
+
animate: { opacity: 1 },
|
|
1885
|
+
exit: { opacity: 0 }
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
return /* @__PURE__ */ jsx24(AnimatePresence3, { mode: exitBeforeEnter ? "wait" : "popLayout", onExitComplete: onTransitionComplete, children: /* @__PURE__ */ jsx24(
|
|
1890
|
+
motion21.div,
|
|
1891
|
+
{
|
|
1892
|
+
ref: mergedRef,
|
|
1893
|
+
variants: getVariants(),
|
|
1894
|
+
initial: "initial",
|
|
1895
|
+
animate: "animate",
|
|
1896
|
+
exit: "exit",
|
|
1897
|
+
transition: springConfig,
|
|
1898
|
+
onAnimationStart: onTransitionStart,
|
|
1899
|
+
className,
|
|
1900
|
+
style,
|
|
1901
|
+
...props,
|
|
1902
|
+
children
|
|
1903
|
+
},
|
|
1904
|
+
layoutId || (React23.isValidElement(children) ? children.key : "page")
|
|
1905
|
+
) });
|
|
1906
|
+
}
|
|
1907
|
+
);
|
|
1908
|
+
PageTransition.displayName = "PageTransition";
|
|
1909
|
+
|
|
1910
|
+
// src/primitives/23-animated-list.tsx
|
|
1911
|
+
import React24, { forwardRef as forwardRef23, useEffect as useEffect17, useState as useState12 } from "react";
|
|
1912
|
+
import { motion as motion22, AnimatePresence as AnimatePresence4 } from "motion/react";
|
|
1913
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1914
|
+
function AnimatedListComponent({
|
|
1915
|
+
items,
|
|
1916
|
+
keyExtractor,
|
|
1917
|
+
renderItem,
|
|
1918
|
+
enterFrom = "below",
|
|
1919
|
+
enterDistance = motionScale.distance.md,
|
|
1920
|
+
stagger = motionScale.stagger.fast,
|
|
1921
|
+
layout = true,
|
|
1922
|
+
maxRendered = Infinity,
|
|
1923
|
+
reversed = false,
|
|
1924
|
+
physics: physics2 = "gentle",
|
|
1925
|
+
className,
|
|
1926
|
+
style,
|
|
1927
|
+
disabled = false
|
|
1928
|
+
}, ref) {
|
|
1929
|
+
const isReducedMotion = useReducedMotion();
|
|
1930
|
+
const internalRef = React24.useRef(null);
|
|
1931
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
1932
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
1933
|
+
const [hasMounted, setHasMounted] = useState12(false);
|
|
1934
|
+
useEffect17(() => setHasMounted(true), []);
|
|
1935
|
+
if (disabled) {
|
|
1936
|
+
const renderedItems2 = reversed ? [...items].reverse() : items;
|
|
1937
|
+
return /* @__PURE__ */ jsx25("ul", { ref: mergedRef, className, style: { display: "flex", flexDirection: "column", gap: 8, ...style }, children: renderedItems2.slice(0, maxRendered).map((item, index) => /* @__PURE__ */ jsx25("li", { style: { listStyle: "none" }, children: renderItem(item, index) }, keyExtractor(item))) });
|
|
1938
|
+
}
|
|
1939
|
+
const getVariant = (direction) => {
|
|
1940
|
+
switch (direction) {
|
|
1941
|
+
case "below":
|
|
1942
|
+
return { y: enterDistance, opacity: 0 };
|
|
1943
|
+
case "above":
|
|
1944
|
+
return { y: -enterDistance, opacity: 0 };
|
|
1945
|
+
case "left":
|
|
1946
|
+
return { x: -enterDistance, opacity: 0 };
|
|
1947
|
+
case "right":
|
|
1948
|
+
return { x: enterDistance, opacity: 0 };
|
|
1949
|
+
case "scale":
|
|
1950
|
+
return { scale: 0.8, opacity: 0 };
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
const initialVariant = getVariant(enterFrom);
|
|
1954
|
+
const renderedItems = reversed ? [...items].reverse() : items;
|
|
1955
|
+
const visibleItems = renderedItems.slice(0, maxRendered);
|
|
1956
|
+
return /* @__PURE__ */ jsx25(
|
|
1957
|
+
motion22.ul,
|
|
1958
|
+
{
|
|
1959
|
+
ref: mergedRef,
|
|
1960
|
+
className,
|
|
1961
|
+
style: { display: "flex", flexDirection: "column", listStyle: "none", margin: 0, padding: 0, ...style },
|
|
1962
|
+
children: /* @__PURE__ */ jsx25(AnimatePresence4, { mode: "popLayout", initial: false, children: visibleItems.map((item, i) => {
|
|
1963
|
+
const key = keyExtractor(item);
|
|
1964
|
+
return /* @__PURE__ */ jsx25(
|
|
1965
|
+
motion22.li,
|
|
1966
|
+
{
|
|
1967
|
+
layout: layout && !isReducedMotion,
|
|
1968
|
+
initial: isReducedMotion ? { opacity: 0 } : initialVariant,
|
|
1969
|
+
animate: { opacity: 1, x: 0, y: 0, scale: 1 },
|
|
1970
|
+
exit: isReducedMotion ? { opacity: 0 } : { ...initialVariant, opacity: 0, transition: { duration: 0.2 } },
|
|
1971
|
+
transition: {
|
|
1972
|
+
...springConfig,
|
|
1973
|
+
delay: isReducedMotion || hasMounted ? 0 : i * stagger
|
|
1974
|
+
},
|
|
1975
|
+
children: renderItem(item, i)
|
|
1976
|
+
},
|
|
1977
|
+
key
|
|
1978
|
+
);
|
|
1979
|
+
}) })
|
|
1980
|
+
}
|
|
1981
|
+
);
|
|
1982
|
+
}
|
|
1983
|
+
var AnimatedList = forwardRef23(AnimatedListComponent);
|
|
1984
|
+
|
|
1985
|
+
// src/primitives/24-marquee.tsx
|
|
1986
|
+
import { forwardRef as forwardRef24, useEffect as useEffect18, useRef as useRef10, useState as useState13 } from "react";
|
|
1987
|
+
import { jsx as jsx26, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1988
|
+
var Marquee = forwardRef24(
|
|
1989
|
+
({
|
|
1990
|
+
children,
|
|
1991
|
+
speed = 50,
|
|
1992
|
+
direction = "left",
|
|
1993
|
+
pauseOnHover = true,
|
|
1994
|
+
gap = 16,
|
|
1995
|
+
gradientWidth = 40,
|
|
1996
|
+
gradientColor = "var(--bg, white)",
|
|
1997
|
+
reverse = false,
|
|
1998
|
+
speedOnHover,
|
|
1999
|
+
className,
|
|
2000
|
+
style,
|
|
2001
|
+
disabled = false,
|
|
2002
|
+
...props
|
|
2003
|
+
}, ref) => {
|
|
2004
|
+
const isReducedMotion = useReducedMotion();
|
|
2005
|
+
const internalRef = useRef10(null);
|
|
2006
|
+
const containerRef = useRef10(null);
|
|
2007
|
+
const contentRef = useRef10(null);
|
|
2008
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2009
|
+
const [contentSize, setContentSize] = useState13(0);
|
|
2010
|
+
const [containerSize, setContainerSize] = useState13(0);
|
|
2011
|
+
const isHorizontal = direction === "left" || direction === "right";
|
|
2012
|
+
const dirFactor = direction === "left" || direction === "up" ? -1 : 1;
|
|
2013
|
+
const revFactor = reverse ? -1 : 1;
|
|
2014
|
+
const calcDir = dirFactor * revFactor;
|
|
2015
|
+
useEffect18(() => {
|
|
2016
|
+
if (disabled || isReducedMotion) return;
|
|
2017
|
+
const observer = new ResizeObserver((entries) => {
|
|
2018
|
+
for (const entry of entries) {
|
|
2019
|
+
if (entry.target === containerRef.current) {
|
|
2020
|
+
setContainerSize(isHorizontal ? entry.contentRect.width : entry.contentRect.height);
|
|
2021
|
+
} else if (entry.target === contentRef.current) {
|
|
2022
|
+
setContentSize(isHorizontal ? entry.contentRect.width : entry.contentRect.height);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
if (containerRef.current) observer.observe(containerRef.current);
|
|
2027
|
+
if (contentRef.current) observer.observe(contentRef.current);
|
|
2028
|
+
return () => observer.disconnect();
|
|
2029
|
+
}, [isHorizontal, disabled, isReducedMotion]);
|
|
2030
|
+
if (disabled || isReducedMotion) {
|
|
2031
|
+
return /* @__PURE__ */ jsx26("div", { ref: mergedRef, className, style: { display: "flex", flexWrap: "wrap", gap, ...style }, ...props, children });
|
|
2032
|
+
}
|
|
2033
|
+
const repeatCount = Math.max(2, Math.ceil(containerSize * 2 / (contentSize + gap)) || 2);
|
|
2034
|
+
const duration = (contentSize + gap) / speed;
|
|
2035
|
+
const keyframesName = `flux-marquee-${calcDir < 0 ? "negative" : "positive"}-${isHorizontal ? "x" : "y"}`;
|
|
2036
|
+
const translateProp = isHorizontal ? "translateX" : "translateY";
|
|
2037
|
+
const cssString = `
|
|
2038
|
+
@keyframes ${keyframesName} {
|
|
2039
|
+
0% { transform: ${translateProp}(${calcDir < 0 ? "0" : `-${contentSize + gap}px`}); }
|
|
2040
|
+
100% { transform: ${translateProp}(${calcDir < 0 ? `-${contentSize + gap}px` : "0"}); }
|
|
2041
|
+
}
|
|
2042
|
+
`;
|
|
2043
|
+
const gradientMask = gradientWidth > 0 && isHorizontal ? `linear-gradient(to right, transparent, black ${gradientWidth}px, black calc(100% - ${gradientWidth}px), transparent)` : gradientWidth > 0 && !isHorizontal ? `linear-gradient(to bottom, transparent, black ${gradientWidth}px, black calc(100% - ${gradientWidth}px), transparent)` : void 0;
|
|
2044
|
+
return /* @__PURE__ */ jsxs7(
|
|
2045
|
+
"div",
|
|
2046
|
+
{
|
|
2047
|
+
ref: mergedRef,
|
|
2048
|
+
className,
|
|
2049
|
+
style: {
|
|
2050
|
+
...style,
|
|
2051
|
+
overflow: "hidden",
|
|
2052
|
+
display: "flex",
|
|
2053
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
2054
|
+
maskImage: gradientMask,
|
|
2055
|
+
WebkitMaskImage: gradientMask
|
|
2056
|
+
},
|
|
2057
|
+
...props,
|
|
2058
|
+
children: [
|
|
2059
|
+
/* @__PURE__ */ jsx26("style", { children: cssString }),
|
|
2060
|
+
/* @__PURE__ */ jsx26(
|
|
2061
|
+
"div",
|
|
2062
|
+
{
|
|
2063
|
+
ref: containerRef,
|
|
2064
|
+
style: {
|
|
2065
|
+
display: "flex",
|
|
2066
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
2067
|
+
gap,
|
|
2068
|
+
width: isHorizontal ? "fit-content" : "100%",
|
|
2069
|
+
height: isHorizontal ? "100%" : "fit-content",
|
|
2070
|
+
animation: `${keyframesName} ${duration}s linear infinite`,
|
|
2071
|
+
animationPlayState: "inherit"
|
|
2072
|
+
},
|
|
2073
|
+
onMouseEnter: (e) => {
|
|
2074
|
+
if (pauseOnHover) e.currentTarget.style.animationPlayState = "paused";
|
|
2075
|
+
else if (speedOnHover) e.currentTarget.style.animationDuration = `${(contentSize + gap) / speedOnHover}s`;
|
|
2076
|
+
},
|
|
2077
|
+
onMouseLeave: (e) => {
|
|
2078
|
+
if (pauseOnHover) e.currentTarget.style.animationPlayState = "running";
|
|
2079
|
+
else if (speedOnHover) e.currentTarget.style.animationDuration = `${duration}s`;
|
|
2080
|
+
},
|
|
2081
|
+
children: Array.from({ length: repeatCount }).map((_, i) => /* @__PURE__ */ jsx26(
|
|
2082
|
+
"div",
|
|
2083
|
+
{
|
|
2084
|
+
ref: i === 0 ? contentRef : null,
|
|
2085
|
+
style: {
|
|
2086
|
+
display: "flex",
|
|
2087
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
2088
|
+
gap,
|
|
2089
|
+
flexShrink: 0
|
|
2090
|
+
},
|
|
2091
|
+
children
|
|
2092
|
+
},
|
|
2093
|
+
i
|
|
2094
|
+
))
|
|
2095
|
+
}
|
|
2096
|
+
)
|
|
2097
|
+
]
|
|
2098
|
+
}
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
);
|
|
2102
|
+
Marquee.displayName = "Marquee";
|
|
2103
|
+
|
|
2104
|
+
// src/primitives/25-dock.tsx
|
|
2105
|
+
import React26, { forwardRef as forwardRef25, useRef as useRef11 } from "react";
|
|
2106
|
+
import { motion as motion23, useMotionValue as useMotionValue7, useSpring as useSpring8, useTransform as useTransform3 } from "motion/react";
|
|
2107
|
+
import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2108
|
+
var DockContext = React26.createContext({
|
|
2109
|
+
mouseX: null,
|
|
2110
|
+
mouseY: null,
|
|
2111
|
+
distance: 150,
|
|
2112
|
+
magnification: 1.6,
|
|
2113
|
+
direction: "horizontal",
|
|
2114
|
+
isReducedMotion: false
|
|
2115
|
+
});
|
|
2116
|
+
var DockRoot = forwardRef25(
|
|
2117
|
+
({
|
|
2118
|
+
children,
|
|
2119
|
+
magnification = 1.6,
|
|
2120
|
+
distance = 150,
|
|
2121
|
+
direction = "horizontal",
|
|
2122
|
+
gap = 8,
|
|
2123
|
+
baseSize = 48,
|
|
2124
|
+
physics: physics2 = "bouncy",
|
|
2125
|
+
className,
|
|
2126
|
+
style,
|
|
2127
|
+
disabled = false,
|
|
2128
|
+
...props
|
|
2129
|
+
}, ref) => {
|
|
2130
|
+
const isReducedMotion = useReducedMotion();
|
|
2131
|
+
const internalRef = useRef11(null);
|
|
2132
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2133
|
+
const mouseX = useMotionValue7(Infinity);
|
|
2134
|
+
const mouseY = useMotionValue7(Infinity);
|
|
2135
|
+
if (disabled || isReducedMotion) {
|
|
2136
|
+
return /* @__PURE__ */ jsx27("div", { ref: mergedRef, className, style: { display: "flex", flexDirection: direction === "horizontal" ? "row" : "column", gap, ...style }, ...props, children });
|
|
2137
|
+
}
|
|
2138
|
+
return /* @__PURE__ */ jsx27(DockContext.Provider, { value: { mouseX, mouseY, distance, magnification, direction, isReducedMotion: false }, children: /* @__PURE__ */ jsx27(
|
|
2139
|
+
motion23.div,
|
|
2140
|
+
{
|
|
2141
|
+
ref: mergedRef,
|
|
2142
|
+
className,
|
|
2143
|
+
style: {
|
|
2144
|
+
display: "flex",
|
|
2145
|
+
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
2146
|
+
gap,
|
|
2147
|
+
alignItems: "center",
|
|
2148
|
+
...style
|
|
2149
|
+
},
|
|
2150
|
+
onMouseMove: (e) => {
|
|
2151
|
+
mouseX.set(e.clientX);
|
|
2152
|
+
mouseY.set(e.clientY);
|
|
2153
|
+
},
|
|
2154
|
+
onMouseLeave: () => {
|
|
2155
|
+
mouseX.set(Infinity);
|
|
2156
|
+
mouseY.set(Infinity);
|
|
2157
|
+
},
|
|
2158
|
+
...props,
|
|
2159
|
+
children
|
|
2160
|
+
}
|
|
2161
|
+
) });
|
|
2162
|
+
}
|
|
2163
|
+
);
|
|
2164
|
+
DockRoot.displayName = "Dock";
|
|
2165
|
+
var DockItem = forwardRef25(
|
|
2166
|
+
({ children, label, onClick, className, style, ...props }, ref) => {
|
|
2167
|
+
const { mouseX, mouseY, distance, magnification, direction, isReducedMotion } = React26.useContext(DockContext);
|
|
2168
|
+
const itemRef = useRef11(null);
|
|
2169
|
+
const mergedRef = useMergedRef(ref, itemRef);
|
|
2170
|
+
const distVar = direction === "horizontal" ? mouseX : mouseY;
|
|
2171
|
+
const distanceCalc = useTransform3(distVar, (val) => {
|
|
2172
|
+
if (val === Infinity || !itemRef.current) return distance;
|
|
2173
|
+
const bounds = itemRef.current.getBoundingClientRect();
|
|
2174
|
+
const center = direction === "horizontal" ? bounds.x + bounds.width / 2 : bounds.y + bounds.height / 2;
|
|
2175
|
+
return Math.abs(val - center);
|
|
2176
|
+
});
|
|
2177
|
+
const scaleRaw = useTransform3(distanceCalc, [0, distance], [magnification, 1]);
|
|
2178
|
+
const scale = useSpring8(scaleRaw, { mass: 0.1, stiffness: 300, damping: 20 });
|
|
2179
|
+
const [isHovered, setIsHovered] = React26.useState(false);
|
|
2180
|
+
if (isReducedMotion) {
|
|
2181
|
+
return /* @__PURE__ */ jsx27("button", { ref: mergedRef, onClick, className, style: { ...style, position: "relative" }, ...props, children });
|
|
2182
|
+
}
|
|
2183
|
+
return /* @__PURE__ */ jsxs8(
|
|
2184
|
+
motion23.button,
|
|
2185
|
+
{
|
|
2186
|
+
ref: mergedRef,
|
|
2187
|
+
onClick,
|
|
2188
|
+
onMouseEnter: () => setIsHovered(true),
|
|
2189
|
+
onMouseLeave: () => setIsHovered(false),
|
|
2190
|
+
style: {
|
|
2191
|
+
scale,
|
|
2192
|
+
transformOrigin: direction === "horizontal" ? "bottom" : "left",
|
|
2193
|
+
// Common dock origin
|
|
2194
|
+
display: "flex",
|
|
2195
|
+
alignItems: "center",
|
|
2196
|
+
justifyContent: "center",
|
|
2197
|
+
position: "relative",
|
|
2198
|
+
...style
|
|
2199
|
+
},
|
|
2200
|
+
className,
|
|
2201
|
+
...props,
|
|
2202
|
+
children: [
|
|
2203
|
+
children,
|
|
2204
|
+
label && isHovered && /* @__PURE__ */ jsx27(
|
|
2205
|
+
motion23.div,
|
|
2206
|
+
{
|
|
2207
|
+
initial: { opacity: 0, scale: 0.8, y: direction === "horizontal" ? -10 : 0, x: direction === "horizontal" ? 0 : 10 },
|
|
2208
|
+
animate: { opacity: 1, scale: 1, y: 0, x: 0 },
|
|
2209
|
+
transition: { type: "spring", stiffness: 400, damping: 20, mass: 0.5 },
|
|
2210
|
+
style: {
|
|
2211
|
+
position: "absolute",
|
|
2212
|
+
[direction === "horizontal" ? "top" : "left"]: direction === "horizontal" ? "-120%" : "120%",
|
|
2213
|
+
fontSize: "12px",
|
|
2214
|
+
background: "rgba(0,0,0,0.8)",
|
|
2215
|
+
color: "white",
|
|
2216
|
+
padding: "4px 8px",
|
|
2217
|
+
borderRadius: "4px",
|
|
2218
|
+
whiteSpace: "nowrap",
|
|
2219
|
+
pointerEvents: "none"
|
|
2220
|
+
},
|
|
2221
|
+
children: label
|
|
2222
|
+
}
|
|
2223
|
+
)
|
|
2224
|
+
]
|
|
2225
|
+
}
|
|
2226
|
+
);
|
|
2227
|
+
}
|
|
2228
|
+
);
|
|
2229
|
+
DockItem.displayName = "Dock.Item";
|
|
2230
|
+
var Dock = Object.assign(DockRoot, { Item: DockItem });
|
|
2231
|
+
|
|
2232
|
+
// src/primitives/26-infinite-scroll.tsx
|
|
2233
|
+
import { forwardRef as forwardRef26, useEffect as useEffect19, useRef as useRef12, useState as useState14 } from "react";
|
|
2234
|
+
import { jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2235
|
+
function InfiniteScrollComponent({
|
|
2236
|
+
items,
|
|
2237
|
+
renderItem,
|
|
2238
|
+
keyExtractor,
|
|
2239
|
+
onLoadMore,
|
|
2240
|
+
hasMore,
|
|
2241
|
+
threshold = 200,
|
|
2242
|
+
loader,
|
|
2243
|
+
enterFrom = "below",
|
|
2244
|
+
stagger = motionScale.stagger.fast,
|
|
2245
|
+
// batchSize = 10,
|
|
2246
|
+
physics: physics2 = "gentle",
|
|
2247
|
+
className,
|
|
2248
|
+
style,
|
|
2249
|
+
disabled = false
|
|
2250
|
+
}, ref) {
|
|
2251
|
+
const isReducedMotion = useReducedMotion();
|
|
2252
|
+
const internalRef = useRef12(null);
|
|
2253
|
+
const scrollRef = useRef12(null);
|
|
2254
|
+
const endMarkerRef = useRef12(null);
|
|
2255
|
+
const mergedRef = useMergedRef(ref, internalRef, scrollRef);
|
|
2256
|
+
const [isLoading, setIsLoading] = useState14(false);
|
|
2257
|
+
useEffect19(() => {
|
|
2258
|
+
if (disabled || !hasMore || isLoading || !endMarkerRef.current) return;
|
|
2259
|
+
const observer = new IntersectionObserver(
|
|
2260
|
+
(entries) => {
|
|
2261
|
+
if (entries[0].isIntersecting) {
|
|
2262
|
+
setIsLoading(true);
|
|
2263
|
+
Promise.resolve(onLoadMore()).finally(() => {
|
|
2264
|
+
setIsLoading(false);
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
},
|
|
2268
|
+
{ rootMargin: `0px 0px ${threshold}px 0px` }
|
|
2269
|
+
);
|
|
2270
|
+
observer.observe(endMarkerRef.current);
|
|
2271
|
+
return () => observer.disconnect();
|
|
2272
|
+
}, [hasMore, isLoading, onLoadMore, threshold, disabled]);
|
|
2273
|
+
if (disabled) {
|
|
2274
|
+
return /* @__PURE__ */ jsxs9("div", { ref: mergedRef, className, style: { overflowY: "auto", ...style }, children: [
|
|
2275
|
+
/* @__PURE__ */ jsx28("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: items.map((item, i) => /* @__PURE__ */ jsx28("li", { children: renderItem(item, i) }, keyExtractor(item))) }),
|
|
2276
|
+
hasMore && /* @__PURE__ */ jsx28("div", { ref: endMarkerRef, children: loader })
|
|
2277
|
+
] });
|
|
2278
|
+
}
|
|
2279
|
+
return /* @__PURE__ */ jsxs9("div", { ref: mergedRef, className, style: { ...style, position: "relative" }, children: [
|
|
2280
|
+
/* @__PURE__ */ jsx28(
|
|
2281
|
+
AnimatedList,
|
|
2282
|
+
{
|
|
2283
|
+
items,
|
|
2284
|
+
keyExtractor,
|
|
2285
|
+
renderItem,
|
|
2286
|
+
enterFrom,
|
|
2287
|
+
stagger,
|
|
2288
|
+
physics: physics2,
|
|
2289
|
+
layout: !isReducedMotion
|
|
2290
|
+
}
|
|
2291
|
+
),
|
|
2292
|
+
hasMore && /* @__PURE__ */ jsx28("div", { ref: endMarkerRef, style: { width: "100%", padding: "16px", display: "flex", justifyContent: "center" }, children: loader || // Default simple loader if none provided
|
|
2293
|
+
/* @__PURE__ */ jsx28("div", { style: { padding: "8px" }, children: "Loading more..." }) })
|
|
2294
|
+
] });
|
|
2295
|
+
}
|
|
2296
|
+
var InfiniteScroll = forwardRef26(InfiniteScrollComponent);
|
|
2297
|
+
|
|
2298
|
+
// src/primitives/27-scroll-progress.tsx
|
|
2299
|
+
import { forwardRef as forwardRef27, useRef as useRef13 } from "react";
|
|
2300
|
+
import { motion as motion24, useScroll as useScroll3, useSpring as useSpring9 } from "motion/react";
|
|
2301
|
+
import { jsx as jsx29, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2302
|
+
var ScrollProgress = forwardRef27(
|
|
2303
|
+
({
|
|
2304
|
+
children,
|
|
2305
|
+
axis = "x",
|
|
2306
|
+
container,
|
|
2307
|
+
color = "var(--flux-primary, #000)",
|
|
2308
|
+
height = 4,
|
|
2309
|
+
position = "top",
|
|
2310
|
+
smooth = true,
|
|
2311
|
+
className,
|
|
2312
|
+
style,
|
|
2313
|
+
disabled = false,
|
|
2314
|
+
...props
|
|
2315
|
+
}, ref) => {
|
|
2316
|
+
const isReducedMotion = useReducedMotion();
|
|
2317
|
+
const internalRef = useRef13(null);
|
|
2318
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2319
|
+
const { scrollYProgress, scrollXProgress } = useScroll3({
|
|
2320
|
+
container: container?.current ? container : void 0
|
|
2321
|
+
});
|
|
2322
|
+
const progress = axis === "x" ? scrollYProgress : scrollXProgress;
|
|
2323
|
+
const springProgress = useSpring9(progress, {
|
|
2324
|
+
stiffness: 100,
|
|
2325
|
+
damping: 30,
|
|
2326
|
+
restDelta: 1e-3
|
|
2327
|
+
});
|
|
2328
|
+
const scaleValue = smooth && !isReducedMotion ? springProgress : progress;
|
|
2329
|
+
if (disabled || isReducedMotion) {
|
|
2330
|
+
return children ? /* @__PURE__ */ jsx29("div", { ref: mergedRef, className, style, ...props, children }) : null;
|
|
2331
|
+
}
|
|
2332
|
+
const posStyles = position === "none" ? {} : position === "top" ? { position: "fixed", top: 0, left: 0, right: 0, transformOrigin: "0% 50%" } : position === "bottom" ? { position: "fixed", bottom: 0, left: 0, right: 0, transformOrigin: "0% 50%" } : position === "left" ? { position: "fixed", top: 0, bottom: 0, left: 0, transformOrigin: "50% 0%" } : { position: "fixed", top: 0, bottom: 0, right: 0, transformOrigin: "50% 0%" };
|
|
2333
|
+
const dimStyles = position === "top" || position === "bottom" || position === "none" ? { height, width: "100%", scaleX: scaleValue } : { width: height, height: "100%", scaleY: scaleValue };
|
|
2334
|
+
if (!children) {
|
|
2335
|
+
return /* @__PURE__ */ jsx29(
|
|
2336
|
+
motion24.div,
|
|
2337
|
+
{
|
|
2338
|
+
ref: mergedRef,
|
|
2339
|
+
className,
|
|
2340
|
+
style: {
|
|
2341
|
+
...posStyles,
|
|
2342
|
+
...dimStyles,
|
|
2343
|
+
backgroundColor: color,
|
|
2344
|
+
zIndex: 9999,
|
|
2345
|
+
...style
|
|
2346
|
+
},
|
|
2347
|
+
...props
|
|
2348
|
+
}
|
|
2349
|
+
);
|
|
2350
|
+
}
|
|
2351
|
+
return /* @__PURE__ */ jsxs10("div", { ref: mergedRef, className, style: { position: "relative", ...style }, ...props, children: [
|
|
2352
|
+
children,
|
|
2353
|
+
/* @__PURE__ */ jsx29(
|
|
2354
|
+
motion24.div,
|
|
2355
|
+
{
|
|
2356
|
+
style: {
|
|
2357
|
+
position: "absolute",
|
|
2358
|
+
top: 0,
|
|
2359
|
+
left: 0,
|
|
2360
|
+
bottom: 0,
|
|
2361
|
+
right: 0,
|
|
2362
|
+
backgroundColor: color,
|
|
2363
|
+
scaleX: axis === "x" ? scaleValue : void 0,
|
|
2364
|
+
scaleY: axis === "y" ? scaleValue : void 0,
|
|
2365
|
+
transformOrigin: "0% 0%",
|
|
2366
|
+
zIndex: -1
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
)
|
|
2370
|
+
] });
|
|
2371
|
+
}
|
|
2372
|
+
);
|
|
2373
|
+
ScrollProgress.displayName = "ScrollProgress";
|
|
2374
|
+
|
|
2375
|
+
// src/primitives/28-parallax.tsx
|
|
2376
|
+
import { forwardRef as forwardRef28, useRef as useRef14 } from "react";
|
|
2377
|
+
import { motion as motion25, useScroll as useScroll4, useTransform as useTransform4 } from "motion/react";
|
|
2378
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2379
|
+
var Parallax = forwardRef28(
|
|
2380
|
+
({
|
|
2381
|
+
children,
|
|
2382
|
+
offset = 50,
|
|
2383
|
+
direction = "up",
|
|
2384
|
+
container,
|
|
2385
|
+
className,
|
|
2386
|
+
style,
|
|
2387
|
+
disabled = false,
|
|
2388
|
+
...props
|
|
2389
|
+
}, ref) => {
|
|
2390
|
+
const isReducedMotion = useReducedMotion();
|
|
2391
|
+
const internalRef = useRef14(null);
|
|
2392
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2393
|
+
const { scrollYProgress } = useScroll4({
|
|
2394
|
+
target: internalRef,
|
|
2395
|
+
container: container?.current ? container : void 0,
|
|
2396
|
+
offset: ["start end", "end start"]
|
|
2397
|
+
});
|
|
2398
|
+
const transformStart = direction === "up" ? offset : direction === "down" ? -offset : direction === "left" ? offset : -offset;
|
|
2399
|
+
const transformEnd = direction === "up" ? -offset : direction === "down" ? offset : direction === "left" ? -offset : offset;
|
|
2400
|
+
const translate = useTransform4(scrollYProgress, [0, 1], [transformStart, transformEnd]);
|
|
2401
|
+
if (disabled || isReducedMotion) {
|
|
2402
|
+
return /* @__PURE__ */ jsx30("div", { ref: mergedRef, className, style, ...props, children });
|
|
2403
|
+
}
|
|
2404
|
+
return /* @__PURE__ */ jsx30(
|
|
2405
|
+
motion25.div,
|
|
2406
|
+
{
|
|
2407
|
+
ref: mergedRef,
|
|
2408
|
+
className,
|
|
2409
|
+
style: {
|
|
2410
|
+
...style,
|
|
2411
|
+
y: direction === "up" || direction === "down" ? translate : 0,
|
|
2412
|
+
x: direction === "left" || direction === "right" ? translate : 0
|
|
2413
|
+
},
|
|
2414
|
+
...props,
|
|
2415
|
+
children
|
|
2416
|
+
}
|
|
2417
|
+
);
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
Parallax.displayName = "Parallax";
|
|
2421
|
+
|
|
2422
|
+
// src/primitives/29-sticky-scroll.tsx
|
|
2423
|
+
import { forwardRef as forwardRef29, useEffect as useEffect20, useRef as useRef15, useState as useState15 } from "react";
|
|
2424
|
+
import { motion as motion26, useScroll as useScroll5 } from "motion/react";
|
|
2425
|
+
import { jsx as jsx31, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2426
|
+
var StickyScroll = forwardRef29(
|
|
2427
|
+
({
|
|
2428
|
+
content,
|
|
2429
|
+
container,
|
|
2430
|
+
physics: physics2 = "gentle",
|
|
2431
|
+
className,
|
|
2432
|
+
style,
|
|
2433
|
+
disabled = false,
|
|
2434
|
+
...props
|
|
2435
|
+
}, ref) => {
|
|
2436
|
+
const isReducedMotion = useReducedMotion();
|
|
2437
|
+
const internalRef = useRef15(null);
|
|
2438
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2439
|
+
const [activeSection, setActiveSection] = useState15(0);
|
|
2440
|
+
const { scrollYProgress } = useScroll5({
|
|
2441
|
+
target: internalRef,
|
|
2442
|
+
container: container?.current ? container : void 0,
|
|
2443
|
+
offset: ["start start", "end end"]
|
|
2444
|
+
});
|
|
2445
|
+
useEffect20(() => {
|
|
2446
|
+
return scrollYProgress.onChange((latest) => {
|
|
2447
|
+
const cardsCount = content.length;
|
|
2448
|
+
const progressPerCard = 1 / cardsCount;
|
|
2449
|
+
const index = Math.min(
|
|
2450
|
+
Math.floor(latest / progressPerCard),
|
|
2451
|
+
cardsCount - 1
|
|
2452
|
+
);
|
|
2453
|
+
setActiveSection(index);
|
|
2454
|
+
});
|
|
2455
|
+
}, [scrollYProgress, content.length]);
|
|
2456
|
+
if (disabled || isReducedMotion) {
|
|
2457
|
+
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: [
|
|
2458
|
+
/* @__PURE__ */ jsx31("h3", { children: item.title }),
|
|
2459
|
+
/* @__PURE__ */ jsx31("div", { children: item.description }),
|
|
2460
|
+
item.asset && /* @__PURE__ */ jsx31("div", { children: item.asset })
|
|
2461
|
+
] }, i)) });
|
|
2462
|
+
}
|
|
2463
|
+
return /* @__PURE__ */ jsxs11(
|
|
2464
|
+
"div",
|
|
2465
|
+
{
|
|
2466
|
+
ref: mergedRef,
|
|
2467
|
+
className,
|
|
2468
|
+
style: {
|
|
2469
|
+
display: "flex",
|
|
2470
|
+
position: "relative",
|
|
2471
|
+
minHeight: `${content.length * 100}vh`,
|
|
2472
|
+
...style
|
|
2473
|
+
},
|
|
2474
|
+
...props,
|
|
2475
|
+
children: [
|
|
2476
|
+
/* @__PURE__ */ jsx31("div", { style: { flex: 1, padding: "4rem 2rem", position: "relative" }, children: content.map((item, index) => /* @__PURE__ */ jsxs11(
|
|
2477
|
+
"div",
|
|
2478
|
+
{
|
|
2479
|
+
style: {
|
|
2480
|
+
height: "100vh",
|
|
2481
|
+
display: "flex",
|
|
2482
|
+
flexDirection: "column",
|
|
2483
|
+
justifyContent: "center",
|
|
2484
|
+
opacity: activeSection === index ? 1 : 0.3,
|
|
2485
|
+
transition: "opacity 0.4s ease"
|
|
2486
|
+
},
|
|
2487
|
+
children: [
|
|
2488
|
+
/* @__PURE__ */ jsx31(
|
|
2489
|
+
motion26.h2,
|
|
2490
|
+
{
|
|
2491
|
+
initial: { opacity: 0, y: 20 },
|
|
2492
|
+
animate: { opacity: activeSection === index ? 1 : 0, y: activeSection === index ? 0 : 20 },
|
|
2493
|
+
style: { fontSize: "2rem", fontWeight: "bold", marginBottom: "1rem" },
|
|
2494
|
+
children: item.title
|
|
2495
|
+
}
|
|
2496
|
+
),
|
|
2497
|
+
/* @__PURE__ */ jsx31(
|
|
2498
|
+
motion26.div,
|
|
2499
|
+
{
|
|
2500
|
+
initial: { opacity: 0 },
|
|
2501
|
+
animate: { opacity: activeSection === index ? 1 : 0 },
|
|
2502
|
+
children: item.description
|
|
2503
|
+
}
|
|
2504
|
+
)
|
|
2505
|
+
]
|
|
2506
|
+
},
|
|
2507
|
+
index
|
|
2508
|
+
)) }),
|
|
2509
|
+
/* @__PURE__ */ jsx31("div", { style: { flex: 1, position: "sticky", top: 0, height: "100vh", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx31(
|
|
2510
|
+
motion26.div,
|
|
2511
|
+
{
|
|
2512
|
+
layout: true,
|
|
2513
|
+
style: { width: "80%", height: "60%", background: "var(--flux-border, #f4f4f5)", borderRadius: "1rem", overflow: "hidden" },
|
|
2514
|
+
children: content[activeSection]?.asset
|
|
2515
|
+
}
|
|
2516
|
+
) })
|
|
2517
|
+
]
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
);
|
|
2522
|
+
StickyScroll.displayName = "StickyScroll";
|
|
2523
|
+
|
|
2524
|
+
// src/primitives/30-scroll-snap.tsx
|
|
2525
|
+
import React31, { forwardRef as forwardRef30, useRef as useRef16 } from "react";
|
|
2526
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2527
|
+
var ScrollSnapContainer = forwardRef30(
|
|
2528
|
+
({
|
|
2529
|
+
children,
|
|
2530
|
+
axis = "y",
|
|
2531
|
+
alignment = "center",
|
|
2532
|
+
strictness = "mandatory",
|
|
2533
|
+
physics: physics2 = "smooth",
|
|
2534
|
+
className,
|
|
2535
|
+
style,
|
|
2536
|
+
disabled = false,
|
|
2537
|
+
...props
|
|
2538
|
+
}, ref) => {
|
|
2539
|
+
const isReducedMotion = useReducedMotion();
|
|
2540
|
+
const internalRef = useRef16(null);
|
|
2541
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2542
|
+
return /* @__PURE__ */ jsx32(SnapContext.Provider, { value: { alignment, disabled: disabled || isReducedMotion }, children: /* @__PURE__ */ jsx32(
|
|
2543
|
+
"div",
|
|
2544
|
+
{
|
|
2545
|
+
ref: mergedRef,
|
|
2546
|
+
className,
|
|
2547
|
+
style: {
|
|
2548
|
+
...style,
|
|
2549
|
+
overflowX: axis === "x" || axis === "both" ? "auto" : "hidden",
|
|
2550
|
+
overflowY: axis === "y" || axis === "both" ? "auto" : "hidden",
|
|
2551
|
+
scrollSnapType: disabled || isReducedMotion ? "none" : `${axis} ${strictness}`
|
|
2552
|
+
},
|
|
2553
|
+
...props,
|
|
2554
|
+
children
|
|
2555
|
+
}
|
|
2556
|
+
) });
|
|
2557
|
+
}
|
|
2558
|
+
);
|
|
2559
|
+
ScrollSnapContainer.displayName = "ScrollSnap";
|
|
2560
|
+
var SnapContext = React31.createContext({ alignment: "center", disabled: false });
|
|
2561
|
+
var ScrollSnapItem = forwardRef30(
|
|
2562
|
+
({ children, alignment: itemAlignment, stopHandling = "normal", className, style, ...props }, ref) => {
|
|
2563
|
+
const { alignment: containerAlignment, disabled } = React31.useContext(SnapContext);
|
|
2564
|
+
const align = itemAlignment || containerAlignment;
|
|
2565
|
+
return /* @__PURE__ */ jsx32(
|
|
2566
|
+
"div",
|
|
2567
|
+
{
|
|
2568
|
+
ref,
|
|
2569
|
+
className,
|
|
2570
|
+
style: {
|
|
2571
|
+
...style,
|
|
2572
|
+
scrollSnapAlign: disabled ? "none" : align,
|
|
2573
|
+
scrollSnapStop: disabled ? "normal" : stopHandling
|
|
2574
|
+
},
|
|
2575
|
+
...props,
|
|
2576
|
+
children
|
|
2577
|
+
}
|
|
2578
|
+
);
|
|
2579
|
+
}
|
|
2580
|
+
);
|
|
2581
|
+
ScrollSnapItem.displayName = "ScrollSnap.Item";
|
|
2582
|
+
var ScrollSnap = Object.assign(ScrollSnapContainer, { Item: ScrollSnapItem });
|
|
2583
|
+
|
|
2584
|
+
// src/primitives/31-aurora.tsx
|
|
2585
|
+
import { forwardRef as forwardRef31, useRef as useRef17 } from "react";
|
|
2586
|
+
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2587
|
+
var Aurora = forwardRef31(
|
|
2588
|
+
({
|
|
2589
|
+
colors = ["#99f6e4", "#34d399", "#2dd4bf"],
|
|
2590
|
+
speed = 10,
|
|
2591
|
+
blur = 60,
|
|
2592
|
+
opacity = 0.5,
|
|
2593
|
+
blendMode = "normal",
|
|
2594
|
+
className,
|
|
2595
|
+
style,
|
|
2596
|
+
disabled = false,
|
|
2597
|
+
...props
|
|
2598
|
+
}, ref) => {
|
|
2599
|
+
const isReducedMotion = useReducedMotion();
|
|
2600
|
+
const internalRef = useRef17(null);
|
|
2601
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2602
|
+
if (disabled) return null;
|
|
2603
|
+
const baseStyle = {
|
|
2604
|
+
position: "absolute",
|
|
2605
|
+
top: "-50%",
|
|
2606
|
+
left: "-50%",
|
|
2607
|
+
width: "200%",
|
|
2608
|
+
height: "200%",
|
|
2609
|
+
opacity,
|
|
2610
|
+
mixBlendMode: blendMode,
|
|
2611
|
+
filter: `blur(${blur}px)`,
|
|
2612
|
+
pointerEvents: "none",
|
|
2613
|
+
zIndex: 0
|
|
2614
|
+
};
|
|
2615
|
+
const gradientString = `linear-gradient(-45deg, ${colors.join(", ")})`;
|
|
2616
|
+
return /* @__PURE__ */ jsxs12(
|
|
2617
|
+
"div",
|
|
2618
|
+
{
|
|
2619
|
+
ref: mergedRef,
|
|
2620
|
+
className,
|
|
2621
|
+
style: {
|
|
2622
|
+
position: "absolute",
|
|
2623
|
+
inset: 0,
|
|
2624
|
+
overflow: "hidden",
|
|
2625
|
+
pointerEvents: "none",
|
|
2626
|
+
...style
|
|
2627
|
+
},
|
|
2628
|
+
...props,
|
|
2629
|
+
children: [
|
|
2630
|
+
/* @__PURE__ */ jsx33(
|
|
2631
|
+
"div",
|
|
2632
|
+
{
|
|
2633
|
+
style: {
|
|
2634
|
+
...baseStyle,
|
|
2635
|
+
background: gradientString,
|
|
2636
|
+
backgroundSize: "400% 400%",
|
|
2637
|
+
animation: isReducedMotion ? "none" : `flux-aurora ${speed}s ease infinite`
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
),
|
|
2641
|
+
/* @__PURE__ */ jsx33("style", { children: `
|
|
2642
|
+
@keyframes flux-aurora {
|
|
2643
|
+
0% { background-position: 0% 50%; transform: rotate(0deg); }
|
|
2644
|
+
50% { background-position: 100% 50%; transform: rotate(180deg); }
|
|
2645
|
+
100% { background-position: 0% 50%; transform: rotate(360deg); }
|
|
2646
|
+
}
|
|
2647
|
+
` })
|
|
2648
|
+
]
|
|
2649
|
+
}
|
|
2650
|
+
);
|
|
2651
|
+
}
|
|
2652
|
+
);
|
|
2653
|
+
Aurora.displayName = "Aurora";
|
|
2654
|
+
|
|
2655
|
+
// src/primitives/32-mesh-gradient.tsx
|
|
2656
|
+
import { forwardRef as forwardRef32, useRef as useRef18 } from "react";
|
|
2657
|
+
import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2658
|
+
var MeshGradient = forwardRef32(
|
|
2659
|
+
({
|
|
2660
|
+
colors = ["#99f6e4", "#fbcfe8", "#fef08a", "#a7f3d0"],
|
|
2661
|
+
speed = 15,
|
|
2662
|
+
className,
|
|
2663
|
+
style,
|
|
2664
|
+
disabled = false,
|
|
2665
|
+
...props
|
|
2666
|
+
}, ref) => {
|
|
2667
|
+
const isReducedMotion = useReducedMotion();
|
|
2668
|
+
const internalRef = useRef18(null);
|
|
2669
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2670
|
+
if (disabled) return null;
|
|
2671
|
+
const baseStyle = {
|
|
2672
|
+
position: "absolute",
|
|
2673
|
+
inset: -50,
|
|
2674
|
+
// bleed edge to avoid seeing bounds during rotation
|
|
2675
|
+
opacity: 0.8,
|
|
2676
|
+
filter: "blur(60px)",
|
|
2677
|
+
pointerEvents: "none",
|
|
2678
|
+
zIndex: 0,
|
|
2679
|
+
background: `
|
|
2680
|
+
radial-gradient(circle at 100% 0%, ${colors[0]} 0%, transparent 50%),
|
|
2681
|
+
radial-gradient(circle at 0% 100%, ${colors[1]} 0%, transparent 50%),
|
|
2682
|
+
radial-gradient(circle at 100% 100%, ${colors[2]} 0%, transparent 50%),
|
|
2683
|
+
radial-gradient(circle at 0% 0%, ${colors[3]} 0%, transparent 50%)
|
|
2684
|
+
`,
|
|
2685
|
+
backgroundSize: "200% 200%"
|
|
2686
|
+
};
|
|
2687
|
+
return /* @__PURE__ */ jsxs13(
|
|
2688
|
+
"div",
|
|
2689
|
+
{
|
|
2690
|
+
ref: mergedRef,
|
|
2691
|
+
className,
|
|
2692
|
+
style: {
|
|
2693
|
+
position: "absolute",
|
|
2694
|
+
inset: 0,
|
|
2695
|
+
overflow: "hidden",
|
|
2696
|
+
pointerEvents: "none",
|
|
2697
|
+
...style
|
|
2698
|
+
},
|
|
2699
|
+
...props,
|
|
2700
|
+
children: [
|
|
2701
|
+
/* @__PURE__ */ jsx34(
|
|
2702
|
+
"div",
|
|
2703
|
+
{
|
|
2704
|
+
style: {
|
|
2705
|
+
...baseStyle,
|
|
2706
|
+
animation: isReducedMotion ? "none" : `flux-mesh ${speed}s ease-in-out infinite alternate`
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
),
|
|
2710
|
+
/* @__PURE__ */ jsx34("style", { children: `
|
|
2711
|
+
@keyframes flux-mesh {
|
|
2712
|
+
0% { background-position: 0% 0%; transform: scale(1) rotate(0deg); }
|
|
2713
|
+
50% { background-position: 100% 100%; transform: scale(1.1) rotate(5deg); }
|
|
2714
|
+
100% { background-position: 0% 0%; transform: scale(1) rotate(-5deg); }
|
|
2715
|
+
}
|
|
2716
|
+
` })
|
|
2717
|
+
]
|
|
2718
|
+
}
|
|
2719
|
+
);
|
|
2720
|
+
}
|
|
2721
|
+
);
|
|
2722
|
+
MeshGradient.displayName = "MeshGradient";
|
|
2723
|
+
|
|
2724
|
+
// src/primitives/33-particles.tsx
|
|
2725
|
+
import { forwardRef as forwardRef33, useEffect as useEffect21, useRef as useRef19 } from "react";
|
|
2726
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
2727
|
+
var Particles = forwardRef33(
|
|
2728
|
+
({
|
|
2729
|
+
color = "#99f6e4",
|
|
2730
|
+
quantity = 100,
|
|
2731
|
+
staticity = 50,
|
|
2732
|
+
ease = 50,
|
|
2733
|
+
className,
|
|
2734
|
+
style,
|
|
2735
|
+
disabled = false,
|
|
2736
|
+
...props
|
|
2737
|
+
}, ref) => {
|
|
2738
|
+
const isReducedMotion = useReducedMotion();
|
|
2739
|
+
const internalRef = useRef19(null);
|
|
2740
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2741
|
+
const context = useRef19(null);
|
|
2742
|
+
const circles = useRef19([]);
|
|
2743
|
+
const mouse = useRef19({ x: 0, y: 0 });
|
|
2744
|
+
const canvasSize = useRef19({ w: 0, h: 0 });
|
|
2745
|
+
const animationFrameId = useRef19(0);
|
|
2746
|
+
useEffect21(() => {
|
|
2747
|
+
if (disabled || isReducedMotion || !internalRef.current) return;
|
|
2748
|
+
const canvas = internalRef.current;
|
|
2749
|
+
context.current = canvas.getContext("2d");
|
|
2750
|
+
const resizeCanvas = () => {
|
|
2751
|
+
if (!internalRef.current || !context.current) return;
|
|
2752
|
+
const rect = internalRef.current.parentElement?.getBoundingClientRect() || internalRef.current.getBoundingClientRect();
|
|
2753
|
+
canvasSize.current.w = rect.width;
|
|
2754
|
+
canvasSize.current.h = rect.height;
|
|
2755
|
+
internalRef.current.width = rect.width;
|
|
2756
|
+
internalRef.current.height = rect.height;
|
|
2757
|
+
initParticles();
|
|
2758
|
+
};
|
|
2759
|
+
const initParticles = () => {
|
|
2760
|
+
circles.current = [];
|
|
2761
|
+
for (let i = 0; i < quantity; i++) {
|
|
2762
|
+
circles.current.push(circleParams());
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
const circleParams = () => {
|
|
2766
|
+
const x = Math.floor(Math.random() * canvasSize.current.w);
|
|
2767
|
+
const y = Math.floor(Math.random() * canvasSize.current.h);
|
|
2768
|
+
const translateX = 0;
|
|
2769
|
+
const translateY = 0;
|
|
2770
|
+
const size = Math.floor(Math.random() * 2) + 0.1;
|
|
2771
|
+
const alpha = 0;
|
|
2772
|
+
const targetAlpha = parseFloat((Math.random() * 0.6 + 0.1).toFixed(1));
|
|
2773
|
+
const dx = (Math.random() - 0.5) * 0.2;
|
|
2774
|
+
const dy = (Math.random() - 0.5) * 0.2;
|
|
2775
|
+
const magnetism = 0.1 + Math.random() * 4;
|
|
2776
|
+
return { x, y, translateX, translateY, size, alpha, targetAlpha, dx, dy, magnetism };
|
|
2777
|
+
};
|
|
2778
|
+
const drawCircle = (circle, update = false) => {
|
|
2779
|
+
if (!context.current) return;
|
|
2780
|
+
const { x, y, translateX, translateY, size, alpha } = circle;
|
|
2781
|
+
context.current.translate(translateX, translateY);
|
|
2782
|
+
context.current.beginPath();
|
|
2783
|
+
context.current.arc(x, y, size, 0, 2 * Math.PI);
|
|
2784
|
+
context.current.fillStyle = `${color}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
2785
|
+
context.current.fill();
|
|
2786
|
+
context.current.setTransform(1, 0, 0, 1, 0, 0);
|
|
2787
|
+
if (!update) return;
|
|
2788
|
+
circle.alpha += (circle.targetAlpha - circle.alpha) * 0.02;
|
|
2789
|
+
circle.x += circle.dx;
|
|
2790
|
+
circle.y += circle.dy;
|
|
2791
|
+
circle.translateX += (mouse.current.x / (staticity / circle.magnetism) - circle.translateX) / ease;
|
|
2792
|
+
circle.translateY += (mouse.current.y / (staticity / circle.magnetism) - circle.translateY) / ease;
|
|
2793
|
+
if (circle.x < -circle.size || circle.x > canvasSize.current.w + circle.size || circle.y < -circle.size || circle.y > canvasSize.current.h + circle.size) {
|
|
2794
|
+
Object.assign(circle, circleParams(), { alpha: 0 });
|
|
2795
|
+
}
|
|
2796
|
+
};
|
|
2797
|
+
const animate = () => {
|
|
2798
|
+
if (!context.current || !internalRef.current) return;
|
|
2799
|
+
context.current.clearRect(0, 0, canvasSize.current.w, canvasSize.current.h);
|
|
2800
|
+
circles.current.forEach((circle) => drawCircle(circle, true));
|
|
2801
|
+
animationFrameId.current = window.requestAnimationFrame(animate);
|
|
2802
|
+
};
|
|
2803
|
+
resizeCanvas();
|
|
2804
|
+
animate();
|
|
2805
|
+
const handleMouseMove = (e) => {
|
|
2806
|
+
if (!internalRef.current) return;
|
|
2807
|
+
const rect = internalRef.current.getBoundingClientRect();
|
|
2808
|
+
mouse.current.x = e.clientX - rect.left - canvasSize.current.w / 2;
|
|
2809
|
+
mouse.current.y = e.clientY - rect.top - canvasSize.current.h / 2;
|
|
2810
|
+
};
|
|
2811
|
+
window.addEventListener("resize", resizeCanvas);
|
|
2812
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
2813
|
+
return () => {
|
|
2814
|
+
window.removeEventListener("resize", resizeCanvas);
|
|
2815
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
2816
|
+
if (animationFrameId.current) window.cancelAnimationFrame(animationFrameId.current);
|
|
2817
|
+
};
|
|
2818
|
+
}, [color, quantity, staticity, ease, disabled, isReducedMotion]);
|
|
2819
|
+
if (disabled) return null;
|
|
2820
|
+
return /* @__PURE__ */ jsx35(
|
|
2821
|
+
"canvas",
|
|
2822
|
+
{
|
|
2823
|
+
ref: mergedRef,
|
|
2824
|
+
className,
|
|
2825
|
+
style: {
|
|
2826
|
+
position: "absolute",
|
|
2827
|
+
inset: 0,
|
|
2828
|
+
pointerEvents: "none",
|
|
2829
|
+
...style
|
|
2830
|
+
},
|
|
2831
|
+
...props
|
|
2832
|
+
}
|
|
2833
|
+
);
|
|
2834
|
+
}
|
|
2835
|
+
);
|
|
2836
|
+
Particles.displayName = "Particles";
|
|
2837
|
+
|
|
2838
|
+
// src/primitives/34-grid-pattern.tsx
|
|
2839
|
+
import { forwardRef as forwardRef34 } from "react";
|
|
2840
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
2841
|
+
var GridPattern = forwardRef34(
|
|
2842
|
+
({
|
|
2843
|
+
size = 24,
|
|
2844
|
+
color = "currentColor",
|
|
2845
|
+
fade = true,
|
|
2846
|
+
className,
|
|
2847
|
+
style,
|
|
2848
|
+
disabled = false,
|
|
2849
|
+
...props
|
|
2850
|
+
}, ref) => {
|
|
2851
|
+
if (disabled) return null;
|
|
2852
|
+
const baseStyle = {
|
|
2853
|
+
position: "absolute",
|
|
2854
|
+
inset: 0,
|
|
2855
|
+
pointerEvents: "none",
|
|
2856
|
+
zIndex: 0,
|
|
2857
|
+
backgroundImage: `url("data:image/svg+xml,%3Csvg width='${size}' height='${size}' viewBox='0 0 ${size} ${size}' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M${size} 0H0V${size}' fill='none' stroke='${encodeURIComponent(color)}' stroke-width='1' stroke-opacity='0.1'/%3E%3C/svg%3E")`,
|
|
2858
|
+
backgroundSize: `${size}px ${size}px`,
|
|
2859
|
+
maskImage: fade ? "radial-gradient(ellipse at center, black 40%, transparent 80%)" : void 0,
|
|
2860
|
+
WebkitMaskImage: fade ? "radial-gradient(ellipse at center, black 40%, transparent 80%)" : void 0
|
|
2861
|
+
};
|
|
2862
|
+
return /* @__PURE__ */ jsx36(
|
|
2863
|
+
"div",
|
|
2864
|
+
{
|
|
2865
|
+
ref,
|
|
2866
|
+
className,
|
|
2867
|
+
style: { ...baseStyle, ...style },
|
|
2868
|
+
...props
|
|
2869
|
+
}
|
|
2870
|
+
);
|
|
2871
|
+
}
|
|
2872
|
+
);
|
|
2873
|
+
GridPattern.displayName = "GridPattern";
|
|
2874
|
+
|
|
2875
|
+
// src/primitives/35-noise.tsx
|
|
2876
|
+
import { forwardRef as forwardRef35 } from "react";
|
|
2877
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2878
|
+
var Noise = forwardRef35(
|
|
2879
|
+
({
|
|
2880
|
+
opacity = 0.05,
|
|
2881
|
+
blendMode = "overlay",
|
|
2882
|
+
className,
|
|
2883
|
+
style,
|
|
2884
|
+
disabled = false,
|
|
2885
|
+
...props
|
|
2886
|
+
}, ref) => {
|
|
2887
|
+
if (disabled) return null;
|
|
2888
|
+
const noiseSvg = `data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E`;
|
|
2889
|
+
return /* @__PURE__ */ jsx37(
|
|
2890
|
+
"div",
|
|
2891
|
+
{
|
|
2892
|
+
ref,
|
|
2893
|
+
className,
|
|
2894
|
+
style: {
|
|
2895
|
+
position: "absolute",
|
|
2896
|
+
inset: 0,
|
|
2897
|
+
pointerEvents: "none",
|
|
2898
|
+
zIndex: 50,
|
|
2899
|
+
// Usually noise sits on top of everything to texture the whole component
|
|
2900
|
+
opacity,
|
|
2901
|
+
mixBlendMode: blendMode,
|
|
2902
|
+
backgroundImage: `url("${noiseSvg}")`,
|
|
2903
|
+
...style
|
|
2904
|
+
},
|
|
2905
|
+
...props
|
|
2906
|
+
}
|
|
2907
|
+
);
|
|
2908
|
+
}
|
|
2909
|
+
);
|
|
2910
|
+
Noise.displayName = "Noise";
|
|
2911
|
+
|
|
2912
|
+
// src/primitives/36-streaming-text.tsx
|
|
2913
|
+
import React37, { forwardRef as forwardRef36, useEffect as useEffect22, useState as useState16 } from "react";
|
|
2914
|
+
import { motion as motion27 } from "motion/react";
|
|
2915
|
+
import { jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2916
|
+
var StreamingText = forwardRef36(
|
|
2917
|
+
({
|
|
2918
|
+
text,
|
|
2919
|
+
speed = 30,
|
|
2920
|
+
cursor = true,
|
|
2921
|
+
cursorChar = "\u258B",
|
|
2922
|
+
physics: physics2 = "gentle",
|
|
2923
|
+
className,
|
|
2924
|
+
style,
|
|
2925
|
+
onComplete,
|
|
2926
|
+
disabled = false,
|
|
2927
|
+
...props
|
|
2928
|
+
}, ref) => {
|
|
2929
|
+
const isReducedMotion = useReducedMotion();
|
|
2930
|
+
const internalRef = React37.useRef(null);
|
|
2931
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2932
|
+
const [displayedText, setDisplayedText] = useState16("");
|
|
2933
|
+
const [isComplete, setIsComplete] = useState16(false);
|
|
2934
|
+
useEffect22(() => {
|
|
2935
|
+
if (disabled || isReducedMotion) {
|
|
2936
|
+
setDisplayedText(text);
|
|
2937
|
+
setIsComplete(true);
|
|
2938
|
+
onComplete?.();
|
|
2939
|
+
return;
|
|
2940
|
+
}
|
|
2941
|
+
setDisplayedText("");
|
|
2942
|
+
setIsComplete(false);
|
|
2943
|
+
let i = 0;
|
|
2944
|
+
const intervalId = setInterval(() => {
|
|
2945
|
+
setDisplayedText(text.slice(0, i + 1));
|
|
2946
|
+
i++;
|
|
2947
|
+
if (i >= text.length) {
|
|
2948
|
+
clearInterval(intervalId);
|
|
2949
|
+
setIsComplete(true);
|
|
2950
|
+
onComplete?.();
|
|
2951
|
+
}
|
|
2952
|
+
}, speed);
|
|
2953
|
+
return () => clearInterval(intervalId);
|
|
2954
|
+
}, [text, speed, disabled, isReducedMotion, onComplete]);
|
|
2955
|
+
return /* @__PURE__ */ jsxs14("span", { ref: mergedRef, className, style: { whiteSpace: "pre-wrap", ...style }, ...props, children: [
|
|
2956
|
+
displayedText,
|
|
2957
|
+
cursor && (!isComplete || isReducedMotion === false) && /* @__PURE__ */ jsx38(
|
|
2958
|
+
motion27.span,
|
|
2959
|
+
{
|
|
2960
|
+
initial: { opacity: 0 },
|
|
2961
|
+
animate: { opacity: 1 },
|
|
2962
|
+
transition: { repeat: Infinity, duration: 0.8, repeatType: "reverse" },
|
|
2963
|
+
style: { display: "inline-block", marginLeft: "2px", fontWeight: "bold" },
|
|
2964
|
+
children: cursorChar
|
|
2965
|
+
}
|
|
2966
|
+
)
|
|
2967
|
+
] });
|
|
2968
|
+
}
|
|
2969
|
+
);
|
|
2970
|
+
StreamingText.displayName = "StreamingText";
|
|
2971
|
+
|
|
2972
|
+
// src/primitives/37-typing-indicator.tsx
|
|
2973
|
+
import React38, { forwardRef as forwardRef37 } from "react";
|
|
2974
|
+
import { motion as motion28 } from "motion/react";
|
|
2975
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2976
|
+
var TypingIndicator = forwardRef37(
|
|
2977
|
+
({
|
|
2978
|
+
color = "currentColor",
|
|
2979
|
+
size = 6,
|
|
2980
|
+
speed = 0.6,
|
|
2981
|
+
className,
|
|
2982
|
+
style,
|
|
2983
|
+
disabled = false,
|
|
2984
|
+
...props
|
|
2985
|
+
}, ref) => {
|
|
2986
|
+
const isReducedMotion = useReducedMotion();
|
|
2987
|
+
const internalRef = React38.useRef(null);
|
|
2988
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
2989
|
+
if (disabled) return null;
|
|
2990
|
+
const dotStyle = {
|
|
2991
|
+
width: size,
|
|
2992
|
+
height: size,
|
|
2993
|
+
borderRadius: "50%",
|
|
2994
|
+
backgroundColor: color
|
|
2995
|
+
};
|
|
2996
|
+
return /* @__PURE__ */ jsx39(
|
|
2997
|
+
"div",
|
|
2998
|
+
{
|
|
2999
|
+
ref: mergedRef,
|
|
3000
|
+
className,
|
|
3001
|
+
style: { display: "inline-flex", alignItems: "center", gap: size / 2, ...style },
|
|
3002
|
+
...props,
|
|
3003
|
+
children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx39(
|
|
3004
|
+
motion28.div,
|
|
3005
|
+
{
|
|
3006
|
+
style: dotStyle,
|
|
3007
|
+
animate: isReducedMotion ? void 0 : {
|
|
3008
|
+
y: [0, -size, 0],
|
|
3009
|
+
opacity: [0.5, 1, 0.5]
|
|
3010
|
+
},
|
|
3011
|
+
transition: {
|
|
3012
|
+
duration: speed,
|
|
3013
|
+
repeat: Infinity,
|
|
3014
|
+
delay: i * (speed / 3),
|
|
3015
|
+
ease: "easeInOut"
|
|
3016
|
+
}
|
|
3017
|
+
},
|
|
3018
|
+
i
|
|
3019
|
+
))
|
|
3020
|
+
}
|
|
3021
|
+
);
|
|
3022
|
+
}
|
|
3023
|
+
);
|
|
3024
|
+
TypingIndicator.displayName = "TypingIndicator";
|
|
3025
|
+
|
|
3026
|
+
// src/primitives/38-skeleton.tsx
|
|
3027
|
+
import React39, { forwardRef as forwardRef38 } from "react";
|
|
3028
|
+
import { motion as motion29 } from "motion/react";
|
|
3029
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
3030
|
+
var Skeleton = forwardRef38(
|
|
3031
|
+
({
|
|
3032
|
+
width = "100%",
|
|
3033
|
+
height = 20,
|
|
3034
|
+
borderRadius = 8,
|
|
3035
|
+
baseColor = "var(--flux-border, #e5e7eb)",
|
|
3036
|
+
highlightColor = "var(--flux-background, #f9fafb)",
|
|
3037
|
+
speed = 1.5,
|
|
3038
|
+
className,
|
|
3039
|
+
style,
|
|
3040
|
+
disabled = false,
|
|
3041
|
+
...props
|
|
3042
|
+
}, ref) => {
|
|
3043
|
+
const isReducedMotion = useReducedMotion();
|
|
3044
|
+
const internalRef = React39.useRef(null);
|
|
3045
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
3046
|
+
if (disabled) {
|
|
3047
|
+
return /* @__PURE__ */ jsx40(
|
|
3048
|
+
"div",
|
|
3049
|
+
{
|
|
3050
|
+
ref: mergedRef,
|
|
3051
|
+
className,
|
|
3052
|
+
style: { width, height, borderRadius, backgroundColor: baseColor, ...style },
|
|
3053
|
+
...props
|
|
3054
|
+
}
|
|
3055
|
+
);
|
|
3056
|
+
}
|
|
3057
|
+
return /* @__PURE__ */ jsx40(
|
|
3058
|
+
"div",
|
|
3059
|
+
{
|
|
3060
|
+
ref: mergedRef,
|
|
3061
|
+
className,
|
|
3062
|
+
style: {
|
|
3063
|
+
width,
|
|
3064
|
+
height,
|
|
3065
|
+
borderRadius,
|
|
3066
|
+
backgroundColor: baseColor,
|
|
3067
|
+
overflow: "hidden",
|
|
3068
|
+
position: "relative",
|
|
3069
|
+
...style
|
|
3070
|
+
},
|
|
3071
|
+
...props,
|
|
3072
|
+
children: !isReducedMotion && /* @__PURE__ */ jsx40(
|
|
3073
|
+
motion29.div,
|
|
3074
|
+
{
|
|
3075
|
+
style: {
|
|
3076
|
+
position: "absolute",
|
|
3077
|
+
top: 0,
|
|
3078
|
+
left: 0,
|
|
3079
|
+
right: 0,
|
|
3080
|
+
bottom: 0,
|
|
3081
|
+
background: `linear-gradient(90deg, transparent, ${highlightColor}, transparent)`
|
|
3082
|
+
},
|
|
3083
|
+
initial: { x: "-100%" },
|
|
3084
|
+
animate: { x: "100%" },
|
|
3085
|
+
transition: {
|
|
3086
|
+
repeat: Infinity,
|
|
3087
|
+
duration: speed,
|
|
3088
|
+
ease: "linear"
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
)
|
|
3092
|
+
}
|
|
3093
|
+
);
|
|
3094
|
+
}
|
|
3095
|
+
);
|
|
3096
|
+
Skeleton.displayName = "Skeleton";
|
|
3097
|
+
|
|
3098
|
+
// src/primitives/39-ai-message.tsx
|
|
3099
|
+
import React40, { forwardRef as forwardRef39 } from "react";
|
|
3100
|
+
import { motion as motion30 } from "motion/react";
|
|
3101
|
+
import { jsx as jsx41, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3102
|
+
var AIMessage = forwardRef39(
|
|
3103
|
+
({
|
|
3104
|
+
children,
|
|
3105
|
+
role = "assistant",
|
|
3106
|
+
avatar,
|
|
3107
|
+
delay = 0,
|
|
3108
|
+
physics: physics2 = "gentle",
|
|
3109
|
+
className,
|
|
3110
|
+
style,
|
|
3111
|
+
disabled = false,
|
|
3112
|
+
...props
|
|
3113
|
+
}, ref) => {
|
|
3114
|
+
const isReducedMotion = useReducedMotion();
|
|
3115
|
+
const internalRef = React40.useRef(null);
|
|
3116
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
3117
|
+
const springConfig = resolveMotion(physics2, void 0, isReducedMotion);
|
|
3118
|
+
if (disabled) {
|
|
3119
|
+
return /* @__PURE__ */ jsxs15("div", { ref: mergedRef, className, style: { display: "flex", gap: 12, ...style }, ...props, children: [
|
|
3120
|
+
avatar && /* @__PURE__ */ jsx41("div", { children: avatar }),
|
|
3121
|
+
/* @__PURE__ */ jsx41("div", { style: { flex: 1 }, children })
|
|
3122
|
+
] });
|
|
3123
|
+
}
|
|
3124
|
+
const alignment = role === "user" ? "flex-end" : "flex-start";
|
|
3125
|
+
const origin = role === "user" ? "bottom right" : "bottom left";
|
|
3126
|
+
return /* @__PURE__ */ jsxs15(
|
|
3127
|
+
motion30.div,
|
|
3128
|
+
{
|
|
3129
|
+
ref: mergedRef,
|
|
3130
|
+
className,
|
|
3131
|
+
initial: isReducedMotion ? { opacity: 0 } : { opacity: 0, y: 10, scale: 0.95 },
|
|
3132
|
+
animate: { opacity: 1, y: 0, scale: 1 },
|
|
3133
|
+
transition: { ...springConfig, delay },
|
|
3134
|
+
style: {
|
|
3135
|
+
display: "flex",
|
|
3136
|
+
gap: 12,
|
|
3137
|
+
justifyContent: alignment,
|
|
3138
|
+
transformOrigin: origin,
|
|
3139
|
+
...style
|
|
3140
|
+
},
|
|
3141
|
+
...props,
|
|
3142
|
+
children: [
|
|
3143
|
+
role !== "user" && avatar && /* @__PURE__ */ jsx41(
|
|
3144
|
+
motion30.div,
|
|
3145
|
+
{
|
|
3146
|
+
initial: isReducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0 },
|
|
3147
|
+
animate: { opacity: 1, scale: 1 },
|
|
3148
|
+
transition: { ...springConfig, delay: delay + 0.1 },
|
|
3149
|
+
children: avatar
|
|
3150
|
+
}
|
|
3151
|
+
),
|
|
3152
|
+
/* @__PURE__ */ jsx41("div", { style: { flex: 1, maxWidth: "80%" }, children }),
|
|
3153
|
+
role === "user" && avatar && /* @__PURE__ */ jsx41(
|
|
3154
|
+
motion30.div,
|
|
3155
|
+
{
|
|
3156
|
+
initial: isReducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0 },
|
|
3157
|
+
animate: { opacity: 1, scale: 1 },
|
|
3158
|
+
transition: { ...springConfig, delay: delay + 0.1 },
|
|
3159
|
+
children: avatar
|
|
3160
|
+
}
|
|
3161
|
+
)
|
|
3162
|
+
]
|
|
3163
|
+
}
|
|
3164
|
+
);
|
|
3165
|
+
}
|
|
3166
|
+
);
|
|
3167
|
+
AIMessage.displayName = "AIMessage";
|
|
3168
|
+
|
|
3169
|
+
// src/primitives/40-hero-highlight.tsx
|
|
3170
|
+
import React41, { forwardRef as forwardRef40 } from "react";
|
|
3171
|
+
import { motion as motion31, useMotionTemplate as useMotionTemplate3, useMotionValue as useMotionValue8 } from "motion/react";
|
|
3172
|
+
import { jsx as jsx42, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3173
|
+
var HeroHighlight = forwardRef40(
|
|
3174
|
+
({
|
|
3175
|
+
children,
|
|
3176
|
+
containerClassName,
|
|
3177
|
+
className,
|
|
3178
|
+
color = "45, 212, 191",
|
|
3179
|
+
// teal-400 equivalent typically
|
|
3180
|
+
disabled = false,
|
|
3181
|
+
...props
|
|
3182
|
+
}, ref) => {
|
|
3183
|
+
const isReducedMotion = useReducedMotion();
|
|
3184
|
+
const internalRef = React41.useRef(null);
|
|
3185
|
+
const mergedRef = useMergedRef(ref, internalRef);
|
|
3186
|
+
const mouseX = useMotionValue8(0);
|
|
3187
|
+
const mouseY = useMotionValue8(0);
|
|
3188
|
+
function handleMouseMove({ currentTarget, clientX, clientY }) {
|
|
3189
|
+
if (!currentTarget) return;
|
|
3190
|
+
const { left, top } = currentTarget.getBoundingClientRect();
|
|
3191
|
+
mouseX.set(clientX - left);
|
|
3192
|
+
mouseY.set(clientY - top);
|
|
3193
|
+
}
|
|
3194
|
+
if (disabled || isReducedMotion) {
|
|
3195
|
+
return /* @__PURE__ */ jsxs16("div", { ref: mergedRef, className: `relative flex items-center justify-center w-full group ${containerClassName || ""}`, ...props, children: [
|
|
3196
|
+
/* @__PURE__ */ jsx42("div", { className: "absolute inset-0 bg-dot-thick-neutral-300 pointer-events-none" }),
|
|
3197
|
+
/* @__PURE__ */ jsx42("div", { className, children })
|
|
3198
|
+
] });
|
|
3199
|
+
}
|
|
3200
|
+
return /* @__PURE__ */ jsxs16(
|
|
3201
|
+
"div",
|
|
3202
|
+
{
|
|
3203
|
+
ref: mergedRef,
|
|
3204
|
+
className: `relative flex items-center justify-center w-full group ${containerClassName || ""}`,
|
|
3205
|
+
onMouseMove: handleMouseMove,
|
|
3206
|
+
...props,
|
|
3207
|
+
children: [
|
|
3208
|
+
/* @__PURE__ */ jsx42("div", { className: "absolute inset-0 bg-dot-thick-neutral-300 dark:bg-dot-thick-neutral-800 pointer-events-none" }),
|
|
3209
|
+
/* @__PURE__ */ jsx42(
|
|
3210
|
+
motion31.div,
|
|
3211
|
+
{
|
|
3212
|
+
className: "absolute inset-0 opacity-0 transition duration-300 group-hover:opacity-100 pointer-events-none bg-dot-thick-teal-500",
|
|
3213
|
+
style: {
|
|
3214
|
+
WebkitMaskImage: useMotionTemplate3`
|
|
3215
|
+
radial-gradient(
|
|
3216
|
+
200px circle at ${mouseX}px ${mouseY}px,
|
|
3217
|
+
black 0%,
|
|
3218
|
+
transparent 100%
|
|
3219
|
+
)
|
|
3220
|
+
`,
|
|
3221
|
+
maskImage: useMotionTemplate3`
|
|
3222
|
+
radial-gradient(
|
|
3223
|
+
200px circle at ${mouseX}px ${mouseY}px,
|
|
3224
|
+
black 0%,
|
|
3225
|
+
transparent 100%
|
|
3226
|
+
)
|
|
3227
|
+
`
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
),
|
|
3231
|
+
/* @__PURE__ */ jsx42("div", { className, children })
|
|
3232
|
+
]
|
|
3233
|
+
}
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
);
|
|
3237
|
+
HeroHighlight.displayName = "HeroHighlight";
|
|
3238
|
+
var Highlight = ({
|
|
3239
|
+
children,
|
|
3240
|
+
className
|
|
3241
|
+
}) => {
|
|
3242
|
+
const isReducedMotion = useReducedMotion();
|
|
3243
|
+
return /* @__PURE__ */ jsx42(
|
|
3244
|
+
motion31.span,
|
|
3245
|
+
{
|
|
3246
|
+
initial: {
|
|
3247
|
+
backgroundSize: "0% 100%"
|
|
3248
|
+
},
|
|
3249
|
+
animate: {
|
|
3250
|
+
backgroundSize: "100% 100%"
|
|
3251
|
+
},
|
|
3252
|
+
transition: isReducedMotion ? { duration: 0 } : {
|
|
3253
|
+
duration: 2,
|
|
3254
|
+
ease: "linear",
|
|
3255
|
+
delay: 0.5
|
|
3256
|
+
},
|
|
3257
|
+
style: {
|
|
3258
|
+
backgroundRepeat: "no-repeat",
|
|
3259
|
+
backgroundPosition: "left center",
|
|
3260
|
+
display: "inline"
|
|
3261
|
+
},
|
|
3262
|
+
className: `relative inline-block pb-1 px-1 rounded-lg bg-gradient-to-r from-teal-300 to-purple-300 ${className || ""}`,
|
|
3263
|
+
children
|
|
3264
|
+
}
|
|
3265
|
+
);
|
|
3266
|
+
};
|
|
3267
|
+
export {
|
|
3268
|
+
AIMessage,
|
|
3269
|
+
AnimatedList,
|
|
3270
|
+
Aurora,
|
|
3271
|
+
Collapse,
|
|
3272
|
+
CountUp,
|
|
3273
|
+
Dock,
|
|
3274
|
+
DockItem,
|
|
3275
|
+
Drag,
|
|
3276
|
+
FlipCard,
|
|
3277
|
+
FluidLayout,
|
|
3278
|
+
FluxProvider,
|
|
3279
|
+
FollowCursor,
|
|
3280
|
+
GridPattern,
|
|
3281
|
+
HeroHighlight,
|
|
3282
|
+
Highlight,
|
|
3283
|
+
Hover3D,
|
|
3284
|
+
Hover3DLayer,
|
|
3285
|
+
HoverScale,
|
|
3286
|
+
InfiniteScroll,
|
|
3287
|
+
LongPress,
|
|
3288
|
+
Magnetic,
|
|
3289
|
+
Marquee,
|
|
3290
|
+
MeshGradient,
|
|
3291
|
+
Morph,
|
|
3292
|
+
MorphText,
|
|
3293
|
+
Noise,
|
|
3294
|
+
PageTransition,
|
|
3295
|
+
Parallax,
|
|
3296
|
+
Particles,
|
|
3297
|
+
Presence,
|
|
3298
|
+
Reorder,
|
|
3299
|
+
ReorderContext,
|
|
3300
|
+
ReorderDragHandle,
|
|
3301
|
+
Reveal,
|
|
3302
|
+
ScrollProgress,
|
|
3303
|
+
ScrollSnap,
|
|
3304
|
+
ScrollSnapItem,
|
|
3305
|
+
ScrollVelocity,
|
|
3306
|
+
Skeleton,
|
|
3307
|
+
Slot,
|
|
3308
|
+
Spotlight,
|
|
3309
|
+
Stagger,
|
|
3310
|
+
StickyScroll,
|
|
3311
|
+
StreamingText,
|
|
3312
|
+
Swipe,
|
|
3313
|
+
TextReveal,
|
|
3314
|
+
Tilt,
|
|
3315
|
+
TypingIndicator,
|
|
3316
|
+
clamp,
|
|
3317
|
+
motionScale,
|
|
3318
|
+
physics,
|
|
3319
|
+
resolveMotion,
|
|
3320
|
+
useAnimationBudget,
|
|
3321
|
+
useFluxContext,
|
|
3322
|
+
useInView,
|
|
3323
|
+
useIsClient,
|
|
3324
|
+
useMergedRef,
|
|
3325
|
+
usePhysics,
|
|
3326
|
+
usePrefersReducedMotion,
|
|
3327
|
+
useReducedMotion,
|
|
3328
|
+
useScrollProgress
|
|
3329
|
+
};
|
|
3330
|
+
//# sourceMappingURL=index.js.map
|