arcanajs 1.0.0 → 2.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.
Files changed (121) hide show
  1. package/babel.config.js +7 -0
  2. package/lib/client/index.d.ts +2 -0
  3. package/lib/client/index.js +40 -0
  4. package/lib/index.d.ts +17 -0
  5. package/lib/index.js +33 -0
  6. package/lib/server/ArcanaJSMiddleware.d.ts +16 -0
  7. package/lib/server/ArcanaJSMiddleware.js +99 -0
  8. package/lib/server/ArcanaJSServer.d.ts +21 -0
  9. package/lib/server/ArcanaJSServer.js +140 -0
  10. package/lib/server/ControllerBinder.d.ts +4 -0
  11. package/lib/server/ControllerBinder.js +32 -0
  12. package/lib/server/CsrfMiddleware.d.ts +2 -0
  13. package/lib/server/CsrfMiddleware.js +34 -0
  14. package/lib/server/DynamicRouter.d.ts +2 -0
  15. package/lib/server/DynamicRouter.js +50 -0
  16. package/lib/server/ResponseHandlerMiddleware.d.ts +27 -0
  17. package/lib/server/ResponseHandlerMiddleware.js +30 -0
  18. package/lib/server/Router.d.ts +94 -0
  19. package/lib/server/Router.js +203 -0
  20. package/lib/server.d.ts +6 -0
  21. package/lib/server.js +28 -0
  22. package/lib/shared/ArcanaJSApp.d.ts +11 -0
  23. package/lib/shared/ArcanaJSApp.js +79 -0
  24. package/lib/shared/components/Body.d.ts +6 -0
  25. package/lib/shared/components/Body.js +11 -0
  26. package/lib/shared/components/Head.d.ts +4 -0
  27. package/lib/shared/components/Head.js +125 -0
  28. package/lib/shared/components/Link.d.ts +6 -0
  29. package/lib/shared/components/Link.js +17 -0
  30. package/lib/shared/components/NavLink.d.ts +8 -0
  31. package/lib/shared/components/NavLink.js +16 -0
  32. package/lib/shared/components/Page.d.ts +6 -0
  33. package/lib/shared/components/Page.js +16 -0
  34. package/lib/shared/context/HeadContext.d.ts +6 -0
  35. package/lib/shared/context/HeadContext.js +5 -0
  36. package/lib/shared/context/PageContext.d.ts +1 -0
  37. package/lib/shared/context/PageContext.js +5 -0
  38. package/lib/shared/context/RouterContext.d.ts +13 -0
  39. package/lib/shared/context/RouterContext.js +13 -0
  40. package/lib/shared/core/ArcanaJSApp.d.ts +13 -0
  41. package/lib/shared/core/ArcanaJSApp.js +98 -0
  42. package/lib/shared/hooks/useDynamicComponents.d.ts +1 -0
  43. package/lib/shared/hooks/useDynamicComponents.js +20 -0
  44. package/lib/shared/hooks/useHead.d.ts +1 -0
  45. package/lib/shared/hooks/useHead.js +7 -0
  46. package/lib/shared/hooks/useLocation.d.ts +5 -0
  47. package/lib/shared/hooks/useLocation.js +13 -0
  48. package/lib/shared/hooks/usePage.d.ts +1 -0
  49. package/lib/shared/hooks/usePage.js +7 -0
  50. package/lib/shared/hooks/useParams.d.ts +1 -0
  51. package/lib/shared/hooks/useParams.js +13 -0
  52. package/lib/shared/hooks/useQuery.d.ts +1 -0
  53. package/lib/shared/hooks/useQuery.js +9 -0
  54. package/lib/shared/hooks/useRouter.d.ts +1 -0
  55. package/lib/shared/hooks/useRouter.js +13 -0
  56. package/lib/shared/utils/createSingletonContext.d.ts +11 -0
  57. package/lib/shared/utils/createSingletonContext.js +21 -0
  58. package/package.json +65 -25
  59. package/postcss.config.js +6 -0
  60. package/tailwind.config.js +8 -0
  61. package/tsconfig.json +6 -17
  62. package/webpack.client.js +71 -0
  63. package/webpack.server.js +39 -0
  64. package/.env.example +0 -0
  65. package/.prettierrc +0 -4
  66. package/README.md +0 -115
  67. package/arcanajs +0 -0
  68. package/arcanajs-cli.json +0 -8
  69. package/arcanajs.config.mjs +0 -0
  70. package/eslint.config.mjs +0 -35
  71. package/jest.config.mjs +0 -8
  72. package/src/app/Http/Controllers/Controller.ts +0 -0
  73. package/src/app/Http/Controllers/UserController.ts +0 -0
  74. package/src/app/Http/Middleware/AuthMiddleware.ts +0 -0
  75. package/src/app/Http/Middleware/ValidationMiddleware.ts +0 -0
  76. package/src/app/Models/User.ts +0 -0
  77. package/src/app/Providers/AppServiceProvider.ts +0 -0
  78. package/src/app/Providers/DatabaseProvider.ts +0 -0
  79. package/src/app/Repositories/UserRepository.ts +0 -0
  80. package/src/app/Services/UserService.ts +0 -0
  81. package/src/bootstrap/app.ts +0 -0
  82. package/src/config/app.ts +0 -0
  83. package/src/config/cache.ts +0 -0
  84. package/src/config/database.ts +0 -0
  85. package/src/config/mail.ts +0 -0
  86. package/src/config/server.ts +0 -0
  87. package/src/core/App.ts +0 -0
  88. package/src/core/Cache.ts +0 -0
  89. package/src/core/Container.ts +0 -0
  90. package/src/core/Controller.ts +0 -0
  91. package/src/core/Kernel.ts +0 -0
  92. package/src/core/Logger.ts +0 -0
  93. package/src/core/Repository.ts +0 -0
  94. package/src/core/Response.ts +0 -0
  95. package/src/core/Service.ts +0 -0
  96. package/src/core/Validator.ts +0 -0
  97. package/src/resources/css/style.css +0 -0
  98. package/src/resources/views/back-office/components/common/Footer/main.tsx +0 -161
  99. package/src/resources/views/back-office/components/common/Header/main.tsx +0 -151
  100. package/src/resources/views/back-office/components/common/Layout/main.tsx +0 -15
  101. package/src/resources/views/back-office/components/ui/CodeBlock/index.tsx +0 -350
  102. package/src/resources/views/back-office/pages/About/index.tsx +0 -0
  103. package/src/resources/views/back-office/pages/Contact/index.tsx +0 -0
  104. package/src/resources/views/back-office/pages/Home/index.tsx +0 -0
  105. package/src/resources/views/back-office/pages/NotFound/index.tsx +0 -0
  106. package/src/resources/views/back-office/types/global.d.ts +0 -0
  107. package/src/resources/views/front-office/components/common/Footer/main.tsx +0 -161
  108. package/src/resources/views/front-office/components/common/Header/main.tsx +0 -151
  109. package/src/resources/views/front-office/components/common/Layout/main.tsx +0 -15
  110. package/src/resources/views/front-office/components/ui/CodeBlock/index.tsx +0 -350
  111. package/src/resources/views/front-office/pages/About/index.tsx +0 -0
  112. package/src/resources/views/front-office/pages/Contact/index.tsx +0 -0
  113. package/src/resources/views/front-office/pages/Home/index.tsx +0 -0
  114. package/src/resources/views/front-office/pages/NotFound/index.tsx +0 -0
  115. package/src/resources/views/front-office/types/global.d.ts +0 -0
  116. package/src/resources/views/main.tsx +0 -0
  117. package/src/routes/api.routes.ts +0 -0
  118. package/src/routes/web.routes.ts +0 -0
  119. package/tests/integration/jest.ts +0 -0
  120. package/tests/unit/jest.ts +0 -0
  121. package/tsconfig.build.json +0 -4
