arcanajs 2.1.6 → 2.2.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.
Files changed (59) hide show
  1. package/README.md +45 -3
  2. package/framework/cli/index.js +127 -25
  3. package/framework/cli/templates.d.ts +6 -0
  4. package/framework/cli/templates.js +41 -0
  5. package/framework/cli/webpack.config.js +87 -44
  6. package/framework/lib/client/index.js +23 -7
  7. package/framework/lib/index.d.ts +2 -2
  8. package/framework/lib/index.js +40 -17
  9. package/framework/lib/server/ArcanaJSMiddleware.d.ts +9 -1
  10. package/framework/lib/server/ArcanaJSMiddleware.js +35 -13
  11. package/framework/lib/server/ArcanaJSServer.d.ts +2 -0
  12. package/framework/lib/server/ArcanaJSServer.js +77 -59
  13. package/framework/lib/server/ControllerBinder.js +4 -1
  14. package/framework/lib/server/CsrfMiddleware.js +10 -3
  15. package/framework/lib/server/DynamicRouter.d.ts +1 -1
  16. package/framework/lib/server/DynamicRouter.js +5 -1
  17. package/framework/lib/server/ResponseHandlerMiddleware.js +5 -1
  18. package/framework/lib/server/Router.d.ts +1 -1
  19. package/framework/lib/server/Router.js +16 -8
  20. package/framework/lib/server.d.ts +10 -0
  21. package/framework/lib/server.js +41 -6
  22. package/framework/lib/shared/components/Body.js +7 -3
  23. package/framework/lib/shared/components/Head.js +47 -10
  24. package/framework/lib/shared/components/Link.js +9 -5
  25. package/framework/lib/shared/components/NavLink.js +10 -6
  26. package/framework/lib/shared/components/Page.js +9 -5
  27. package/framework/lib/shared/context/HeadContext.js +5 -2
  28. package/framework/lib/shared/context/PageContext.js +5 -2
  29. package/framework/lib/shared/context/RouterContext.js +9 -5
  30. package/framework/lib/shared/core/ArcanaJSApp.js +18 -14
  31. package/framework/lib/shared/hooks/useHead.d.ts +1 -1
  32. package/framework/lib/shared/hooks/useHead.js +7 -3
  33. package/framework/lib/shared/hooks/useLocation.js +7 -3
  34. package/framework/lib/shared/hooks/usePage.js +7 -3
  35. package/framework/lib/shared/hooks/useParams.js +8 -4
  36. package/framework/lib/shared/hooks/useQuery.js +7 -3
  37. package/framework/lib/shared/hooks/useRouter.d.ts +1 -1
  38. package/framework/lib/shared/hooks/useRouter.js +8 -4
  39. package/framework/lib/shared/utils/createSingletonContext.js +6 -3
  40. package/framework/lib/shared/views/ErrorPage.d.ts +7 -0
  41. package/framework/lib/shared/views/ErrorPage.js +11 -0
  42. package/framework/lib/shared/views/NotFoundPage.d.ts +5 -0
  43. package/framework/lib/shared/views/NotFoundPage.js +10 -0
  44. package/framework/templates/ErrorPage.tsx +137 -0
  45. package/framework/templates/HomePage.tsx +344 -0
  46. package/framework/templates/NotFoundPage.tsx +109 -0
  47. package/framework/templates/arcanajs.png +0 -0
  48. package/framework/templates/arcanajs.svg +12 -0
  49. package/framework/templates/client-index.tsx +7 -0
  50. package/framework/templates/favicon.ico +0 -0
  51. package/framework/templates/globals.css +198 -0
  52. package/framework/templates/package.json +15 -0
  53. package/framework/templates/postcss.config.js +6 -0
  54. package/framework/templates/server-controller-home.ts +7 -0
  55. package/framework/templates/server-index.ts +10 -0
  56. package/framework/templates/server-routes-web.ts +7 -0
  57. package/package.json +30 -25
  58. package/framework/lib/shared/hooks/useDynamicComponents.d.ts +0 -1
  59. package/framework/lib/shared/hooks/useDynamicComponents.js +0 -16
