create-lumen 1.1.4 → 1.2.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.
- package/README.md +41 -34
- package/package.json +5 -1
- package/src/configure.js +6 -2
- package/src/css.js +71 -24
- package/src/dependencies.js +15 -6
- package/src/injector.js +116 -24
- package/src/main.js +3 -1
- package/src/readme.js +64 -22
- package/templates/architectures/component-based/src/App.jsx +6 -3
- package/templates/architectures/component-based/src/App.tsx +6 -3
- package/templates/architectures/component-based/src/components/common/Button.jsx +5 -2
- package/templates/architectures/component-based/src/components/common/Button.tsx +5 -2
- package/templates/architectures/component-based/src/hooks/useApp.js +10 -0
- package/templates/architectures/component-based/src/hooks/useApp.ts +10 -0
- package/templates/architectures/component-based/src/layouts/MainLayout.jsx +12 -4
- package/templates/architectures/component-based/src/layouts/MainLayout.tsx +12 -4
- package/templates/architectures/component-based/src/pages/Home/Home.jsx +6 -1
- package/templates/architectures/component-based/src/pages/Home/Home.tsx +6 -1
- package/templates/architectures/component-based/src/providers/AppProvider.jsx +20 -0
- package/templates/architectures/component-based/src/providers/AppProvider.tsx +24 -0
- package/templates/architectures/component-based/src/providers/appcontext.js +3 -0
- package/templates/architectures/component-based/src/{context/app-context.ts → providers/appcontext.ts} +1 -3
- package/templates/architectures/{feature-based → component-based}/src/types/index.js +7 -0
- package/templates/architectures/{feature-based → component-based}/src/types/index.ts +5 -0
- package/templates/architectures/feature-based/main.jsx +1 -1
- package/templates/architectures/feature-based/main.tsx +1 -1
- package/templates/architectures/feature-based/scripts/create-feature.mjs +2 -2
- package/templates/architectures/feature-based/src/app/App.jsx +15 -4
- package/templates/architectures/feature-based/src/app/App.tsx +15 -4
- package/templates/architectures/feature-based/src/app/contexts/themecontext.js +3 -0
- package/templates/architectures/feature-based/src/app/contexts/themecontext.ts +8 -0
- package/templates/architectures/feature-based/src/app/hooks/useTheme.js +10 -0
- package/templates/architectures/feature-based/src/app/hooks/useTheme.ts +10 -0
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.jsx +18 -1
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.tsx +19 -2
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.jsx +18 -4
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.tsx +18 -4
- package/templates/architectures/feature-based/src/shared/components/ui/Button.jsx +31 -0
- package/templates/architectures/feature-based/src/shared/components/ui/Button.tsx +36 -0
- package/templates/architectures/feature-based/src/shared/layouts/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/stores/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/styles/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/types/index.js +20 -0
- package/templates/architectures/feature-based/src/shared/types/index.ts +16 -0
- package/templates/conditional/axios/component-based/src/config/axios.config.js +7 -0
- package/templates/conditional/axios/component-based/src/config/axios.config.ts +7 -0
- package/templates/conditional/axios/component-based/src/services/axios.client.js +24 -0
- package/templates/conditional/axios/component-based/src/services/axios.client.ts +24 -0
- package/templates/conditional/axios/component-based/src/services/user.service.js +33 -0
- package/templates/conditional/axios/component-based/src/services/user.service.ts +29 -0
- package/templates/conditional/axios/feature-based/src/features/home/services/user.service.js +33 -0
- package/templates/conditional/axios/feature-based/src/features/home/services/user.service.ts +29 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.client.js +24 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.client.ts +24 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.config.js +7 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.config.ts +7 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/index.js +1 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/index.ts +1 -0
- package/templates/conditional/fetch/component-based/src/config/api.config.js +7 -0
- package/templates/conditional/fetch/component-based/src/config/api.config.ts +7 -0
- package/templates/conditional/fetch/component-based/src/services/api.client.js +51 -0
- package/templates/conditional/fetch/component-based/src/services/api.client.ts +55 -0
- package/templates/conditional/fetch/component-based/src/services/user.service.js +33 -0
- package/templates/conditional/fetch/component-based/src/services/user.service.ts +29 -0
- package/templates/conditional/fetch/feature-based/src/features/home/services/user.service.js +33 -0
- package/templates/conditional/fetch/feature-based/src/features/home/services/user.service.ts +29 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.client.js +51 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.client.ts +55 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.config.js +7 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.config.ts +7 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/index.js +1 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/index.ts +1 -0
- package/templates/conditional/icons/huge/component-based/bootstrap/src/pages/Home/Home.jsx +20 -0
- package/templates/conditional/icons/huge/component-based/bootstrap/src/pages/Home/Home.tsx +20 -0
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.jsx +24 -8
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.tsx +24 -8
- package/templates/conditional/icons/huge/component-based/tailwind/src/pages/Home/Home.jsx +20 -0
- package/templates/conditional/icons/huge/component-based/tailwind/src/pages/Home/Home.tsx +20 -0
- package/templates/conditional/icons/huge/feature-based/bootstrap/src/features/home/pages/HomePage.jsx +20 -0
- package/templates/conditional/icons/huge/feature-based/bootstrap/src/features/home/pages/HomePage.tsx +20 -0
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.jsx +25 -9
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.tsx +25 -9
- package/templates/conditional/icons/huge/feature-based/tailwind/src/features/home/pages/HomePage.jsx +20 -0
- package/templates/conditional/icons/huge/feature-based/tailwind/src/features/home/pages/HomePage.tsx +20 -0
- package/templates/conditional/icons/lucide/component-based/bootstrap/src/pages/Home/Home.jsx +19 -0
- package/templates/conditional/icons/lucide/component-based/bootstrap/src/pages/Home/Home.tsx +19 -0
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.jsx +24 -8
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.tsx +24 -8
- package/templates/conditional/icons/lucide/component-based/tailwind/src/pages/Home/Home.jsx +19 -0
- package/templates/conditional/icons/lucide/component-based/tailwind/src/pages/Home/Home.tsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/bootstrap/src/features/home/pages/HomePage.jsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/bootstrap/src/features/home/pages/HomePage.tsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.jsx +25 -9
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.tsx +25 -9
- package/templates/conditional/icons/lucide/feature-based/tailwind/src/features/home/pages/HomePage.jsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/tailwind/src/features/home/pages/HomePage.tsx +19 -0
- package/templates/conditional/router/component-based/bootstrap/src/layouts/MainLayout.jsx +17 -0
- package/templates/conditional/router/component-based/bootstrap/src/layouts/MainLayout.tsx +17 -0
- package/templates/conditional/router/component-based/src/App.jsx +4 -4
- package/templates/conditional/router/component-based/src/App.tsx +4 -4
- package/templates/conditional/router/component-based/src/layouts/MainLayout.jsx +39 -0
- package/templates/conditional/router/component-based/src/layouts/MainLayout.tsx +39 -0
- package/templates/conditional/router/component-based/src/router/guards/AuthGuard.jsx +8 -0
- package/templates/conditional/router/component-based/src/router/guards/AuthGuard.tsx +14 -0
- package/templates/conditional/router/component-based/src/router/guards/GuestGuard.jsx +8 -0
- package/templates/conditional/router/component-based/src/router/guards/GuestGuard.tsx +14 -0
- package/templates/conditional/router/component-based/src/router/index.jsx +44 -0
- package/templates/conditional/router/component-based/src/router/index.tsx +44 -0
- package/templates/conditional/router/component-based/tailwind/src/layouts/MainLayout.jsx +17 -0
- package/templates/conditional/router/component-based/tailwind/src/layouts/MainLayout.tsx +17 -0
- package/templates/conditional/router/feature-based/bootstrap/src/shared/layouts/RootLayout.jsx +9 -0
- package/templates/conditional/router/feature-based/bootstrap/src/shared/layouts/RootLayout.tsx +9 -0
- package/templates/conditional/router/feature-based/src/app/App.jsx +6 -1
- package/templates/conditional/router/feature-based/src/app/App.tsx +6 -1
- package/templates/conditional/router/feature-based/src/app/router/guards/AuthGuard.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/AuthGuard.tsx +14 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/RoleGuard.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/RoleGuard.tsx +15 -0
- package/templates/conditional/router/feature-based/src/app/router/index.jsx +16 -0
- package/templates/conditional/router/feature-based/src/app/router/index.tsx +16 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/auth.routes.jsx +18 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/auth.routes.tsx +18 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/home.routes.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/home.routes.tsx +8 -0
- package/templates/conditional/router/feature-based/src/shared/layouts/RootLayout.jsx +17 -0
- package/templates/conditional/router/feature-based/src/shared/layouts/RootLayout.tsx +17 -0
- package/templates/conditional/router/feature-based/tailwind/src/shared/layouts/RootLayout.jsx +9 -0
- package/templates/conditional/router/feature-based/tailwind/src/shared/layouts/RootLayout.tsx +9 -0
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.jsx +1 -1
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.tsx +1 -1
- package/templates/css/bootstrap/src/themes.css +14 -0
- package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.jsx +17 -0
- package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.tsx +22 -0
- package/templates/css/component-styles/bootstrap/component-based/src/layouts/MainLayout.jsx +15 -0
- package/templates/css/component-styles/bootstrap/component-based/src/layouts/MainLayout.tsx +19 -0
- package/templates/css/component-styles/bootstrap/component-based/src/pages/Home/Home.jsx +13 -0
- package/templates/css/component-styles/bootstrap/component-based/src/pages/Home/Home.tsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/app/App.jsx +9 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/app/App.tsx +9 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.jsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.tsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.jsx +17 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.tsx +22 -0
- package/templates/{architectures/feature-based/src/components/ui → css/component-styles/tailwind/component-based/src/components/common}/Button.jsx +1 -1
- package/templates/{architectures/feature-based/src/components/ui → css/component-styles/tailwind/component-based/src/components/common}/Button.tsx +1 -1
- package/templates/css/component-styles/tailwind/component-based/src/layouts/MainLayout.jsx +15 -0
- package/templates/css/component-styles/tailwind/component-based/src/layouts/MainLayout.tsx +19 -0
- package/templates/css/component-styles/tailwind/component-based/src/pages/Home/Home.jsx +13 -0
- package/templates/css/component-styles/tailwind/component-based/src/pages/Home/Home.tsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/app/App.jsx +9 -0
- package/templates/css/component-styles/tailwind/feature-based/src/app/App.tsx +9 -0
- package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.jsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.tsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.jsx +21 -0
- package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.tsx +26 -0
- package/templates/css/none/src/{index.css → main.css} +2 -0
- package/templates/css/none/src/themes.css +19 -0
- package/templates/css/tailwind/src/themes.css +9 -0
- package/templates/architectures/component-based/src/config/constants.js +0 -1
- package/templates/architectures/component-based/src/config/constants.ts +0 -1
- package/templates/architectures/component-based/src/config/routes.js +0 -7
- package/templates/architectures/component-based/src/config/routes.ts +0 -7
- package/templates/architectures/component-based/src/context/AppContext.jsx +0 -12
- package/templates/architectures/component-based/src/context/AppContext.tsx +0 -18
- package/templates/architectures/component-based/src/context/app-context.js +0 -5
- package/templates/architectures/component-based/src/hooks/index.js +0 -1
- package/templates/architectures/component-based/src/hooks/index.ts +0 -1
- package/templates/architectures/component-based/src/layouts/index.js +0 -1
- package/templates/architectures/component-based/src/layouts/index.ts +0 -1
- package/templates/architectures/component-based/src/styles/globals.css +0 -7
- package/templates/architectures/component-based/src/utils/index.js +0 -1
- package/templates/architectures/component-based/src/utils/index.ts +0 -1
- package/templates/architectures/feature-based/src/config/constants.js +0 -1
- package/templates/architectures/feature-based/src/config/constants.ts +0 -1
- package/templates/architectures/feature-based/src/hooks/index.js +0 -1
- package/templates/architectures/feature-based/src/hooks/index.ts +0 -1
- package/templates/architectures/feature-based/src/utils/index.js +0 -1
- package/templates/architectures/feature-based/src/utils/index.ts +0 -1
- package/templates/conditional/axios/component-based/src/services/axios.jsx +0 -19
- package/templates/conditional/axios/component-based/src/services/axios.ts +0 -19
- package/templates/conditional/axios/component-based/src/services/index.js +0 -1
- package/templates/conditional/axios/component-based/src/services/index.ts +0 -1
- package/templates/conditional/axios/feature-based/src/lib/axios.jsx +0 -19
- package/templates/conditional/axios/feature-based/src/lib/axios.ts +0 -19
- package/templates/conditional/axios/feature-based/src/lib/index.js +0 -1
- package/templates/conditional/axios/feature-based/src/lib/index.ts +0 -1
- package/templates/conditional/fetch/component-based/src/services/api.jsx +0 -27
- package/templates/conditional/fetch/component-based/src/services/api.ts +0 -27
- package/templates/conditional/fetch/component-based/src/services/index.js +0 -1
- package/templates/conditional/fetch/component-based/src/services/index.ts +0 -1
- package/templates/conditional/fetch/feature-based/src/lib/api.jsx +0 -27
- package/templates/conditional/fetch/feature-based/src/lib/api.ts +0 -27
- package/templates/conditional/fetch/feature-based/src/lib/index.js +0 -1
- package/templates/conditional/fetch/feature-based/src/lib/index.ts +0 -1
- package/templates/conditional/router/component-based/src/routes/index.jsx +0 -12
- package/templates/conditional/router/component-based/src/routes/index.tsx +0 -12
- package/templates/conditional/router/feature-based/src/app/router.jsx +0 -13
- package/templates/conditional/router/feature-based/src/app/router.tsx +0 -13
- package/templates/css/tailwind/src/index.css +0 -1
- /package/templates/architectures/component-based/src/{components/layout → config}/.gitkeep +0 -0
- /package/templates/architectures/{feature-based/src/features/home/interfaces → component-based/src/providers}/.gitkeep +0 -0
- /package/templates/architectures/{feature-based/src/lib → component-based/src/styles}/.gitkeep +0 -0
- /package/templates/architectures/feature-based/src/{stores → features/home/types}/.gitkeep +0 -0
- /package/templates/architectures/feature-based/src/{components → shared/components}/ui/index.js +0 -0
- /package/templates/architectures/feature-based/src/{components → shared/components}/ui/index.ts +0 -0
- /package/templates/architectures/feature-based/src/{hooks → shared/hooks}/useLocalStorage.jsx +0 -0
- /package/templates/architectures/feature-based/src/{hooks → shared/hooks}/useLocalStorage.ts +0 -0
- /package/templates/architectures/feature-based/src/{utils → shared/utils}/cn.jsx +0 -0
- /package/templates/architectures/feature-based/src/{utils → shared/utils}/cn.ts +0 -0
- /package/templates/conditional/state/redux/component-based/src/{context → providers}/StoreProvider.jsx +0 -0
- /package/templates/conditional/state/redux/component-based/src/{context → providers}/StoreProvider.tsx +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/hooks.js +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/hooks.ts +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/index.js +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/index.ts +0 -0
- /package/templates/css/bootstrap/src/{index.css → globals.css} +0 -0
- /package/templates/{architectures/feature-based/src/styles → css/tailwind/src}/globals.css +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Sun, Moon, GitBranch } from "lucide-react";
|
|
2
|
+
import { Button } from "@/shared/components/ui";
|
|
3
|
+
|
|
4
|
+
export function HomePage() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="text-center">
|
|
7
|
+
<div className="flex justify-center gap-4 mb-6">
|
|
8
|
+
<Sun className="w-8 h-8 text-yellow-500" />
|
|
9
|
+
<Moon className="w-8 h-8 text-blue-500" />
|
|
10
|
+
<GitBranch className="w-8 h-8 text-gray-800" />
|
|
11
|
+
</div>
|
|
12
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
13
|
+
<p className="text-gray-600 mb-8">
|
|
14
|
+
Your React + Vite project is ready. Start building!
|
|
15
|
+
</p>
|
|
16
|
+
<Button>Get Started</Button>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function MainLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="min-vh-100 d-flex flex-column">
|
|
6
|
+
<header className="px-4 py-3 border-bottom">
|
|
7
|
+
<h2 className="h5 fw-semibold mb-0">Lumen</h2>
|
|
8
|
+
</header>
|
|
9
|
+
<main className="flex-grow-1 p-4 d-flex align-items-center justify-content-center">
|
|
10
|
+
<Outlet />
|
|
11
|
+
</main>
|
|
12
|
+
<footer className="px-4 py-3 border-top text-center text-muted">
|
|
13
|
+
<p className="mb-0">Built with Lumen</p>
|
|
14
|
+
</footer>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function MainLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="min-vh-100 d-flex flex-column">
|
|
6
|
+
<header className="px-4 py-3 border-bottom">
|
|
7
|
+
<h2 className="h5 fw-semibold mb-0">Lumen</h2>
|
|
8
|
+
</header>
|
|
9
|
+
<main className="flex-grow-1 p-4 d-flex align-items-center justify-content-center">
|
|
10
|
+
<Outlet />
|
|
11
|
+
</main>
|
|
12
|
+
<footer className="px-4 py-3 border-top text-center text-muted">
|
|
13
|
+
<p className="mb-0">Built with Lumen</p>
|
|
14
|
+
</footer>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppRoutes } from
|
|
1
|
+
import { AppProvider } from '@/providers/AppProvider';
|
|
2
|
+
import { AppRoutes } from '@/router';
|
|
3
3
|
|
|
4
4
|
export default function App() {
|
|
5
5
|
return (
|
|
6
|
-
<
|
|
6
|
+
<AppProvider>
|
|
7
7
|
<AppRoutes />
|
|
8
|
-
</
|
|
8
|
+
</AppProvider>
|
|
9
9
|
);
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppRoutes } from
|
|
1
|
+
import { AppProvider } from '@/providers/AppProvider';
|
|
2
|
+
import { AppRoutes } from '@/router';
|
|
3
3
|
|
|
4
4
|
export default function App() {
|
|
5
5
|
return (
|
|
6
|
-
<
|
|
6
|
+
<AppProvider>
|
|
7
7
|
<AppRoutes />
|
|
8
|
-
</
|
|
8
|
+
</AppProvider>
|
|
9
9
|
);
|
|
10
10
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function MainLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{ minHeight: "100vh", display: "flex", flexDirection: "column" }}
|
|
7
|
+
>
|
|
8
|
+
<header
|
|
9
|
+
style={{
|
|
10
|
+
padding: "16px 24px",
|
|
11
|
+
borderBottom: "1px solid var(--color-border)",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<h2 style={{ fontSize: "1.25rem", fontWeight: 600 }}>Lumen</h2>
|
|
15
|
+
</header>
|
|
16
|
+
<main
|
|
17
|
+
style={{
|
|
18
|
+
flex: 1,
|
|
19
|
+
padding: "24px",
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<Outlet />
|
|
26
|
+
</main>
|
|
27
|
+
<footer
|
|
28
|
+
style={{
|
|
29
|
+
padding: "16px 24px",
|
|
30
|
+
borderTop: "1px solid var(--color-border)",
|
|
31
|
+
textAlign: "center",
|
|
32
|
+
color: "var(--color-muted)",
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<p>Built with Lumen</p>
|
|
36
|
+
</footer>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function MainLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{ minHeight: "100vh", display: "flex", flexDirection: "column" }}
|
|
7
|
+
>
|
|
8
|
+
<header
|
|
9
|
+
style={{
|
|
10
|
+
padding: "16px 24px",
|
|
11
|
+
borderBottom: "1px solid var(--color-border)",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<h2 style={{ fontSize: "1.25rem", fontWeight: 600 }}>Lumen</h2>
|
|
15
|
+
</header>
|
|
16
|
+
<main
|
|
17
|
+
style={{
|
|
18
|
+
flex: 1,
|
|
19
|
+
padding: "24px",
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<Outlet />
|
|
26
|
+
</main>
|
|
27
|
+
<footer
|
|
28
|
+
style={{
|
|
29
|
+
padding: "16px 24px",
|
|
30
|
+
borderTop: "1px solid var(--color-border)",
|
|
31
|
+
textAlign: "center",
|
|
32
|
+
color: "var(--color-muted)",
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<p>Built with Lumen</p>
|
|
36
|
+
</footer>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Navigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
interface AuthGuardProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
isAuthenticated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function AuthGuard({ children, isAuthenticated = true }: AuthGuardProps) {
|
|
10
|
+
if (!isAuthenticated) {
|
|
11
|
+
return <Navigate to="/login" replace />;
|
|
12
|
+
}
|
|
13
|
+
return children;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Navigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
interface GuestGuardProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
isAuthenticated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function GuestGuard({ children, isAuthenticated = false }: GuestGuardProps) {
|
|
10
|
+
if (isAuthenticated) {
|
|
11
|
+
return <Navigate to="/" replace />;
|
|
12
|
+
}
|
|
13
|
+
return children;
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
2
|
+
import { MainLayout } from '@/layouts/MainLayout';
|
|
3
|
+
import { HomePage } from '@/pages/Home';
|
|
4
|
+
import { AuthGuard } from './guards/AuthGuard';
|
|
5
|
+
import { GuestGuard } from './guards/GuestGuard';
|
|
6
|
+
|
|
7
|
+
const router = createBrowserRouter([
|
|
8
|
+
{
|
|
9
|
+
path: '/',
|
|
10
|
+
element: <MainLayout />,
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
index: true,
|
|
14
|
+
element: <HomePage />,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
path: 'login',
|
|
18
|
+
element: (
|
|
19
|
+
<GuestGuard>
|
|
20
|
+
<div style={{ textAlign: 'center', padding: '32px' }}>
|
|
21
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700 }}>Login</h1>
|
|
22
|
+
<p style={{ color: 'var(--color-muted)' }}>Public route — a page only for guests.</p>
|
|
23
|
+
</div>
|
|
24
|
+
</GuestGuard>
|
|
25
|
+
),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: 'admin',
|
|
29
|
+
element: (
|
|
30
|
+
<AuthGuard>
|
|
31
|
+
<div style={{ textAlign: 'center', padding: '32px' }}>
|
|
32
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700 }}>Protected Page</h1>
|
|
33
|
+
<p style={{ color: 'var(--color-muted)' }}>Accessible to authenticated users.</p>
|
|
34
|
+
</div>
|
|
35
|
+
</AuthGuard>
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
export function AppRoutes() {
|
|
43
|
+
return <RouterProvider router={router} />;
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
2
|
+
import { MainLayout } from '@/layouts/MainLayout';
|
|
3
|
+
import { HomePage } from '@/pages/Home';
|
|
4
|
+
import { AuthGuard } from './guards/AuthGuard';
|
|
5
|
+
import { GuestGuard } from './guards/GuestGuard';
|
|
6
|
+
|
|
7
|
+
const router = createBrowserRouter([
|
|
8
|
+
{
|
|
9
|
+
path: '/',
|
|
10
|
+
element: <MainLayout />,
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
index: true,
|
|
14
|
+
element: <HomePage />,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
path: 'login',
|
|
18
|
+
element: (
|
|
19
|
+
<GuestGuard>
|
|
20
|
+
<div style={{ textAlign: 'center', padding: '32px' }}>
|
|
21
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700 }}>Login</h1>
|
|
22
|
+
<p style={{ color: 'var(--color-muted)' }}>Public route — a page only for guests.</p>
|
|
23
|
+
</div>
|
|
24
|
+
</GuestGuard>
|
|
25
|
+
),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: 'admin',
|
|
29
|
+
element: (
|
|
30
|
+
<AuthGuard>
|
|
31
|
+
<div style={{ textAlign: 'center', padding: '32px' }}>
|
|
32
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700 }}>Protected Page</h1>
|
|
33
|
+
<p style={{ color: 'var(--color-muted)' }}>Accessible to authenticated users.</p>
|
|
34
|
+
</div>
|
|
35
|
+
</AuthGuard>
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
export function AppRoutes() {
|
|
43
|
+
return <RouterProvider router={router} />;
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function MainLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="min-h-screen flex flex-col">
|
|
6
|
+
<header className="px-6 py-4 border-b">
|
|
7
|
+
<h2 className="text-xl font-semibold">Lumen</h2>
|
|
8
|
+
</header>
|
|
9
|
+
<main className="flex-1 p-6 flex items-center justify-center">
|
|
10
|
+
<Outlet />
|
|
11
|
+
</main>
|
|
12
|
+
<footer className="px-6 py-4 border-t text-center text-gray-500">
|
|
13
|
+
<p>Built with Lumen</p>
|
|
14
|
+
</footer>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function MainLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="min-h-screen flex flex-col">
|
|
6
|
+
<header className="px-6 py-4 border-b">
|
|
7
|
+
<h2 className="text-xl font-semibold">Lumen</h2>
|
|
8
|
+
</header>
|
|
9
|
+
<main className="flex-1 p-6 flex items-center justify-center">
|
|
10
|
+
<Outlet />
|
|
11
|
+
</main>
|
|
12
|
+
<footer className="px-6 py-4 border-t text-center text-gray-500">
|
|
13
|
+
<p>Built with Lumen</p>
|
|
14
|
+
</footer>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Navigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
interface AuthGuardProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
isAuthenticated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function AuthGuard({ children, isAuthenticated = true }: AuthGuardProps) {
|
|
10
|
+
if (!isAuthenticated) {
|
|
11
|
+
return <Navigate to="/login" replace />;
|
|
12
|
+
}
|
|
13
|
+
return children;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Navigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
interface RoleGuardProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
roles?: string[];
|
|
7
|
+
userRole?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function RoleGuard({ children, roles = ['admin'], userRole = 'admin' }: RoleGuardProps) {
|
|
11
|
+
if (!roles.includes(userRole)) {
|
|
12
|
+
return <Navigate to="/login" replace />;
|
|
13
|
+
}
|
|
14
|
+
return children;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
2
|
+
import { RootLayout } from '@/shared/layouts/RootLayout';
|
|
3
|
+
import { authRoutes } from './routes/auth.routes';
|
|
4
|
+
import { homeRoutes } from './routes/home.routes';
|
|
5
|
+
|
|
6
|
+
const router = createBrowserRouter([
|
|
7
|
+
{
|
|
8
|
+
path: '/',
|
|
9
|
+
element: <RootLayout />,
|
|
10
|
+
children: [...homeRoutes, ...authRoutes],
|
|
11
|
+
},
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
export function AppRouter() {
|
|
15
|
+
return <RouterProvider router={router} />;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
2
|
+
import { RootLayout } from '@/shared/layouts/RootLayout';
|
|
3
|
+
import { authRoutes } from './routes/auth.routes';
|
|
4
|
+
import { homeRoutes } from './routes/home.routes';
|
|
5
|
+
|
|
6
|
+
const router = createBrowserRouter([
|
|
7
|
+
{
|
|
8
|
+
path: '/',
|
|
9
|
+
element: <RootLayout />,
|
|
10
|
+
children: [...homeRoutes, ...authRoutes],
|
|
11
|
+
},
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
export function AppRouter() {
|
|
15
|
+
return <RouterProvider router={router} />;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthGuard } from '../guards/AuthGuard';
|
|
2
|
+
import { RoleGuard } from '../guards/RoleGuard';
|
|
3
|
+
|
|
4
|
+
export const authRoutes = [
|
|
5
|
+
{
|
|
6
|
+
path: 'admin',
|
|
7
|
+
element: (
|
|
8
|
+
<AuthGuard>
|
|
9
|
+
<RoleGuard>
|
|
10
|
+
<div style={{ textAlign: 'center', padding: '32px' }}>
|
|
11
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700 }}>Protected Page</h1>
|
|
12
|
+
<p style={{ color: 'var(--color-muted)' }}>Accessible to authenticated admin users.</p>
|
|
13
|
+
</div>
|
|
14
|
+
</RoleGuard>
|
|
15
|
+
</AuthGuard>
|
|
16
|
+
),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthGuard } from '../guards/AuthGuard';
|
|
2
|
+
import { RoleGuard } from '../guards/RoleGuard';
|
|
3
|
+
|
|
4
|
+
export const authRoutes = [
|
|
5
|
+
{
|
|
6
|
+
path: 'admin',
|
|
7
|
+
element: (
|
|
8
|
+
<AuthGuard>
|
|
9
|
+
<RoleGuard>
|
|
10
|
+
<div style={{ textAlign: 'center', padding: '32px' }}>
|
|
11
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700 }}>Protected Page</h1>
|
|
12
|
+
<p style={{ color: 'var(--color-muted)' }}>Accessible to authenticated admin users.</p>
|
|
13
|
+
</div>
|
|
14
|
+
</RoleGuard>
|
|
15
|
+
</AuthGuard>
|
|
16
|
+
),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function RootLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
minHeight: "100vh",
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
backgroundColor: "var(--color-bg)",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<Outlet />
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
export function RootLayout() {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
minHeight: "100vh",
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
backgroundColor: "var(--color-bg)",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<Outlet />
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { store } from "@/stores";
|
|
3
|
+
import { store } from "@/shared/stores";
|
|
4
4
|
|
|
5
5
|
export function StoreProvider({ children }: { children: ReactNode }) {
|
|
6
6
|
return <Provider store={store}>{children}</Provider>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* themes.css — Bootstrap 5.3+ theme overrides
|
|
2
|
+
* Bootstrap 5.3+ reads data-bs-theme on a parent element to switch between
|
|
3
|
+
* light/dark variants. The themes here customize the default tokens; the
|
|
4
|
+
* data-bs-theme attribute is applied externally.
|
|
5
|
+
*/
|
|
6
|
+
:root[data-bs-theme="light"] {
|
|
7
|
+
--bs-primary: #6366f1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:root[data-bs-theme="dark"] {
|
|
11
|
+
--bs-body-bg: #111827;
|
|
12
|
+
--bs-body-color: #f9fafb;
|
|
13
|
+
--bs-primary: #818cf8;
|
|
14
|
+
}
|
package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.jsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function Button({
|
|
2
|
+
variant = "primary",
|
|
3
|
+
children,
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
const variants = {
|
|
8
|
+
primary: "btn btn-primary",
|
|
9
|
+
secondary: "btn btn-secondary",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<button className={`${variants[variant]} ${className ?? ""}`} {...props}>
|
|
14
|
+
{children}
|
|
15
|
+
</button>
|
|
16
|
+
);
|
|
17
|
+
}
|