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
@@ -1,22 +1,58 @@
1
- import React, { useEffect } from "react";
2
- import { useHead } from "../hooks/useHead";
3
- export const Head = ({ children }) => {
4
- const headManager = useHead();
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Head = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const useHead_1 = require("../hooks/useHead");
39
+ const Head = ({ children }) => {
40
+ const headManager = (0, useHead_1.useHead)();
5
41
  // Server-side: Push tags to context
6
42
  if (typeof window === "undefined" && headManager) {
7
- React.Children.forEach(children, (child) => {
8
- if (React.isValidElement(child)) {
9
- headManager.push(React.cloneElement(child, {
43
+ react_1.default.Children.forEach(children, (child) => {
44
+ if (react_1.default.isValidElement(child)) {
45
+ headManager.push(react_1.default.cloneElement(child, {
10
46
  "data-arcanajs-head": "true",
11
47
  }));
12
48
  }
13
49
  });
14
50
  }
15
51
  // Client-side: Update DOM
16
- useEffect(() => {
52
+ (0, react_1.useEffect)(() => {
17
53
  const managedElements = [];
18
- React.Children.forEach(children, (child) => {
19
- if (React.isValidElement(child)) {
54
+ react_1.default.Children.forEach(children, (child) => {
55
+ if (react_1.default.isValidElement(child)) {
20
56
  const reactElement = child;
21
57
  if (reactElement.type === "title") {
22
58
  document.title = reactElement.props.children;
@@ -86,3 +122,4 @@ export const Head = ({ children }) => {
86
122
  }, [children]);
87
123
  return null;
88
124
  };
125
+ exports.Head = Head;
@@ -1,10 +1,14 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useRouter } from "../hooks/useRouter";
3
- export const Link = ({ href, children, ...props }) => {
4
- const { navigateTo } = useRouter();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Link = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const useRouter_1 = require("../hooks/useRouter");
6
+ const Link = ({ href, children, ...props }) => {
7
+ const { navigateTo } = (0, useRouter_1.useRouter)();
5
8
  const handleClick = (e) => {
6
9
  e.preventDefault();
7
10
  navigateTo(href);
8
11
  };
9
- return (_jsx("a", { href: href, onClick: handleClick, ...props, children: children }));
12
+ return ((0, jsx_runtime_1.jsx)("a", { href: href, onClick: handleClick, ...props, children: children }));
10
13
  };
14
+ exports.Link = Link;
@@ -1,9 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Link } from "./Link";
3
- import { useRouter } from "../hooks/useRouter";
4
- export const NavLink = ({ href, activeClassName = "active", className = "", exact = false, children, ...props }) => {
5
- const { currentUrl } = useRouter();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavLink = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Link_1 = require("./Link");
6
+ const useRouter_1 = require("../hooks/useRouter");
7
+ const NavLink = ({ href, activeClassName = "active", className = "", exact = false, children, ...props }) => {
8
+ const { currentUrl } = (0, useRouter_1.useRouter)();
6
9
  const isActive = exact ? currentUrl === href : currentUrl.startsWith(href);
7
10
  const combinedClassName = `${className} ${isActive ? activeClassName : ""}`.trim();
8
- return (_jsx(Link, { href: href, className: combinedClassName, ...props, children: children }));
11
+ return ((0, jsx_runtime_1.jsx)(Link_1.Link, { href: href, className: combinedClassName, ...props, children: children }));
9
12
  };
13
+ exports.NavLink = NavLink;
@@ -1,6 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { PageContext } from "../context/PageContext";
3
- import { Head } from "./Head";
4
- export const Page = ({ data, title, children }) => {
5
- return (_jsxs(PageContext.Provider, { value: data, children: [title && (_jsx(Head, { children: _jsx("title", { children: title }) })), children] }));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Page = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const PageContext_1 = require("../context/PageContext");
6
+ const Head_1 = require("./Head");
7
+ const Page = ({ data, title, children }) => {
8
+ return ((0, jsx_runtime_1.jsxs)(PageContext_1.PageContext.Provider, { value: data, children: [title && ((0, jsx_runtime_1.jsx)(Head_1.Head, { children: (0, jsx_runtime_1.jsx)("title", { children: title }) })), children] }));
6
9
  };
10
+ exports.Page = Page;
@@ -1,2 +1,5 @@
1
- import { createSingletonContext } from "../utils/createSingletonContext";
2
- export const HeadContext = createSingletonContext("HeadContext", null);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeadContext = void 0;
4
+ const createSingletonContext_1 = require("../utils/createSingletonContext");
5
+ exports.HeadContext = (0, createSingletonContext_1.createSingletonContext)("HeadContext", null);
@@ -1,2 +1,5 @@
1
- import { createSingletonContext } from "../utils/createSingletonContext";
2
- export const PageContext = createSingletonContext("PageContext", null);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageContext = void 0;
4
+ const createSingletonContext_1 = require("../utils/createSingletonContext");
5
+ exports.PageContext = (0, createSingletonContext_1.createSingletonContext)("PageContext", null);
@@ -1,6 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createSingletonContext } from "../utils/createSingletonContext";
3
- export const RouterContext = createSingletonContext("RouterContext", null);
4
- export const RouterProvider = ({ value, children }) => {
5
- return (_jsx(RouterContext.Provider, { value: value, children: children }));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouterProvider = exports.RouterContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const createSingletonContext_1 = require("../utils/createSingletonContext");
6
+ exports.RouterContext = (0, createSingletonContext_1.createSingletonContext)("RouterContext", null);
7
+ const RouterProvider = ({ value, children }) => {
8
+ return ((0, jsx_runtime_1.jsx)(exports.RouterContext.Provider, { value: value, children: children }));
6
9
  };
10
+ exports.RouterProvider = RouterProvider;
@@ -1,14 +1,17 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Page } from "../components/Page";
4
- import { RouterProvider } from "../context/RouterContext";
5
- export const ArcanaJSApp = ({ initialPage, initialData, initialParams = {}, initialUrl, csrfToken, views, layout: Layout, }) => {
6
- const [page, setPage] = useState(initialPage);
7
- const [data, setData] = useState(initialData);
8
- const [params, setParams] = useState(initialParams);
9
- const [url, setUrl] = useState(initialUrl ||
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArcanaJSApp = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const Page_1 = require("../components/Page");
7
+ const RouterContext_1 = require("../context/RouterContext");
8
+ const ArcanaJSApp = ({ initialPage, initialData, initialParams = {}, initialUrl, csrfToken, views, layout: Layout, }) => {
9
+ const [page, setPage] = (0, react_1.useState)(initialPage);
10
+ const [data, setData] = (0, react_1.useState)(initialData);
11
+ const [params, setParams] = (0, react_1.useState)(initialParams);
12
+ const [url, setUrl] = (0, react_1.useState)(initialUrl ||
10
13
  (typeof window !== "undefined" ? window.location.pathname : "/"));
11
- useEffect(() => {
14
+ (0, react_1.useEffect)(() => {
12
15
  const handlePopState = (event) => {
13
16
  if (event.state) {
14
17
  setPage(event.state.page);
@@ -47,15 +50,16 @@ export const ArcanaJSApp = ({ initialPage, initialData, initialParams = {}, init
47
50
  }
48
51
  };
49
52
  const renderPage = () => {
50
- const Component = views[page] || views["NotFoundPage"] || (() => _jsx("div", { children: "404 Not Found" }));
51
- return (_jsx(Page, { data: data, children: _jsx(Component, { data: data, navigateTo: navigateTo, params: params }) }));
53
+ const Component = views[page] || views["NotFoundPage"] || (() => (0, jsx_runtime_1.jsx)("div", { children: "404 Not Found" }));
54
+ return ((0, jsx_runtime_1.jsx)(Page_1.Page, { data: data, children: (0, jsx_runtime_1.jsx)(Component, { data: data, navigateTo: navigateTo, params: params }) }));
52
55
  };
53
56
  const content = renderPage();
54
- return (_jsx(RouterProvider, { value: {
57
+ return ((0, jsx_runtime_1.jsx)(RouterContext_1.RouterProvider, { value: {
55
58
  navigateTo,
56
59
  currentPage: page,
57
60
  currentUrl: url,
58
61
  params,
59
62
  csrfToken,
60
- }, children: Layout ? _jsx(Layout, { children: content }) : _jsx(_Fragment, { children: content }) }));
63
+ }, children: Layout ? (0, jsx_runtime_1.jsx)(Layout, { children: content }) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: content }) }));
61
64
  };
65
+ exports.ArcanaJSApp = ArcanaJSApp;
@@ -1 +1 @@
1
- export declare const useHead: () => import("../..").HeadManager | null;
1
+ export declare const useHead: () => import("../context/HeadContext").HeadManager | null;
@@ -1,3 +1,7 @@
1
- import { useContext } from "react";
2
- import { HeadContext } from "../context/HeadContext";
3
- export const useHead = () => useContext(HeadContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useHead = void 0;
4
+ const react_1 = require("react");
5
+ const HeadContext_1 = require("../context/HeadContext");
6
+ const useHead = () => (0, react_1.useContext)(HeadContext_1.HeadContext);
7
+ exports.useHead = useHead;
@@ -1,9 +1,13 @@
1
- import { useRouter } from "./useRouter";
2
- export const useLocation = () => {
3
- const { currentUrl } = useRouter();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLocation = void 0;
4
+ const useRouter_1 = require("./useRouter");
5
+ const useLocation = () => {
6
+ const { currentUrl } = (0, useRouter_1.useRouter)();
4
7
  return {
5
8
  pathname: currentUrl,
6
9
  search: typeof window !== "undefined" ? window.location.search : "",
7
10
  hash: typeof window !== "undefined" ? window.location.hash : "",
8
11
  };
9
12
  };
13
+ exports.useLocation = useLocation;
@@ -1,3 +1,7 @@
1
- import { useContext } from "react";
2
- import { PageContext } from "../context/PageContext";
3
- export const usePage = () => useContext(PageContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePage = void 0;
4
+ const react_1 = require("react");
5
+ const PageContext_1 = require("../context/PageContext");
6
+ const usePage = () => (0, react_1.useContext)(PageContext_1.PageContext);
7
+ exports.usePage = usePage;
@@ -1,9 +1,13 @@
1
- import { useContext } from "react";
2
- import { RouterContext } from "../context/RouterContext";
3
- export const useParams = () => {
4
- const context = useContext(RouterContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useParams = void 0;
4
+ const react_1 = require("react");
5
+ const RouterContext_1 = require("../context/RouterContext");
6
+ const useParams = () => {
7
+ const context = (0, react_1.useContext)(RouterContext_1.RouterContext);
5
8
  if (!context) {
6
9
  throw new Error("useParams must be used within an ArcanaJSApp");
7
10
  }
8
11
  return context.params;
9
12
  };
13
+ exports.useParams = useParams;
@@ -1,5 +1,9 @@
1
- import { useLocation } from "./useLocation";
2
- export const useQuery = () => {
3
- const { search } = useLocation();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useQuery = void 0;
4
+ const useLocation_1 = require("./useLocation");
5
+ const useQuery = () => {
6
+ const { search } = (0, useLocation_1.useLocation)();
4
7
  return new URLSearchParams(search);
5
8
  };
9
+ exports.useQuery = useQuery;
@@ -1 +1 @@
1
- export declare const useRouter: () => import("../..").RouterContextType;
1
+ export declare const useRouter: () => import("../context/RouterContext").RouterContextType;
@@ -1,9 +1,13 @@
1
- import { useContext } from "react";
2
- import { RouterContext } from "../context/RouterContext";
3
- export const useRouter = () => {
4
- const context = useContext(RouterContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useRouter = void 0;
4
+ const react_1 = require("react");
5
+ const RouterContext_1 = require("../context/RouterContext");
6
+ const useRouter = () => {
7
+ const context = (0, react_1.useContext)(RouterContext_1.RouterContext);
5
8
  if (!context) {
6
9
  throw new Error("useRouter must be used within an ArcanaJSApp");
7
10
  }
8
11
  return context;
9
12
  };
13
+ exports.useRouter = useRouter;
@@ -1,4 +1,7 @@
1
- import { createContext } from "react";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSingletonContext = createSingletonContext;
4
+ const react_1 = require("react");
2
5
  /**
3
6
  * Creates a React Context that persists across multiple module loads (Webpack bundles vs Node require).
4
7
  * This is essential for SSR applications where the server bundle and dynamically loaded views
@@ -8,11 +11,11 @@ import { createContext } from "react";
8
11
  * @param defaultValue The default value for the context
9
12
  * @returns A React Context instance (singleton)
10
13
  */
11
- export function createSingletonContext(key, defaultValue) {
14
+ function createSingletonContext(key, defaultValue) {
12
15
  const globalAny = global;
13
16
  const symbolKey = Symbol.for(`ARCANAJS_CONTEXT_${key}`);
14
17
  if (!globalAny[symbolKey]) {
15
- globalAny[symbolKey] = createContext(defaultValue);
18
+ globalAny[symbolKey] = (0, react_1.createContext)(defaultValue);
16
19
  }
17
20
  return globalAny[symbolKey];
18
21
  }
@@ -0,0 +1,7 @@
1
+ interface ErrorPageProps {
2
+ message?: string;
3
+ statusCode?: number;
4
+ stack?: string;
5
+ }
6
+ export default function ErrorPage({ message, statusCode, stack, }: ErrorPageProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ErrorPage;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Page_1 = require("../components/Page");
6
+ const Head_1 = require("../components/Head");
7
+ const Body_1 = require("../components/Body");
8
+ function ErrorPage({ message = "Something went wrong", statusCode = 500, stack, }) {
9
+ const isDevelopment = process.env.NODE_ENV === "development";
10
+ return ((0, jsx_runtime_1.jsxs)(Page_1.Page, { children: [(0, jsx_runtime_1.jsxs)(Head_1.Head, { children: [(0, jsx_runtime_1.jsxs)("title", { children: [statusCode, " - Server Error"] }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: "An error occurred on the server" })] }), (0, jsx_runtime_1.jsx)(Body_1.Body, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative min-h-screen overflow-hidden bg-black text-white flex flex-col justify-center items-center px-4 font-sans", children: [(0, jsx_runtime_1.jsxs)("div", { className: "fixed inset-0 z-0 overflow-hidden pointer-events-none", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 grid-pattern opacity-30" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute top-1/4 right-1/4 w-96 h-96 bg-red-600 rounded-full opacity-20 blur-3xl animate-glow" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute bottom-1/4 left-1/4 w-96 h-96 bg-orange-600 rounded-full opacity-10 blur-3xl animate-glow", style: { animationDelay: "2s" } }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 hero-gradient" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative z-10 max-w-2xl w-full text-center animate-scale-in", children: [(0, jsx_runtime_1.jsxs)("div", { className: "glass-card rounded-3xl p-12 border border-white/10 shadow-2xl", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-8", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-6xl mb-6 animate-float", children: (0, jsx_runtime_1.jsx)("span", { className: "text-red-500 drop-shadow-lg filter", children: "\u26A0\uFE0F" }) }), (0, jsx_runtime_1.jsx)("h1", { className: "text-8xl font-bold text-transparent bg-clip-text bg-gradient-to-br from-red-500 to-orange-500 mb-4", children: statusCode }), (0, jsx_runtime_1.jsx)("h2", { className: "text-3xl font-bold text-white mb-4", children: "Server Error" }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-400 text-lg leading-relaxed", children: message })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col sm:flex-row gap-4 justify-center mb-8", children: [(0, jsx_runtime_1.jsxs)("a", { href: "/", 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 bg-gradient-to-r from-red-600 to-orange-600 hover:from-red-500 hover:to-orange-500 border-none shadow-red-900/20", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, 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" }) }), "Go Home"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => window.location.reload(), 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", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }), "Try Again"] })] }), isDevelopment && stack && ((0, jsx_runtime_1.jsx)("div", { className: "mt-8 text-left animate-slide-up", children: (0, jsx_runtime_1.jsxs)("details", { className: "bg-black/40 border border-white/10 rounded-xl overflow-hidden group", children: [(0, jsx_runtime_1.jsxs)("summary", { className: "cursor-pointer font-medium text-gray-300 p-4 hover:bg-white/5 transition-colors flex items-center justify-between select-none", children: [(0, jsx_runtime_1.jsx)("span", { children: "Stack Trace (Development Only)" }), (0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5 text-gray-500 group-open:rotate-180 transition-transform", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }), (0, jsx_runtime_1.jsx)("pre", { className: "text-xs text-red-300/80 p-4 overflow-x-auto whitespace-pre-wrap font-mono border-t border-white/5 bg-black/20", children: stack })] }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 text-gray-500 text-sm", children: ["If this problem persists, please", " ", (0, jsx_runtime_1.jsx)("a", { href: "/contact", className: "text-red-400 hover:text-red-300 underline transition-colors", children: "contact support" }), "."] })] })] }) })] }));
11
+ }
@@ -0,0 +1,5 @@
1
+ interface NotFoundPageProps {
2
+ url?: string;
3
+ }
4
+ export default function NotFoundPage({ url }: NotFoundPageProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = NotFoundPage;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Page_1 = require("../components/Page");
6
+ const Head_1 = require("../components/Head");
7
+ const Body_1 = require("../components/Body");
8
+ function NotFoundPage({ url }) {
9
+ return ((0, jsx_runtime_1.jsxs)(Page_1.Page, { children: [(0, jsx_runtime_1.jsxs)(Head_1.Head, { children: [(0, jsx_runtime_1.jsx)("title", { children: "404 - Page Not Found" }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: "The page you're looking for doesn't exist" })] }), (0, jsx_runtime_1.jsx)(Body_1.Body, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative min-h-screen overflow-hidden bg-black text-white flex flex-col justify-center items-center px-4 font-sans", children: [(0, jsx_runtime_1.jsxs)("div", { className: "fixed inset-0 z-0 overflow-hidden pointer-events-none", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 grid-pattern opacity-30" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute top-1/4 left-1/4 w-96 h-96 bg-orange-500 rounded-full opacity-20 blur-3xl animate-glow" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute bottom-1/4 right-1/4 w-96 h-96 bg-purple-500 rounded-full opacity-10 blur-3xl animate-glow", style: { animationDelay: "2s" } }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 hero-gradient" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative z-10 max-w-lg w-full text-center animate-scale-in", children: [(0, jsx_runtime_1.jsxs)("div", { className: "glass-card rounded-3xl p-12 border border-white/10 shadow-2xl", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-8", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-9xl font-bold text-transparent bg-clip-text bg-gradient-to-br from-white to-gray-500 mb-4 animate-float", children: "404" }), (0, jsx_runtime_1.jsx)("h2", { className: "text-3xl font-bold text-white mb-4", children: "Page Not Found" }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-400 text-lg leading-relaxed", children: url ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["The page ", (0, jsx_runtime_1.jsxs)("span", { className: "text-orange-400", children: ["\"", url, "\""] }), " ", "you're looking for doesn't exist."] })) : ("The page you're looking for doesn't exist.") })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col sm:flex-row gap-4 justify-center", children: [(0, jsx_runtime_1.jsxs)("a", { href: "/", 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", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, 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" }) }), "Go Home"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => window.history.back(), 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", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) }), "Go Back"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 text-gray-500 text-sm", children: ["If you believe this is an error, please", " ", (0, jsx_runtime_1.jsx)("a", { href: "/contact", className: "text-orange-400 hover:text-orange-300 underline transition-colors", children: "contact support" }), "."] })] })] }) })] }));
10
+ }
@@ -0,0 +1,137 @@
1
+ import React from "react";
2
+ import { Page, Head, Body } from "arcanajs";
3
+
4
+ interface ErrorPageProps {
5
+ message?: string;
6
+ statusCode?: number;
7
+ stack?: string;
8
+ }
9
+
10
+ export default function ErrorPage({
11
+ message = "Something went wrong",
12
+ statusCode = 500,
13
+ stack,
14
+ }: ErrorPageProps) {
15
+ const isDevelopment = process.env.NODE_ENV === "development";
16
+
17
+ return (
18
+ <Page>
19
+ <Head>
20
+ <title>{statusCode} - Server Error</title>
21
+ <meta name="description" content="An error occurred on the server" />
22
+ </Head>
23
+ <Body>
24
+ <div className="relative min-h-screen overflow-hidden bg-black text-white flex flex-col justify-center items-center px-4 font-sans">
25
+ {/* Animated Background */}
26
+ <div className="fixed inset-0 z-0 overflow-hidden pointer-events-none">
27
+ <div className="absolute inset-0 grid-pattern opacity-30"></div>
28
+ <div className="absolute top-1/4 right-1/4 w-96 h-96 bg-red-600 rounded-full opacity-20 blur-3xl animate-glow"></div>
29
+ <div
30
+ className="absolute bottom-1/4 left-1/4 w-96 h-96 bg-orange-600 rounded-full opacity-10 blur-3xl animate-glow"
31
+ style={{ animationDelay: "2s" }}
32
+ ></div>
33
+ <div className="absolute inset-0 hero-gradient"></div>
34
+ </div>
35
+
36
+ <div className="relative z-10 max-w-2xl w-full text-center animate-scale-in">
37
+ <div className="glass-card rounded-3xl p-12 border border-white/10 shadow-2xl">
38
+ <div className="mb-8">
39
+ <div className="text-6xl mb-6 animate-float">
40
+ <span className="text-red-500 drop-shadow-lg filter">⚠️</span>
41
+ </div>
42
+ <h1 className="text-8xl font-bold text-transparent bg-clip-text bg-gradient-to-br from-red-500 to-orange-500 mb-4">
43
+ {statusCode}
44
+ </h1>
45
+ <h2 className="text-3xl font-bold text-white mb-4">
46
+ Server Error
47
+ </h2>
48
+ <p className="text-gray-400 text-lg leading-relaxed">
49
+ {message}
50
+ </p>
51
+ </div>
52
+
53
+ <div className="flex flex-col sm:flex-row gap-4 justify-center mb-8">
54
+ <a
55
+ href="/"
56
+ 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 bg-gradient-to-r from-red-600 to-orange-600 hover:from-red-500 hover:to-orange-500 border-none shadow-red-900/20"
57
+ >
58
+ <svg
59
+ className="w-5 h-5"
60
+ fill="none"
61
+ stroke="currentColor"
62
+ viewBox="0 0 24 24"
63
+ >
64
+ <path
65
+ strokeLinecap="round"
66
+ strokeLinejoin="round"
67
+ strokeWidth={2}
68
+ 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"
69
+ />
70
+ </svg>
71
+ Go Home
72
+ </a>
73
+
74
+ <button
75
+ onClick={() => window.location.reload()}
76
+ 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"
77
+ >
78
+ <svg
79
+ className="w-5 h-5"
80
+ fill="none"
81
+ stroke="currentColor"
82
+ viewBox="0 0 24 24"
83
+ >
84
+ <path
85
+ strokeLinecap="round"
86
+ strokeLinejoin="round"
87
+ strokeWidth={2}
88
+ d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
89
+ />
90
+ </svg>
91
+ Try Again
92
+ </button>
93
+ </div>
94
+
95
+ {isDevelopment && stack && (
96
+ <div className="mt-8 text-left animate-slide-up">
97
+ <details className="bg-black/40 border border-white/10 rounded-xl overflow-hidden group">
98
+ <summary className="cursor-pointer font-medium text-gray-300 p-4 hover:bg-white/5 transition-colors flex items-center justify-between select-none">
99
+ <span>Stack Trace (Development Only)</span>
100
+ <svg
101
+ className="w-5 h-5 text-gray-500 group-open:rotate-180 transition-transform"
102
+ fill="none"
103
+ stroke="currentColor"
104
+ viewBox="0 0 24 24"
105
+ >
106
+ <path
107
+ strokeLinecap="round"
108
+ strokeLinejoin="round"
109
+ strokeWidth={2}
110
+ d="M19 9l-7 7-7-7"
111
+ />
112
+ </svg>
113
+ </summary>
114
+ <pre className="text-xs text-red-300/80 p-4 overflow-x-auto whitespace-pre-wrap font-mono border-t border-white/5 bg-black/20">
115
+ {stack}
116
+ </pre>
117
+ </details>
118
+ </div>
119
+ )}
120
+ </div>
121
+
122
+ <div className="mt-8 text-gray-500 text-sm">
123
+ If this problem persists, please{" "}
124
+ <a
125
+ href="/contact"
126
+ className="text-red-400 hover:text-red-300 underline transition-colors"
127
+ >
128
+ contact support
129
+ </a>
130
+ .
131
+ </div>
132
+ </div>
133
+ </div>
134
+ </Body>
135
+ </Page>
136
+ );
137
+ }