@web-my-money/blocks 1.0.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/dist/fx.mjs ADDED
@@ -0,0 +1,1084 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-PJO7WJ4G.mjs";
4
+
5
+ // src/fx/aurora-background.tsx
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ function AuroraBackground({
8
+ blur = "80px",
9
+ intensity = 0.6,
10
+ speed = 18,
11
+ vignette = true,
12
+ className
13
+ }) {
14
+ return /* @__PURE__ */ jsxs(
15
+ "div",
16
+ {
17
+ "aria-hidden": true,
18
+ className: cn("pointer-events-none absolute inset-0 overflow-hidden", className),
19
+ style: { opacity: intensity },
20
+ children: [
21
+ /* @__PURE__ */ jsx(
22
+ "div",
23
+ {
24
+ "data-wmm-fx": true,
25
+ className: "absolute -left-[10%] -top-[20%] h-[70%] w-[60%] rounded-full",
26
+ style: {
27
+ background: "radial-gradient(circle at center, color-mix(in srgb, var(--primary) 70%, transparent), transparent 70%)",
28
+ filter: `blur(${blur})`,
29
+ animation: `wmm-aurora-drift ${speed}s var(--ease-in-out, ease-in-out) infinite`
30
+ }
31
+ }
32
+ ),
33
+ /* @__PURE__ */ jsx(
34
+ "div",
35
+ {
36
+ "data-wmm-fx": true,
37
+ className: "absolute -right-[10%] top-[5%] h-[65%] w-[55%] rounded-full",
38
+ style: {
39
+ background: "radial-gradient(circle at center, color-mix(in srgb, var(--accent, var(--primary)) 65%, transparent), transparent 70%)",
40
+ filter: `blur(${blur})`,
41
+ animation: `wmm-aurora-drift-2 ${speed * 1.3}s var(--ease-in-out, ease-in-out) infinite`
42
+ }
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ "data-wmm-fx": true,
49
+ className: "absolute bottom-[-15%] left-[25%] h-[55%] w-[50%] rounded-full",
50
+ style: {
51
+ background: "radial-gradient(circle at center, color-mix(in srgb, var(--primary) 50%, transparent), transparent 70%)",
52
+ filter: `blur(${blur})`,
53
+ animation: `wmm-aurora-drift ${speed * 0.85}s var(--ease-in-out, ease-in-out) infinite reverse`
54
+ }
55
+ }
56
+ ),
57
+ vignette && /* @__PURE__ */ jsx(
58
+ "div",
59
+ {
60
+ className: "absolute inset-0",
61
+ style: { background: "radial-gradient(ellipse at center, transparent 40%, var(--background) 100%)" }
62
+ }
63
+ )
64
+ ]
65
+ }
66
+ );
67
+ }
68
+
69
+ // src/fx/mesh-gradient.tsx
70
+ import { jsx as jsx2 } from "react/jsx-runtime";
71
+ function MeshGradient({
72
+ speed = 15,
73
+ intensity = 0.5,
74
+ static: isStatic = false,
75
+ className
76
+ }) {
77
+ return /* @__PURE__ */ jsx2(
78
+ "div",
79
+ {
80
+ "aria-hidden": true,
81
+ "data-wmm-fx": true,
82
+ className: cn("pointer-events-none absolute inset-0", className),
83
+ style: {
84
+ opacity: intensity,
85
+ backgroundImage: [
86
+ "radial-gradient(at 20% 30%, color-mix(in srgb, var(--primary) 55%, transparent) 0px, transparent 50%)",
87
+ "radial-gradient(at 80% 20%, color-mix(in srgb, var(--accent, var(--primary)) 45%, transparent) 0px, transparent 50%)",
88
+ "radial-gradient(at 70% 80%, color-mix(in srgb, var(--primary) 40%, transparent) 0px, transparent 50%)",
89
+ "radial-gradient(at 25% 75%, color-mix(in srgb, var(--accent, var(--primary)) 35%, transparent) 0px, transparent 50%)"
90
+ ].join(", "),
91
+ backgroundSize: "150% 150%",
92
+ animation: isStatic ? void 0 : `wmm-mesh-pan ${speed}s var(--ease-in-out, ease-in-out) infinite`
93
+ }
94
+ }
95
+ );
96
+ }
97
+
98
+ // src/fx/grid-background.tsx
99
+ import * as React from "react";
100
+ import { jsx as jsx3 } from "react/jsx-runtime";
101
+ function GridBackground({
102
+ variant = "dot",
103
+ size = 32,
104
+ spotlight = false,
105
+ spotlightRadius = 220,
106
+ fade = true,
107
+ className
108
+ }) {
109
+ const ref = React.useRef(null);
110
+ const frame = React.useRef(null);
111
+ React.useEffect(() => {
112
+ if (!spotlight) return;
113
+ const el = ref.current;
114
+ if (!el) return;
115
+ const onMove = (e) => {
116
+ if (frame.current != null) return;
117
+ frame.current = requestAnimationFrame(() => {
118
+ frame.current = null;
119
+ const rect = el.getBoundingClientRect();
120
+ el.style.setProperty("--wmm-x", `${e.clientX - rect.left}px`);
121
+ el.style.setProperty("--wmm-y", `${e.clientY - rect.top}px`);
122
+ });
123
+ };
124
+ window.addEventListener("pointermove", onMove);
125
+ return () => {
126
+ window.removeEventListener("pointermove", onMove);
127
+ if (frame.current != null) cancelAnimationFrame(frame.current);
128
+ };
129
+ }, [spotlight]);
130
+ const lineColor = "color-mix(in srgb, var(--foreground) 10%, transparent)";
131
+ const gridImage = variant === "dot" ? `radial-gradient(${lineColor} 1px, transparent 1px)` : `linear-gradient(${lineColor} 1px, transparent 1px), linear-gradient(90deg, ${lineColor} 1px, transparent 1px)`;
132
+ const maskParts = [];
133
+ if (spotlight) {
134
+ maskParts.push(
135
+ `radial-gradient(${spotlightRadius}px circle at var(--wmm-x, -100%) var(--wmm-y, -100%), black 0%, transparent 100%)`
136
+ );
137
+ } else if (fade) {
138
+ maskParts.push("radial-gradient(ellipse at center, black 50%, transparent 100%)");
139
+ }
140
+ const maskStyle = maskParts.length > 0 ? { WebkitMaskImage: maskParts.join(", "), maskImage: maskParts.join(", ") } : {};
141
+ return /* @__PURE__ */ jsx3(
142
+ "div",
143
+ {
144
+ ref,
145
+ "aria-hidden": true,
146
+ className: cn("pointer-events-none absolute inset-0", className),
147
+ style: {
148
+ backgroundImage: gridImage,
149
+ backgroundSize: `${size}px ${size}px`,
150
+ ...maskStyle
151
+ }
152
+ }
153
+ );
154
+ }
155
+
156
+ // src/fx/spotlight-background.tsx
157
+ import * as React2 from "react";
158
+ import { jsx as jsx4 } from "react/jsx-runtime";
159
+ function SpotlightBackground({
160
+ radius = 400,
161
+ intensity = 0.15,
162
+ idleFloat = true,
163
+ className
164
+ }) {
165
+ const ref = React2.useRef(null);
166
+ const frame = React2.useRef(null);
167
+ const [active, setActive] = React2.useState(false);
168
+ React2.useEffect(() => {
169
+ const el = ref.current;
170
+ if (!el) return;
171
+ const onMove = (e) => {
172
+ if (frame.current != null) return;
173
+ frame.current = requestAnimationFrame(() => {
174
+ frame.current = null;
175
+ const rect = el.getBoundingClientRect();
176
+ el.style.setProperty("--wmm-x", `${e.clientX - rect.left}px`);
177
+ el.style.setProperty("--wmm-y", `${e.clientY - rect.top}px`);
178
+ if (!active) setActive(true);
179
+ });
180
+ };
181
+ window.addEventListener("pointermove", onMove);
182
+ return () => {
183
+ window.removeEventListener("pointermove", onMove);
184
+ if (frame.current != null) cancelAnimationFrame(frame.current);
185
+ };
186
+ }, [active]);
187
+ return /* @__PURE__ */ jsx4(
188
+ "div",
189
+ {
190
+ ref,
191
+ "aria-hidden": true,
192
+ "data-wmm-fx": idleFloat && !active ? "" : void 0,
193
+ className: cn("pointer-events-none absolute inset-0", className),
194
+ style: {
195
+ background: `radial-gradient(${radius}px circle at var(--wmm-x, 50%) var(--wmm-y, 30%), color-mix(in srgb, var(--primary) ${Math.round(
196
+ intensity * 100
197
+ )}%, transparent), transparent 80%)`,
198
+ animation: idleFloat && !active ? "wmm-float 7s var(--ease-in-out, ease-in-out) infinite" : void 0,
199
+ transition: "background 120ms linear"
200
+ }
201
+ }
202
+ );
203
+ }
204
+
205
+ // src/fx/particle-field.tsx
206
+ import * as React3 from "react";
207
+ import { jsx as jsx5 } from "react/jsx-runtime";
208
+ function ParticleField({
209
+ count = 60,
210
+ connect = true,
211
+ linkDistance = 130,
212
+ color,
213
+ speed = 1,
214
+ interactive = true,
215
+ className
216
+ }) {
217
+ const canvasRef = React3.useRef(null);
218
+ React3.useEffect(() => {
219
+ const canvas = canvasRef.current;
220
+ if (!canvas) return;
221
+ const ctx = canvas.getContext("2d");
222
+ if (!ctx) return;
223
+ const reduced = typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
224
+ const resolvedColor = color || getComputedStyle(canvas).getPropertyValue("--primary").trim() || "currentColor";
225
+ let width = 0;
226
+ let height = 0;
227
+ let dpr = 1;
228
+ let particles = [];
229
+ const mouse = { x: -9999, y: -9999 };
230
+ const isSmall = typeof window !== "undefined" && window.innerWidth < 768;
231
+ const n = Math.max(8, Math.round(isSmall ? count * 0.5 : count));
232
+ const resize = () => {
233
+ const parent = canvas.parentElement;
234
+ if (!parent) return;
235
+ dpr = Math.min(window.devicePixelRatio || 1, 1.5);
236
+ width = parent.clientWidth;
237
+ height = parent.clientHeight;
238
+ canvas.width = width * dpr;
239
+ canvas.height = height * dpr;
240
+ canvas.style.width = `${width}px`;
241
+ canvas.style.height = `${height}px`;
242
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
243
+ };
244
+ const seed = () => {
245
+ particles = Array.from({ length: n }, () => ({
246
+ x: Math.random() * width,
247
+ y: Math.random() * height,
248
+ vx: (Math.random() - 0.5) * 0.4 * speed,
249
+ vy: (Math.random() - 0.5) * 0.4 * speed
250
+ }));
251
+ };
252
+ const draw = () => {
253
+ ctx.clearRect(0, 0, width, height);
254
+ for (const p of particles) {
255
+ ctx.beginPath();
256
+ ctx.arc(p.x, p.y, 1.6, 0, Math.PI * 2);
257
+ ctx.fillStyle = resolvedColor;
258
+ ctx.globalAlpha = 0.7;
259
+ ctx.fill();
260
+ }
261
+ if (connect) {
262
+ for (let i = 0; i < particles.length; i++) {
263
+ for (let j = i + 1; j < particles.length; j++) {
264
+ const a = particles[i];
265
+ const b = particles[j];
266
+ const dx = a.x - b.x;
267
+ const dy = a.y - b.y;
268
+ const dist = Math.hypot(dx, dy);
269
+ if (dist < linkDistance) {
270
+ ctx.beginPath();
271
+ ctx.moveTo(a.x, a.y);
272
+ ctx.lineTo(b.x, b.y);
273
+ ctx.strokeStyle = resolvedColor;
274
+ ctx.globalAlpha = (1 - dist / linkDistance) * 0.25;
275
+ ctx.lineWidth = 1;
276
+ ctx.stroke();
277
+ }
278
+ }
279
+ }
280
+ }
281
+ ctx.globalAlpha = 1;
282
+ };
283
+ const step = () => {
284
+ for (const p of particles) {
285
+ p.x += p.vx;
286
+ p.y += p.vy;
287
+ if (interactive) {
288
+ const dx = mouse.x - p.x;
289
+ const dy = mouse.y - p.y;
290
+ const d = Math.hypot(dx, dy);
291
+ if (d < 120 && d > 0.1) {
292
+ p.x += dx / d * 0.4;
293
+ p.y += dy / d * 0.4;
294
+ }
295
+ }
296
+ if (p.x < 0 || p.x > width) p.vx *= -1;
297
+ if (p.y < 0 || p.y > height) p.vy *= -1;
298
+ p.x = Math.max(0, Math.min(width, p.x));
299
+ p.y = Math.max(0, Math.min(height, p.y));
300
+ }
301
+ draw();
302
+ };
303
+ let raf = 0;
304
+ let running = false;
305
+ const loop = () => {
306
+ step();
307
+ raf = requestAnimationFrame(loop);
308
+ };
309
+ const start = () => {
310
+ if (running || reduced) return;
311
+ running = true;
312
+ raf = requestAnimationFrame(loop);
313
+ };
314
+ const stop = () => {
315
+ running = false;
316
+ cancelAnimationFrame(raf);
317
+ };
318
+ resize();
319
+ seed();
320
+ draw();
321
+ const io = new IntersectionObserver(
322
+ ([entry]) => entry.isIntersecting ? start() : stop(),
323
+ { threshold: 0.01 }
324
+ );
325
+ io.observe(canvas);
326
+ const onVisibility = () => document.hidden ? stop() : start();
327
+ const onResize = () => {
328
+ resize();
329
+ seed();
330
+ };
331
+ const onMove = (e) => {
332
+ const rect = canvas.getBoundingClientRect();
333
+ mouse.x = e.clientX - rect.left;
334
+ mouse.y = e.clientY - rect.top;
335
+ };
336
+ const onLeave = () => {
337
+ mouse.x = -9999;
338
+ mouse.y = -9999;
339
+ };
340
+ document.addEventListener("visibilitychange", onVisibility);
341
+ window.addEventListener("resize", onResize);
342
+ if (interactive) {
343
+ window.addEventListener("pointermove", onMove);
344
+ window.addEventListener("pointerleave", onLeave);
345
+ }
346
+ return () => {
347
+ stop();
348
+ io.disconnect();
349
+ document.removeEventListener("visibilitychange", onVisibility);
350
+ window.removeEventListener("resize", onResize);
351
+ window.removeEventListener("pointermove", onMove);
352
+ window.removeEventListener("pointerleave", onLeave);
353
+ };
354
+ }, [count, connect, linkDistance, color, speed, interactive]);
355
+ return /* @__PURE__ */ jsx5(
356
+ "canvas",
357
+ {
358
+ ref: canvasRef,
359
+ "aria-hidden": true,
360
+ className: cn("pointer-events-none absolute inset-0 h-full w-full", className)
361
+ }
362
+ );
363
+ }
364
+
365
+ // src/fx/noise-overlay.tsx
366
+ import { jsx as jsx6 } from "react/jsx-runtime";
367
+ var NOISE_SVG = encodeURIComponent(
368
+ `<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>`
369
+ ).replace(/%23/g, "%23");
370
+ function NoiseOverlay({ opacity = 0.04, blend = "overlay", className }) {
371
+ return /* @__PURE__ */ jsx6(
372
+ "div",
373
+ {
374
+ "aria-hidden": true,
375
+ className: cn("pointer-events-none absolute inset-0", className),
376
+ style: {
377
+ opacity,
378
+ mixBlendMode: blend,
379
+ backgroundImage: `url("data:image/svg+xml,${NOISE_SVG}")`,
380
+ backgroundSize: "120px 120px"
381
+ }
382
+ }
383
+ );
384
+ }
385
+
386
+ // src/fx/preferences.tsx
387
+ import * as React4 from "react";
388
+ import { jsx as jsx7 } from "react/jsx-runtime";
389
+ var BACKGROUND_VARIANTS = [
390
+ "none",
391
+ "aurora",
392
+ "mesh",
393
+ "grid",
394
+ "spotlight",
395
+ "particles"
396
+ ];
397
+ var Ctx = React4.createContext(null);
398
+ var PREFS_KEY = "wmm-fx-prefs";
399
+ var THEME_KEY = "wmm-theme";
400
+ function readStored() {
401
+ if (typeof window === "undefined") return {};
402
+ try {
403
+ return JSON.parse(window.localStorage.getItem(PREFS_KEY) || "{}");
404
+ } catch {
405
+ return {};
406
+ }
407
+ }
408
+ function FxPreferencesProvider({
409
+ children,
410
+ defaultBackground = "none"
411
+ }) {
412
+ const [background, setBackgroundState] = React4.useState(defaultBackground);
413
+ const [logo, setLogoState] = React4.useState(null);
414
+ const [theme, setThemeState] = React4.useState("dark");
415
+ React4.useEffect(() => {
416
+ const stored = readStored();
417
+ if (stored.background) setBackgroundState(stored.background);
418
+ if (stored.logo !== void 0) setLogoState(stored.logo ?? null);
419
+ const domTheme = document.documentElement.dataset.theme || void 0;
420
+ const lsTheme = window.localStorage.getItem(THEME_KEY) || void 0;
421
+ if (domTheme || lsTheme) setThemeState(domTheme || lsTheme || "dark");
422
+ }, []);
423
+ const persist = React4.useCallback((next) => {
424
+ if (typeof window === "undefined") return;
425
+ const merged = { ...readStored(), ...next };
426
+ window.localStorage.setItem(PREFS_KEY, JSON.stringify(merged));
427
+ }, []);
428
+ const setBackground = React4.useCallback(
429
+ (b) => {
430
+ setBackgroundState(b);
431
+ persist({ background: b });
432
+ },
433
+ [persist]
434
+ );
435
+ const setLogo = React4.useCallback(
436
+ (id) => {
437
+ setLogoState(id);
438
+ persist({ logo: id });
439
+ },
440
+ [persist]
441
+ );
442
+ const setTheme = React4.useCallback((t) => {
443
+ setThemeState(t);
444
+ if (typeof document !== "undefined") {
445
+ document.documentElement.dataset.theme = t;
446
+ try {
447
+ window.localStorage.setItem(THEME_KEY, t);
448
+ } catch {
449
+ }
450
+ }
451
+ }, []);
452
+ const value = React4.useMemo(
453
+ () => ({ background, setBackground, logo, setLogo, theme, setTheme }),
454
+ [background, setBackground, logo, setLogo, theme, setTheme]
455
+ );
456
+ return /* @__PURE__ */ jsx7(Ctx.Provider, { value, children });
457
+ }
458
+ function useFxPreferences() {
459
+ const ctx = React4.useContext(Ctx);
460
+ if (!ctx) throw new Error("useFxPreferences must be used within <FxPreferencesProvider>");
461
+ return ctx;
462
+ }
463
+ function useOptionalFxPreferences() {
464
+ return React4.useContext(Ctx);
465
+ }
466
+
467
+ // src/fx/dynamic-background.tsx
468
+ import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
469
+ function DynamicBackground({
470
+ variant,
471
+ noise = false,
472
+ aurora,
473
+ mesh,
474
+ grid,
475
+ spotlight,
476
+ particles,
477
+ className
478
+ }) {
479
+ const prefs = useOptionalFxPreferences();
480
+ const active = variant ?? prefs?.background ?? "none";
481
+ let bg = null;
482
+ switch (active) {
483
+ case "aurora":
484
+ bg = /* @__PURE__ */ jsx8(AuroraBackground, { ...aurora });
485
+ break;
486
+ case "mesh":
487
+ bg = /* @__PURE__ */ jsx8(MeshGradient, { ...mesh });
488
+ break;
489
+ case "grid":
490
+ bg = /* @__PURE__ */ jsx8(GridBackground, { ...grid });
491
+ break;
492
+ case "spotlight":
493
+ bg = /* @__PURE__ */ jsx8(SpotlightBackground, { ...spotlight });
494
+ break;
495
+ case "particles":
496
+ bg = /* @__PURE__ */ jsx8(ParticleField, { ...particles });
497
+ break;
498
+ case "none":
499
+ default:
500
+ bg = null;
501
+ }
502
+ if (!bg && !noise) return null;
503
+ return /* @__PURE__ */ jsxs2("div", { "aria-hidden": true, className: className ?? "pointer-events-none absolute inset-0 overflow-hidden", children: [
504
+ bg,
505
+ noise && /* @__PURE__ */ jsx8(NoiseOverlay, {})
506
+ ] });
507
+ }
508
+
509
+ // src/fx/spotlight-card.tsx
510
+ import * as React5 from "react";
511
+ import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
512
+ function SpotlightCard({
513
+ radius = 320,
514
+ intensity = 0.12,
515
+ borderGlow = true,
516
+ className,
517
+ children,
518
+ style,
519
+ ...rest
520
+ }) {
521
+ const ref = React5.useRef(null);
522
+ const frame = React5.useRef(null);
523
+ const onMove = React5.useCallback((e) => {
524
+ const el = ref.current;
525
+ if (!el || frame.current != null) return;
526
+ const cx = e.clientX;
527
+ const cy = e.clientY;
528
+ frame.current = requestAnimationFrame(() => {
529
+ frame.current = null;
530
+ const rect = el.getBoundingClientRect();
531
+ el.style.setProperty("--wmm-x", `${cx - rect.left}px`);
532
+ el.style.setProperty("--wmm-y", `${cy - rect.top}px`);
533
+ });
534
+ }, []);
535
+ return /* @__PURE__ */ jsxs3(
536
+ "div",
537
+ {
538
+ ref,
539
+ onPointerMove: onMove,
540
+ className: cn(
541
+ "group/spot relative overflow-hidden rounded-2xl border border-border bg-card",
542
+ className
543
+ ),
544
+ style,
545
+ ...rest,
546
+ children: [
547
+ /* @__PURE__ */ jsx9(
548
+ "div",
549
+ {
550
+ "aria-hidden": true,
551
+ className: "pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover/spot:opacity-100",
552
+ style: {
553
+ background: `radial-gradient(${radius}px circle at var(--wmm-x, 50%) var(--wmm-y, 50%), color-mix(in srgb, var(--primary) ${Math.round(
554
+ intensity * 100
555
+ )}%, transparent), transparent 70%)`
556
+ }
557
+ }
558
+ ),
559
+ borderGlow && /* @__PURE__ */ jsx9(
560
+ "div",
561
+ {
562
+ "aria-hidden": true,
563
+ className: "pointer-events-none absolute inset-0 rounded-2xl opacity-0 transition-opacity duration-300 group-hover/spot:opacity-100",
564
+ style: {
565
+ background: `radial-gradient(${radius}px circle at var(--wmm-x, 50%) var(--wmm-y, 50%), color-mix(in srgb, var(--primary) 40%, transparent), transparent 60%)`,
566
+ WebkitMask: "linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",
567
+ WebkitMaskComposite: "xor",
568
+ maskComposite: "exclude",
569
+ padding: 1
570
+ }
571
+ }
572
+ ),
573
+ /* @__PURE__ */ jsx9("div", { className: "relative", children })
574
+ ]
575
+ }
576
+ );
577
+ }
578
+
579
+ // src/fx/tilt-card.tsx
580
+ import * as React6 from "react";
581
+ import { motion, useMotionTemplate, useMotionValue, useSpring, useTransform } from "framer-motion";
582
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
583
+ function TiltCard({
584
+ max = 10,
585
+ lift = 0,
586
+ glare = true,
587
+ className,
588
+ children,
589
+ style,
590
+ ...rest
591
+ }) {
592
+ const ref = React6.useRef(null);
593
+ const px = useMotionValue(0.5);
594
+ const py = useMotionValue(0.5);
595
+ const sx = useSpring(px, { stiffness: 220, damping: 18 });
596
+ const sy = useSpring(py, { stiffness: 220, damping: 18 });
597
+ const rotateX = useTransform(sy, [0, 1], [max, -max]);
598
+ const rotateY = useTransform(sx, [0, 1], [-max, max]);
599
+ const glareX = useTransform(sx, [0, 1], ["0%", "100%"]);
600
+ const glareY = useTransform(sy, [0, 1], ["0%", "100%"]);
601
+ const glareBg = useMotionTemplate`radial-gradient(circle at ${glareX} ${glareY}, color-mix(in srgb, var(--foreground) 18%, transparent), transparent 60%)`;
602
+ const onMove = (e) => {
603
+ const el = ref.current;
604
+ if (!el) return;
605
+ const rect = el.getBoundingClientRect();
606
+ px.set((e.clientX - rect.left) / rect.width);
607
+ py.set((e.clientY - rect.top) / rect.height);
608
+ };
609
+ const onLeave = () => {
610
+ px.set(0.5);
611
+ py.set(0.5);
612
+ };
613
+ return /* @__PURE__ */ jsx10(
614
+ motion.div,
615
+ {
616
+ ref,
617
+ onPointerMove: onMove,
618
+ onPointerLeave: onLeave,
619
+ style: { perspective: 900, ...style },
620
+ className: cn("relative", className),
621
+ ...rest,
622
+ children: /* @__PURE__ */ jsxs4(
623
+ motion.div,
624
+ {
625
+ style: { rotateX, rotateY, transformStyle: "preserve-3d", translateZ: lift },
626
+ className: "relative h-full w-full rounded-2xl",
627
+ children: [
628
+ children,
629
+ glare && /* @__PURE__ */ jsx10(
630
+ motion.div,
631
+ {
632
+ "aria-hidden": true,
633
+ className: "pointer-events-none absolute inset-0 rounded-2xl",
634
+ style: { background: glareBg }
635
+ }
636
+ )
637
+ ]
638
+ }
639
+ )
640
+ }
641
+ );
642
+ }
643
+
644
+ // src/fx/magnetic.tsx
645
+ import * as React7 from "react";
646
+ import { motion as motion2, useMotionValue as useMotionValue2, useSpring as useSpring2 } from "framer-motion";
647
+ import { jsx as jsx11 } from "react/jsx-runtime";
648
+ function Magnetic({ strength = 0.35, radius = 120, className, children }) {
649
+ const ref = React7.useRef(null);
650
+ const x = useMotionValue2(0);
651
+ const y = useMotionValue2(0);
652
+ const sx = useSpring2(x, { stiffness: 260, damping: 16, mass: 0.4 });
653
+ const sy = useSpring2(y, { stiffness: 260, damping: 16, mass: 0.4 });
654
+ React7.useEffect(() => {
655
+ const el = ref.current;
656
+ if (!el) return;
657
+ const onMove = (e) => {
658
+ const rect = el.getBoundingClientRect();
659
+ const cx = rect.left + rect.width / 2;
660
+ const cy = rect.top + rect.height / 2;
661
+ const dx = e.clientX - cx;
662
+ const dy = e.clientY - cy;
663
+ const dist = Math.hypot(dx, dy);
664
+ if (dist < radius) {
665
+ x.set(dx * strength);
666
+ y.set(dy * strength);
667
+ } else {
668
+ x.set(0);
669
+ y.set(0);
670
+ }
671
+ };
672
+ window.addEventListener("pointermove", onMove);
673
+ return () => window.removeEventListener("pointermove", onMove);
674
+ }, [strength, radius, x, y]);
675
+ return /* @__PURE__ */ jsx11(motion2.div, { ref, style: { x: sx, y: sy }, className: cn("inline-flex", className), children });
676
+ }
677
+
678
+ // src/fx/border-beam.tsx
679
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
680
+ function BorderBeam({
681
+ size = 1.5,
682
+ speed = 6,
683
+ radius = 16,
684
+ color = "var(--primary)",
685
+ className
686
+ }) {
687
+ return /* @__PURE__ */ jsxs5(
688
+ "div",
689
+ {
690
+ "aria-hidden": true,
691
+ className: cn("pointer-events-none absolute inset-0 overflow-hidden", className),
692
+ style: { borderRadius: radius },
693
+ children: [
694
+ /* @__PURE__ */ jsx12(
695
+ "div",
696
+ {
697
+ "data-wmm-fx": true,
698
+ className: "absolute left-1/2 top-1/2 aspect-square w-[140%]",
699
+ style: {
700
+ background: `conic-gradient(from 0deg, transparent 0deg, ${color} 60deg, transparent 120deg)`,
701
+ animation: `wmm-border-spin ${speed}s linear infinite`,
702
+ transform: "translate(-50%, -50%)"
703
+ }
704
+ }
705
+ ),
706
+ /* @__PURE__ */ jsx12(
707
+ "div",
708
+ {
709
+ className: "absolute bg-card",
710
+ style: { inset: size, borderRadius: Math.max(0, radius - size) }
711
+ }
712
+ )
713
+ ]
714
+ }
715
+ );
716
+ }
717
+
718
+ // src/fx/logo-3d.tsx
719
+ import * as React8 from "react";
720
+ import { motion as motion3, useMotionTemplate as useMotionTemplate2, useMotionValue as useMotionValue3, useSpring as useSpring3, useTransform as useTransform2 } from "framer-motion";
721
+ import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
722
+ function Logo3D({
723
+ children,
724
+ max = 18,
725
+ idle = true,
726
+ shadow = true,
727
+ sheen = true,
728
+ className
729
+ }) {
730
+ const ref = React8.useRef(null);
731
+ const px = useMotionValue3(0.5);
732
+ const py = useMotionValue3(0.5);
733
+ const sx = useSpring3(px, { stiffness: 150, damping: 15 });
734
+ const sy = useSpring3(py, { stiffness: 150, damping: 15 });
735
+ const [hovering, setHovering] = React8.useState(false);
736
+ const rotateX = useTransform2(sy, [0, 1], [max, -max]);
737
+ const rotateY = useTransform2(sx, [0, 1], [-max, max]);
738
+ const sheenX = useTransform2(sx, [0, 1], ["0%", "100%"]);
739
+ const sheenY = useTransform2(sy, [0, 1], ["0%", "100%"]);
740
+ const sheenBg = useMotionTemplate2`radial-gradient(circle at ${sheenX} ${sheenY}, color-mix(in srgb, var(--foreground) 35%, transparent), transparent 55%)`;
741
+ const onMove = (e) => {
742
+ const el = ref.current;
743
+ if (!el) return;
744
+ const rect = el.getBoundingClientRect();
745
+ px.set((e.clientX - rect.left) / rect.width);
746
+ py.set((e.clientY - rect.top) / rect.height);
747
+ };
748
+ const onLeave = () => {
749
+ setHovering(false);
750
+ px.set(0.5);
751
+ py.set(0.5);
752
+ };
753
+ return /* @__PURE__ */ jsxs6(
754
+ "div",
755
+ {
756
+ ref,
757
+ onPointerMove: onMove,
758
+ onPointerEnter: () => setHovering(true),
759
+ onPointerLeave: onLeave,
760
+ className: cn("relative inline-flex select-none", className),
761
+ style: { perspective: 800 },
762
+ children: [
763
+ /* @__PURE__ */ jsxs6(
764
+ motion3.div,
765
+ {
766
+ "data-wmm-fx": idle && !hovering ? "" : void 0,
767
+ style: { rotateX, rotateY, transformStyle: "preserve-3d" },
768
+ className: "relative",
769
+ animate: idle && !hovering ? { y: [0, -8, 0] } : { y: 0 },
770
+ transition: idle && !hovering ? { duration: 5, repeat: Infinity, ease: "easeInOut" } : { duration: 0.3 },
771
+ children: [
772
+ /* @__PURE__ */ jsx13("div", { style: { transform: "translateZ(40px)" }, children }),
773
+ sheen && /* @__PURE__ */ jsx13(
774
+ motion3.div,
775
+ {
776
+ "aria-hidden": true,
777
+ className: "pointer-events-none absolute inset-0 mix-blend-overlay",
778
+ style: { background: sheenBg, transform: "translateZ(41px)" }
779
+ }
780
+ )
781
+ ]
782
+ }
783
+ ),
784
+ shadow && /* @__PURE__ */ jsx13(
785
+ "div",
786
+ {
787
+ "aria-hidden": true,
788
+ className: "pointer-events-none absolute -bottom-4 left-1/2 h-4 w-2/3 -translate-x-1/2 rounded-[50%]",
789
+ style: { background: "color-mix(in srgb, var(--foreground) 30%, transparent)", filter: "blur(12px)" }
790
+ }
791
+ )
792
+ ]
793
+ }
794
+ );
795
+ }
796
+
797
+ // src/fx/text-shimmer.tsx
798
+ import * as React9 from "react";
799
+ function TextShimmer({ children, className, duration = 2.5, as = "span" }) {
800
+ return React9.createElement(
801
+ as,
802
+ {
803
+ "data-wmm-fx": true,
804
+ className: cn("inline-block bg-clip-text text-transparent", className),
805
+ style: {
806
+ backgroundImage: "linear-gradient(90deg, var(--muted-foreground) 0%, var(--foreground) 50%, var(--muted-foreground) 100%)",
807
+ backgroundSize: "200% 100%",
808
+ animation: `wmm-shimmer ${duration}s linear infinite`
809
+ }
810
+ },
811
+ children
812
+ );
813
+ }
814
+
815
+ // src/fx/dock.tsx
816
+ import * as React10 from "react";
817
+ import { motion as motion4, useMotionValue as useMotionValue4, useSpring as useSpring4, useTransform as useTransform3 } from "framer-motion";
818
+ import { jsx as jsx14 } from "react/jsx-runtime";
819
+ var MouseCtx = React10.createContext(null);
820
+ function Dock({ children, className, maxSize = 64, baseSize = 44 }) {
821
+ const mouseX = useMotionValue4(Infinity);
822
+ return /* @__PURE__ */ jsx14(MouseCtx.Provider, { value: mouseX, children: /* @__PURE__ */ jsx14(
823
+ "div",
824
+ {
825
+ "data-wmm-fx": true,
826
+ onMouseMove: (e) => mouseX.set(e.pageX),
827
+ onMouseLeave: () => mouseX.set(Infinity),
828
+ className: cn(
829
+ "mx-auto flex items-end gap-3 rounded-2xl border border-border bg-card/80 px-3 pb-2 pt-2 backdrop-blur",
830
+ className
831
+ ),
832
+ style: { height: maxSize + 16 },
833
+ children: React10.Children.map(children, (child) => /* @__PURE__ */ jsx14(DockSlot, { maxSize, baseSize, children: child }))
834
+ }
835
+ ) });
836
+ }
837
+ function DockSlot({ children, maxSize, baseSize }) {
838
+ const ref = React10.useRef(null);
839
+ const mouseX = React10.useContext(MouseCtx);
840
+ const distance = useTransform3(mouseX, (val) => {
841
+ const b = ref.current?.getBoundingClientRect() ?? { x: 0, width: baseSize };
842
+ return val - b.x - b.width / 2;
843
+ });
844
+ const sizeRaw = useTransform3(distance, [-150, 0, 150], [baseSize, maxSize, baseSize]);
845
+ const size = useSpring4(sizeRaw, { mass: 0.1, stiffness: 150, damping: 12 });
846
+ return /* @__PURE__ */ jsx14(
847
+ motion4.div,
848
+ {
849
+ ref,
850
+ style: { width: size, height: size },
851
+ className: "flex items-center justify-center rounded-xl bg-muted text-foreground",
852
+ children
853
+ }
854
+ );
855
+ }
856
+
857
+ // src/fx/design-studio.tsx
858
+ import * as React11 from "react";
859
+ import { AnimatePresence, motion as motion5 } from "framer-motion";
860
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
861
+ var THEMES = [
862
+ { id: "light", label: "Light" },
863
+ { id: "dark", label: "Dark" },
864
+ { id: "wmm", label: "WMM" }
865
+ ];
866
+ var BG_LABEL = {
867
+ none: "None",
868
+ aurora: "Aurora",
869
+ mesh: "Mesh",
870
+ grid: "Grid",
871
+ spotlight: "Spotlight",
872
+ particles: "Particles"
873
+ };
874
+ var POSITION = {
875
+ "bottom-right": "bottom-5 right-5 origin-bottom-right",
876
+ "bottom-left": "bottom-5 left-5 origin-bottom-left",
877
+ "top-right": "top-5 right-5 origin-top-right",
878
+ "top-left": "top-5 left-5 origin-top-left"
879
+ };
880
+ function SparkleIcon() {
881
+ return /* @__PURE__ */ jsxs7("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [
882
+ /* @__PURE__ */ jsx15(
883
+ "path",
884
+ {
885
+ d: "M12 3l1.8 4.9L18.7 9 13.8 10.8 12 15.6 10.2 10.8 5.3 9l4.9-1.1L12 3z",
886
+ fill: "currentColor"
887
+ }
888
+ ),
889
+ /* @__PURE__ */ jsx15("path", { d: "M18.5 14.5l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7.7-1.9z", fill: "currentColor" })
890
+ ] });
891
+ }
892
+ function CloseIcon() {
893
+ return /* @__PURE__ */ jsx15("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "M6 6l12 12M18 6L6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) });
894
+ }
895
+ function BgSwatch({ variant }) {
896
+ const common = "absolute inset-0";
897
+ switch (variant) {
898
+ case "aurora":
899
+ return /* @__PURE__ */ jsx15(
900
+ "div",
901
+ {
902
+ className: common,
903
+ style: {
904
+ background: "radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--primary) 80%, transparent), transparent 60%), radial-gradient(circle at 70% 70%, color-mix(in srgb, var(--accent, var(--primary)) 70%, transparent), transparent 60%)",
905
+ filter: "blur(4px)"
906
+ }
907
+ }
908
+ );
909
+ case "mesh":
910
+ return /* @__PURE__ */ jsx15(
911
+ "div",
912
+ {
913
+ className: common,
914
+ style: {
915
+ background: "radial-gradient(at 20% 30%, color-mix(in srgb, var(--primary) 70%, transparent), transparent 50%), radial-gradient(at 80% 70%, color-mix(in srgb, var(--accent, var(--primary)) 60%, transparent), transparent 50%)"
916
+ }
917
+ }
918
+ );
919
+ case "grid":
920
+ return /* @__PURE__ */ jsx15(
921
+ "div",
922
+ {
923
+ className: common,
924
+ style: {
925
+ backgroundImage: "radial-gradient(color-mix(in srgb, var(--foreground) 35%, transparent) 1px, transparent 1px)",
926
+ backgroundSize: "8px 8px"
927
+ }
928
+ }
929
+ );
930
+ case "spotlight":
931
+ return /* @__PURE__ */ jsx15(
932
+ "div",
933
+ {
934
+ className: common,
935
+ style: {
936
+ background: "radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--primary) 60%, transparent), transparent 70%)"
937
+ }
938
+ }
939
+ );
940
+ case "particles":
941
+ return /* @__PURE__ */ jsxs7("div", { className: common, children: [
942
+ /* @__PURE__ */ jsx15("div", { className: "absolute left-1/4 top-1/3 h-1 w-1 rounded-full bg-primary" }),
943
+ /* @__PURE__ */ jsx15("div", { className: "absolute left-2/3 top-1/4 h-1 w-1 rounded-full bg-primary" }),
944
+ /* @__PURE__ */ jsx15("div", { className: "absolute left-1/2 top-2/3 h-1 w-1 rounded-full bg-primary" }),
945
+ /* @__PURE__ */ jsx15("div", { className: "absolute left-1/3 top-3/4 h-px w-1/3 rotate-12 bg-primary/40" })
946
+ ] });
947
+ case "none":
948
+ default:
949
+ return /* @__PURE__ */ jsx15("div", { className: cn(common, "bg-muted/40") });
950
+ }
951
+ }
952
+ function DesignStudio({
953
+ position = "bottom-right",
954
+ title = "Design Studio",
955
+ showThemes = true,
956
+ showBackgrounds = true,
957
+ logos,
958
+ defaultOpen = false,
959
+ className
960
+ }) {
961
+ const { background, setBackground, theme, setTheme, logo, setLogo } = useFxPreferences();
962
+ const [open, setOpen] = React11.useState(defaultOpen);
963
+ return /* @__PURE__ */ jsx15("div", { className: cn("fixed z-[1400]", POSITION[position], className), children: /* @__PURE__ */ jsx15(AnimatePresence, { mode: "popLayout", children: open ? /* @__PURE__ */ jsxs7(
964
+ motion5.div,
965
+ {
966
+ initial: { opacity: 0, scale: 0.9, y: 8 },
967
+ animate: { opacity: 1, scale: 1, y: 0 },
968
+ exit: { opacity: 0, scale: 0.9, y: 8 },
969
+ transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
970
+ className: "w-72 rounded-2xl border border-border bg-card/95 p-4 text-foreground shadow-2xl backdrop-blur-xl",
971
+ style: { boxShadow: "var(--shadow-dialog, 0 20px 60px rgba(0,0,0,0.4))" },
972
+ children: [
973
+ /* @__PURE__ */ jsxs7("div", { className: "mb-3 flex items-center justify-between", children: [
974
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 text-sm font-semibold", children: [
975
+ /* @__PURE__ */ jsx15("span", { className: "text-primary", children: /* @__PURE__ */ jsx15(SparkleIcon, {}) }),
976
+ title
977
+ ] }),
978
+ /* @__PURE__ */ jsx15(
979
+ "button",
980
+ {
981
+ onClick: () => setOpen(false),
982
+ "aria-label": "Close design studio",
983
+ className: "rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
984
+ children: /* @__PURE__ */ jsx15(CloseIcon, {})
985
+ }
986
+ )
987
+ ] }),
988
+ showThemes && /* @__PURE__ */ jsxs7("section", { className: "mb-4", children: [
989
+ /* @__PURE__ */ jsx15("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Theme" }),
990
+ /* @__PURE__ */ jsx15("div", { className: "grid grid-cols-3 gap-1.5", children: THEMES.map((t) => /* @__PURE__ */ jsx15(
991
+ "button",
992
+ {
993
+ onClick: () => setTheme(t.id),
994
+ className: cn(
995
+ "rounded-lg border px-2 py-1.5 text-xs font-medium transition-colors",
996
+ theme === t.id ? "border-primary bg-primary text-primary-foreground" : "border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"
997
+ ),
998
+ children: t.label
999
+ },
1000
+ t.id
1001
+ )) })
1002
+ ] }),
1003
+ showBackgrounds && /* @__PURE__ */ jsxs7("section", { className: "mb-1", children: [
1004
+ /* @__PURE__ */ jsx15("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Background" }),
1005
+ /* @__PURE__ */ jsx15("div", { className: "grid grid-cols-3 gap-1.5", children: BACKGROUND_VARIANTS.map((v) => /* @__PURE__ */ jsxs7(
1006
+ "button",
1007
+ {
1008
+ onClick: () => setBackground(v),
1009
+ className: cn(
1010
+ "group relative flex h-14 flex-col overflow-hidden rounded-lg border text-left transition-colors",
1011
+ background === v ? "border-primary ring-1 ring-primary" : "border-border hover:border-primary/40"
1012
+ ),
1013
+ children: [
1014
+ /* @__PURE__ */ jsx15("span", { className: "relative flex-1 overflow-hidden bg-background", children: /* @__PURE__ */ jsx15(BgSwatch, { variant: v }) }),
1015
+ /* @__PURE__ */ jsx15(
1016
+ "span",
1017
+ {
1018
+ className: cn(
1019
+ "px-1.5 py-0.5 text-[10px] font-medium",
1020
+ background === v ? "bg-primary text-primary-foreground" : "bg-card text-muted-foreground"
1021
+ ),
1022
+ children: BG_LABEL[v]
1023
+ }
1024
+ )
1025
+ ]
1026
+ },
1027
+ v
1028
+ )) })
1029
+ ] }),
1030
+ logos && logos.length > 0 && /* @__PURE__ */ jsxs7("section", { className: "mt-4", children: [
1031
+ /* @__PURE__ */ jsx15("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Logo" }),
1032
+ /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-2", children: logos.map((opt) => /* @__PURE__ */ jsx15(
1033
+ "button",
1034
+ {
1035
+ onClick: () => setLogo(opt.id),
1036
+ title: opt.label,
1037
+ className: cn(
1038
+ "flex h-16 w-16 items-center justify-center overflow-hidden rounded-lg border bg-background p-2 transition-colors",
1039
+ logo === opt.id ? "border-primary ring-1 ring-primary" : "border-border hover:border-primary/40"
1040
+ ),
1041
+ children: opt.node
1042
+ },
1043
+ opt.id
1044
+ )) })
1045
+ ] })
1046
+ ]
1047
+ },
1048
+ "panel"
1049
+ ) : /* @__PURE__ */ jsx15(
1050
+ motion5.button,
1051
+ {
1052
+ initial: { opacity: 0, scale: 0.8 },
1053
+ animate: { opacity: 1, scale: 1 },
1054
+ exit: { opacity: 0, scale: 0.8 },
1055
+ onClick: () => setOpen(true),
1056
+ "aria-label": "Open design studio",
1057
+ className: "flex h-12 w-12 items-center justify-center rounded-full border border-border bg-card text-primary shadow-xl backdrop-blur-xl transition-transform hover:scale-105",
1058
+ style: { boxShadow: "var(--glow-primary, 0 0 40px rgba(0,0,0,0.2))" },
1059
+ children: /* @__PURE__ */ jsx15(SparkleIcon, {})
1060
+ },
1061
+ "fab"
1062
+ ) }) });
1063
+ }
1064
+ export {
1065
+ AuroraBackground,
1066
+ BACKGROUND_VARIANTS,
1067
+ BorderBeam,
1068
+ DesignStudio,
1069
+ Dock,
1070
+ DynamicBackground,
1071
+ FxPreferencesProvider,
1072
+ GridBackground,
1073
+ Logo3D,
1074
+ Magnetic,
1075
+ MeshGradient,
1076
+ NoiseOverlay,
1077
+ ParticleField,
1078
+ SpotlightBackground,
1079
+ SpotlightCard,
1080
+ TextShimmer,
1081
+ TiltCard,
1082
+ useFxPreferences,
1083
+ useOptionalFxPreferences
1084
+ };