@@ -0,0 +1,344 @@
1
+ import { Page, Head, Body } from "arcanajs";
2
+
3
+ export default function HomePage() {
4
+ return (
5
+ <Page>
6
+ <Head>
7
+ <title>Welcome to ArcanaJS</title>
8
+ <meta
9
+ name="description"
10
+ content="A modern React framework with Tailwind CSS v4"
11
+ />
12
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
13
+ </Head>
14
+ <Body>
15
+ <div className="relative min-h-screen overflow-hidden bg-black text-white">
16
+ {/* Animated Background */}
17
+ <div className="fixed inset-0 z-0 overflow-hidden pointer-events-none">
18
+ {/* Grid Pattern */}
19
+ <div className="absolute inset-0 grid-pattern opacity-30"></div>
20
+ <div className="absolute inset-0 grid-pattern opacity-30"></div>
21
+
22
+ {/* Animated Orbs */}
23
+ <div className="absolute top-1/4 left-1/4 w-96 h-96 bg-orange-500 rounded-full opacity-20 blur-3xl animate-glow"></div>
24
+ <div
25
+ className="absolute top-1/3 right-1/4 w-96 h-96 bg-purple-500 rounded-full opacity-15 blur-3xl animate-glow"
26
+ style={{ animationDelay: "2s" }}
27
+ ></div>
28
+ <div
29
+ className="absolute bottom-1/4 left-1/2 w-96 h-96 bg-blue-500 rounded-full opacity-10 blur-3xl animate-glow"
30
+ style={{ animationDelay: "4s" }}
31
+ ></div>
32
+
33
+ {/* Radial Gradient Accent */}
34
+ <div className="absolute inset-0 hero-gradient"></div>
35
+ </div>
36
+
37
+ <div className="relative z-10">
38
+ {/* Navigation */}
39
+ <nav className="fixed top-0 w-full z-50 nav-blur animate-slide-down border-b border-white/5 backdrop-blur-sm">
40
+ <div className="container mx-auto px-6 py-4 flex items-center justify-between">
41
+ <div className="flex items-center gap-3 group cursor-pointer">
42
+ <div className="relative w-16 h-16">
43
+ <div className="absolute inset-0 bg-gradient-to-br from-orange-500 to-red-600 rounded-full blur-lg opacity-40 group-hover:opacity-100 transition-opacity"></div>
44
+ <img
45
+ src="arcanajs.png"
46
+ alt="ArcanaJS Logo"
47
+ className="relative w-full h-full object-contain"
48
+ />
49
+ </div>
50
+ </div>
51
+ <div className="hidden md:flex space-x-8">
52
+ <a
53
+ href="#features"
54
+ className="text-gray-400 hover:text-white transition-colors text-sm font-medium"
55
+ >
56
+ Features
57
+ </a>
58
+ <a
59
+ href="#docs"
60
+ className="text-gray-400 hover:text-white transition-colors text-sm font-medium"
61
+ >
62
+ Docs
63
+ </a>
64
+ <a
65
+ href="#examples"
66
+ className="text-gray-400 hover:text-white transition-colors text-sm font-medium"
67
+ >
68
+ Examples
69
+ </a>
70
+ </div>
71
+ </div>
72
+ </nav>
73
+
74
+ {/* Hero Section */}
75
+ <main className="pt-32 pb-12 px-4 sm:px-6 lg:px-8">
76
+ <div className="max-w-5xl mx-auto text-center">
77
+ <div className="glass-card rounded-3xl p-8 md:p-12 mb-12 animate-scale-in border-white/10">
78
+ <h1 className="text-5xl md:text-7xl font-bold text-white mb-6 tracking-tight drop-shadow-2xl">
79
+ Welcome to <span className="gradient-text">ArcanaJS</span>
80
+ </h1>
81
+ <p className="text-xl md:text-2xl text-gray-300 mb-10 max-w-3xl mx-auto text-balance font-light leading-relaxed">
82
+ A modern React framework with server-side rendering and
83
+ Tailwind CSS v4 support. Build fast, beautiful applications
84
+ with zero configuration.
85
+ </p>
86
+ <div className="flex flex-col sm:flex-row gap-4 justify-center">
87
+ <button className="btn-primary px-8 py-3.5 text-lg font-semibold rounded-xl inline-flex items-center justify-center gap-2">
88
+ Get Started
89
+ <svg
90
+ className="w-5 h-5"
91
+ fill="none"
92
+ stroke="currentColor"
93
+ viewBox="0 0 24 24"
94
+ >
95
+ <path
96
+ strokeLinecap="round"
97
+ strokeLinejoin="round"
98
+ strokeWidth={2}
99
+ d="M13 7l5 5m0 0l-5 5m5-5H6"
100
+ />
101
+ </svg>
102
+ </button>
103
+ <button className="btn-secondary px-8 py-3.5 text-lg font-semibold rounded-xl inline-flex items-center justify-center gap-2">
104
+ View Examples
105
+ </button>
106
+ </div>
107
+ </div>
108
+
109
+ {/* Features Grid */}
110
+ <section
111
+ id="features"
112
+ className="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12"
113
+ >
114
+ <div className="glass-card rounded-2xl p-8 feature-card text-center group">
115
+ <div className="w-14 h-14 bg-orange-500/10 rounded-xl flex items-center justify-center mx-auto mb-4 group-hover:scale-110 transition-transform border border-orange-500/20">
116
+ <svg
117
+ className="w-7 h-7 text-orange-500"
118
+ fill="none"
119
+ stroke="currentColor"
120
+ viewBox="0 0 24 24"
121
+ >
122
+ <path
123
+ strokeLinecap="round"
124
+ strokeLinejoin="round"
125
+ strokeWidth={2}
126
+ d="M13 10V3L4 14h7v7l9-11h-7z"
127
+ />
128
+ </svg>
129
+ </div>
130
+ <h3 className="text-xl font-bold text-white mb-2 group-hover:text-orange-400 transition-colors">
131
+ Fast SSR
132
+ </h3>
133
+ <p className="text-gray-400 text-sm leading-relaxed">
134
+ Server-side rendering for optimal performance and SEO.
135
+ </p>
136
+ </div>
137
+
138
+ <div className="glass-card rounded-2xl p-8 feature-card text-center group">
139
+ <div className="w-14 h-14 bg-purple-500/10 rounded-xl flex items-center justify-center mx-auto mb-4 group-hover:scale-110 transition-transform border border-purple-500/20">
140
+ <svg
141
+ className="w-7 h-7 text-purple-500"
142
+ fill="none"
143
+ stroke="currentColor"
144
+ viewBox="0 0 24 24"
145
+ >
146
+ <path
147
+ strokeLinecap="round"
148
+ strokeLinejoin="round"
149
+ strokeWidth={2}
150
+ d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
151
+ />
152
+ </svg>
153
+ </div>
154
+ <h3 className="text-xl font-bold text-white mb-2 group-hover:text-purple-400 transition-colors">
155
+ TypeScript
156
+ </h3>
157
+ <p className="text-gray-400 text-sm leading-relaxed">
158
+ Built-in TypeScript support for better developer
159
+ experience.
160
+ </p>
161
+ </div>
162
+
163
+ <div className="glass-card rounded-2xl p-8 feature-card text-center group">
164
+ <div className="w-14 h-14 bg-blue-500/10 rounded-xl flex items-center justify-center mx-auto mb-4 group-hover:scale-110 transition-transform border border-blue-500/20">
165
+ <svg
166
+ className="w-7 h-7 text-blue-500"
167
+ fill="none"
168
+ stroke="currentColor"
169
+ viewBox="0 0 24 24"
170
+ >
171
+ <path
172
+ strokeLinecap="round"
173
+ strokeLinejoin="round"
174
+ strokeWidth={2}
175
+ d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h4a2 2 0 002-2V9a2 2 0 00-2-2H7a2 2 0 00-2 2v6a2 2 0 002 2z"
176
+ />
177
+ </svg>
178
+ </div>
179
+ <h3 className="text-xl font-bold text-white mb-2 group-hover:text-blue-400 transition-colors">
180
+ Tailwind v4
181
+ </h3>
182
+ <p className="text-gray-400 text-sm leading-relaxed">
183
+ Latest Tailwind CSS with CSS-first configuration.
184
+ </p>
185
+ </div>
186
+
187
+ <div className="glass-card rounded-2xl p-8 feature-card text-center group">
188
+ <div className="w-14 h-14 bg-green-500/10 rounded-xl flex items-center justify-center mx-auto mb-4 group-hover:scale-110 transition-transform border border-green-500/20">
189
+ <svg
190
+ className="w-7 h-7 text-green-500"
191
+ fill="none"
192
+ stroke="currentColor"
193
+ viewBox="0 0 24 24"
194
+ >
195
+ <path
196
+ strokeLinecap="round"
197
+ strokeLinejoin="round"
198
+ strokeWidth={2}
199
+ d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"
200
+ />
201
+ </svg>
202
+ </div>
203
+ <h3 className="text-xl font-bold text-white mb-2 group-hover:text-green-400 transition-colors">
204
+ Hot Reload
205
+ </h3>
206
+ <p className="text-gray-400 text-sm leading-relaxed">
207
+ Instant updates during development for faster iteration.
208
+ </p>
209
+ </div>
210
+
211
+ <div className="glass-card rounded-2xl p-8 feature-card text-center group">
212
+ <div className="w-14 h-14 bg-red-500/10 rounded-xl flex items-center justify-center mx-auto mb-4 group-hover:scale-110 transition-transform border border-red-500/20">
213
+ <svg
214
+ className="w-7 h-7 text-red-500"
215
+ fill="none"
216
+ stroke="currentColor"
217
+ viewBox="0 0 24 24"
218
+ >
219
+ <path
220
+ strokeLinecap="round"
221
+ strokeLinejoin="round"
222
+ strokeWidth={2}
223
+ d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2V7zm0 0V5a2 2 0 012-2h6l2 2h6a2 2 0 012 2v2H3z"
224
+ />
225
+ </svg>
226
+ </div>
227
+ <h3 className="text-xl font-bold text-white mb-2 group-hover:text-red-400 transition-colors">
228
+ File-based Routing
229
+ </h3>
230
+ <p className="text-gray-400 text-sm leading-relaxed">
231
+ Intuitive routing based on your file structure.
232
+ </p>
233
+ </div>
234
+
235
+ <div className="glass-card rounded-2xl p-8 feature-card text-center group">
236
+ <div className="w-14 h-14 bg-indigo-500/10 rounded-xl flex items-center justify-center mx-auto mb-4 group-hover:scale-110 transition-transform border border-indigo-500/20">
237
+ <svg
238
+ className="w-7 h-7 text-indigo-500"
239
+ fill="none"
240
+ stroke="currentColor"
241
+ viewBox="0 0 24 24"
242
+ >
243
+ <path
244
+ strokeLinecap="round"
245
+ strokeLinejoin="round"
246
+ strokeWidth={2}
247
+ d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
248
+ />
249
+ <path
250
+ strokeLinecap="round"
251
+ strokeLinejoin="round"
252
+ strokeWidth={2}
253
+ d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
254
+ />
255
+ </svg>
256
+ </div>
257
+ <h3 className="text-xl font-bold text-white mb-2 group-hover:text-indigo-400 transition-colors">
258
+ Zero Config
259
+ </h3>
260
+ <p className="text-gray-400 text-sm leading-relaxed">
261
+ Get started immediately with sensible defaults.
262
+ </p>
263
+ </div>
264
+ </section>
265
+
266
+ {/* Code Example */}
267
+ <section
268
+ id="examples"
269
+ className="glass-card rounded-2xl p-8 text-left border-white/10"
270
+ >
271
+ <h2 className="text-2xl font-bold text-white mb-6 text-center">
272
+ Quick Start
273
+ </h2>
274
+ <div className="bg-black/50 rounded-xl p-6 text-sm font-mono text-gray-300 overflow-x-auto border border-white/10 shadow-inner">
275
+ <div className="mb-4">
276
+ <div className="text-gray-500 mb-1">
277
+ # Create a new folder
278
+ </div>
279
+ <div className="text-orange-400">
280
+ mkdir my-app cd my-app
281
+ </div>
282
+ </div>
283
+ <div className="mb-4">
284
+ <div className="text-gray-500 mb-1">
285
+ # Initialize a new project
286
+ </div>
287
+ <div className="text-orange-400">npx arcanajs init</div>
288
+ </div>
289
+ <div className="mb-4">
290
+ <div className="text-gray-500 mb-1">
291
+ # Install dependencies
292
+ </div>
293
+ <div className="text-white">npm install</div>
294
+ </div>
295
+ <div className="mb-4">
296
+ <div className="text-gray-500 mb-1">
297
+ # Start development server
298
+ </div>
299
+ <div className="text-white">npm run dev</div>
300
+ </div>
301
+ <div>
302
+ <div className="text-gray-500 mb-1">
303
+ # Build for production
304
+ </div>
305
+ <div className="text-white">npm run build</div>
306
+ </div>
307
+ <div>
308
+ <div className="text-gray-500 mb-1">
309
+ # Start production server
310
+ </div>
311
+ <div className="text-white">npm start</div>
312
+ </div>
313
+ </div>
314
+ </section>
315
+ </div>
316
+ </main>
317
+
318
+ {/* Footer */}
319
+ <footer className="border-t border-white/5 mt-12 relative z-10 bg-black/20 backdrop-blur-md">
320
+ <div className="container mx-auto px-6 py-8">
321
+ <div className="flex flex-col md:flex-row items-center justify-between gap-4">
322
+ <div className="text-gray-500 text-sm">
323
+ &copy; 2025 ArcanaJS. All rights reserved.
324
+ </div>
325
+ <div className="flex gap-6 text-gray-500 text-sm">
326
+ <a href="#" className="hover:text-white transition-colors">
327
+ GitHub
328
+ </a>
329
+ <a href="#" className="hover:text-white transition-colors">
330
+ Docs
331
+ </a>
332
+ <a href="#" className="hover:text-white transition-colors">
333
+ Community
334
+ </a>
335
+ </div>
336
+ </div>
337
+ </div>
338
+ </footer>
339
+ </div>
340
+ </div>
341
+ </Body>
342
+ </Page>
343
+ );
344
+ }
@@ -0,0 +1,109 @@
1
+ import React from "react";
2
+ import { Page, Head, Body } from "arcanajs";
3
+
4
+ interface NotFoundPageProps {
5
+ url?: string;
6
+ }
7
+
8
+ export default function NotFoundPage({ url }: NotFoundPageProps) {
9
+ return (
10
+ <Page>
11
+ <Head>
12
+ <title>404 - Page Not Found</title>
13
+ <meta
14
+ name="description"
15
+ content="The page you're looking for doesn't exist"
16
+ />
17
+ </Head>
18
+ <Body>
19
+ <div className="relative min-h-screen overflow-hidden bg-black text-white flex flex-col justify-center items-center px-4 font-sans">
20
+ {/* Animated Background */}
21
+ <div className="fixed inset-0 z-0 overflow-hidden pointer-events-none">
22
+ <div className="absolute inset-0 grid-pattern opacity-30"></div>
23
+ <div className="absolute top-1/4 left-1/4 w-96 h-96 bg-orange-500 rounded-full opacity-20 blur-3xl animate-glow"></div>
24
+ <div
25
+ className="absolute bottom-1/4 right-1/4 w-96 h-96 bg-purple-500 rounded-full opacity-10 blur-3xl animate-glow"
26
+ style={{ animationDelay: "2s" }}
27
+ ></div>
28
+ <div className="absolute inset-0 hero-gradient"></div>
29
+ </div>
30
+
31
+ <div className="relative z-10 max-w-lg w-full text-center animate-scale-in">
32
+ <div className="glass-card rounded-3xl p-12 border border-white/10 shadow-2xl">
33
+ <div className="mb-8">
34
+ <h1 className="text-9xl font-bold text-transparent bg-clip-text bg-gradient-to-br from-white to-gray-500 mb-4 animate-float">
35
+ 404
36
+ </h1>
37
+ <h2 className="text-3xl font-bold text-white mb-4">
38
+ Page Not Found
39
+ </h2>
40
+ <p className="text-gray-400 text-lg leading-relaxed">
41
+ {url ? (
42
+ <>
43
+ The page <span className="text-orange-400">"{url}"</span>{" "}
44
+ you're looking for doesn't exist.
45
+ </>
46
+ ) : (
47
+ "The page you're looking for doesn't exist."
48
+ )}
49
+ </p>
50
+ </div>
51
+
52
+ <div className="flex flex-col sm:flex-row gap-4 justify-center">
53
+ <a
54
+ href="/"
55
+ className="btn-primary px-8 py-3.5 text-white font-semibold rounded-xl inline-flex items-center justify-center gap-2 w-full sm:w-auto"
56
+ >
57
+ <svg
58
+ className="w-5 h-5"
59
+ fill="none"
60
+ stroke="currentColor"
61
+ viewBox="0 0 24 24"
62
+ >
63
+ <path
64
+ strokeLinecap="round"
65
+ strokeLinejoin="round"
66
+ strokeWidth={2}
67
+ d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
68
+ />
69
+ </svg>
70
+ Go Home
71
+ </a>
72
+
73
+ <button
74
+ onClick={() => window.history.back()}
75
+ className="btn-secondary px-8 py-3.5 text-white font-semibold rounded-xl inline-flex items-center justify-center gap-2 w-full sm:w-auto"
76
+ >
77
+ <svg
78
+ className="w-5 h-5"
79
+ fill="none"
80
+ stroke="currentColor"
81
+ viewBox="0 0 24 24"
82
+ >
83
+ <path
84
+ strokeLinecap="round"
85
+ strokeLinejoin="round"
86
+ strokeWidth={2}
87
+ d="M10 19l-7-7m0 0l7-7m-7 7h18"
88
+ />
89
+ </svg>
90
+ Go Back
91
+ </button>
92
+ </div>
93
+ </div>
94
+ <div className="mt-8 text-gray-500 text-sm">
95
+ If you believe this is an error, please{" "}
96
+ <a
97
+ href="/contact"
98
+ className="text-orange-400 hover:text-orange-300 underline transition-colors"
99
+ >
100
+ contact support
101
+ </a>
102
+ .
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </Body>
107
+ </Page>
108
+ );
109
+ }
Binary file