create-x402-app 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +54 -4
- package/package.json +2 -2
- package/templates/backend-express/README.md +56 -0
- package/templates/backend-express/env.example +8 -0
- package/templates/backend-express/gitignore +4 -0
- package/templates/backend-express/package.json +23 -0
- package/templates/backend-express/src/index.ts +79 -0
- package/templates/backend-express/tsconfig.json +18 -0
- package/templates/backend-hono/README.md +57 -0
- package/templates/backend-hono/env.example +8 -0
- package/templates/backend-hono/gitignore +4 -0
- package/templates/backend-hono/package.json +21 -0
- package/templates/backend-hono/src/index.ts +75 -0
- package/templates/backend-hono/tsconfig.json +18 -0
- package/templates/fullstack-express/README.md +308 -0
- package/templates/fullstack-express/_env.example +11 -0
- package/templates/fullstack-express/_gitignore +46 -0
- package/templates/fullstack-express/eslint.config.mjs +18 -0
- package/templates/fullstack-express/next-env.d.ts +6 -0
- package/templates/fullstack-express/next.config.ts +7 -0
- package/templates/fullstack-express/package.json +33 -0
- package/templates/fullstack-express/postcss.config.mjs +7 -0
- package/templates/fullstack-express/public/X402.png +0 -0
- package/templates/fullstack-express/src/app/api/info/route.ts +14 -0
- package/templates/fullstack-express/src/app/api/premium/route.ts +52 -0
- package/templates/fullstack-express/src/app/api/weather/route.ts +103 -0
- package/templates/fullstack-express/src/app/favicon.ico +0 -0
- package/templates/fullstack-express/src/app/globals.css +82 -0
- package/templates/fullstack-express/src/app/layout.tsx +42 -0
- package/templates/fullstack-express/src/app/page.tsx +511 -0
- package/templates/fullstack-express/src/components/grain-overlay.tsx +11 -0
- package/templates/fullstack-express/src/components/magnetic-button.tsx +90 -0
- package/templates/fullstack-express/src/components/ui/blur-fade.tsx +81 -0
- package/templates/fullstack-express/src/components/ui/magic-card.tsx +103 -0
- package/templates/fullstack-express/src/lib/utils.ts +6 -0
- package/templates/fullstack-express/src/types/ethereum.d.ts +11 -0
- package/templates/fullstack-express/tsconfig.json +34 -0
- package/templates/fullstack-hono/README.md +308 -0
- package/templates/fullstack-hono/_env.example +11 -0
- package/templates/fullstack-hono/_gitignore +46 -0
- package/templates/fullstack-hono/eslint.config.mjs +18 -0
- package/templates/fullstack-hono/next-env.d.ts +6 -0
- package/templates/fullstack-hono/next.config.ts +7 -0
- package/templates/fullstack-hono/package.json +33 -0
- package/templates/fullstack-hono/postcss.config.mjs +7 -0
- package/templates/fullstack-hono/public/X402.png +0 -0
- package/templates/fullstack-hono/src/app/api/info/route.ts +14 -0
- package/templates/fullstack-hono/src/app/api/premium/route.ts +52 -0
- package/templates/fullstack-hono/src/app/api/weather/route.ts +103 -0
- package/templates/fullstack-hono/src/app/favicon.ico +0 -0
- package/templates/fullstack-hono/src/app/globals.css +82 -0
- package/templates/fullstack-hono/src/app/layout.tsx +42 -0
- package/templates/fullstack-hono/src/app/page.tsx +511 -0
- package/templates/fullstack-hono/src/components/grain-overlay.tsx +11 -0
- package/templates/fullstack-hono/src/components/magnetic-button.tsx +90 -0
- package/templates/fullstack-hono/src/components/ui/blur-fade.tsx +81 -0
- package/templates/fullstack-hono/src/components/ui/magic-card.tsx +103 -0
- package/templates/fullstack-hono/src/lib/utils.ts +6 -0
- package/templates/fullstack-hono/src/types/ethereum.d.ts +11 -0
- package/templates/fullstack-hono/tsconfig.json +34 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect } from "react"
|
|
4
|
+
import { motion, useMotionTemplate, useMotionValue } from "motion/react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
interface MagicCardProps {
|
|
9
|
+
children?: React.ReactNode
|
|
10
|
+
className?: string
|
|
11
|
+
gradientSize?: number
|
|
12
|
+
gradientColor?: string
|
|
13
|
+
gradientOpacity?: number
|
|
14
|
+
gradientFrom?: string
|
|
15
|
+
gradientTo?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function MagicCard({
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
gradientSize = 200,
|
|
22
|
+
gradientColor = "#262626",
|
|
23
|
+
gradientOpacity = 0.8,
|
|
24
|
+
gradientFrom = "#9E7AFF",
|
|
25
|
+
gradientTo = "#FE8BBB",
|
|
26
|
+
}: MagicCardProps) {
|
|
27
|
+
const mouseX = useMotionValue(-gradientSize)
|
|
28
|
+
const mouseY = useMotionValue(-gradientSize)
|
|
29
|
+
const reset = useCallback(() => {
|
|
30
|
+
mouseX.set(-gradientSize)
|
|
31
|
+
mouseY.set(-gradientSize)
|
|
32
|
+
}, [gradientSize, mouseX, mouseY])
|
|
33
|
+
|
|
34
|
+
const handlePointerMove = useCallback(
|
|
35
|
+
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
36
|
+
const rect = e.currentTarget.getBoundingClientRect()
|
|
37
|
+
mouseX.set(e.clientX - rect.left)
|
|
38
|
+
mouseY.set(e.clientY - rect.top)
|
|
39
|
+
},
|
|
40
|
+
[mouseX, mouseY]
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
reset()
|
|
45
|
+
}, [reset])
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const handleGlobalPointerOut = (e: PointerEvent) => {
|
|
49
|
+
if (!e.relatedTarget) {
|
|
50
|
+
reset()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const handleVisibility = () => {
|
|
55
|
+
if (document.visibilityState !== "visible") {
|
|
56
|
+
reset()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
window.addEventListener("pointerout", handleGlobalPointerOut)
|
|
61
|
+
window.addEventListener("blur", reset)
|
|
62
|
+
document.addEventListener("visibilitychange", handleVisibility)
|
|
63
|
+
|
|
64
|
+
return () => {
|
|
65
|
+
window.removeEventListener("pointerout", handleGlobalPointerOut)
|
|
66
|
+
window.removeEventListener("blur", reset)
|
|
67
|
+
document.removeEventListener("visibilitychange", handleVisibility)
|
|
68
|
+
}
|
|
69
|
+
}, [reset])
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
className={cn("group relative rounded-[inherit]", className)}
|
|
74
|
+
onPointerMove={handlePointerMove}
|
|
75
|
+
onPointerLeave={reset}
|
|
76
|
+
onPointerEnter={reset}
|
|
77
|
+
>
|
|
78
|
+
<motion.div
|
|
79
|
+
className="bg-border pointer-events-none absolute inset-0 rounded-[inherit] duration-300 group-hover:opacity-100"
|
|
80
|
+
style={{
|
|
81
|
+
background: useMotionTemplate`
|
|
82
|
+
radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px,
|
|
83
|
+
${gradientFrom},
|
|
84
|
+
${gradientTo},
|
|
85
|
+
var(--border) 100%
|
|
86
|
+
)
|
|
87
|
+
`,
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
<div className="bg-background absolute inset-px rounded-[inherit]" />
|
|
91
|
+
<motion.div
|
|
92
|
+
className="pointer-events-none absolute inset-px rounded-[inherit] opacity-0 transition-opacity duration-300 group-hover:opacity-100"
|
|
93
|
+
style={{
|
|
94
|
+
background: useMotionTemplate`
|
|
95
|
+
radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px, ${gradientColor}, transparent 100%)
|
|
96
|
+
`,
|
|
97
|
+
opacity: gradientOpacity,
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
<div className="relative">{children}</div>
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface EthereumProvider {
|
|
2
|
+
request(args: { method: string; params?: unknown[] }): Promise<unknown>
|
|
3
|
+
isMetaMask?: boolean
|
|
4
|
+
on(event: string, handler: (...args: unknown[]) => void): void
|
|
5
|
+
removeListener(event: string, handler: (...args: unknown[]) => void): void
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface Window {
|
|
9
|
+
ethereum?: EthereumProvider
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"next-env.d.ts",
|
|
27
|
+
"**/*.ts",
|
|
28
|
+
"**/*.tsx",
|
|
29
|
+
".next/types/**/*.ts",
|
|
30
|
+
".next/dev/types/**/*.ts",
|
|
31
|
+
"**/*.mts"
|
|
32
|
+
],
|
|
33
|
+
"exclude": ["node_modules", "server.ts"]
|
|
34
|
+
}
|