@kuckit/landing-module 4.0.5 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,375 @@
1
+ import { cn } from "./utils.js";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/client/components/ui/glare-card.tsx
6
+ const GlareCard = ({ children, className, expandable = true, variant = "default" }) => {
7
+ const isPointerInside = useRef(false);
8
+ const refElement = useRef(null);
9
+ const cardRef = useRef(null);
10
+ const [isExpanded, setIsExpanded] = useState(false);
11
+ const [hasPopped, setHasPopped] = useState(false);
12
+ const [isAnimating, setIsAnimating] = useState(false);
13
+ const state = useRef({
14
+ glare: {
15
+ x: 50,
16
+ y: 50
17
+ },
18
+ background: {
19
+ x: 50,
20
+ y: 50
21
+ },
22
+ rotate: {
23
+ x: 0,
24
+ y: 0
25
+ },
26
+ pointerFromCenter: 0
27
+ });
28
+ const variantColors = {
29
+ default: {
30
+ "--holo-1": "hsl(330, 85%, 65%)",
31
+ "--holo-2": "hsl(280, 75%, 60%)",
32
+ "--holo-3": "hsl(220, 85%, 60%)",
33
+ "--holo-4": "hsl(185, 80%, 55%)",
34
+ "--holo-5": "hsl(160, 75%, 50%)",
35
+ "--holo-6": "hsl(45, 90%, 60%)",
36
+ "--holo-7": "hsl(25, 90%, 60%)",
37
+ "--holo-8": "hsl(5, 80%, 60%)",
38
+ "--glow-color": "rgba(139, 92, 246, 0.4)"
39
+ },
40
+ cosmic: {
41
+ "--holo-1": "hsl(270, 90%, 70%)",
42
+ "--holo-2": "hsl(240, 85%, 65%)",
43
+ "--holo-3": "hsl(200, 90%, 60%)",
44
+ "--holo-4": "hsl(180, 85%, 55%)",
45
+ "--holo-5": "hsl(300, 80%, 65%)",
46
+ "--holo-6": "hsl(320, 85%, 70%)",
47
+ "--holo-7": "hsl(260, 90%, 68%)",
48
+ "--holo-8": "hsl(220, 85%, 62%)",
49
+ "--glow-color": "rgba(147, 51, 234, 0.5)"
50
+ },
51
+ aurora: {
52
+ "--holo-1": "hsl(160, 85%, 55%)",
53
+ "--holo-2": "hsl(180, 80%, 50%)",
54
+ "--holo-3": "hsl(200, 85%, 55%)",
55
+ "--holo-4": "hsl(280, 75%, 60%)",
56
+ "--holo-5": "hsl(320, 80%, 65%)",
57
+ "--holo-6": "hsl(140, 75%, 50%)",
58
+ "--holo-7": "hsl(170, 85%, 52%)",
59
+ "--holo-8": "hsl(190, 80%, 55%)",
60
+ "--glow-color": "rgba(34, 211, 238, 0.4)"
61
+ }
62
+ };
63
+ const containerStyle = {
64
+ "--m-x": "50%",
65
+ "--m-y": "50%",
66
+ "--r-x": "0deg",
67
+ "--r-y": "0deg",
68
+ "--bg-x": "50%",
69
+ "--bg-y": "50%",
70
+ "--duration": "400ms",
71
+ "--opacity": "0",
72
+ "--radius": "20px",
73
+ "--easing": "cubic-bezier(0.16, 1, 0.3, 1)",
74
+ "--pointer-from-center": "0",
75
+ "--scale": "1",
76
+ "--translate-x": "0px",
77
+ "--translate-y": "0px",
78
+ "--translate-z": "0px",
79
+ "--rotate-delta": "0deg",
80
+ ...variantColors[variant]
81
+ };
82
+ const updateStyles = () => {
83
+ if (refElement.current) {
84
+ const { background, rotate, glare, pointerFromCenter } = state.current;
85
+ refElement.current.style.setProperty("--m-x", `${glare.x}%`);
86
+ refElement.current.style.setProperty("--m-y", `${glare.y}%`);
87
+ refElement.current.style.setProperty("--r-x", `${rotate.x}deg`);
88
+ refElement.current.style.setProperty("--r-y", `${rotate.y}deg`);
89
+ refElement.current.style.setProperty("--bg-x", `${background.x}%`);
90
+ refElement.current.style.setProperty("--bg-y", `${background.y}%`);
91
+ refElement.current.style.setProperty("--pointer-from-center", `${pointerFromCenter}`);
92
+ }
93
+ };
94
+ const expand = useCallback(() => {
95
+ if (!cardRef.current || !refElement.current || isAnimating) return;
96
+ setIsAnimating(true);
97
+ const rect = cardRef.current.getBoundingClientRect();
98
+ const deltaX = window.innerWidth / 2 - rect.left - rect.width / 2;
99
+ const deltaY = window.innerHeight / 2 - rect.top - rect.height / 2;
100
+ const scaleW = window.innerWidth / rect.width * .82;
101
+ const scaleH = window.innerHeight / rect.height * .82;
102
+ const targetScale = Math.min(scaleW, scaleH, 1.85);
103
+ refElement.current.style.setProperty("--scale", `${targetScale}`);
104
+ refElement.current.style.setProperty("--translate-x", `${deltaX}px`);
105
+ refElement.current.style.setProperty("--translate-y", `${deltaY}px`);
106
+ refElement.current.style.setProperty("--translate-z", `${targetScale * 120}px`);
107
+ if (!hasPopped) {
108
+ refElement.current.style.setProperty("--rotate-delta", "360deg");
109
+ setHasPopped(true);
110
+ }
111
+ refElement.current.style.setProperty("--opacity", "1");
112
+ setTimeout(() => {
113
+ refElement.current?.style.setProperty("--duration", "0s");
114
+ setIsAnimating(false);
115
+ }, 600);
116
+ setIsExpanded(true);
117
+ }, [hasPopped, isAnimating]);
118
+ const collapse = useCallback(() => {
119
+ if (!refElement.current || isAnimating) return;
120
+ setIsAnimating(true);
121
+ refElement.current.style.setProperty("--duration", "500ms");
122
+ refElement.current.style.setProperty("--scale", "1");
123
+ refElement.current.style.setProperty("--translate-x", "0px");
124
+ refElement.current.style.setProperty("--translate-y", "0px");
125
+ refElement.current.style.setProperty("--translate-z", "0px");
126
+ refElement.current.style.setProperty("--rotate-delta", "0deg");
127
+ setTimeout(() => setIsAnimating(false), 500);
128
+ setIsExpanded(false);
129
+ }, [isAnimating]);
130
+ const handleClick = useCallback((e) => {
131
+ if (!expandable || isAnimating) return;
132
+ e.stopPropagation();
133
+ if (isExpanded) collapse();
134
+ else expand();
135
+ }, [
136
+ expandable,
137
+ isExpanded,
138
+ expand,
139
+ collapse,
140
+ isAnimating
141
+ ]);
142
+ useEffect(() => {
143
+ const handleKeyDown = (e) => {
144
+ if (e.key === "Escape" && isExpanded && !isAnimating) collapse();
145
+ };
146
+ window.addEventListener("keydown", handleKeyDown);
147
+ return () => window.removeEventListener("keydown", handleKeyDown);
148
+ }, [
149
+ isExpanded,
150
+ collapse,
151
+ isAnimating
152
+ ]);
153
+ useEffect(() => {
154
+ if (!isExpanded) return;
155
+ const handleClickOutside = (e) => {
156
+ if (cardRef.current && !cardRef.current.contains(e.target) && !isAnimating) collapse();
157
+ };
158
+ const timer = setTimeout(() => {
159
+ window.addEventListener("click", handleClickOutside);
160
+ }, 150);
161
+ return () => {
162
+ clearTimeout(timer);
163
+ window.removeEventListener("click", handleClickOutside);
164
+ };
165
+ }, [
166
+ isExpanded,
167
+ collapse,
168
+ isAnimating
169
+ ]);
170
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
171
+ /* @__PURE__ */ jsx("div", {
172
+ className: cn("fixed inset-0 z-40 transition-all duration-700", isExpanded ? "opacity-100 backdrop-blur-md bg-black/70" : "opacity-0 pointer-events-none backdrop-blur-none bg-transparent"),
173
+ style: { background: isExpanded ? `
174
+ radial-gradient(ellipse 80% 60% at 50% 50%, transparent 0%, rgba(0,0,0,0.85) 100%),
175
+ linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.8))
176
+ ` : "transparent" },
177
+ onClick: collapse
178
+ }),
179
+ /* @__PURE__ */ jsx("div", {
180
+ style: containerStyle,
181
+ className: cn("group relative isolate [contain:layout_style] [perspective:1200px]", "transition-[transform,z-index] duration-[var(--duration)] ease-[var(--easing)]", "will-change-transform w-full max-w-md", expandable && "cursor-pointer", isExpanded && "z-50"),
182
+ ref: refElement,
183
+ onClick: handleClick,
184
+ onPointerMove: (event) => {
185
+ const rotateFactor = isExpanded ? .25 : .45;
186
+ const rect = event.currentTarget.getBoundingClientRect();
187
+ const position = {
188
+ x: event.clientX - rect.left,
189
+ y: event.clientY - rect.top
190
+ };
191
+ const percentage = {
192
+ x: Math.max(0, Math.min(100, 100 / rect.width * position.x)),
193
+ y: Math.max(0, Math.min(100, 100 / rect.height * position.y))
194
+ };
195
+ const delta = {
196
+ x: percentage.x - 50,
197
+ y: percentage.y - 50
198
+ };
199
+ const pointerFromCenter = Math.min(1, Math.sqrt(delta.x * delta.x + delta.y * delta.y) / 50);
200
+ const { background, rotate, glare } = state.current;
201
+ background.x = 50 + percentage.x / 4 - 12.5;
202
+ background.y = 50 + percentage.y / 3 - 16.67;
203
+ rotate.x = -(delta.x / 3.5) * rotateFactor;
204
+ rotate.y = delta.y / 2 * rotateFactor;
205
+ glare.x = percentage.x;
206
+ glare.y = percentage.y;
207
+ state.current.pointerFromCenter = pointerFromCenter;
208
+ updateStyles();
209
+ },
210
+ onPointerEnter: () => {
211
+ isPointerInside.current = true;
212
+ if (refElement.current) setTimeout(() => {
213
+ if (isPointerInside.current) refElement.current?.style.setProperty("--duration", "0s");
214
+ }, 400);
215
+ },
216
+ onPointerLeave: () => {
217
+ isPointerInside.current = false;
218
+ if (refElement.current && !isExpanded) {
219
+ refElement.current.style.setProperty("--duration", "400ms");
220
+ refElement.current.style.setProperty("--r-x", "0deg");
221
+ refElement.current.style.setProperty("--r-y", "0deg");
222
+ refElement.current.style.setProperty("--pointer-from-center", "0");
223
+ }
224
+ },
225
+ children: /* @__PURE__ */ jsxs("div", {
226
+ ref: cardRef,
227
+ className: cn("h-full grid will-change-transform origin-center", "transition-all duration-[var(--duration)] ease-[var(--easing)]", "[transform-style:preserve-3d]", "rounded-[var(--radius)]", "overflow-hidden", "hover:[--opacity:1]"),
228
+ style: {
229
+ transform: `
230
+ translate3d(var(--translate-x), var(--translate-y), var(--translate-z))
231
+ scale(var(--scale))
232
+ rotateY(calc(var(--r-x) + var(--rotate-delta)))
233
+ rotateX(var(--r-y))
234
+ `,
235
+ boxShadow: isExpanded ? `
236
+ 0 0 0 1px rgba(255,255,255,0.15),
237
+ 0 0 20px 0 var(--glow-color),
238
+ 0 0 60px -10px var(--glow-color),
239
+ 0 30px 60px -15px rgba(0,0,0,0.5),
240
+ 0 50px 100px -30px rgba(0,0,0,0.6)
241
+ ` : `
242
+ 0 1px 2px rgba(0,0,0,0.02),
243
+ 0 2px 4px rgba(0,0,0,0.03),
244
+ 0 4px 8px rgba(0,0,0,0.04),
245
+ 0 8px 16px rgba(0,0,0,0.05),
246
+ 0 16px 32px rgba(0,0,0,0.06),
247
+ 0 32px 64px rgba(0,0,0,0.07)
248
+ `
249
+ },
250
+ children: [
251
+ /* @__PURE__ */ jsx("div", {
252
+ className: "w-full h-full grid [grid-area:1/1] [clip-path:inset(0_0_0_0_round_var(--radius))]",
253
+ children: /* @__PURE__ */ jsx("div", {
254
+ className: cn("h-full w-full relative bg-card", className),
255
+ children
256
+ })
257
+ }),
258
+ /* @__PURE__ */ jsx("div", {
259
+ className: "w-full h-full grid [grid-area:1/1] pointer-events-none [clip-path:inset(0_0_0_0_round_var(--radius))] mix-blend-overlay",
260
+ style: {
261
+ background: `
262
+ linear-gradient(
263
+ 135deg,
264
+ transparent 0%,
265
+ rgba(255,255,255,0.03) 50%,
266
+ transparent 100%
267
+ )
268
+ `,
269
+ backgroundSize: "200% 200%",
270
+ animation: "shimmer 8s ease-in-out infinite",
271
+ opacity: .5
272
+ }
273
+ }),
274
+ /* @__PURE__ */ jsx("div", {
275
+ className: "w-full h-full grid [grid-area:1/1] pointer-events-none [clip-path:inset(0_0_0_0_round_var(--radius))] opacity-[var(--opacity)] transition-opacity duration-500 mix-blend-color-dodge",
276
+ style: {
277
+ backgroundImage: `
278
+ repeating-linear-gradient(
279
+ 127deg,
280
+ var(--holo-1) 0%,
281
+ var(--holo-2) 2.5%,
282
+ var(--holo-3) 5%,
283
+ var(--holo-4) 7.5%,
284
+ var(--holo-5) 10%,
285
+ var(--holo-6) 12.5%,
286
+ var(--holo-7) 15%,
287
+ var(--holo-8) 17.5%,
288
+ var(--holo-1) 20%
289
+ )
290
+ `,
291
+ backgroundSize: "400% 400%",
292
+ backgroundPosition: "var(--bg-x) var(--bg-y)",
293
+ filter: `brightness(${isExpanded ? .75 : .65}) saturate(${isExpanded ? 2 : 1.6}) contrast(1.15)`,
294
+ opacity: isExpanded ? .28 : .2
295
+ }
296
+ }),
297
+ /* @__PURE__ */ jsx("div", {
298
+ className: "w-full h-full grid [grid-area:1/1] pointer-events-none [clip-path:inset(0_0_0_0_round_var(--radius))] opacity-[var(--opacity)] transition-opacity duration-300 mix-blend-overlay",
299
+ style: {
300
+ background: `
301
+ conic-gradient(
302
+ from 210deg at var(--m-x) var(--m-y),
303
+ var(--holo-1) 0deg,
304
+ var(--holo-2) 45deg,
305
+ var(--holo-3) 90deg,
306
+ var(--holo-4) 135deg,
307
+ var(--holo-5) 180deg,
308
+ var(--holo-6) 225deg,
309
+ var(--holo-7) 270deg,
310
+ var(--holo-8) 315deg,
311
+ var(--holo-1) 360deg
312
+ )
313
+ `,
314
+ filter: `brightness(${isExpanded ? 1.4 : 1.2}) saturate(0.65)`,
315
+ opacity: isExpanded ? .38 : .28
316
+ }
317
+ }),
318
+ /* @__PURE__ */ jsx("div", {
319
+ className: "w-full h-full grid [grid-area:1/1] pointer-events-none [clip-path:inset(0_0_0_0_round_var(--radius))] opacity-[var(--opacity)] transition-opacity duration-100 mix-blend-overlay",
320
+ style: {
321
+ background: `
322
+ radial-gradient(
323
+ farthest-corner circle at var(--m-x) var(--m-y),
324
+ rgba(255, 255, 255, 1) 0%,
325
+ rgba(255, 255, 255, 0.85) 8%,
326
+ rgba(255, 255, 255, 0.5) 20%,
327
+ transparent 55%
328
+ )
329
+ `,
330
+ filter: `brightness(${isExpanded ? 1.5 : 1.25})`
331
+ }
332
+ }),
333
+ /* @__PURE__ */ jsx("div", {
334
+ className: cn("absolute inset-0 rounded-[var(--radius)] pointer-events-none transition-all duration-300", isExpanded ? "opacity-100" : "opacity-[var(--opacity)]"),
335
+ style: { boxShadow: `
336
+ inset 0 0 0 1px rgba(255, 255, 255, ${isExpanded ? .18 : .1}),
337
+ inset 0 1px 0 0 rgba(255, 255, 255, ${isExpanded ? .22 : .12}),
338
+ inset 0 -1px 0 0 rgba(0, 0, 0, ${isExpanded ? .12 : .08})
339
+ ` }
340
+ }),
341
+ isExpanded && /* @__PURE__ */ jsx("div", {
342
+ className: "absolute top-5 right-5 z-10 pointer-events-none",
343
+ style: { animation: "fadeInUp 0.4s ease-out 0.3s both" },
344
+ children: /* @__PURE__ */ jsxs("div", {
345
+ className: "flex items-center gap-2 px-3 py-1.5 rounded-full bg-white/10 backdrop-blur-sm border border-white/20",
346
+ children: [/* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-white/60 animate-pulse" }), /* @__PURE__ */ jsx("span", {
347
+ className: "text-white/70 text-[10px] font-medium tracking-widest uppercase",
348
+ children: "Click to close"
349
+ })]
350
+ })
351
+ })
352
+ ]
353
+ })
354
+ }),
355
+ /* @__PURE__ */ jsx("style", { children: `
356
+ @keyframes shimmer {
357
+ 0%, 100% { background-position: 200% 200%; }
358
+ 50% { background-position: 0% 0%; }
359
+ }
360
+ @keyframes fadeInUp {
361
+ from {
362
+ opacity: 0;
363
+ transform: translateY(8px);
364
+ }
365
+ to {
366
+ opacity: 1;
367
+ transform: translateY(0);
368
+ }
369
+ }
370
+ ` })
371
+ ] });
372
+ };
373
+
374
+ //#endregion
375
+ export { GlareCard };
@@ -0,0 +1,10 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ //#region src/client/components/ui/utils.ts
5
+ function cn(...inputs) {
6
+ return twMerge(clsx(inputs));
7
+ }
8
+
9
+ //#endregion
10
+ export { cn };
@@ -1,12 +1,7 @@
1
+ import { LandingPage } from "./components/LandingPage.js";
2
+ import { ModulesPage } from "./components/ModulesPage.js";
1
3
  import { KuckitClientModuleContext } from "@kuckit/sdk-react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
4
 
4
- //#region src/client/components/LandingPage.d.ts
5
- declare function LandingPage(): react_jsx_runtime0.JSX.Element;
6
- //#endregion
7
- //#region src/client/components/ModulesPage.d.ts
8
- declare function ModulesPage(): react_jsx_runtime0.JSX.Element;
9
- //#endregion
10
5
  //#region src/client/index.d.ts
11
6
  declare const kuckitClientModule: {
12
7
  id: string;
@@ -15,5 +10,4 @@ declare const kuckitClientModule: {
15
10
  register(ctx: KuckitClientModuleContext): void;
16
11
  };
17
12
  //#endregion
18
- export { LandingPage, ModulesPage, kuckitClientModule };
19
- //# sourceMappingURL=index.d.ts.map
13
+ export { LandingPage, ModulesPage, kuckitClientModule };