package/eslint.config.mjs DELETED
@@ -1,35 +0,0 @@
1
- // @ts-check
2
- import eslint from '@eslint/js';
3
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4
- import globals from 'globals';
5
- import tseslint from 'typescript-eslint';
6
-
7
- export default tseslint.config(
8
- {
9
- ignores: ['eslint.config.mjs'],
10
- },
11
- eslint.configs.recommended,
12
- ...tseslint.configs.recommendedTypeChecked,
13
- eslintPluginPrettierRecommended,
14
- {
15
- languageOptions: {
16
- globals: {
17
- ...globals.node,
18
- ...globals.jest,
19
- },
20
- sourceType: 'commonjs',
21
- parserOptions: {
22
- projectService: true,
23
- tsconfigRootDir: import.meta.dirname,
24
- },
25
- },
26
- },
27
- {
28
- rules: {
29
- '@typescript-eslint/no-explicit-any': 'off',
30
- '@typescript-eslint/no-floating-promises': 'warn',
31
- '@typescript-eslint/no-unsafe-argument': 'warn',
32
- "prettier/prettier": ["error", { endOfLine: "auto" }],
33
- },
34
- },
35
- );
package/jest.config.mjs DELETED
@@ -1,8 +0,0 @@
1
- export default {
2
- testEnvironment: "node",
3
- transform: {
4
- "^.+\\.js$": "babel-jest",
5
- },
6
- transformIgnorePatterns: ["/node_modules/(?!(uuid)/)"],
7
- testMatch: ["**/test/**/*.test.js"],
8
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/config/app.ts DELETED
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/core/App.ts DELETED
File without changes
package/src/core/Cache.ts DELETED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,161 +0,0 @@
1
- import { Link } from "router-kit";
2
-
3
- const MainFooter = () => {
4
- return (
5
- <footer className="bg-primary-500 border-t border-white/10">
6
- <div className="max-w-7xl mx-auto px-4 sm:px-6 py-8 sm:py-10 lg:py-12">
7
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 sm:gap-8">
8
- {/* Company Info */}
9
- <div className="col-span-1 sm:col-span-2">
10
- <div className="flex items-center space-x-3 mb-3 sm:mb-4">
11
- <span className="text-xl sm:text-2xl font-bold text-gradient">
12
- Router-Kit
13
- </span>
14
- </div>
15
- <p className="text-white/70 text-xs sm:text-sm mb-3 sm:mb-4 max-w-md">
16
- A lightweight, minimal, and powerful client-side routing library
17
- for React applications. Simple yet flexible routing without the
18
- overhead.
19
- </p>
20
- <div className="flex space-x-3 sm:space-x-4">
21
- <a
22
- href="https://github.com/Mohammed-Ben-Cheikh/router-kit"
23
- target="_blank"
24
- rel="noopener noreferrer"
25
- className="text-white/70 hover:text-accent-300 transition-colors"
26
- aria-label="GitHub"
27
- >
28
- <svg
29
- className="w-5 h-5 sm:w-6 sm:h-6"
30
- fill="currentColor"
31
- viewBox="0 0 24 24"
32
- >
33
- <path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
34
- </svg>
35
- </a>
36
- <a
37
- href="https://www.npmjs.com/package/router-kit"
38
- target="_blank"
39
- rel="noopener noreferrer"
40
- className="text-white/70 hover:text-accent-300 transition-colors"
41
- aria-label="NPM"
42
- >
43
- <svg
44
- className="w-5 h-5 sm:w-6 sm:h-6"
45
- fill="currentColor"
46
- viewBox="0 0 24 24"
47
- >
48
- <path d="M0 7.334v8h6.666v1.332H12v-1.332h12v-8H0zm6.666 6.664H5.334v-4H3.999v4H1.335V8.667h5.331v5.331zm4 0v1.336H8.001V8.667h5.334v5.332h-2.669v-.001zm12.001 0h-1.33v-4h-1.336v4h-1.335v-4h-1.33v4h-2.671V8.667h8.002v5.331zM10.665 10H12v2.667h-1.335V10z" />
49
- </svg>
50
- </a>
51
- </div>
52
- </div>
53
-
54
- {/* Quick Links */}
55
- <div>
56
- <h4 className="text-white text-base sm:text-lg font-semibold mb-3 sm:mb-4">
57
- Quick Links
58
- </h4>
59
- <ul className="space-y-2">
60
- <li>
61
- <Link
62
- to="/"
63
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
64
- >
65
- Home
66
- </Link>
67
- </li>
68
- <li>
69
- <Link
70
- to="/docs"
71
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
72
- >
73
- Documentation
74
- </Link>
75
- </li>
76
- <li>
77
- <Link
78
- to="/about"
79
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
80
- >
81
- About
82
- </Link>
83
- </li>
84
- <li>
85
- <Link
86
- to="/contact"
87
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
88
- >
89
- Contact
90
- </Link>
91
- </li>
92
- </ul>
93
- </div>
94
-
95
- {/* Resources */}
96
- <div>
97
- <h4 className="text-white text-base sm:text-lg font-semibold mb-3 sm:mb-4">
98
- Resources
99
- </h4>
100
- <ul className="space-y-2">
101
- <li>
102
- <a
103
- href="https://github.com/Mohammed-Ben-Cheikh/router-kit"
104
- target="_blank"
105
- rel="noopener noreferrer"
106
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
107
- >
108
- GitHub
109
- </a>
110
- </li>
111
- <li>
112
- <a
113
- href="https://www.npmjs.com/package/router-kit"
114
- target="_blank"
115
- rel="noopener noreferrer"
116
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
117
- >
118
- NPM Package
119
- </a>
120
- </li>
121
- <li>
122
- <a
123
- href="#"
124
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
125
- >
126
- API Reference
127
- </a>
128
- </li>
129
- <li>
130
- <a
131
- href="#"
132
- className="text-sm text-white/70 hover:text-accent-300 transition-colors"
133
- >
134
- Examples
135
- </a>
136
- </li>
137
- </ul>
138
- </div>
139
- </div>
140
-
141
- {/* Copyright */}
142
- <div className="border-t border-white/10 mt-6 sm:mt-8 pt-6 sm:pt-8 text-xs sm:text-sm text-center text-white/60">
143
- <p className="px-4">
144
- © {new Date().getFullYear()} Router-Kit by{" "}
145
- <a
146
- href="https://mohammedbencheikh.com"
147
- target="_blank"
148
- rel="noopener noreferrer"
149
- className="text-accent-300 hover:underline"
150
- >
151
- Mohammed Ben Cheikh
152
- </a>
153
- . All rights reserved.
154
- </p>
155
- </div>
156
- </div>
157
- </footer>
158
- );
159
- };
160
-
161
- export default MainFooter;
@@ -1,151 +0,0 @@
1
- import { useState } from "react";
2
- import { Link, NavLink } from "router-kit";
3
-
4
- const MainHeader = () => {
5
- const [isMenuOpen, setIsMenuOpen] = useState(false);
6
-
7
- const linkClasses =
8
- "px-4 py-2 text-white/80 hover:text-accent-300 transition-all duration-300 rounded-lg hover:bg-white/10 font-medium";
9
- const activeLinkClasses = "!text-accent-300 bg-white/10";
10
-
11
- const mobileLinkClasses =
12
- "block px-4 py-3 text-white/80 hover:text-accent-300 transition-all duration-300 rounded-lg hover:bg-white/10 font-medium";
13
-
14
- const toggleMenu = () => {
15
- setIsMenuOpen(!isMenuOpen);
16
- };
17
-
18
- const closeMenu = () => {
19
- setIsMenuOpen(false);
20
- };
21
-
22
- return (
23
- <nav className="fixed top-0 left-0 right-0 bg-primary-500/95 backdrop-blur-md border-b border-white/10 z-50">
24
- <div className="max-w-7xl mx-auto px-4">
25
- <div className="flex items-center justify-between h-16">
26
- <Link to="/" className="flex items-center space-x-3 group">
27
- <span className="text-2xl font-bold text-gradient">Router-Kit</span>
28
- </Link>
29
-
30
- {/* Desktop Menu */}
31
- <div className="hidden md:flex items-center space-x-2">
32
- <NavLink
33
- className={linkClasses}
34
- activeClassName={activeLinkClasses}
35
- to="/"
36
- >
37
- Home
38
- </NavLink>
39
- <NavLink
40
- className={linkClasses}
41
- activeClassName={activeLinkClasses}
42
- to="/docs"
43
- >
44
- Documentation
45
- </NavLink>
46
- <NavLink
47
- className={linkClasses}
48
- activeClassName={activeLinkClasses}
49
- to="/about"
50
- >
51
- About
52
- </NavLink>
53
- <NavLink
54
- className={linkClasses}
55
- activeClassName={activeLinkClasses}
56
- to="/contact"
57
- >
58
- Contact
59
- </NavLink>
60
- <a
61
- href="https://github.com/Mohammed-Ben-Cheikh/router-kit"
62
- target="_blank"
63
- rel="noopener noreferrer"
64
- className="ml-4 px-4 py-2 bg-gradient-blue text-primary-500 rounded-lg font-semibold hover:shadow-lg hover:shadow-accent-300/50 transition-all duration-300"
65
- >
66
- GitHub
67
- </a>
68
- </div>
69
-
70
- {/* Mobile Menu Button */}
71
- <button
72
- onClick={toggleMenu}
73
- className="md:hidden p-2 text-white/80 hover:text-accent-300 transition-colors"
74
- aria-label="Toggle menu"
75
- >
76
- <svg
77
- className="w-6 h-6"
78
- fill="none"
79
- stroke="currentColor"
80
- viewBox="0 0 24 24"
81
- >
82
- {isMenuOpen ? (
83
- <path
84
- strokeLinecap="round"
85
- strokeLinejoin="round"
86
- strokeWidth={2}
87
- d="M6 18L18 6M6 6l12 12"
88
- />
89
- ) : (
90
- <path
91
- strokeLinecap="round"
92
- strokeLinejoin="round"
93
- strokeWidth={2}
94
- d="M4 6h16M4 12h16M4 18h16"
95
- />
96
- )}
97
- </svg>
98
- </button>
99
- </div>
100
-
101
- {/* Mobile Menu */}
102
- <div
103
- className={`md:hidden overflow-hidden transition-all duration-300 ease-in-out ${
104
- isMenuOpen ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
105
- }`}
106
- >
107
- <div className="py-4 space-y-2" onClick={closeMenu}>
108
- <NavLink
109
- className={mobileLinkClasses}
110
- activeClassName={activeLinkClasses}
111
- to="/"
112
- >
113
- Home
114
- </NavLink>
115
- <NavLink
116
- className={mobileLinkClasses}
117
- activeClassName={activeLinkClasses}
118
- to="/docs"
119
- >
120
- Documentation
121
- </NavLink>
122
- <NavLink
123
- className={mobileLinkClasses}
124
- activeClassName={activeLinkClasses}
125
- to="/about"
126
- >
127
- About
128
- </NavLink>
129
- <NavLink
130
- className={mobileLinkClasses}
131
- activeClassName={activeLinkClasses}
132
- to="/contact"
133
- >
134
- Contact
135
- </NavLink>
136
- <a
137
- href="https://github.com/Mohammed-Ben-Cheikh/router-kit"
138
- target="_blank"
139
- rel="noopener noreferrer"
140
- className="block mx-4 mt-4 px-4 py-2 bg-gradient-blue text-primary-500 rounded-lg font-semibold text-center hover:shadow-lg hover:shadow-accent-300/50 transition-all duration-300"
141
- >
142
- GitHub
143
- </a>
144
- </div>
145
- </div>
146
- </div>
147
- </nav>
148
- );
149
- };
150
-
151
- export default MainHeader;
@@ -1,15 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import MainFooter from "../Footer/main";
3
- import MainHeader from "../Header/main";
4
-
5
- const MainLayout = ({ children }: { children: ReactNode }) => {
6
- return (
7
- <div className="min-h-screen bg-primary-500 flex flex-col">
8
- <MainHeader />
9
- <main className="pt-16 flex-grow">{children}</main>
10
- <MainFooter />
11
- </div>
12
- );
13
- };
14
-
15
- export default MainLayout;